From 737b320096e853dc3df16ce51530904976c094c2 Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Thu, 1 Feb 2024 13:03:07 -0300 Subject: [PATCH 001/171] eth: init full switch to alloy --- Cargo.lock | 904 +++++++++++++++++++++++++++++++++++++------- Cargo.toml | 16 +- src/eth/provider.rs | 55 +-- src/eth/types.rs | 15 +- 4 files changed, 825 insertions(+), 165 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0c459d5f8..3157b8522 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -123,6 +123,230 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" +[[package]] +name = "alloy-eips" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +dependencies = [ + "alloy-primitives 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-rlp", + "serde", + "thiserror", +] + +[[package]] +name = "alloy-json-rpc" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +dependencies = [ + "alloy-primitives 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "alloy-network" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +dependencies = [ + "alloy-eips", + "alloy-json-rpc", + "alloy-primitives 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-rlp", + "serde", +] + +[[package]] +name = "alloy-primitives" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4b6fb2b432ff223d513db7f908937f63c252bee0af9b82bfd25b0a5dd1eb0d8" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more", + "hex-literal", + "itoa", + "k256", + "keccak-asm", + "proptest", + "rand", + "ruint", + "serde", + "tiny-keccak", +] + +[[package]] +name = "alloy-primitives" +version = "0.6.2" +source = "git+https://github.com/alloy-rs/core.git#04d63af7d9a3dc69749355c8dfeb3413b29a4f76" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more", + "hex-literal", + "itoa", + "k256", + "keccak-asm", + "proptest", + "rand", + "ruint", + "serde", + "tiny-keccak", +] + +[[package]] +name = "alloy-providers" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +dependencies = [ + "alloy-network", + "alloy-primitives 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-rpc-client", + "alloy-rpc-trace-types", + "alloy-rpc-types", + "alloy-transport", + "alloy-transport-http", + "async-trait", + "auto_impl", + "reqwest", + "serde", + "thiserror", +] + +[[package]] +name = "alloy-pubsub" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +dependencies = [ + "alloy-json-rpc", + "alloy-primitives 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-transport", + "bimap", + "futures", + "serde_json", + "tokio", + "tower", + "tracing", +] + +[[package]] +name = "alloy-rlp" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d58d9f5da7b40e9bfff0b7e7816700be4019db97d4b6359fe7f94a9e22e42ac" +dependencies = [ + "alloy-rlp-derive", + "arrayvec", + "bytes", +] + +[[package]] +name = "alloy-rlp-derive" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a047897373be4bbb0224c1afdabca92648dc57a9c9ef6e7b0be3aff7a859c83" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "alloy-rpc-client" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +dependencies = [ + "alloy-json-rpc", + "alloy-primitives 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-pubsub", + "alloy-transport", + "alloy-transport-http", + "alloy-transport-ws", + "futures", + "pin-project", + "reqwest", + "serde_json", + "tokio", + "tower", + "tracing", + "url", +] + +[[package]] +name = "alloy-rpc-trace-types" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +dependencies = [ + "alloy-primitives 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-rpc-types", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-rpc-types" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +dependencies = [ + "alloy-primitives 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-rlp", + "itertools 0.12.1", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "alloy-transport" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +dependencies = [ + "alloy-json-rpc", + "base64 0.21.4", + "serde", + "serde_json", + "thiserror", + "tokio", + "tower", + "url", + "wasm-bindgen-futures", +] + +[[package]] +name = "alloy-transport-http" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +dependencies = [ + "alloy-json-rpc", + "alloy-transport", + "reqwest", + "serde_json", + "tower", + "url", +] + +[[package]] +name = "alloy-transport-ws" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +dependencies = [ + "alloy-pubsub", + "alloy-transport", + "futures", + "http", + "serde_json", + "tokio", + "tokio-tungstenite 0.20.1", + "tracing", + "ws_stream_wasm", +] + [[package]] name = "ambient-authority" version = "0.0.2" @@ -204,6 +428,130 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +[[package]] +name = "ark-ff" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6" +dependencies = [ + "ark-ff-asm 0.3.0", + "ark-ff-macros 0.3.0", + "ark-serialize 0.3.0", + "ark-std 0.3.0", + "derivative", + "num-bigint", + "num-traits", + "paste", + "rustc_version 0.3.3", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm 0.4.2", + "ark-ff-macros 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "digest 0.10.7", + "itertools 0.10.5", + "num-bigint", + "num-traits", + "paste", + "rustc_version 0.4.0", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" +dependencies = [ + "num-bigint", + "num-traits", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-serialize" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" +dependencies = [ + "ark-std 0.3.0", + "digest 0.9.0", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-std 0.4.0", + "digest 0.10.7", + "num-bigint", +] + +[[package]] +name = "ark-std" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + [[package]] name = "array-init" version = "0.0.4" @@ -236,13 +584,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -253,7 +601,7 @@ checksum = "b6d7b9decdf35d8908a7e3ef02f64c5e9b1695e230154c0e8de3969142d9b94c" dependencies = [ "futures", "pharos", - "rustc_version", + "rustc_version 0.4.0", ] [[package]] @@ -319,6 +667,12 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" +[[package]] +name = "bimap" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "230c5f1ca6a325a32553f8640d31ac9b49f2411e901e427570154868b46da4f7" + [[package]] name = "bincode" version = "1.3.3" @@ -346,7 +700,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -394,7 +748,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] @@ -408,7 +762,7 @@ dependencies = [ "cc", "cfg-if", "constant_time_eq 0.3.0", - "digest", + "digest 0.10.7", ] [[package]] @@ -573,13 +927,13 @@ dependencies = [ [[package]] name = "cargo_metadata" -version = "0.17.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7daec1a2a2129eeba1644b220b4647ec537b0b5d4bfd6876fcc5a540056b592" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" dependencies = [ "camino", "cargo-platform", - "semver", + "semver 1.0.18", "serde", "serde_json", "thiserror", @@ -735,7 +1089,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -752,7 +1106,7 @@ checksum = "3b6be4a5df2098cd811f3194f64ddb96c267606bffd9689ac7b0160097b01ad3" dependencies = [ "bs58", "coins-core", - "digest", + "digest 0.10.7", "hmac", "k256", "serde", @@ -785,7 +1139,7 @@ dependencies = [ "base64 0.21.4", "bech32", "bs58", - "digest", + "digest 0.10.7", "generic-array", "hex", "ripemd", @@ -804,13 +1158,14 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "const-hex" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08849ed393c907c90016652a01465a12d86361cd38ad2a7de026c56a520cc259" +checksum = "a5104de16b218eddf8e34ffe2f86f74bfa4e61e95a1b89732fccf6325efd0557" dependencies = [ "cfg-if", "cpufeatures", "hex", + "proptest", "serde", ] @@ -832,6 +1187,12 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + [[package]] name = "core-foundation" version = "0.9.3" @@ -1111,7 +1472,7 @@ dependencies = [ "curve25519-dalek-derive", "fiat-crypto", "platforms", - "rustc_version", + "rustc_version 0.4.0", "subtle", "zeroize", ] @@ -1124,7 +1485,7 @@ checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -1206,6 +1567,17 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "derive_builder" version = "0.9.0" @@ -1237,8 +1609,10 @@ version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ + "convert_case", "proc-macro2", "quote", + "rustc_version 0.4.0", "syn 1.0.109", ] @@ -1248,6 +1622,15 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + [[package]] name = "digest" version = "0.10.7" @@ -1357,7 +1740,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" dependencies = [ "der", - "digest", + "digest 0.10.7", "elliptic-curve", "rfc6979", "signature", @@ -1378,7 +1761,7 @@ checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct", "crypto-bigint", - "digest", + "digest 0.10.7", "ff", "generic-array", "group", @@ -1469,7 +1852,7 @@ checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" dependencies = [ "aes 0.8.3", "ctr 0.9.2", - "digest", + "digest 0.10.7", "hex", "hmac", "pbkdf2 0.11.0", @@ -1533,9 +1916,9 @@ dependencies = [ [[package]] name = "ethers" -version = "2.0.10" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad13497f6e0a24292fc7b408e30d22fe9dc262da1f40d7b542c3a44e7fc0476" +checksum = "6c7cd562832e2ff584fa844cd2f6e5d4f35bbe11b28c7c9b8df957b2e1d0c701" dependencies = [ "ethers-addressbook", "ethers-contract", @@ -1549,9 +1932,9 @@ dependencies = [ [[package]] name = "ethers-addressbook" -version = "2.0.10" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6e9e8acd0ed348403cc73a670c24daba3226c40b98dc1a41903766b3ab6240a" +checksum = "35dc9a249c066d17e8947ff52a4116406163cf92c7f0763cb8c001760b26403f" dependencies = [ "ethers-core", "once_cell", @@ -1561,9 +1944,9 @@ dependencies = [ [[package]] name = "ethers-contract" -version = "2.0.10" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d79269278125006bb0552349c03593ffa9702112ca88bc7046cc669f148fb47c" +checksum = "43304317c7f776876e47f2f637859f6d0701c1ec7930a150f169d5fbe7d76f5a" dependencies = [ "const-hex", "ethers-contract-abigen", @@ -1580,9 +1963,9 @@ dependencies = [ [[package]] name = "ethers-contract-abigen" -version = "2.0.10" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce95a43c939b2e4e2f3191c5ad4a1f279780b8a39139c9905b43a7433531e2ab" +checksum = "f9f96502317bf34f6d71a3e3d270defaa9485d754d789e15a8e04a84161c95eb" dependencies = [ "Inflector", "const-hex", @@ -1597,16 +1980,16 @@ dependencies = [ "reqwest", "serde", "serde_json", - "syn 2.0.32", - "toml 0.7.8", + "syn 2.0.48", + "toml 0.8.8", "walkdir", ] [[package]] name = "ethers-contract-derive" -version = "2.0.10" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9ce44906fc871b3ee8c69a695ca7ec7f70e50cb379c9b9cb5e532269e492f6" +checksum = "452ff6b0a64507ce8d67ffd48b1da3b42f03680dcf5382244e9c93822cbbf5de" dependencies = [ "Inflector", "const-hex", @@ -1615,14 +1998,14 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] name = "ethers-core" -version = "2.0.10" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0a17f0708692024db9956b31d7a20163607d2745953f5ae8125ab368ba280ad" +checksum = "aab3cef6cc1c9fd7f787043c81ad3052eff2b96a3878ef1526aa446311bdbfc9" dependencies = [ "arrayvec", "bytes", @@ -1641,7 +2024,7 @@ dependencies = [ "serde", "serde_json", "strum", - "syn 2.0.32", + "syn 2.0.48", "tempfile", "thiserror", "tiny-keccak", @@ -1650,13 +2033,14 @@ dependencies = [ [[package]] name = "ethers-etherscan" -version = "2.0.10" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e53451ea4a8128fbce33966da71132cf9e1040dcfd2a2084fd7733ada7b2045" +checksum = "16d45b981f5fa769e1d0343ebc2a44cfa88c9bc312eb681b676318b40cef6fb1" dependencies = [ + "chrono", "ethers-core", "reqwest", - "semver", + "semver 1.0.18", "serde", "serde_json", "thiserror", @@ -1665,9 +2049,9 @@ dependencies = [ [[package]] name = "ethers-middleware" -version = "2.0.10" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "473f1ccd0c793871bbc248729fa8df7e6d2981d6226e4343e3bbaa9281074d5d" +checksum = "145211f34342487ef83a597c1e69f0d3e01512217a7c72cc8a25931854c7dca0" dependencies = [ "async-trait", "auto_impl", @@ -1692,9 +2076,9 @@ dependencies = [ [[package]] name = "ethers-providers" -version = "2.0.10" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6838fa110e57d572336178b7c79e94ff88ef976306852d8cb87d9e5b1fc7c0b5" +checksum = "fb6b15393996e3b8a78ef1332d6483c11d839042c17be58decc92fa8b1c3508a" dependencies = [ "async-trait", "auto_impl", @@ -1730,9 +2114,9 @@ dependencies = [ [[package]] name = "ethers-signers" -version = "2.0.10" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea44bec930f12292866166f9ddbea6aa76304850e4d8dcd66dc492b43d00ff1" +checksum = "b3b125a103b56aef008af5d5fb48191984aa326b50bfd2557d231dc499833de3" dependencies = [ "async-trait", "coins-bip32", @@ -1749,9 +2133,9 @@ dependencies = [ [[package]] name = "ethers-solc" -version = "2.0.10" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de34e484e7ae3cab99fbfd013d6c5dc7f9013676a4e0e414d8b12e1213e8b3ba" +checksum = "d21df08582e0a43005018a858cc9b465c5fff9cf4056651be64f844e57d1f55f" dependencies = [ "cfg-if", "const-hex", @@ -1766,7 +2150,7 @@ dependencies = [ "path-slash", "rayon", "regex", - "semver", + "semver 1.0.18", "serde", "serde_json", "solang-parser", @@ -1807,6 +2191,17 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +[[package]] +name = "fastrlp" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139834ddba373bbdd213dffe02c8d110508dcf1726c2be27e8d1f7d7e1856418" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", +] + [[package]] name = "fd-lock" version = "4.0.0" @@ -1921,9 +2316,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -1936,9 +2331,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -1946,15 +2341,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -1963,9 +2358,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-locks" @@ -1979,26 +2374,26 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-timer" @@ -2012,9 +2407,9 @@ dependencies = [ [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -2235,6 +2630,15 @@ name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] + +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "hkdf" @@ -2251,7 +2655,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] @@ -2605,6 +3009,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.9" @@ -2671,7 +3084,7 @@ checksum = "6204285f77fe7d9784db3fdc449ecce1a0114927a51d5a41c4c7a292011c015f" dependencies = [ "base64 0.13.1", "crypto-common", - "digest", + "digest 0.10.7", "hmac", "serde", "serde_json", @@ -2701,11 +3114,30 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "keccak-asm" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb8515fff80ed850aea4a1595f2e519c003e2a00a82fe168ebf5269196caf444" +dependencies = [ + "digest 0.10.7", + "sha3-asm", +] + [[package]] name = "kinode" version = "0.5.2" dependencies = [ "aes-gcm 0.10.2", + "alloy-network", + "alloy-primitives 0.6.2 (git+https://github.com/alloy-rs/core.git)", + "alloy-providers", + "alloy-pubsub", + "alloy-rpc-client", + "alloy-rpc-types", + "alloy-transport", + "alloy-transport-http", + "alloy-transport-ws", "anyhow", "async-trait", "base64 0.13.1", @@ -2718,7 +3150,7 @@ dependencies = [ "clap", "crossterm", "dashmap", - "digest", + "digest 0.10.7", "elliptic-curve", "ethers", "ethers-providers", @@ -2825,6 +3257,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + [[package]] name = "librocksdb-sys" version = "0.11.0+8.1.1" @@ -2934,7 +3372,7 @@ version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] @@ -2994,9 +3432,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", "log", @@ -3105,6 +3543,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg", + "libm", ] [[package]] @@ -3135,7 +3574,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -3221,7 +3660,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -3332,7 +3771,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" dependencies = [ - "digest", + "digest 0.10.7", "hmac", "password-hash", "sha2", @@ -3344,7 +3783,7 @@ version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ - "digest", + "digest 0.10.7", "hmac", ] @@ -3369,6 +3808,17 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +[[package]] +name = "pest" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f200d8d83c44a45b21764d1916299752ca035d15ecd46faca3e9a2a2bf6ad06" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + [[package]] name = "petgraph" version = "0.6.4" @@ -3386,7 +3836,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9567389417feee6ce15dd6527a8a1ecac205ef62c2932bcf3d9f6fc5b78b414" dependencies = [ "futures", - "rustc_version", + "rustc_version 0.4.0", ] [[package]] @@ -3419,7 +3869,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -3457,7 +3907,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -3559,7 +4009,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ "proc-macro2", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -3583,7 +4033,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ "once_cell", - "toml_edit", + "toml_edit 0.19.15", ] [[package]] @@ -3618,13 +4068,33 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" +dependencies = [ + "bit-set", + "bit-vec", + "bitflags 2.4.0", + "lazy_static", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax 0.8.2", + "rusty-fork", + "tempfile", + "unarray", +] + [[package]] name = "psm" version = "0.1.21" @@ -3655,11 +4125,17 @@ dependencies = [ "trust-dns-proto", ] +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -3710,6 +4186,15 @@ dependencies = [ "getrandom", ] +[[package]] +name = "rand_xorshift" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +dependencies = [ + "rand_core", +] + [[package]] name = "rayon" version = "1.7.0" @@ -3883,7 +4368,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" dependencies = [ - "digest", + "digest 0.10.7", ] [[package]] @@ -3946,6 +4431,36 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afab94fb28594581f62d981211a9a4d53cc8130bbcbbb89a0440d9b8e81a7746" +[[package]] +name = "ruint" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608a5726529f2f0ef81b8fde9873c4bb829d6b5b5ca6be4d97345ddf0749c825" +dependencies = [ + "alloy-rlp", + "ark-ff 0.3.0", + "ark-ff 0.4.2", + "bytes", + "fastrlp", + "num-bigint", + "num-traits", + "parity-scale-codec", + "primitive-types", + "proptest", + "rand", + "rlp", + "ruint-macro", + "serde", + "valuable", + "zeroize", +] + +[[package]] +name = "ruint-macro" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e666a5496a0b2186dbcd0ff6106e29e093c15591bde62c20d3842007c6978a09" + [[package]] name = "rusqlite" version = "0.30.0" @@ -3978,13 +4493,22 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" +[[package]] +name = "rustc_version" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +dependencies = [ + "semver 0.11.0", +] + [[package]] name = "rustc_version" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver", + "semver 1.0.18", ] [[package]] @@ -4053,6 +4577,18 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +[[package]] +name = "rusty-fork" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] + [[package]] name = "ryu" version = "1.0.15" @@ -4181,6 +4717,15 @@ dependencies = [ "libc", ] +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser", +] + [[package]] name = "semver" version = "1.0.18" @@ -4190,6 +4735,15 @@ dependencies = [ "serde", ] +[[package]] +name = "semver-parser" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] + [[package]] name = "send_wrapper" version = "0.4.0" @@ -4230,7 +4784,7 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -4246,9 +4800,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" dependencies = [ "serde", ] @@ -4273,7 +4827,7 @@ checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.7", ] [[package]] @@ -4284,7 +4838,7 @@ checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.7", ] [[package]] @@ -4293,10 +4847,20 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ - "digest", + "digest 0.10.7", "keccak", ] +[[package]] +name = "sha3-asm" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bac61da6b35ad76b195eb4771210f947734321a8d81d7738e1580d953bc7a15e" +dependencies = [ + "cc", + "cfg-if", +] + [[package]] name = "shellexpand" version = "2.1.2" @@ -4348,7 +4912,7 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" dependencies = [ - "digest", + "digest 0.10.7", "rand_core", ] @@ -4412,7 +4976,7 @@ dependencies = [ "curve25519-dalek", "rand_core", "ring", - "rustc_version", + "rustc_version 0.4.0", "sha2", "subtle", ] @@ -4429,9 +4993,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", "windows-sys 0.48.0", @@ -4439,9 +5003,9 @@ dependencies = [ [[package]] name = "solang-parser" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cb9fa2fa2fa6837be8a2495486ff92e3ffe68a99b6eeba288e139efdd842457" +checksum = "c425ce1c59f4b154717592f0bdf4715c3a1d55058883622d3157e1f0908a5b26" dependencies = [ "itertools 0.11.0", "lalrpop", @@ -4552,7 +5116,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -4572,7 +5136,7 @@ dependencies = [ "hex", "once_cell", "reqwest", - "semver", + "semver 1.0.18", "serde", "serde_json", "sha2", @@ -4594,9 +5158,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.32" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239814284fd6f1a4ffe4ca893952cdd93c224b6a1571c9a9eadd670295c0c9e2" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -4693,7 +5257,7 @@ checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -4750,9 +5314,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.32.0" +version = "1.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" dependencies = [ "backtrace", "bytes", @@ -4761,20 +5325,20 @@ dependencies = [ "num_cpus", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.4", + "socket2 0.5.5", "tokio-macros", "windows-sys 0.48.0", ] [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -4860,21 +5424,21 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.8" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" +checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit", + "toml_edit 0.21.0", ] [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" dependencies = [ "serde", ] @@ -4884,6 +5448,17 @@ name = "toml_edit" version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.0.0", + "toml_datetime", + "winnow", +] + +[[package]] +name = "toml_edit" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" dependencies = [ "indexmap 2.0.0", "serde", @@ -4892,6 +5467,27 @@ dependencies = [ "winnow", ] +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + [[package]] name = "tower-service" version = "0.3.2" @@ -4900,11 +5496,10 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "cfg-if", "log", "pin-project-lite", "tracing-attributes", @@ -4913,20 +5508,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", ] @@ -5039,6 +5634,12 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +[[package]] +name = "ucd-trie" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" + [[package]] name = "uint" version = "0.9.5" @@ -5051,6 +5652,12 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicase" version = "2.7.0" @@ -5168,6 +5775,12 @@ dependencies = [ "serde", ] +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "vcpkg" version = "0.2.15" @@ -5180,6 +5793,15 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + [[package]] name = "walkdir" version = "2.4.0" @@ -5300,7 +5922,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", "wasm-bindgen-shared", ] @@ -5334,7 +5956,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5370,7 +5992,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53290b1276c5c2d47d694fb1a920538c01f51690e7e261acbe1d10c5fc306ea1" dependencies = [ "indexmap 2.0.0", - "semver", + "semver 1.0.18", ] [[package]] @@ -5380,7 +6002,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95ee9723b928e735d53000dec9eae7b07a60e490c85ab54abb66659fc61bfcd9" dependencies = [ "indexmap 2.0.0", - "semver", + "semver 1.0.18", ] [[package]] @@ -5471,7 +6093,7 @@ dependencies = [ "anyhow", "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", "wasmtime-component-util", "wasmtime-wit-bindgen", "wit-parser", @@ -5663,7 +6285,7 @@ checksum = "f50f51f8d79bfd2aa8e9d9a0ae7c2d02b45fe412e62ff1b87c0c81b07c738231" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", ] [[package]] @@ -5808,7 +6430,7 @@ dependencies = [ "proc-macro2", "quote", "shellexpand", - "syn 2.0.32", + "syn 2.0.48", "witx", ] @@ -5820,7 +6442,7 @@ checksum = "c189fe00c67f61bb330827f2abab1af9b5925c7929535cd13a68d265ec20b02d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.32", + "syn 2.0.48", "wiggle-generate", ] @@ -6051,7 +6673,7 @@ dependencies = [ "id-arena", "indexmap 2.0.0", "log", - "semver", + "semver 1.0.18", "serde", "serde_derive", "serde_json", @@ -6081,7 +6703,7 @@ dependencies = [ "js-sys", "log", "pharos", - "rustc_version", + "rustc_version 0.4.0", "send_wrapper 0.6.0", "thiserror", "wasm-bindgen", @@ -6109,6 +6731,20 @@ name = "zeroize" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] [[package]] name = "zip" diff --git a/Cargo.toml b/Cargo.toml index 580bc6f8c..9df282dd0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,18 @@ simulation-mode = [] [dependencies] aes-gcm = "0.10.2" +alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy" } +alloy-primitives = { git = "https://github.com/alloy-rs/core.git" } +alloy-providers = { git = "https://github.com/alloy-rs/alloy.git" } +alloy-network = { git = "https://github.com/alloy-rs/alloy.git" } +alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy.git", features = [ + "pubsub", + "ws", +] } +alloy-pubsub = { git = "https://github.com/alloy-rs/alloy.git" } +alloy-transport = { git = "https://github.com/alloy-rs/alloy.git" } +alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy.git" } +alloy-transport-http = { git = "https://github.com/alloy-rs/alloy.git" } anyhow = "1.0.71" async-trait = "0.1.71" base64 = "0.13" @@ -33,8 +45,8 @@ crossterm = { version = "0.26.1", features = ["event-stream", "bracketed-paste"] dashmap = "5.5.3" digest = "0.10" elliptic-curve = { version = "0.13.8", features = ["ecdh"] } -ethers = "2.0" -ethers-providers = "2.0.9" +ethers = "2.0.13" +ethers-providers = "2.0.13" flate2 = "1.0" futures = "0.3" generic-array = "0.14" diff --git a/src/eth/provider.rs b/src/eth/provider.rs index 75eed98ea..6f5a8ccd4 100644 --- a/src/eth/provider.rs +++ b/src/eth/provider.rs @@ -1,15 +1,14 @@ use crate::eth::types::*; use crate::types::*; +use alloy_primitives::U256; +use alloy_rpc_client::ClientBuilder; +use alloy_rpc_types::pubsub::SubscriptionResult; +use alloy_transport_ws::WsConnect; use anyhow::Result; -use ethers::prelude::Provider; -use ethers::types::Filter; -use ethers_providers::{Middleware, StreamExt, Ws}; use std::collections::HashMap; use std::sync::Arc; use url::Url; -const WS_RECONNECTS: usize = 10_000; // TODO workshop this - /// The ETH provider runtime process is responsible for connecting to one or more ETH RPC providers /// and using them to service indexing requests from other apps. This could also be done by a wasm /// app, but in the future, this process will hopefully expand in scope to perform more complex @@ -24,6 +23,7 @@ pub async fn provider( let our = Arc::new(our); // for now, we can only handle WebSocket RPC URLs. In the future, we should // be able to handle HTTP too, at least. + // todo add http reqwest.. match Url::parse(&rpc_url)?.scheme() { "http" | "https" => { return Err(anyhow::anyhow!( @@ -38,15 +38,18 @@ pub async fn provider( } } - let provider = match Provider::::connect_with_reconnects(&rpc_url, WS_RECONNECTS).await { - Ok(provider) => provider, - Err(e) => { - return Err(anyhow::anyhow!( - "eth: fatal: given RPC URL could not connect! {e:?}" - )); - } + let connector = WsConnect { + url: rpc_url.clone(), + auth: None, }; + // http option here, although doesn't implement .get_watcher()... investigating + // let client = ClientBuilder::default().reqwest_http(Url::from_str(&rpc_url)?); + + let client = ClientBuilder::default().pubsub(connector).await?; + + let provider = alloy_providers::provider::Provider::new_with_client(client); + let x = provider.inner(); let mut connections = RpcConnections { provider, ws_provider_subscriptions: HashMap::new(), @@ -123,10 +126,18 @@ async fn handle_request( // if this process has already used this subscription ID, // this subscription will **overwrite** the existing one. + let id = connections + .provider + .inner() + .prepare::<_, U256>("eth_subscribe", filter) + .await + .unwrap(); + + let rx = connections.provider.inner().get_watcher(id).await; + let handle = tokio::spawn(handle_subscription_stream( our.clone(), - connections.provider.clone(), - filter, + rx, target.clone(), send_to_loop.clone(), )); @@ -151,19 +162,13 @@ async fn handle_request( /// for a specific subscription made by a process. async fn handle_subscription_stream( our: Arc, - provider: Provider, - filter: Filter, + mut rx: tokio::sync::broadcast::Receiver>, target: Address, send_to_loop: MessageSender, ) -> Result<(), EthError> { - let mut stream = match provider.subscribe_logs(&filter).await { - Ok(s) => s, - Err(e) => { - return Err(EthError::ProviderError(e.to_string())); - } - }; - - while let Some(event) = stream.next().await { + while let Ok(value) = rx.recv().await { + println!("got some sub!! {:?}", value); + let event: SubscriptionResult = serde_json::from_value(value.get().into()).unwrap(); send_to_loop .send(KernelMessage { id: rand::random(), @@ -176,7 +181,7 @@ async fn handle_subscription_stream( message: Message::Request(Request { inherit: false, expects_response: None, - body: serde_json::to_vec(&EthSubEvent::Log(event)).unwrap(), + body: serde_json::to_vec(&event).unwrap(), metadata: None, capabilities: vec![], }), diff --git a/src/eth/types.rs b/src/eth/types.rs index c88f37550..a4b0f78ac 100644 --- a/src/eth/types.rs +++ b/src/eth/types.rs @@ -1,7 +1,13 @@ use crate::types::ProcessId; -use ethers::prelude::Provider; -use ethers::types::{Filter, Log}; -use ethers_providers::Ws; +use alloy_primitives::{Address, ChainId, U256}; +use alloy_providers::provider::Provider; +use alloy_pubsub::{PubSubConnect, PubSubFrontend}; +use alloy_rpc_client::ClientBuilder; +use alloy_rpc_types::pubsub::{Params, SubscriptionKind, SubscriptionResult}; +use alloy_rpc_types::{Filter, Log}; +use alloy_transport::BoxTransport; +use alloy_transport::Transport; +use alloy_transport_ws::WsConnect; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use tokio::task::JoinHandle; @@ -46,6 +52,7 @@ pub enum EthSubEvent { /// Primary state object of the `eth` module pub struct RpcConnections { - pub provider: Provider, + // todo generics when they work properly: pub struct RpcConnections + pub provider: Provider, pub ws_provider_subscriptions: HashMap<(ProcessId, u64), JoinHandle>>, } From ec4cd9b39e267a6210e9961a87aaa0fa5543148a Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Thu, 1 Feb 2024 13:19:56 -0300 Subject: [PATCH 002/171] kns_indexer: draft alloy --- modules/kns_indexer/kns_indexer/src/lib.rs | 185 +++++++++++---------- 1 file changed, 101 insertions(+), 84 deletions(-) diff --git a/modules/kns_indexer/kns_indexer/src/lib.rs b/modules/kns_indexer/kns_indexer/src/lib.rs index 37bbac1d2..5d96df8f8 100644 --- a/modules/kns_indexer/kns_indexer/src/lib.rs +++ b/modules/kns_indexer/kns_indexer/src/lib.rs @@ -1,17 +1,20 @@ -use alloy_rpc_types::Log; +use alloy_primitives::Address as EthAddress; +use alloy_rpc_types::pubsub::SubscriptionResult; +use alloy_rpc_types::{Filter, Log}; use alloy_sol_types::{sol, SolEvent}; -use kinode_process_lib::eth::{EthAddress, EthSubEvent, SubscribeLogsRequest}; use kinode_process_lib::{ await_message, get_typed_state, print_to_terminal, println, set_state, Address, Message, Request, Response, }; use serde::{Deserialize, Serialize}; -use std::collections::{ - hash_map::{Entry, HashMap}, - BTreeMap, -}; -use std::str::FromStr; use std::string::FromUtf8Error; +use std::{ + collections::{ + hash_map::{Entry, HashMap}, + BTreeMap, + }, + str::FromStr, +}; wit_bindgen::generate!({ path: "../../../wit", @@ -21,6 +24,15 @@ wit_bindgen::generate!({ }, }); +//TEMP +#[derive(Debug, Serialize, Deserialize)] +pub enum EthAction { + /// Subscribe to logs with a custom filter. ID is to be used to unsubscribe. + SubscribeLogs { sub_id: u64, filter: Filter }, + /// Kill a SubscribeLogs subscription of a given ID, to stop getting updates. + UnsubscribeLogs(u64), +} + #[derive(Clone, Debug, Serialize, Deserialize)] struct State { // what contract this state pertains to @@ -161,16 +173,25 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> { ))? .send()?; - SubscribeLogsRequest::new(1) // subscription id 1 - .address(EthAddress::from_str(contract_address.unwrap().as_str())?) - .from_block(state.block - 1) + let mut filter = Filter::new() + .address(contract_address.unwrap().parse::().unwrap()) + .from_block(0) .events(vec![ "NodeRegistered(bytes32,bytes)", "KeyUpdate(bytes32,bytes32)", "IpUpdate(bytes32,uint128)", "WsUpdate(bytes32,uint16)", "RoutingUpdate(bytes32,bytes32[])", - ]) + ]); + + filter = filter.from_block(0); + + Request::new() + .target((&our.node, "eth", "distro", "sys")) + .body(serde_json::to_vec(&EthAction::SubscribeLogs { + sub_id: 8, + filter, + })?) .send()?; let mut pending_requests: BTreeMap> = BTreeMap::new(); @@ -230,88 +251,84 @@ fn handle_eth_message( pending_requests: &mut BTreeMap>, body: &[u8], ) -> anyhow::Result<()> { - let Ok(msg) = serde_json::from_slice::(body) else { + let Ok(log) = serde_json::from_slice::(body) else { return Err(anyhow::anyhow!("kns_indexer: got invalid message")); }; - match msg { - EthSubEvent::Log(log) => { - state.block = log.block_number.expect("expect").to::(); + state.block = log.block_number.expect("expect").to::(); - let node_id: alloy_primitives::FixedBytes<32> = log.topics[1]; + let node_id: alloy_primitives::FixedBytes<32> = log.topics[1]; - let name = match state.names.entry(node_id.to_string()) { - Entry::Occupied(o) => o.into_mut(), - Entry::Vacant(v) => v.insert(get_name(&log)), - }; + let name = match state.names.entry(node_id.to_string()) { + Entry::Occupied(o) => o.into_mut(), + Entry::Vacant(v) => v.insert(get_name(&log)), + }; - let node = state - .nodes - .entry(name.to_string()) - .or_insert_with(|| KnsUpdate::new(name, &node_id.to_string())); + let node = state + .nodes + .entry(name.to_string()) + .or_insert_with(|| KnsUpdate::new(name, &node_id.to_string())); - let mut send = true; + let mut send = true; - match log.topics[0] { - KeyUpdate::SIGNATURE_HASH => { - node.public_key = KeyUpdate::abi_decode_data(&log.data, true) - .unwrap() - .0 - .to_string(); - } - IpUpdate::SIGNATURE_HASH => { - let ip = IpUpdate::abi_decode_data(&log.data, true).unwrap().0; - node.ip = format!( - "{}.{}.{}.{}", - (ip >> 24) & 0xFF, - (ip >> 16) & 0xFF, - (ip >> 8) & 0xFF, - ip & 0xFF - ); - // when we get ip data, we should delete any router data, - // since the assignment of ip indicates an direct node - node.routers = vec![]; - } - WsUpdate::SIGNATURE_HASH => { - node.port = WsUpdate::abi_decode_data(&log.data, true).unwrap().0; - // when we get port data, we should delete any router data, - // since the assignment of port indicates an direct node - node.routers = vec![]; - } - RoutingUpdate::SIGNATURE_HASH => { - node.routers = RoutingUpdate::abi_decode_data(&log.data, true) - .unwrap() - .0 - .iter() - .map(|r| r.to_string()) - .collect::>(); - // when we get routing data, we should delete any ws/ip data, - // since the assignment of routers indicates an indirect node - node.ip = "".to_string(); - node.port = 0; - } - _ => { - send = false; - } - } - - if node.public_key != "" - && ((node.ip != "" && node.port != 0) || node.routers.len() > 0) - && send - { - print_to_terminal( - 1, - &format!( - "kns_indexer: sending ID to net: {node:?} (blocknum {})", - state.block - ), - ); - Request::new() - .target((&our.node, "net", "distro", "sys")) - .try_body(NetActions::KnsUpdate(node.clone()))? - .send()?; - } + match log.topics[0] { + KeyUpdate::SIGNATURE_HASH => { + node.public_key = KeyUpdate::abi_decode_data(&log.data, true) + .unwrap() + .0 + .to_string(); } + IpUpdate::SIGNATURE_HASH => { + let ip = IpUpdate::abi_decode_data(&log.data, true).unwrap().0; + node.ip = format!( + "{}.{}.{}.{}", + (ip >> 24) & 0xFF, + (ip >> 16) & 0xFF, + (ip >> 8) & 0xFF, + ip & 0xFF + ); + // when we get ip data, we should delete any router data, + // since the assignment of ip indicates an direct node + node.routers = vec![]; + } + WsUpdate::SIGNATURE_HASH => { + node.port = WsUpdate::abi_decode_data(&log.data, true).unwrap().0; + // when we get port data, we should delete any router data, + // since the assignment of port indicates an direct node + node.routers = vec![]; + } + RoutingUpdate::SIGNATURE_HASH => { + node.routers = RoutingUpdate::abi_decode_data(&log.data, true) + .unwrap() + .0 + .iter() + .map(|r| r.to_string()) + .collect::>(); + // when we get routing data, we should delete any ws/ip data, + // since the assignment of routers indicates an indirect node + node.ip = "".to_string(); + node.port = 0; + } + _ => { + send = false; + } + } + + if node.public_key != "" + && ((node.ip != "" && node.port != 0) || node.routers.len() > 0) + && send + { + print_to_terminal( + 1, + &format!( + "kns_indexer: sending ID to net: {node:?} (blocknum {})", + state.block + ), + ); + Request::new() + .target((&our.node, "net", "distro", "sys")) + .try_body(NetActions::KnsUpdate(node.clone()))? + .send()?; } // check the pending_requests btreemap to see if there are any requests that // can be handled now that the state block has been updated From 07a3a857b884cee657df2f6af0466e51688cbc1c Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Thu, 1 Feb 2024 18:58:10 -0300 Subject: [PATCH 003/171] eth & kns: reform subscribe action --- modules/kns_indexer/kns_indexer/src/lib.rs | 22 +++++-- src/eth/provider.rs | 77 +++++++++++++--------- src/eth/types.rs | 6 +- 3 files changed, 66 insertions(+), 39 deletions(-) diff --git a/modules/kns_indexer/kns_indexer/src/lib.rs b/modules/kns_indexer/kns_indexer/src/lib.rs index 5d96df8f8..53b4a3639 100644 --- a/modules/kns_indexer/kns_indexer/src/lib.rs +++ b/modules/kns_indexer/kns_indexer/src/lib.rs @@ -1,7 +1,10 @@ use alloy_primitives::Address as EthAddress; -use alloy_rpc_types::pubsub::SubscriptionResult; -use alloy_rpc_types::{Filter, Log}; +use alloy_rpc_types::{ + pubsub::{Params, SubscriptionKind, SubscriptionResult}, + BlockNumberOrTag, Filter, Log, +}; use alloy_sol_types::{sol, SolEvent}; + use kinode_process_lib::{ await_message, get_typed_state, print_to_terminal, println, set_state, Address, Message, Request, Response, @@ -28,7 +31,11 @@ wit_bindgen::generate!({ #[derive(Debug, Serialize, Deserialize)] pub enum EthAction { /// Subscribe to logs with a custom filter. ID is to be used to unsubscribe. - SubscribeLogs { sub_id: u64, filter: Filter }, + SubscribeLogs { + sub_id: u64, + kind: SubscriptionKind, + params: Params, + }, /// Kill a SubscribeLogs subscription of a given ID, to stop getting updates. UnsubscribeLogs(u64), } @@ -173,9 +180,10 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> { ))? .send()?; - let mut filter = Filter::new() + let filter = Filter::new() .address(contract_address.unwrap().parse::().unwrap()) .from_block(0) + .to_block(BlockNumberOrTag::Latest) .events(vec![ "NodeRegistered(bytes32,bytes)", "KeyUpdate(bytes32,bytes32)", @@ -184,13 +192,15 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> { "RoutingUpdate(bytes32,bytes32[])", ]); - filter = filter.from_block(0); + let params = Params::Logs(Box::new(filter)); + let kind = SubscriptionKind::Logs; Request::new() .target((&our.node, "eth", "distro", "sys")) .body(serde_json::to_vec(&EthAction::SubscribeLogs { sub_id: 8, - filter, + kind, + params, })?) .send()?; diff --git a/src/eth/provider.rs b/src/eth/provider.rs index 6f5a8ccd4..bd16e9569 100644 --- a/src/eth/provider.rs +++ b/src/eth/provider.rs @@ -1,8 +1,10 @@ use crate::eth::types::*; use crate::types::*; -use alloy_primitives::U256; +use alloy_primitives::{Bytes, U256}; +use alloy_providers::provider::TempProvider; use alloy_rpc_client::ClientBuilder; -use alloy_rpc_types::pubsub::SubscriptionResult; +use alloy_rpc_types::pubsub::{Params, SubscriptionKind, SubscriptionResult}; +use alloy_rpc_types::{BlockNumberOrTag, Filter}; use alloy_transport_ws::WsConnect; use anyhow::Result; use std::collections::HashMap; @@ -43,13 +45,14 @@ pub async fn provider( auth: None, }; - // http option here, although doesn't implement .get_watcher()... investigating + // note, reqwest::http is an option here, although doesn't implement .get_watcher() + // polling should be an option, investigating // let client = ClientBuilder::default().reqwest_http(Url::from_str(&rpc_url)?); let client = ClientBuilder::default().pubsub(connector).await?; let provider = alloy_providers::provider::Provider::new_with_client(client); - let x = provider.inner(); + let mut connections = RpcConnections { provider, ws_provider_subscriptions: HashMap::new(), @@ -120,27 +123,31 @@ async fn handle_request( send_to_loop: &MessageSender, ) -> Result<(), EthError> { match action { - EthAction::SubscribeLogs { sub_id, filter } => { + EthAction::SubscribeLogs { + sub_id, + kind, + params, + } => { let sub_id = (target.process.clone(), sub_id); - // if this process has already used this subscription ID, - // this subscription will **overwrite** the existing one. + let kind = serde_json::to_value(&kind).unwrap(); + let params = serde_json::to_value(¶ms).unwrap(); let id = connections .provider .inner() - .prepare::<_, U256>("eth_subscribe", filter) + .prepare("eth_subscribe", [kind, params]) .await .unwrap(); let rx = connections.provider.inner().get_watcher(id).await; - let handle = tokio::spawn(handle_subscription_stream( our.clone(), rx, target.clone(), send_to_loop.clone(), )); + connections.ws_provider_subscriptions.insert(sub_id, handle); Ok(()) } @@ -166,29 +173,35 @@ async fn handle_subscription_stream( target: Address, send_to_loop: MessageSender, ) -> Result<(), EthError> { - while let Ok(value) = rx.recv().await { - println!("got some sub!! {:?}", value); - let event: SubscriptionResult = serde_json::from_value(value.get().into()).unwrap(); - send_to_loop - .send(KernelMessage { - id: rand::random(), - source: Address { - node: our.to_string(), - process: ETH_PROCESS_ID.clone(), - }, - target: target.clone(), - rsvp: None, - message: Message::Request(Request { - inherit: false, - expects_response: None, - body: serde_json::to_vec(&event).unwrap(), - metadata: None, - capabilities: vec![], - }), - lazy_load_blob: None, - }) - .await - .unwrap(); + match rx.recv().await { + Err(e) => { + println!("got an error from the subscription stream: {:?}", e); + // TODO should we stop the subscription here? + // return Err(EthError::ProviderError(format!("{:?}", e))); + } + Ok(value) => { + let event: SubscriptionResult = serde_json::from_str(value.get()).unwrap(); + send_to_loop + .send(KernelMessage { + id: rand::random(), + source: Address { + node: our.to_string(), + process: ETH_PROCESS_ID.clone(), + }, + target: target.clone(), + rsvp: None, + message: Message::Request(Request { + inherit: false, + expects_response: None, + body: serde_json::to_vec(&event).unwrap(), + metadata: None, + capabilities: vec![], + }), + lazy_load_blob: None, + }) + .await + .unwrap(); + } } Err(EthError::SubscriptionClosed) } diff --git a/src/eth/types.rs b/src/eth/types.rs index a4b0f78ac..efc9f5244 100644 --- a/src/eth/types.rs +++ b/src/eth/types.rs @@ -19,7 +19,11 @@ use tokio::task::JoinHandle; #[derive(Debug, Serialize, Deserialize)] pub enum EthAction { /// Subscribe to logs with a custom filter. ID is to be used to unsubscribe. - SubscribeLogs { sub_id: u64, filter: Filter }, + SubscribeLogs { + sub_id: u64, + kind: SubscriptionKind, + params: Params, + }, /// Kill a SubscribeLogs subscription of a given ID, to stop getting updates. UnsubscribeLogs(u64), } From 55c55ab5568dc49ed048273473d27e90725223ae Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Thu, 1 Feb 2024 19:12:27 -0300 Subject: [PATCH 004/171] eth: add get_logs & get_block_number --- modules/kns_indexer/kns_indexer/src/lib.rs | 11 ++++++- src/eth/provider.rs | 38 ++++++++++++++++++++++ src/eth/types.rs | 7 ++-- 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/modules/kns_indexer/kns_indexer/src/lib.rs b/modules/kns_indexer/kns_indexer/src/lib.rs index 53b4a3639..14a52b346 100644 --- a/modules/kns_indexer/kns_indexer/src/lib.rs +++ b/modules/kns_indexer/kns_indexer/src/lib.rs @@ -38,6 +38,10 @@ pub enum EthAction { }, /// Kill a SubscribeLogs subscription of a given ID, to stop getting updates. UnsubscribeLogs(u64), + /// get_logs + GetLogs { filter: Filter }, + /// get_block_number + GetBlockNumber, } #[derive(Clone, Debug, Serialize, Deserialize)] @@ -192,9 +196,14 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> { "RoutingUpdate(bytes32,bytes32[])", ]); - let params = Params::Logs(Box::new(filter)); + let params = Params::Logs(Box::new(filter.clone())); let kind = SubscriptionKind::Logs; + Request::new() + .target((&our.node, "eth", "distro", "sys")) + .body(serde_json::to_vec(&EthAction::GetLogs { filter })?) + .send()?; + Request::new() .target((&our.node, "eth", "distro", "sys")) .body(serde_json::to_vec(&EthAction::SubscribeLogs { diff --git a/src/eth/provider.rs b/src/eth/provider.rs index bd16e9569..372f5635e 100644 --- a/src/eth/provider.rs +++ b/src/eth/provider.rs @@ -161,6 +161,44 @@ async fn handle_request( handle.abort(); Ok(()) } + EthAction::GetBlockNumber => { + let block_number = connections.provider.get_block_number().await.unwrap(); + + Ok(()) + } + EthAction::GetLogs { filter } => { + let logs = connections + .provider + .get_logs(filter) + .await + .map_err(|e| EthError::ProviderError(format!("{:?}", e)))?; + + // TEMP, will change. + for log in logs { + send_to_loop + .send(KernelMessage { + id: rand::random(), + source: Address { + node: our.to_string(), + process: ETH_PROCESS_ID.clone(), + }, + target: target.clone(), + rsvp: None, + message: Message::Request(Request { + inherit: false, + expects_response: None, + body: serde_json::to_vec(&log).unwrap(), + metadata: None, + capabilities: vec![], + }), + lazy_load_blob: None, + }) + .await + .unwrap(); + } + + Ok(()) + } } } diff --git a/src/eth/types.rs b/src/eth/types.rs index efc9f5244..d9e36b867 100644 --- a/src/eth/types.rs +++ b/src/eth/types.rs @@ -5,9 +5,6 @@ use alloy_pubsub::{PubSubConnect, PubSubFrontend}; use alloy_rpc_client::ClientBuilder; use alloy_rpc_types::pubsub::{Params, SubscriptionKind, SubscriptionResult}; use alloy_rpc_types::{Filter, Log}; -use alloy_transport::BoxTransport; -use alloy_transport::Transport; -use alloy_transport_ws::WsConnect; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use tokio::task::JoinHandle; @@ -26,6 +23,10 @@ pub enum EthAction { }, /// Kill a SubscribeLogs subscription of a given ID, to stop getting updates. UnsubscribeLogs(u64), + /// get_logs + GetLogs { filter: Filter }, + /// get_block_number + GetBlockNumber, } /// The Response type which a process will get from requesting with an [`EthAction`] will be From e7363393bf3cc1d6eb843024684931c814e81349 Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Fri, 2 Feb 2024 14:40:49 -0300 Subject: [PATCH 005/171] eth: wip other methods & apI --- Cargo.lock | 1436 +++++++++----------- Cargo.toml | 2 +- modules/kns_indexer/kns_indexer/src/lib.rs | 107 +- src/eth/provider.rs | 119 +- src/eth/types.rs | 68 +- src/register.rs | 4 +- 6 files changed, 850 insertions(+), 886 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3157b8522..af56ed3b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,15 +27,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "aead" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" -dependencies = [ - "generic-array", -] - [[package]] name = "aead" version = "0.5.2" @@ -46,18 +37,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "aes" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" -dependencies = [ - "cfg-if", - "cipher 0.3.0", - "cpufeatures", - "opaque-debug", -] - [[package]] name = "aes" version = "0.8.3" @@ -65,54 +44,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" dependencies = [ "cfg-if", - "cipher 0.4.4", + "cipher", "cpufeatures", ] [[package]] name = "aes-gcm" -version = "0.9.4" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" +checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" dependencies = [ - "aead 0.4.3", - "aes 0.7.5", - "cipher 0.3.0", - "ctr 0.8.0", - "ghash 0.4.4", - "subtle", -] - -[[package]] -name = "aes-gcm" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "209b47e8954a928e1d72e86eca7000ebb6655fe1436d33eefc2201cad027e237" -dependencies = [ - "aead 0.5.2", - "aes 0.8.3", - "cipher 0.4.4", - "ctr 0.9.2", - "ghash 0.5.0", + "aead", + "aes", + "cipher", + "ctr", + "ghash", "subtle", ] [[package]] name = "ahash" -version = "0.8.3" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" dependencies = [ "cfg-if", "once_cell", "version_check", + "zerocopy", ] [[package]] name = "aho-corasick" -version = "1.0.5" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] @@ -126,9 +92,9 @@ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" [[package]] name = "alloy-eips" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" dependencies = [ - "alloy-primitives 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "serde", "thiserror", @@ -137,9 +103,9 @@ dependencies = [ [[package]] name = "alloy-json-rpc" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" dependencies = [ - "alloy-primitives 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "serde", "serde_json", "thiserror", @@ -148,11 +114,11 @@ dependencies = [ [[package]] name = "alloy-network" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" dependencies = [ "alloy-eips", "alloy-json-rpc", - "alloy-primitives 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "serde", ] @@ -179,34 +145,13 @@ dependencies = [ "tiny-keccak", ] -[[package]] -name = "alloy-primitives" -version = "0.6.2" -source = "git+https://github.com/alloy-rs/core.git#04d63af7d9a3dc69749355c8dfeb3413b29a4f76" -dependencies = [ - "alloy-rlp", - "bytes", - "cfg-if", - "const-hex", - "derive_more", - "hex-literal", - "itoa", - "k256", - "keccak-asm", - "proptest", - "rand", - "ruint", - "serde", - "tiny-keccak", -] - [[package]] name = "alloy-providers" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" dependencies = [ "alloy-network", - "alloy-primitives 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-client", "alloy-rpc-trace-types", "alloy-rpc-types", @@ -222,13 +167,14 @@ dependencies = [ [[package]] name = "alloy-pubsub" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" dependencies = [ "alloy-json-rpc", - "alloy-primitives 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-transport", "bimap", "futures", + "serde", "serde_json", "tokio", "tower", @@ -260,10 +206,10 @@ dependencies = [ [[package]] name = "alloy-rpc-client" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" dependencies = [ "alloy-json-rpc", - "alloy-primitives 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-pubsub", "alloy-transport", "alloy-transport-http", @@ -271,8 +217,8 @@ dependencies = [ "futures", "pin-project", "reqwest", + "serde", "serde_json", - "tokio", "tower", "tracing", "url", @@ -281,9 +227,9 @@ dependencies = [ [[package]] name = "alloy-rpc-trace-types" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" dependencies = [ - "alloy-primitives 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rpc-types", "serde", "serde_json", @@ -292,9 +238,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" dependencies = [ - "alloy-primitives 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "alloy-primitives", "alloy-rlp", "itertools 0.12.1", "serde", @@ -305,10 +251,10 @@ dependencies = [ [[package]] name = "alloy-transport" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" dependencies = [ "alloy-json-rpc", - "base64 0.21.4", + "base64 0.21.7", "serde", "serde_json", "thiserror", @@ -321,7 +267,7 @@ dependencies = [ [[package]] name = "alloy-transport-http" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -334,7 +280,7 @@ dependencies = [ [[package]] name = "alloy-transport-ws" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#e6f98e15efac4bb2c598570580296925cc590dd3" +source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" dependencies = [ "alloy-pubsub", "alloy-transport", @@ -342,7 +288,7 @@ dependencies = [ "http", "serde_json", "tokio", - "tokio-tungstenite 0.20.1", + "tokio-tungstenite", "tracing", "ws_stream_wasm", ] @@ -370,9 +316,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.4" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" +checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" dependencies = [ "anstyle", "anstyle-parse", @@ -384,43 +330,43 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "2faccea4cc4ab4a667ce676a30e8ec13922a692c99bb8f5b11f1502c72e04220" [[package]] name = "anstyle-parse" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.1" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" dependencies = [ "anstyle", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[package]] name = "arbitrary" @@ -552,15 +498,6 @@ dependencies = [ "rand", ] -[[package]] -name = "array-init" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23589ecb866b460d3a0f1278834750268c607e8e28a1b982c907219f3178cd72" -dependencies = [ - "nodrop", -] - [[package]] name = "arrayref" version = "0.3.7" @@ -606,14 +543,13 @@ dependencies = [ [[package]] name = "auto_impl" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" +checksum = "823b8bb275161044e2ac7a25879cb3e2480cb403e3943022c7c769c599b756aa" dependencies = [ - "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.48", ] [[package]] @@ -651,9 +587,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.4" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64ct" @@ -726,9 +662,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "bitvec" @@ -753,16 +689,15 @@ dependencies = [ [[package]] name = "blake3" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "199c42ab6972d92c9f8995f086273d25c42fc0f7b2a1fcefba465c1352d25ba5" +checksum = "0231f06152bf547e9c2b5194f247cd97aacf6dcd8b15d8e5ec0663f64580da87" dependencies = [ "arrayref", "arrayvec", "cc", "cfg-if", "constant_time_eq 0.3.0", - "digest 0.10.7", ] [[package]] @@ -786,9 +721,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "byte-slice-cast" @@ -798,9 +733,9 @@ checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" @@ -843,50 +778,50 @@ dependencies = [ [[package]] name = "cap-fs-ext" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b779b2d0a001c125b4584ad586268fb4b92d957bff8d26d7fe0dd78283faa814" +checksum = "88e341d15ac1029aadce600be764a1a1edafe40e03cde23285bc1d261b3a4866" dependencies = [ "cap-primitives", "cap-std", - "io-lifetimes 2.0.2", - "windows-sys 0.48.0", + "io-lifetimes", + "windows-sys 0.52.0", ] [[package]] name = "cap-net-ext" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ffc30dee200c20b4dcb80572226f42658e1d9c4b668656d7cc59c33d50e396e" +checksum = "434168fe6533055f0f4204039abe3ff6d7db338ef46872a5fa39e9d5ad5ab7a9" dependencies = [ "cap-primitives", "cap-std", - "rustix 0.38.27", - "smallvec 1.11.0", + "rustix", + "smallvec", ] [[package]] name = "cap-primitives" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bf30c373a3bee22c292b1b6a7a26736a38376840f1af3d2d806455edf8c3899" +checksum = "fe16767ed8eee6d3f1f00d6a7576b81c226ab917eb54b96e5f77a5216ef67abb" dependencies = [ "ambient-authority", "fs-set-times", "io-extras", - "io-lifetimes 2.0.2", + "io-lifetimes", "ipnet", "maybe-owned", - "rustix 0.38.27", - "windows-sys 0.48.0", + "rustix", + "windows-sys 0.52.0", "winx", ] [[package]] name = "cap-rand" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "577de6cff7c2a47d6b13efe5dd28bf116bd7f8f7db164ea95b7cc2640711f522" +checksum = "20e5695565f0cd7106bc3c7170323597540e772bb73e0be2cd2c662a0f8fa4ca" dependencies = [ "ambient-authority", "rand", @@ -894,33 +829,35 @@ dependencies = [ [[package]] name = "cap-std" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84bade423fa6403efeebeafe568fdb230e8c590a275fba2ba978dd112efcf6e9" +checksum = "593db20e4c51f62d3284bae7ee718849c3214f93a3b94ea1899ad85ba119d330" dependencies = [ "cap-primitives", "io-extras", - "io-lifetimes 2.0.2", - "rustix 0.38.27", + "io-lifetimes", + "rustix", ] [[package]] name = "cap-time-ext" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8f52b3c8f4abfe3252fd0a071f3004aaa3b18936ec97bdbd8763ce03aff6247" +checksum = "03261630f291f425430a36f38c847828265bc928f517cdd2004c56f4b02f002b" dependencies = [ + "ambient-authority", "cap-primitives", + "iana-time-zone", "once_cell", - "rustix 0.38.27", + "rustix", "winx", ] [[package]] name = "cargo-platform" -version = "0.1.3" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cfa25e60aea747ec7e1124f238816749faa93759c6ff5b31f1ccdda137f4479" +checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d" dependencies = [ "serde", ] @@ -933,7 +870,7 @@ checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" dependencies = [ "camino", "cargo-platform", - "semver 1.0.18", + "semver 1.0.21", "serde", "serde_json", "thiserror", @@ -964,18 +901,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chacha20" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" -dependencies = [ - "cfg-if", - "cipher 0.3.0", - "cpufeatures", - "zeroize", -] - [[package]] name = "chacha20" version = "0.9.1" @@ -983,57 +908,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818" dependencies = [ "cfg-if", - "cipher 0.4.4", + "cipher", "cpufeatures", ] -[[package]] -name = "chacha20poly1305" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5" -dependencies = [ - "aead 0.4.3", - "chacha20 0.8.2", - "cipher 0.3.0", - "poly1305 0.7.2", - "zeroize", -] - [[package]] name = "chacha20poly1305" version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10cd79432192d1c0f4e1a0fef9527696cc039165d729fb41b3f4f4f354c2dc35" dependencies = [ - "aead 0.5.2", - "chacha20 0.9.1", - "cipher 0.4.4", - "poly1305 0.8.0", + "aead", + "chacha20", + "cipher", + "poly1305", "zeroize", ] [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets 0.48.5", -] - -[[package]] -name = "cipher" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" -dependencies = [ - "generic-array", + "windows-targets 0.52.0", ] [[package]] @@ -1049,9 +952,9 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" +checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" dependencies = [ "glob", "libc", @@ -1060,9 +963,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.10" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fffed7514f420abec6d183b1d3acfd9099c79c3a10a06ade4f8203f1411272" +checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" dependencies = [ "clap_builder", "clap_derive", @@ -1070,9 +973,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.9" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63361bae7eef3771745f02d8d892bec2fee5f6e34af316ba556e7f97a7069ff1" +checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" dependencies = [ "anstream", "anstyle", @@ -1136,7 +1039,7 @@ version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5286a0843c21f8367f7be734f89df9b822e0321d8bcce8d6e735aadff7d74979" dependencies = [ - "base64 0.21.4", + "base64 0.21.7", "bech32", "bs58", "digest 0.10.7", @@ -1171,9 +1074,9 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "constant_time_eq" @@ -1195,9 +1098,9 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -1205,9 +1108,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpp_demangle" @@ -1220,9 +1123,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] @@ -1250,10 +1153,10 @@ dependencies = [ "cranelift-entity", "cranelift-isle", "gimli", - "hashbrown 0.14.0", + "hashbrown 0.14.3", "log", "regalloc2", - "smallvec 1.11.0", + "smallvec", "target-lexicon", ] @@ -1299,7 +1202,7 @@ checksum = "e57374fd11d72cf9ffb85ff64506ed831440818318f58d09f45b4185e5e9c376" dependencies = [ "cranelift-codegen", "log", - "smallvec 1.11.0", + "smallvec", "target-lexicon", ] @@ -1331,8 +1234,8 @@ dependencies = [ "cranelift-frontend", "itertools 0.10.5", "log", - "smallvec 1.11.0", - "wasmparser 0.116.0", + "smallvec", + "wasmparser 0.116.1", "wasmtime-types", ] @@ -1345,48 +1248,30 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crossbeam-channel" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - [[package]] name = "crossbeam-deque" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.15" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if", "crossbeam-utils", - "memoffset", - "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "crossterm" @@ -1422,9 +1307,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.5.3" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "740fe28e594155f10cfc383984cbefd529d7396050557148f79cb0f621204124" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", "rand_core", @@ -1443,22 +1328,13 @@ dependencies = [ "typenum", ] -[[package]] -name = "ctr" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" -dependencies = [ - "cipher 0.3.0", -] - [[package]] name = "ctr" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ - "cipher 0.4.4", + "cipher", ] [[package]] @@ -1479,9 +1355,9 @@ dependencies = [ [[package]] name = "curve25519-dalek-derive" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", @@ -1530,7 +1406,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", - "hashbrown 0.14.0", + "hashbrown 0.14.3", "lock_api", "once_cell", "parking_lot_core", @@ -1538,9 +1414,9 @@ dependencies = [ [[package]] name = "data-encoding" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" +checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" [[package]] name = "debugid" @@ -1548,7 +1424,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" dependencies = [ - "uuid 1.4.1", + "uuid 1.7.0", ] [[package]] @@ -1563,9 +1439,12 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.8" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] [[package]] name = "derivative" @@ -1723,7 +1602,7 @@ checksum = "53ecafc952c4528d9b51a458d1a8904b81783feff9fde08ab6ed2545ff396872" dependencies = [ "cfg-if", "libc", - "socket2 0.4.9", + "socket2 0.4.10", "winapi", ] @@ -1735,9 +1614,9 @@ checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" [[package]] name = "ecdsa" -version = "0.16.8" +version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der", "digest 0.10.7", @@ -1799,11 +1678,11 @@ checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" [[package]] name = "enr" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0be7b2ac146c1f99fe245c02d16af0696450d8e06c135db75e10eeb9e642c20d" +checksum = "fe81b5c06ecfdbc71dd845216f225f53b62a10cb8a16c946836a3467f701d05b" dependencies = [ - "base64 0.21.4", + "base64 0.21.7", "bytes", "hex", "k256", @@ -1811,7 +1690,6 @@ dependencies = [ "rand", "rlp", "serde", - "serde-hex", "sha3", "zeroize", ] @@ -1850,8 +1728,8 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" dependencies = [ - "aes 0.8.3", - "ctr 0.9.2", + "aes", + "ctr", "digest 0.10.7", "hex", "hmac", @@ -1981,7 +1859,7 @@ dependencies = [ "serde", "serde_json", "syn 2.0.48", - "toml 0.8.8", + "toml 0.8.9", "walkdir", ] @@ -2040,7 +1918,7 @@ dependencies = [ "chrono", "ethers-core", "reqwest", - "semver 1.0.18", + "semver 1.0.21", "serde", "serde_json", "thiserror", @@ -2082,7 +1960,7 @@ checksum = "fb6b15393996e3b8a78ef1332d6483c11d839042c17be58decc92fa8b1c3508a" dependencies = [ "async-trait", "auto_impl", - "base64 0.21.4", + "base64 0.21.7", "bytes", "const-hex", "enr", @@ -2102,7 +1980,7 @@ dependencies = [ "serde_json", "thiserror", "tokio", - "tokio-tungstenite 0.20.1", + "tokio-tungstenite", "tracing", "tracing-futures", "url", @@ -2150,7 +2028,7 @@ dependencies = [ "path-slash", "rayon", "regex", - "semver 1.0.18", + "semver 1.0.21", "serde", "serde_json", "solang-parser", @@ -2165,9 +2043,9 @@ dependencies = [ [[package]] name = "eyre" -version = "0.6.8" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c2b6b5a29c02cdc822728b7d7b8ae1bab3e3b05d44522770ddd49722eeac7eb" +checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" dependencies = [ "indenter", "once_cell", @@ -2187,9 +2065,9 @@ checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a" [[package]] name = "fastrand" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "fastrlp" @@ -2204,13 +2082,13 @@ dependencies = [ [[package]] name = "fd-lock" -version = "4.0.0" +version = "4.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b0377f1edc77dbd1118507bc7a66e4ab64d2b90c66f90726dc801e73a8c68f9" +checksum = "7e5768da2206272c81ef0b5e951a41862938a6070da63bcea197899942d3b947" dependencies = [ "cfg-if", - "rustix 0.38.27", - "windows-sys 0.48.0", + "rustix", + "windows-sys 0.52.0", ] [[package]] @@ -2225,9 +2103,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.2.2" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a481586acf778f1b1455424c343f71124b048ffa5f4fc3f8f6ae9dc432dcb3c7" +checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" [[package]] name = "fixed-hash" @@ -2249,9 +2127,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", "miniz_oxide", @@ -2280,22 +2158,22 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] [[package]] name = "fs-set-times" -version = "0.20.0" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd738b84894214045e8414eaded76359b4a5773f0a0a56b16575110739cdcf39" +checksum = "033b337d725b97690d86893f9de22b67b80dcc4e9ad815f348254c38119db8fb" dependencies = [ - "io-lifetimes 2.0.2", - "rustix 0.38.27", - "windows-sys 0.48.0", + "io-lifetimes", + "rustix", + "windows-sys 0.52.0", ] [[package]] @@ -2438,7 +2316,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27d12c0aed7f1e24276a241aadc4cb8ea9f83000f34bc062b7cc2d51e3b0fabd" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.2", "debugid", "fxhash", "serde", @@ -2458,25 +2336,15 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "libc", "wasi", ] -[[package]] -name = "ghash" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" -dependencies = [ - "opaque-debug", - "polyval 0.5.3", -] - [[package]] name = "ghash" version = "0.5.0" @@ -2484,17 +2352,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" dependencies = [ "opaque-debug", - "polyval 0.6.1", + "polyval", ] [[package]] name = "gimli" -version = "0.28.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" dependencies = [ "fallible-iterator", - "indexmap 2.0.0", + "indexmap", "stable_deref_trait", ] @@ -2529,9 +2397,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.21" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" dependencies = [ "bytes", "fnv", @@ -2539,19 +2407,13 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 1.9.3", + "indexmap", "slab", "tokio", "tokio-util", "tracing", ] -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - [[package]] name = "hashbrown" version = "0.13.2" @@ -2563,9 +2425,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ "ahash", "allocator-api2", @@ -2586,7 +2448,7 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" dependencies = [ - "hashbrown 0.14.0", + "hashbrown 0.14.3", ] [[package]] @@ -2595,7 +2457,7 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" dependencies = [ - "base64 0.21.4", + "base64 0.21.7", "bytes", "headers-core", "http", @@ -2621,9 +2483,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" [[package]] name = "hex" @@ -2642,9 +2504,9 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" [[package]] name = "hkdf" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" dependencies = [ "hmac", ] @@ -2660,18 +2522,18 @@ dependencies = [ [[package]] name = "home" -version = "0.5.5" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "http" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ "bytes", "fnv", @@ -2680,9 +2542,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", "http", @@ -2703,9 +2565,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", @@ -2718,7 +2580,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.9", + "socket2 0.5.5", "tokio", "tower-service", "tracing", @@ -2727,9 +2589,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http", @@ -2768,16 +2630,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.57" +version = "0.1.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows", + "windows-core", ] [[package]] @@ -2814,9 +2676,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -2891,22 +2753,12 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "1.9.3" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - -[[package]] -name = "indexmap" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown 0.14.3", "serde", ] @@ -2930,36 +2782,25 @@ dependencies = [ [[package]] name = "io-extras" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d3c230ee517ee76b1cc593b52939ff68deda3fae9e41eca426c6b4993df51c4" -dependencies = [ - "io-lifetimes 2.0.2", - "windows-sys 0.48.0", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.11" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +checksum = "c301e73fb90e8a29e600a9f402d095765f74310d582916a952f618836a1bd1ed" dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.48.0", + "io-lifetimes", + "windows-sys 0.52.0", ] [[package]] name = "io-lifetimes" -version = "2.0.2" +version = "2.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bffb4def18c48926ccac55c1223e02865ce1a821751a95920448662696e7472c" +checksum = "5a611371471e98973dbcab4e0ec66c31a10bc356eeb4d54a0e05eac8158fe38c" [[package]] name = "ipnet" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-docker" @@ -2972,13 +2813,13 @@ dependencies = [ [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" dependencies = [ "hermit-abi", - "rustix 0.38.27", - "windows-sys 0.48.0", + "rustix", + "windows-sys 0.52.0", ] [[package]] @@ -3020,9 +2861,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "ittapi" @@ -3046,18 +2887,18 @@ dependencies = [ [[package]] name = "jobserver" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" +checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" dependencies = [ "wasm-bindgen", ] @@ -3068,9 +2909,9 @@ version = "8.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" dependencies = [ - "base64 0.21.4", + "base64 0.21.7", "pem", - "ring", + "ring 0.16.20", "serde", "serde_json", "simple_asn1", @@ -3093,9 +2934,9 @@ dependencies = [ [[package]] name = "k256" -version = "0.13.1" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" +checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" dependencies = [ "cfg-if", "ecdsa", @@ -3107,9 +2948,9 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" dependencies = [ "cpufeatures", ] @@ -3128,9 +2969,9 @@ dependencies = [ name = "kinode" version = "0.5.2" dependencies = [ - "aes-gcm 0.10.2", + "aes-gcm", "alloy-network", - "alloy-primitives 0.6.2 (git+https://github.com/alloy-rs/core.git)", + "alloy-primitives", "alloy-providers", "alloy-pubsub", "alloy-rpc-client", @@ -3145,7 +2986,7 @@ dependencies = [ "blake3", "bytes", "cap-std", - "chacha20poly1305 0.10.1", + "chacha20poly1305", "chrono", "clap", "crossterm", @@ -3171,7 +3012,7 @@ dependencies = [ "public-ip", "rand", "reqwest", - "ring", + "ring 0.16.20", "rmp-serde", "rocksdb", "route-recognizer", @@ -3185,9 +3026,9 @@ dependencies = [ "thiserror", "tokio", "tokio-stream", - "tokio-tungstenite 0.20.1", + "tokio-tungstenite", "url", - "uuid 1.4.1", + "uuid 1.7.0", "walkdir", "warp", "wasmtime", @@ -3243,18 +3084,18 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.150" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libloading" -version = "0.7.4" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161" dependencies = [ "cfg-if", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -3263,6 +3104,17 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +[[package]] +name = "libredox" +version = "0.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" +dependencies = [ + "bitflags 2.4.2", + "libc", + "redox_syscall", +] + [[package]] name = "librocksdb-sys" version = "0.11.0+8.1.1" @@ -3292,9 +3144,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.12" +version = "1.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" +checksum = "037731f5d3aaa87a5675e895b63ddff1a87624bc29f77004ea829809654e48f6" dependencies = [ "cc", "pkg-config", @@ -3303,21 +3155,15 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - -[[package]] -name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -3360,34 +3206,29 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - [[package]] name = "md-5" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" dependencies = [ + "cfg-if", "digest 0.10.7", ] [[package]] name = "memchr" -version = "2.6.3" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f232d6ef707e1956a43342693d2a31e72989554d58299d7a88738cc95b0d35c" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "memfd" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc89ccdc6e10d6907450f753537ebc5c5d3460d2e4e62ea74bd571db62c0f9e" +checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" dependencies = [ - "rustix 0.37.23", + "rustix", ] [[package]] @@ -3490,15 +3331,9 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77a5d83df9f36fe23f0c3648c6bbb8b0298bb5f1939c8f2704431371f4b84d43" dependencies = [ - "smallvec 1.11.0", + "smallvec", ] -[[package]] -name = "nodrop" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" - [[package]] name = "nohash-hasher" version = "0.2.0" @@ -3526,6 +3361,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-integer" version = "0.1.45" @@ -3538,9 +3379,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", "libm", @@ -3558,20 +3399,20 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70bf6736f74634d299d00086f02986875b3c2d924781a6a2cb6c201e73da0ceb" +checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ea360eafe1022f7cc56cd7b869ed57330fb2453d0c7831d99b74c65d2f5597" +checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", "syn 2.0.48", @@ -3579,21 +3420,21 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "crc32fast", - "hashbrown 0.14.0", - "indexmap 2.0.0", + "hashbrown 0.14.3", + "indexmap", "memchr", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "opaque-debug" @@ -3603,9 +3444,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "open" -version = "5.0.0" +version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfabf1927dce4d6fdf563d63328a0a506101ced3ec780ca2135747336c98cef8" +checksum = "90878fb664448b54c4e592455ad02831e23a3f7e157374a8b95654731aac7349" dependencies = [ "is-wsl", "libc", @@ -3639,11 +3480,11 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.57" +version = "0.10.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" +checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.2", "cfg-if", "foreign-types", "libc", @@ -3671,9 +3512,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.93" +version = "0.9.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" +checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" dependencies = [ "cc", "libc", @@ -3689,9 +3530,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "parity-scale-codec" -version = "3.6.8" +version = "3.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f88eaac72ead1b9bd4ce747d577dbd2ad31fb0a56a9a20c611bf27bd1b97fbed" +checksum = "881331e34fa842a2fb61cc2db9643a8fedc615e47cfcc52597d1af0db9a7e8fe" dependencies = [ "arrayvec", "bitvec", @@ -3703,11 +3544,11 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.8" +version = "3.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33bdcd446e9400b6ad9fc85b4aea68846c258b07c3efb994679ae82707b133f0" +checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 2.0.0", "proc-macro2", "quote", "syn 1.0.109", @@ -3725,14 +3566,14 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", - "smallvec 1.11.0", + "redox_syscall", + "smallvec", "windows-targets 0.48.5", ] @@ -3804,9 +3645,9 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" @@ -3826,7 +3667,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.0.0", + "indexmap", ] [[package]] @@ -3892,18 +3733,18 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", @@ -3934,26 +3775,15 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "platforms" -version = "3.1.2" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4503fa043bf02cee09a9582e9554b4c6403b2ef55e4612e96561d294419429f8" - -[[package]] -name = "poly1305" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" -dependencies = [ - "cpufeatures", - "opaque-debug", - "universal-hash 0.4.1", -] +checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" [[package]] name = "poly1305" @@ -3963,32 +3793,26 @@ checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf" dependencies = [ "cpufeatures", "opaque-debug", - "universal-hash 0.5.1", + "universal-hash", ] [[package]] name = "polyval" -version = "0.5.3" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" +checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" dependencies = [ "cfg-if", "cpufeatures", "opaque-debug", - "universal-hash 0.4.1", + "universal-hash", ] [[package]] -name = "polyval" -version = "0.6.1" +name = "powerfmt" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" -dependencies = [ - "cfg-if", - "cpufeatures", - "opaque-debug", - "universal-hash 0.5.1", -] +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" @@ -4004,9 +3828,9 @@ checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] name = "prettyplease" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" dependencies = [ "proc-macro2", "syn 2.0.48", @@ -4014,9 +3838,9 @@ dependencies = [ [[package]] name = "primitive-types" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" dependencies = [ "fixed-hash", "impl-codec", @@ -4037,27 +3861,21 @@ dependencies = [ ] [[package]] -name = "proc-macro-error" -version = "1.0.4" +name = "proc-macro-crate" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", + "toml_edit 0.20.7", ] [[package]] -name = "proc-macro-error-attr" -version = "1.0.4" +name = "proc-macro-crate" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ - "proc-macro2", - "quote", - "version_check", + "toml_edit 0.21.1", ] [[package]] @@ -4083,7 +3901,7 @@ checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.4.0", + "bitflags 2.4.2", "lazy_static", "num-traits", "rand", @@ -4197,9 +4015,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" dependencies = [ "either", "rayon-core", @@ -4207,42 +4025,31 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.11.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "num_cpus", -] - -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", ] [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", ] [[package]] name = "redox_users" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" dependencies = [ "getrandom", - "redox_syscall 0.2.16", + "libredox", "thiserror", ] @@ -4256,14 +4063,14 @@ dependencies = [ "log", "rustc-hash", "slice-group-by", - "smallvec 1.11.0", + "smallvec", ] [[package]] name = "regex" -version = "1.10.2" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", @@ -4273,9 +4080,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ "aho-corasick", "memchr", @@ -4296,11 +4103,11 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" -version = "0.11.22" +version = "0.11.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" dependencies = [ - "base64 0.21.4", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", @@ -4324,6 +4131,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", + "sync_wrapper", "system-configuration", "tokio", "tokio-native-tls", @@ -4357,11 +4165,25 @@ dependencies = [ "libc", "once_cell", "spin 0.5.2", - "untrusted", + "untrusted 0.7.1", "web-sys", "winapi", ] +[[package]] +name = "ring" +version = "0.17.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +dependencies = [ + "cc", + "getrandom", + "libc", + "spin 0.9.8", + "untrusted 0.9.0", + "windows-sys 0.48.0", +] + [[package]] name = "ripemd" version = "0.1.3" @@ -4467,12 +4289,12 @@ version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a78046161564f5e7cd9008aff3b2990b3850dc8e0349119b98e8f251e099f24d" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.2", "fallible-iterator", "fallible-streaming-iterator", "hashlink", "libsqlite3-sys", - "smallvec 1.11.0", + "smallvec", ] [[package]] @@ -4508,67 +4330,53 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.18", + "semver 1.0.21", ] [[package]] name = "rustix" -version = "0.37.23" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ - "bitflags 1.3.2", - "errno", - "io-lifetimes 1.0.11", - "libc", - "linux-raw-sys 0.3.8", - "windows-sys 0.48.0", -] - -[[package]] -name = "rustix" -version = "0.38.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfeae074e687625746172d639330f1de242a178bf3189b51e35a7a21573513ac" -dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.2", "errno", "itoa", "libc", - "linux-raw-sys 0.4.12", + "linux-raw-sys", "once_cell", "windows-sys 0.52.0", ] [[package]] name = "rustls" -version = "0.21.7" +version = "0.21.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", - "ring", + "ring 0.17.7", "rustls-webpki", "sct", ] [[package]] name = "rustls-pemfile" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64 0.21.4", + "base64 0.21.7", ] [[package]] name = "rustls-webpki" -version = "0.101.4" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring", - "untrusted", + "ring 0.17.7", + "untrusted 0.9.0", ] [[package]] @@ -4591,9 +4399,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] name = "salsa20" @@ -4601,7 +4409,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" dependencies = [ - "cipher 0.4.4", + "cipher", ] [[package]] @@ -4615,9 +4423,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35c0a159d0c45c12b20c5a844feb1fe4bea86e28f17b92a5f0c42193634d3782" +checksum = "7f7d66a1128282b7ef025a8ead62a4a9fcf017382ec53b8ffbf4d7bf77bd3c60" dependencies = [ "cfg-if", "derive_more", @@ -4627,11 +4435,11 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.9.0" +version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "912e55f6d20e0e80d63733872b40e1227c0bce1e1ab81ba67d696339bfd7fd29" +checksum = "abf2c68b89cafb3b8d918dd07b42be0da66ff202cf1155c5739a4e0c1ea0dc19" dependencies = [ - "proc-macro-crate", + "proc-macro-crate 1.3.1", "proc-macro2", "quote", "syn 1.0.109", @@ -4639,11 +4447,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -4672,12 +4480,12 @@ dependencies = [ [[package]] name = "sct" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring", - "untrusted", + "ring 0.17.7", + "untrusted 0.9.0", ] [[package]] @@ -4728,9 +4536,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.18" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" dependencies = [ "serde", ] @@ -4758,29 +4566,18 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.188" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] -[[package]] -name = "serde-hex" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca37e3e4d1b39afd7ff11ee4e947efae85adfddf4841787bfa47c470e96dc26d" -dependencies = [ - "array-init", - "serde", - "smallvec 0.6.14", -] - [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", @@ -4789,9 +4586,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.106" +version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cc66a619ed80bf7a0f6b17dd063a84b88f6dea1813737cf469aef1d081142c2" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ "itoa", "ryu", @@ -4821,9 +4618,9 @@ dependencies = [ [[package]] name = "sha1" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", @@ -4832,9 +4629,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -4872,9 +4669,9 @@ dependencies = [ [[package]] name = "shlex" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook" @@ -4908,9 +4705,9 @@ dependencies = [ [[package]] name = "signature" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest 0.10.7", "rand_core", @@ -4951,31 +4748,22 @@ checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" [[package]] name = "smallvec" -version = "0.6.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" -dependencies = [ - "maybe-uninit", -] - -[[package]] -name = "smallvec" -version = "1.11.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "snow" -version = "0.9.3" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c9d1425eb528a21de2755c75af4c9b5d57f50a0d4c3b7f1828a4cd03f8ba155" +checksum = "850948bee068e713b8ab860fe1adc4d109676ab4c3b621fd8147f06b261f2f85" dependencies = [ - "aes-gcm 0.9.4", + "aes-gcm", "blake2", - "chacha20poly1305 0.9.1", + "chacha20poly1305", "curve25519-dalek", "rand_core", - "ring", + "ring 0.17.7", "rustc_version 0.4.0", "sha2", "subtle", @@ -4983,9 +4771,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" dependencies = [ "libc", "winapi", @@ -5029,9 +4817,9 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "spki" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", "der", @@ -5108,9 +4896,9 @@ dependencies = [ [[package]] name = "strum_macros" -version = "0.25.2" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad8d03b598d3d0fff69bf533ee3ef19b8eeb342729596df84bcc7e1f96ec4059" +checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" dependencies = [ "heck", "proc-macro2", @@ -5121,22 +4909,22 @@ dependencies = [ [[package]] name = "subtle" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "svm-rs" -version = "0.3.0" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597e3a746727984cb7ea2487b6a40726cad0dbe86628e7d429aa6b8c4c153db4" +checksum = "11297baafe5fa0c99d5722458eac6a5e25c01eb1b8e5cd137f54079093daa7a4" dependencies = [ "dirs 5.0.1", "fs2", "hex", "once_cell", "reqwest", - "semver 1.0.18", + "semver 1.0.21", "serde", "serde_json", "sha2", @@ -5167,6 +4955,12 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + [[package]] name = "system-configuration" version = "0.5.1" @@ -5190,17 +4984,17 @@ dependencies = [ [[package]] name = "system-interface" -version = "0.26.0" +version = "0.26.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27ce32341b2c0b70c144bbf35627fdc1ef18c76ced5e5e7b3ee8b5ba6b2ab6a0" +checksum = "0682e006dd35771e392a6623ac180999a9a854b1d4a6c12fb2e804941c2b1f58" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.2", "cap-fs-ext", "cap-std", "fd-lock", - "io-lifetimes 2.0.2", - "rustix 0.38.27", - "windows-sys 0.48.0", + "io-lifetimes", + "rustix", + "windows-sys 0.52.0", "winx", ] @@ -5212,21 +5006,21 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "target-lexicon" -version = "0.12.12" +version = "0.12.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c39fd04924ca3a864207c66fc2cd7d22d7c016007f9ce846cbb9326331930a" +checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" [[package]] name = "tempfile" -version = "3.8.0" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" dependencies = [ "cfg-if", "fastrand", - "redox_syscall 0.3.5", - "rustix 0.38.27", - "windows-sys 0.48.0", + "redox_syscall", + "rustix", + "windows-sys 0.52.0", ] [[package]] @@ -5242,18 +5036,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.48" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6d7a740b8a666a7e828dd00da9c0dc290dff53154ea77ac109281de90589b7" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.48" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49922ecae66cc8a249b77e68d1d0623c1b2c514f0060c27cdc68bd62a1219d35" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", @@ -5262,12 +5056,14 @@ dependencies = [ [[package]] name = "time" -version = "0.3.28" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48" +checksum = "fe80ced77cbfb4cb91a94bf72b378b4b6791a0d9b7f09d0be747d1bdff4e68bd" dependencies = [ "deranged", "itoa", + "num-conv", + "powerfmt", "serde", "time-core", "time-macros", @@ -5275,16 +5071,17 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.14" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" dependencies = [ + "num-conv", "time-core", ] @@ -5314,9 +5111,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.1" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", "bytes", @@ -5372,18 +5169,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-tungstenite" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54319c93411147bced34cb5609a80e0a8e44c5999c93903a81cd866630ec0bfd" -dependencies = [ - "futures-util", - "log", - "tokio", - "tungstenite 0.18.0", -] - [[package]] name = "tokio-tungstenite" version = "0.20.1" @@ -5395,15 +5180,15 @@ dependencies = [ "rustls", "tokio", "tokio-rustls", - "tungstenite 0.20.1", + "tungstenite", "webpki-roots", ] [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ "bytes", "futures-core", @@ -5424,14 +5209,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" +checksum = "c6a4b9e8023eb94392d3dca65d717c53abc5dad49c07cb65bb8fcd87115fa325" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.21.0", + "toml_edit 0.21.1", ] [[package]] @@ -5449,18 +5234,29 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.0.0", + "indexmap", "toml_datetime", "winnow", ] [[package]] name = "toml_edit" -version = "0.21.0" +version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" +checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ - "indexmap 2.0.0", + "indexmap", + "toml_datetime", + "winnow", +] + +[[package]] +name = "toml_edit" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +dependencies = [ + "indexmap", "serde", "serde_spanned", "toml_datetime", @@ -5576,7 +5372,7 @@ dependencies = [ "lazy_static", "log", "rand", - "smallvec 1.11.0", + "smallvec", "thiserror", "tinyvec", "tokio", @@ -5585,28 +5381,9 @@ dependencies = [ [[package]] name = "try-lock" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" - -[[package]] -name = "tungstenite" -version = "0.18.0" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ee6ab729cd4cf0fd55218530c4522ed30b7b6081752839b68fcec8d0960788" -dependencies = [ - "base64 0.13.1", - "byteorder", - "bytes", - "http", - "httparse", - "log", - "rand", - "sha1", - "thiserror", - "url", - "utf-8", -] +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tungstenite" @@ -5630,9 +5407,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "ucd-trie" @@ -5669,15 +5446,15 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -5690,9 +5467,9 @@ dependencies = [ [[package]] name = "unicode-width" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] name = "unicode-xid" @@ -5700,16 +5477,6 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" -[[package]] -name = "universal-hash" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" -dependencies = [ - "generic-array", - "subtle", -] - [[package]] name = "universal-hash" version = "0.5.1" @@ -5726,14 +5493,20 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", - "idna 0.4.0", + "idna 0.5.0", "percent-encoding", ] @@ -5767,9 +5540,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.4.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79daa5ed5740825c40b389c5e50312b9c86df53fccd33f281df655642b43869d" +checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a" dependencies = [ "getrandom", "serde", @@ -5823,9 +5596,9 @@ dependencies = [ [[package]] name = "warp" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba431ef570df1287f7f8b07e376491ad54f84d26ac473489427231e1718e1f69" +checksum = "c1e92e22e03ff1230c03a1a8ee37d2f89cd489e2e541b7550d6afad96faed169" dependencies = [ "bytes", "futures-channel", @@ -5846,7 +5619,7 @@ dependencies = [ "serde_urlencoded", "tokio", "tokio-stream", - "tokio-tungstenite 0.18.0", + "tokio-tungstenite", "tokio-util", "tower-service", "tracing", @@ -5872,9 +5645,9 @@ dependencies = [ "cap-time-ext", "fs-set-times", "io-extras", - "io-lifetimes 2.0.2", + "io-lifetimes", "once_cell", - "rustix 0.38.27", + "rustix", "system-interface", "tracing", "wasi-common", @@ -5888,12 +5661,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84f6774ec9e464b7373f683bc57ff87fcca5fd26a7d6bdb7438fb2f56a545aa6" dependencies = [ "anyhow", - "bitflags 2.4.0", + "bitflags 2.4.2", "cap-rand", "cap-std", "io-extras", "log", - "rustix 0.38.27", + "rustix", "thiserror", "tracing", "wasmtime", @@ -5903,9 +5676,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -5913,9 +5686,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" dependencies = [ "bumpalo", "log", @@ -5928,9 +5701,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.37" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" dependencies = [ "cfg-if", "js-sys", @@ -5940,9 +5713,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5950,9 +5723,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" dependencies = [ "proc-macro2", "quote", @@ -5963,9 +5736,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" [[package]] name = "wasm-encoder" @@ -5978,41 +5751,42 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.38.1" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad2b51884de9c7f4fe2fd1043fccb8dcad4b1e29558146ee57a144d15779f3f" +checksum = "e09bca7d6388637d27fb5edbeab11f56bfabcef8743c55ae34370e1e5030a071" dependencies = [ "leb128", ] [[package]] name = "wasmparser" -version = "0.116.0" +version = "0.116.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53290b1276c5c2d47d694fb1a920538c01f51690e7e261acbe1d10c5fc306ea1" +checksum = "a58e28b80dd8340cb07b8242ae654756161f6fc8d0038123d679b7b99964fa50" dependencies = [ - "indexmap 2.0.0", - "semver 1.0.18", + "indexmap", + "semver 1.0.21", ] [[package]] name = "wasmparser" -version = "0.118.1" +version = "0.121.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ee9723b928e735d53000dec9eae7b07a60e490c85ab54abb66659fc61bfcd9" +checksum = "953cf6a7606ab31382cb1caa5ae403e77ba70c7f8e12eeda167e7040d42bfda8" dependencies = [ - "indexmap 2.0.0", - "semver 1.0.18", + "bitflags 2.4.2", + "indexmap", + "semver 1.0.21", ] [[package]] name = "wasmprinter" -version = "0.2.75" +version = "0.2.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d027eb8294904fc715ac0870cebe6b0271e96b90605ee21511e7565c4ce568c" +checksum = "05e32c13c59fdc64d3f6998a1d52eb1d362b6904a88b754190ccb85661ad577a" dependencies = [ "anyhow", - "wasmparser 0.118.1", + "wasmparser 0.121.0", ] [[package]] @@ -6028,7 +5802,7 @@ dependencies = [ "cfg-if", "encoding_rs", "fxprof-processed-profile", - "indexmap 2.0.0", + "indexmap", "libc", "log", "object", @@ -6041,7 +5815,7 @@ dependencies = [ "serde_json", "target-lexicon", "wasm-encoder 0.36.2", - "wasmparser 0.116.0", + "wasmparser 0.116.1", "wasmtime-cache", "wasmtime-component-macro", "wasmtime-component-util", @@ -6071,11 +5845,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aba5bf44d044d25892c03fb3534373936ee204141ff92bac8297787ac7f22318" dependencies = [ "anyhow", - "base64 0.21.4", + "base64 0.21.7", "bincode", "directories-next", "log", - "rustix 0.38.27", + "rustix", "serde", "serde_derive", "sha2", @@ -6124,7 +5898,7 @@ dependencies = [ "object", "target-lexicon", "thiserror", - "wasmparser 0.116.0", + "wasmparser 0.116.1", "wasmtime-cranelift-shared", "wasmtime-environ", "wasmtime-versioned-export-macros", @@ -6155,7 +5929,7 @@ dependencies = [ "anyhow", "cranelift-entity", "gimli", - "indexmap 2.0.0", + "indexmap", "log", "object", "serde", @@ -6163,7 +5937,7 @@ dependencies = [ "target-lexicon", "thiserror", "wasm-encoder 0.36.2", - "wasmparser 0.116.0", + "wasmparser 0.116.1", "wasmprinter", "wasmtime-component-util", "wasmtime-types", @@ -6178,7 +5952,7 @@ dependencies = [ "anyhow", "cc", "cfg-if", - "rustix 0.38.27", + "rustix", "wasmtime-asm-macros", "wasmtime-versioned-export-macros", "windows-sys 0.48.0", @@ -6200,7 +5974,7 @@ dependencies = [ "log", "object", "rustc-demangle", - "rustix 0.38.27", + "rustix", "serde", "serde_derive", "target-lexicon", @@ -6219,7 +5993,7 @@ checksum = "4e0c4b74e606d1462d648631d5bc328e3d5b14e7f9d3ff93bc6db062fb8c5cd8" dependencies = [ "object", "once_cell", - "rustix 0.38.27", + "rustix", "wasmtime-versioned-export-macros", ] @@ -6244,7 +6018,7 @@ dependencies = [ "cc", "cfg-if", "encoding_rs", - "indexmap 2.0.0", + "indexmap", "libc", "log", "mach", @@ -6252,7 +6026,7 @@ dependencies = [ "memoffset", "paste", "rand", - "rustix 0.38.27", + "rustix", "sptr", "wasm-encoder 0.36.2", "wasmtime-asm-macros", @@ -6274,7 +6048,7 @@ dependencies = [ "serde", "serde_derive", "thiserror", - "wasmparser 0.116.0", + "wasmparser 0.116.1", ] [[package]] @@ -6296,7 +6070,7 @@ checksum = "eff3f4ad191a5e6d002bb5bffa3e2931a58984da9b30e57b48f353848748cf80" dependencies = [ "anyhow", "async-trait", - "bitflags 2.4.0", + "bitflags 2.4.2", "bytes", "cap-fs-ext", "cap-net-ext", @@ -6306,11 +6080,11 @@ dependencies = [ "fs-set-times", "futures", "io-extras", - "io-lifetimes 2.0.2", + "io-lifetimes", "libc", "log", "once_cell", - "rustix 0.38.27", + "rustix", "system-interface", "thiserror", "tokio", @@ -6334,7 +6108,7 @@ dependencies = [ "gimli", "object", "target-lexicon", - "wasmparser 0.116.0", + "wasmparser 0.116.1", "wasmtime-cranelift-shared", "wasmtime-environ", "winch-codegen", @@ -6348,7 +6122,7 @@ checksum = "4b804dfd3d0c0d6d37aa21026fe7772ba1a769c89ee4f5c4f13b82d91d75216f" dependencies = [ "anyhow", "heck", - "indexmap 2.0.0", + "indexmap", "wit-parser", ] @@ -6369,30 +6143,31 @@ dependencies = [ [[package]] name = "wast" -version = "69.0.1" +version = "70.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ee37317321afde358e4d7593745942c48d6d17e0e6e943704de9bbee121e7a" +checksum = "a3d5061300042ff5065123dae1e27d00c03f567d34a2937c8472255148a216dc" dependencies = [ + "bumpalo", "leb128", "memchr", "unicode-width", - "wasm-encoder 0.38.1", + "wasm-encoder 0.41.0", ] [[package]] name = "wat" -version = "1.0.82" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeb338ee8dee4d4cd05e6426683f21c5087dc7cfc8903e839ccf48d43332da3c" +checksum = "afd7357b6cc46d46a2509c43dcb1dd4131dafbf4e75562d87017b5a05ffad2d6" dependencies = [ - "wast 69.0.1", + "wast 70.0.2", ] [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" dependencies = [ "js-sys", "wasm-bindgen", @@ -6400,9 +6175,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.25.2" +version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "wiggle" @@ -6412,7 +6187,7 @@ checksum = "f91028b241e692fdf30627ac10ba9d5ac378353ea4119b4f904ac95177057a44" dependencies = [ "anyhow", "async-trait", - "bitflags 2.4.0", + "bitflags 2.4.2", "thiserror", "tracing", "wasmtime", @@ -6464,9 +6239,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -6487,19 +6262,19 @@ dependencies = [ "cranelift-codegen", "gimli", "regalloc2", - "smallvec 1.11.0", + "smallvec", "target-lexicon", - "wasmparser 0.116.0", + "wasmparser 0.116.1", "wasmtime-environ", ] [[package]] -name = "windows" -version = "0.48.0" +name = "windows-core" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] @@ -6636,9 +6411,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.15" +version = "0.5.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" +checksum = "818ce546a11a9986bc24f93d0cdf38a8a1a400f1473ea8c82e59f6e0ffab9249" dependencies = [ "memchr", ] @@ -6655,25 +6430,25 @@ dependencies = [ [[package]] name = "winx" -version = "0.36.2" +version = "0.36.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "357bb8e2932df531f83b052264b050b81ba0df90ee5a59b2d1d3949f344f81e5" +checksum = "f9643b83820c0cd246ecabe5fa454dd04ba4fa67996369466d0747472d337346" dependencies = [ - "bitflags 2.4.0", - "windows-sys 0.48.0", + "bitflags 2.4.2", + "windows-sys 0.52.0", ] [[package]] name = "wit-parser" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15df6b7b28ce94b8be39d8df5cb21a08a4f3b9f33b631aedb4aa5776f785ead3" +checksum = "df4913a2219096373fd6512adead1fb77ecdaa59d7fc517972a7d30b12f625be" dependencies = [ "anyhow", "id-arena", - "indexmap 2.0.0", + "indexmap", "log", - "semver 1.0.18", + "semver 1.0.21", "serde", "serde_derive", "serde_json", @@ -6726,6 +6501,26 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "zeroize" version = "1.7.0" @@ -6752,7 +6547,7 @@ version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "760394e246e4c28189f19d488c058bf16f564016aefac5d32bb1f3b51d5e9261" dependencies = [ - "aes 0.8.3", + "aes", "byteorder", "bzip2", "constant_time_eq 0.1.5", @@ -6787,11 +6582,10 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.8+zstd.1.5.5" +version = "2.0.9+zstd.1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5556e6ee25d32df2586c098bbfa278803692a20d0ab9565e049480d52707ec8c" +checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" dependencies = [ "cc", - "libc", "pkg-config", ] diff --git a/Cargo.toml b/Cargo.toml index 9df282dd0..d83cbbeae 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ simulation-mode = [] [dependencies] aes-gcm = "0.10.2" alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy" } -alloy-primitives = { git = "https://github.com/alloy-rs/core.git" } +alloy-primitives = "0.6.2" alloy-providers = { git = "https://github.com/alloy-rs/alloy.git" } alloy-network = { git = "https://github.com/alloy-rs/alloy.git" } alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy.git", features = [ diff --git a/modules/kns_indexer/kns_indexer/src/lib.rs b/modules/kns_indexer/kns_indexer/src/lib.rs index 14a52b346..6e9f48fde 100644 --- a/modules/kns_indexer/kns_indexer/src/lib.rs +++ b/modules/kns_indexer/kns_indexer/src/lib.rs @@ -44,6 +44,30 @@ pub enum EthAction { GetBlockNumber, } +//TEMP +/// Potential EthResponse type. +/// Can encapsulate all methods in their own response type, +/// or return generic result which can be parsed later.. +#[derive(Debug, Serialize, Deserialize)] +pub enum EthResponse { + // another possible strat, just return RpcResult, + // then try deserializing on the process_lib side. + Ok, + //Err(EthError), + Sub(SubscriptionResult), + GetLogs(Vec), + // GetBlockNumber(u64), + // GetBalance(U256), + // GetGasPrice(U256), + // Call(Vec), // alloy_primimtives::Bytes deserialization.. + // GetTransactionCount(U256), + // GetBlockByNumber(Option), + // GetBlockByHash(Option), + // // raw json vs enum type vs into T? + // RawRequest(serde_json::Value), + // SendRawTransaction(Vec), // alloy_primitives::TxHash deserialization.. +} + #[derive(Clone, Debug, Serialize, Deserialize)] struct State { // what contract this state pertains to @@ -270,10 +294,60 @@ fn handle_eth_message( pending_requests: &mut BTreeMap>, body: &[u8], ) -> anyhow::Result<()> { - let Ok(log) = serde_json::from_slice::(body) else { + let Ok(res) = serde_json::from_slice::(body) else { return Err(anyhow::anyhow!("kns_indexer: got invalid message")); }; + match res { + EthResponse::GetLogs(logs) => { + for log in logs { + handle_log(our, state, &log)?; + } + } + EthResponse::Sub(result) => match result { + SubscriptionResult::Log(log) => { + handle_log(our, state, &log)?; + } + _ => {} + }, + _ => {} + } + + // check the pending_requests btreemap to see if there are any requests that + // can be handled now that the state block has been updated + let mut blocks_to_remove = vec![]; + for (block, requests) in pending_requests.iter() { + if *block <= state.block { + for request in requests.iter() { + match request { + IndexerRequests::NamehashToName { hash, .. } => { + Response::new() + .body(serde_json::to_vec(&state.names.get(hash))?) + .send() + .unwrap(); + } + IndexerRequests::NodeInfo { name, .. } => { + Response::new() + .body(serde_json::to_vec(&state.nodes.get(name))?) + .send() + .unwrap(); + } + } + } + blocks_to_remove.push(*block); + } else { + break; + } + } + for block in blocks_to_remove.iter() { + pending_requests.remove(block); + } + + set_state(&bincode::serialize(state)?); + Ok(()) +} + +fn handle_log(our: &Address, state: &mut State, log: &Log) -> anyhow::Result<()> { state.block = log.block_number.expect("expect").to::(); let node_id: alloy_primitives::FixedBytes<32> = log.topics[1]; @@ -349,37 +423,6 @@ fn handle_eth_message( .try_body(NetActions::KnsUpdate(node.clone()))? .send()?; } - // check the pending_requests btreemap to see if there are any requests that - // can be handled now that the state block has been updated - let mut blocks_to_remove = vec![]; - for (block, requests) in pending_requests.iter() { - if *block <= state.block { - for request in requests.iter() { - match request { - IndexerRequests::NamehashToName { hash, .. } => { - Response::new() - .body(serde_json::to_vec(&state.names.get(hash))?) - .send() - .unwrap(); - } - IndexerRequests::NodeInfo { name, .. } => { - Response::new() - .body(serde_json::to_vec(&state.nodes.get(name))?) - .send() - .unwrap(); - } - } - } - blocks_to_remove.push(*block); - } else { - break; - } - } - for block in blocks_to_remove.iter() { - pending_requests.remove(block); - } - - set_state(&bincode::serialize(state)?); Ok(()) } diff --git a/src/eth/provider.rs b/src/eth/provider.rs index 372f5635e..2f3d25b62 100644 --- a/src/eth/provider.rs +++ b/src/eth/provider.rs @@ -1,13 +1,15 @@ use crate::eth::types::*; use crate::types::*; -use alloy_primitives::{Bytes, U256}; +use alloy_primitives::{Address as EthAddress, Bytes, U256}; use alloy_providers::provider::TempProvider; +use alloy_pubsub::RawSubscription; use alloy_rpc_client::ClientBuilder; use alloy_rpc_types::pubsub::{Params, SubscriptionKind, SubscriptionResult}; use alloy_rpc_types::{BlockNumberOrTag, Filter}; use alloy_transport_ws::WsConnect; use anyhow::Result; use std::collections::HashMap; +use std::str::FromStr; use std::sync::Arc; use url::Url; @@ -58,6 +60,8 @@ pub async fn provider( ws_provider_subscriptions: HashMap::new(), }; + // turn into dashmap so we can share across threads + while let Some(km) = recv_in_client.recv().await { // this module only handles requests, ignores all responses let Message::Request(req) = &km.message else { @@ -140,7 +144,7 @@ async fn handle_request( .await .unwrap(); - let rx = connections.provider.inner().get_watcher(id).await; + let rx = connections.provider.inner().get_raw_subscription(id).await; let handle = tokio::spawn(handle_subscription_stream( our.clone(), rx, @@ -162,7 +166,7 @@ async fn handle_request( Ok(()) } EthAction::GetBlockNumber => { - let block_number = connections.provider.get_block_number().await.unwrap(); + let vc: Vec = Vec::new(); Ok(()) } @@ -174,28 +178,95 @@ async fn handle_request( .map_err(|e| EthError::ProviderError(format!("{:?}", e)))?; // TEMP, will change. - for log in logs { - send_to_loop - .send(KernelMessage { - id: rand::random(), - source: Address { - node: our.to_string(), - process: ETH_PROCESS_ID.clone(), - }, - target: target.clone(), - rsvp: None, - message: Message::Request(Request { + send_to_loop + .send(KernelMessage { + id: rand::random(), + source: Address { + node: our.to_string(), + process: ETH_PROCESS_ID.clone(), + }, + target: target.clone(), + rsvp: None, + message: Message::Response(( + Response { inherit: false, - expects_response: None, - body: serde_json::to_vec(&log).unwrap(), + body: serde_json::to_vec(&EthResponse::GetLogs(logs)).unwrap(), metadata: None, capabilities: vec![], - }), - lazy_load_blob: None, - }) - .await - .unwrap(); - } + }, + None, + )), + lazy_load_blob: None, + }) + .await + .unwrap(); + Ok(()) + } + EthAction::GetGasPrice => { + let gas_price = connections + .provider + .get_gas_price() + .await + .map_err(|e| EthError::ProviderError(format!("{:?}", e)))?; + + send_to_loop + .send(KernelMessage { + id: rand::random(), + source: Address { + node: our.to_string(), + process: ETH_PROCESS_ID.clone(), + }, + target: target.clone(), + rsvp: None, + message: Message::Request(Request { + inherit: false, + expects_response: None, + body: serde_json::to_vec(&gas_price).unwrap(), + metadata: None, + capabilities: vec![], + }), + lazy_load_blob: None, + }) + .await + .unwrap(); + + Ok(()) + } + EthAction::GetBalance { address, tag } => { + let address = EthAddress::from_str(&address) + .map_err(|e| EthError::ProviderError(format!("{:?}", e)))?; + let balance = connections + .provider + .get_balance(address, tag) + .await + .map_err(|e| EthError::ProviderError(format!("{:?}", e)))?; + + send_to_loop + .send(KernelMessage { + id: rand::random(), + source: Address { + node: our.to_string(), + process: ETH_PROCESS_ID.clone(), + }, + target: target.clone(), + rsvp: None, + message: Message::Request(Request { + inherit: false, + expects_response: None, + body: serde_json::to_vec(&balance).unwrap(), + metadata: None, + capabilities: vec![], + }), + lazy_load_blob: None, + }) + .await + .unwrap(); + + Ok(()) + } + _ => { + println!("eth: unhandled action: {:?}", action); + // will be handled soon. Ok(()) } @@ -207,7 +278,7 @@ async fn handle_request( /// for a specific subscription made by a process. async fn handle_subscription_stream( our: Arc, - mut rx: tokio::sync::broadcast::Receiver>, + mut rx: RawSubscription, target: Address, send_to_loop: MessageSender, ) -> Result<(), EthError> { @@ -231,7 +302,7 @@ async fn handle_subscription_stream( message: Message::Request(Request { inherit: false, expects_response: None, - body: serde_json::to_vec(&event).unwrap(), + body: serde_json::to_vec(&EthResponse::Sub(event)).unwrap(), metadata: None, capabilities: vec![], }), diff --git a/src/eth/types.rs b/src/eth/types.rs index d9e36b867..6bf13c2c7 100644 --- a/src/eth/types.rs +++ b/src/eth/types.rs @@ -1,10 +1,10 @@ use crate::types::ProcessId; -use alloy_primitives::{Address, ChainId, U256}; +use alloy_primitives::{Address, BlockHash, Bytes, ChainId, TxHash, B256, U256}; use alloy_providers::provider::Provider; -use alloy_pubsub::{PubSubConnect, PubSubFrontend}; -use alloy_rpc_client::ClientBuilder; +use alloy_pubsub::PubSubFrontend; use alloy_rpc_types::pubsub::{Params, SubscriptionKind, SubscriptionResult}; -use alloy_rpc_types::{Filter, Log}; +use alloy_rpc_types::{Block, BlockId, BlockNumberOrTag, CallRequest, Filter, Log}; +use alloy_transport::RpcResult; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use tokio::task::JoinHandle; @@ -16,6 +16,7 @@ use tokio::task::JoinHandle; #[derive(Debug, Serialize, Deserialize)] pub enum EthAction { /// Subscribe to logs with a custom filter. ID is to be used to unsubscribe. + /// Logs come in as alloy_rpc_types::pubsub::SubscriptionResults SubscribeLogs { sub_id: u64, kind: SubscriptionKind, @@ -24,9 +25,64 @@ pub enum EthAction { /// Kill a SubscribeLogs subscription of a given ID, to stop getting updates. UnsubscribeLogs(u64), /// get_logs - GetLogs { filter: Filter }, + /// Vec or loop through? + GetLogs { + filter: Filter, + }, /// get_block_number GetBlockNumber, + /// eth_getBalance + GetBalance { + address: String, // alloy_primitives::Address deserialization.. + tag: Option, + }, + GetGasPrice, + Call { + tx: CallRequest, + tag: BlockNumberOrTag, + }, + GetTransactionCount { + address: String, // alloy_primitives::Address deserialization.. + tag: Option, + }, + GetBlockByNumber { + block: BlockId, + full_tx: bool, + }, + GetBlockByHash { + hash: Vec, // alloy_primitives::BlockHash deserialization.. + full_tx: bool, + }, + RawRequest { + method: String, + params: Params, + }, + SendRawTransaction { + tx: Vec, // alloy_primitives::Bytes deserialization.. + }, +} + +/// Potential EthResponse type. +/// Can encapsulate all methods in their own response type, +/// or return generic result which can be parsed later.. +#[derive(Debug, Serialize, Deserialize)] +pub enum EthResponse { + // another possible strat, just return RpcResult, + // then try deserializing on the process_lib side. + Ok, + Err(EthError), + Sub(SubscriptionResult), + GetLogs(Vec), + GetBlockNumber(u64), + GetBalance(U256), + GetGasPrice(U256), + Call(Vec), // alloy_primimtives::Bytes deserialization.. + GetTransactionCount(U256), + GetBlockByNumber(Option), + GetBlockByHash(Option), + // raw json vs enum type vs into T? + RawRequest(serde_json::Value), + SendRawTransaction(Vec), // alloy_primitives::TxHash deserialization.. } /// The Response type which a process will get from requesting with an [`EthAction`] will be @@ -57,7 +113,7 @@ pub enum EthSubEvent { /// Primary state object of the `eth` module pub struct RpcConnections { - // todo generics when they work properly: pub struct RpcConnections + // todo generics when they work properly: pub struct RpcConnections, where T: Transport pub provider: Provider, pub ws_provider_subscriptions: HashMap<(ProcessId, u64), JoinHandle>>, } diff --git a/src/register.rs b/src/register.rs index ed31a5fe6..532bd45e5 100644 --- a/src/register.rs +++ b/src/register.rs @@ -267,10 +267,10 @@ async fn get_unencrypted_info(keyfile: Option>) -> Result Date: Mon, 5 Feb 2024 15:03:53 -0300 Subject: [PATCH 006/171] eth: clean and use reqeust --- src/eth/provider.rs | 103 ++++++++++---------------------------------- src/eth/types.rs | 97 ++++++++++++++++------------------------- 2 files changed, 59 insertions(+), 141 deletions(-) diff --git a/src/eth/provider.rs b/src/eth/provider.rs index 2f3d25b62..017d8b496 100644 --- a/src/eth/provider.rs +++ b/src/eth/provider.rs @@ -1,15 +1,11 @@ use crate::eth::types::*; use crate::types::*; -use alloy_primitives::{Address as EthAddress, Bytes, U256}; -use alloy_providers::provider::TempProvider; use alloy_pubsub::RawSubscription; use alloy_rpc_client::ClientBuilder; -use alloy_rpc_types::pubsub::{Params, SubscriptionKind, SubscriptionResult}; -use alloy_rpc_types::{BlockNumberOrTag, Filter}; +use alloy_rpc_types::pubsub::SubscriptionResult; use alloy_transport_ws::WsConnect; use anyhow::Result; use std::collections::HashMap; -use std::str::FromStr; use std::sync::Arc; use url::Url; @@ -73,6 +69,7 @@ pub async fn provider( match handle_request( our.clone(), &km.rsvp.unwrap_or(km.source.clone()), + km.id, action, &mut connections, &send_to_loop, @@ -122,6 +119,7 @@ pub async fn provider( async fn handle_request( our: Arc, target: &Address, + id: u64, action: EthAction, connections: &mut RpcConnections, send_to_loop: &MessageSender, @@ -147,6 +145,7 @@ async fn handle_request( let rx = connections.provider.inner().get_raw_subscription(id).await; let handle = tokio::spawn(handle_subscription_stream( our.clone(), + sub_id.1.clone(), rx, target.clone(), send_to_loop.clone(), @@ -165,22 +164,23 @@ async fn handle_request( handle.abort(); Ok(()) } - EthAction::GetBlockNumber => { - let vc: Vec = Vec::new(); + EthAction::Request { method, params } => { + let method = to_static_str(&method).ok_or(EthError::ProviderError(format!( + "eth: method not found: {}", + method + )))?; - Ok(()) - } - EthAction::GetLogs { filter } => { - let logs = connections + // throw transportErrorKinds straight back to process + let ass: serde_json::Value = connections .provider - .get_logs(filter) + .inner() + .prepare(method, params) .await - .map_err(|e| EthError::ProviderError(format!("{:?}", e)))?; - - // TEMP, will change. + .unwrap(); + // send response back to loop: send_to_loop .send(KernelMessage { - id: rand::random(), + id, source: Address { node: our.to_string(), process: ETH_PROCESS_ID.clone(), @@ -190,7 +190,7 @@ async fn handle_request( message: Message::Response(( Response { inherit: false, - body: serde_json::to_vec(&EthResponse::GetLogs(logs)).unwrap(), + body: serde_json::to_vec(&EthResponse::Request(ass)).unwrap(), metadata: None, capabilities: vec![], }, @@ -202,68 +202,6 @@ async fn handle_request( .unwrap(); Ok(()) } - EthAction::GetGasPrice => { - let gas_price = connections - .provider - .get_gas_price() - .await - .map_err(|e| EthError::ProviderError(format!("{:?}", e)))?; - - send_to_loop - .send(KernelMessage { - id: rand::random(), - source: Address { - node: our.to_string(), - process: ETH_PROCESS_ID.clone(), - }, - target: target.clone(), - rsvp: None, - message: Message::Request(Request { - inherit: false, - expects_response: None, - body: serde_json::to_vec(&gas_price).unwrap(), - metadata: None, - capabilities: vec![], - }), - lazy_load_blob: None, - }) - .await - .unwrap(); - - Ok(()) - } - EthAction::GetBalance { address, tag } => { - let address = EthAddress::from_str(&address) - .map_err(|e| EthError::ProviderError(format!("{:?}", e)))?; - let balance = connections - .provider - .get_balance(address, tag) - .await - .map_err(|e| EthError::ProviderError(format!("{:?}", e)))?; - - send_to_loop - .send(KernelMessage { - id: rand::random(), - source: Address { - node: our.to_string(), - process: ETH_PROCESS_ID.clone(), - }, - target: target.clone(), - rsvp: None, - message: Message::Request(Request { - inherit: false, - expects_response: None, - body: serde_json::to_vec(&balance).unwrap(), - metadata: None, - capabilities: vec![], - }), - lazy_load_blob: None, - }) - .await - .unwrap(); - - Ok(()) - } _ => { println!("eth: unhandled action: {:?}", action); // will be handled soon. @@ -278,6 +216,7 @@ async fn handle_request( /// for a specific subscription made by a process. async fn handle_subscription_stream( our: Arc, + sub_id: u64, mut rx: RawSubscription, target: Address, send_to_loop: MessageSender, @@ -302,7 +241,11 @@ async fn handle_subscription_stream( message: Message::Request(Request { inherit: false, expects_response: None, - body: serde_json::to_vec(&EthResponse::Sub(event)).unwrap(), + body: serde_json::to_vec(&EthResponse::Sub { + id: sub_id, + result: event, + }) + .unwrap(), metadata: None, capabilities: vec![], }), diff --git a/src/eth/types.rs b/src/eth/types.rs index 6bf13c2c7..e1f740606 100644 --- a/src/eth/types.rs +++ b/src/eth/types.rs @@ -4,7 +4,6 @@ use alloy_providers::provider::Provider; use alloy_pubsub::PubSubFrontend; use alloy_rpc_types::pubsub::{Params, SubscriptionKind, SubscriptionResult}; use alloy_rpc_types::{Block, BlockId, BlockNumberOrTag, CallRequest, Filter, Log}; -use alloy_transport::RpcResult; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use tokio::task::JoinHandle; @@ -24,65 +23,19 @@ pub enum EthAction { }, /// Kill a SubscribeLogs subscription of a given ID, to stop getting updates. UnsubscribeLogs(u64), - /// get_logs - /// Vec or loop through? - GetLogs { - filter: Filter, - }, - /// get_block_number - GetBlockNumber, - /// eth_getBalance - GetBalance { - address: String, // alloy_primitives::Address deserialization.. - tag: Option, - }, - GetGasPrice, - Call { - tx: CallRequest, - tag: BlockNumberOrTag, - }, - GetTransactionCount { - address: String, // alloy_primitives::Address deserialization.. - tag: Option, - }, - GetBlockByNumber { - block: BlockId, - full_tx: bool, - }, - GetBlockByHash { - hash: Vec, // alloy_primitives::BlockHash deserialization.. - full_tx: bool, - }, - RawRequest { + /// Raw request. Used by kinode_process_lib. + Request { method: String, - params: Params, - }, - SendRawTransaction { - tx: Vec, // alloy_primitives::Bytes deserialization.. + params: serde_json::Value, }, } -/// Potential EthResponse type. -/// Can encapsulate all methods in their own response type, -/// or return generic result which can be parsed later.. #[derive(Debug, Serialize, Deserialize)] pub enum EthResponse { - // another possible strat, just return RpcResult, - // then try deserializing on the process_lib side. Ok, + Request(serde_json::Value), Err(EthError), - Sub(SubscriptionResult), - GetLogs(Vec), - GetBlockNumber(u64), - GetBalance(U256), - GetGasPrice(U256), - Call(Vec), // alloy_primimtives::Bytes deserialization.. - GetTransactionCount(U256), - GetBlockByNumber(Option), - GetBlockByHash(Option), - // raw json vs enum type vs into T? - RawRequest(serde_json::Value), - SendRawTransaction(Vec), // alloy_primitives::TxHash deserialization.. + Sub { id: u64, result: SubscriptionResult }, } /// The Response type which a process will get from requesting with an [`EthAction`] will be @@ -98,19 +51,41 @@ pub enum EthError { SubscriptionNotFound, } -/// The Request type which a process will get from using SubscribeLogs to subscribe -/// to a log. -/// -/// Will be serialized and deserialized using `serde_json::to_vec` and `serde_json::from_slice`. -#[derive(Debug, Serialize, Deserialize)] -pub enum EthSubEvent { - Log(Log), -} - // // Internal types // +/// For static lifetimes of method strings. +/// Hopefully replaced asap by alloy-rs network abstraction. +pub fn to_static_str(method: &str) -> Option<&'static str> { + match method { + "eth_getBalance" => Some("eth_getBalance"), + "eth_sendRawTransaction" => Some("eth_sendRawTransaction"), + "eth_call" => Some("eth_call"), + "eth_getTransactionReceipt" => Some("eth_getTransactionReceipt"), + "eth_estimateGas" => Some("eth_estimateGas"), + "eth_blockNumber" => Some("eth_blockNumber"), + "eth_getBlockByHash" => Some("eth_getBlockByHash"), + "eth_getBlockByNumber" => Some("eth_getBlockByNumber"), + "eth_getTransactionByHash" => Some("eth_getTransactionByHash"), + "eth_getCode" => Some("eth_getCode"), + "eth_getStorageAt" => Some("eth_getStorageAt"), + "eth_gasPrice" => Some("eth_gasPrice"), + "eth_accounts" => Some("eth_accounts"), + "eth_hashrate" => Some("eth_hashrate"), + "eth_getLogs" => Some("eth_getLogs"), + "eth_subscribe" => Some("eth_subscribe"), + "eth_unsubscribe" => Some("eth_unsubscribe"), + // "eth_mining" => Some("eth_mining"), + // "net_version" => Some("net_version"), + // "net_peerCount" => Some("net_peerCount"), + // "net_listening" => Some("net_listening"), + // "web3_clientVersion" => Some("web3_clientVersion"), + // "web3_sha3" => Some("web3_sha3"), + _ => None, + } +} + /// Primary state object of the `eth` module pub struct RpcConnections { // todo generics when they work properly: pub struct RpcConnections, where T: Transport From 49ec4509b5575727299e9800e60b15f4041e4c7a Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Mon, 5 Feb 2024 15:39:14 -0300 Subject: [PATCH 007/171] eth: spawn threads for requests, send provider --- src/eth/provider.rs | 211 ++++++++++++++++++++------------------------ src/eth/types.rs | 7 -- 2 files changed, 94 insertions(+), 124 deletions(-) diff --git a/src/eth/provider.rs b/src/eth/provider.rs index 017d8b496..a9287b437 100644 --- a/src/eth/provider.rs +++ b/src/eth/provider.rs @@ -1,12 +1,13 @@ use crate::eth::types::*; use crate::types::*; -use alloy_pubsub::RawSubscription; +use alloy_pubsub::{PubSubFrontend, RawSubscription}; use alloy_rpc_client::ClientBuilder; use alloy_rpc_types::pubsub::SubscriptionResult; use alloy_transport_ws::WsConnect; use anyhow::Result; -use std::collections::HashMap; +use dashmap::DashMap; use std::sync::Arc; +use tokio::task::JoinHandle; use url::Url; /// The ETH provider runtime process is responsible for connecting to one or more ETH RPC providers @@ -18,7 +19,7 @@ pub async fn provider( rpc_url: String, send_to_loop: MessageSender, mut recv_in_client: MessageReceiver, - print_tx: PrintSender, + _print_tx: PrintSender, ) -> Result<()> { let our = Arc::new(our); // for now, we can only handle WebSocket RPC URLs. In the future, we should @@ -51,118 +52,93 @@ pub async fn provider( let provider = alloy_providers::provider::Provider::new_with_client(client); - let mut connections = RpcConnections { - provider, - ws_provider_subscriptions: HashMap::new(), - }; + // handles of longrunning subscriptions. + let connections: DashMap<(ProcessId, u64), JoinHandle>> = DashMap::new(); - // turn into dashmap so we can share across threads + let connections = Arc::new(connections); + let provider = Arc::new(provider); while let Some(km) = recv_in_client.recv().await { - // this module only handles requests, ignores all responses - let Message::Request(req) = &km.message else { - continue; - }; - let Ok(action) = serde_json::from_slice::(&req.body) else { - continue; - }; - match handle_request( - our.clone(), - &km.rsvp.unwrap_or(km.source.clone()), - km.id, - action, - &mut connections, - &send_to_loop, - ) - .await - { - Ok(()) => {} - Err(e) => { - let _ = print_tx - .send(Printout { - verbosity: 0, - content: format!("eth: error handling request: {:?}", e), - }) - .await; - if req.expects_response.is_some() { - send_to_loop - .send(KernelMessage { - id: km.id, - source: Address { - node: our.to_string(), - process: ETH_PROCESS_ID.clone(), - }, - target: Address { - node: our.to_string(), - process: km.source.process.clone(), - }, - rsvp: None, - message: Message::Response(( - Response { - inherit: false, - body: serde_json::to_vec::>(&Err(e))?, - metadata: None, - capabilities: vec![], - }, - None, - )), - lazy_load_blob: None, - }) - .await?; - } + // clone Arcs + let our = our.clone(); + let send_to_loop = send_to_loop.clone(); + let provider = provider.clone(); + let connections = connections.clone(); + + tokio::spawn(async move { + if let Err(e) = handle_request( + &our, + &km, + &send_to_loop, + provider.clone(), + connections.clone(), + ) + .await + { + println!("got error: {:?}", e); } - } + }); } Err(anyhow::anyhow!("eth: fatal: message receiver closed!")) } async fn handle_request( - our: Arc, - target: &Address, - id: u64, - action: EthAction, - connections: &mut RpcConnections, + our: &str, + km: &KernelMessage, send_to_loop: &MessageSender, + provider: Arc>, + connections: Arc>>>, ) -> Result<(), EthError> { - match action { + let Message::Request(req) = &km.message else { + return Err(EthError::ProviderError( + "eth: only accepts requests".to_string(), + )); + }; + + let action = serde_json::from_slice::(&req.body).map_err(|e| { + EthError::ProviderError(format!("eth: failed to deserialize request: {:?}", e)) + })?; + + // we might want some of these in payloads.. sub items? + let return_body: EthResponse = match action { EthAction::SubscribeLogs { sub_id, kind, params, } => { - let sub_id = (target.process.clone(), sub_id); + let sub_id = (km.target.process.clone(), sub_id); let kind = serde_json::to_value(&kind).unwrap(); let params = serde_json::to_value(¶ms).unwrap(); - let id = connections - .provider + let id = provider .inner() .prepare("eth_subscribe", [kind, params]) .await .unwrap(); - let rx = connections.provider.inner().get_raw_subscription(id).await; + let target = km.source.clone(); // rsvp? + + let rx = provider.inner().get_raw_subscription(id).await; let handle = tokio::spawn(handle_subscription_stream( - our.clone(), + our.to_string(), sub_id.1.clone(), rx, - target.clone(), + target, send_to_loop.clone(), )); - connections.ws_provider_subscriptions.insert(sub_id, handle); - Ok(()) + connections.insert(sub_id, handle); + EthResponse::Ok } EthAction::UnsubscribeLogs(sub_id) => { - let sub_id = (target.process.clone(), sub_id); + let sub_id = (km.target.process.clone(), sub_id); let handle = connections - .ws_provider_subscriptions .remove(&sub_id) .ok_or(EthError::SubscriptionNotFound)?; - handle.abort(); - Ok(()) + handle.1.abort(); + EthResponse::Ok } EthAction::Request { method, params } => { let method = to_static_str(&method).ok_or(EthError::ProviderError(format!( @@ -171,51 +147,51 @@ async fn handle_request( )))?; // throw transportErrorKinds straight back to process - let ass: serde_json::Value = connections - .provider - .inner() - .prepare(method, params) - .await - .unwrap(); - // send response back to loop: - send_to_loop - .send(KernelMessage { - id, - source: Address { - node: our.to_string(), - process: ETH_PROCESS_ID.clone(), - }, - target: target.clone(), - rsvp: None, - message: Message::Response(( - Response { - inherit: false, - body: serde_json::to_vec(&EthResponse::Request(ass)).unwrap(), - metadata: None, - capabilities: vec![], - }, - None, - )), - lazy_load_blob: None, - }) - .await - .unwrap(); - Ok(()) - } - _ => { - println!("eth: unhandled action: {:?}", action); - // will be handled soon. + let response: serde_json::Value = + provider.inner().prepare(method, params).await.unwrap(); - Ok(()) + EthResponse::Request(response) } - } + }; + + // todo: fix km.clone() and metadata.clone() + if let Some(target) = km.clone().rsvp.or_else(|| { + req.expects_response.map(|_| Address { + node: our.to_string(), + process: km.source.process.clone(), + }) + }) { + let response = KernelMessage { + id: km.id, + source: Address { + node: our.to_string(), + process: VFS_PROCESS_ID.clone(), + }, + target: target.clone(), + rsvp: None, + message: Message::Response(( + Response { + inherit: false, + body: serde_json::to_vec(&return_body).unwrap(), + metadata: req.metadata.clone(), + capabilities: vec![], + }, + None, + )), + lazy_load_blob: None, + }; + + // Send the response, handling potential errors appropriately + let _ = send_to_loop.send(response).await; + }; + Ok(()) } /// Executed as a long-lived task. The JoinHandle is stored in the `connections` map. /// This task is responsible for connecting to the ETH RPC provider and streaming logs /// for a specific subscription made by a process. async fn handle_subscription_stream( - our: Arc, + our: String, sub_id: u64, mut rx: RawSubscription, target: Address, @@ -228,12 +204,13 @@ async fn handle_subscription_stream( // return Err(EthError::ProviderError(format!("{:?}", e))); } Ok(value) => { - let event: SubscriptionResult = serde_json::from_str(value.get()).unwrap(); + let event: SubscriptionResult = serde_json::from_str(value.get()) + .map_err(|e| EthError::ProviderError(format!("{:?}", e)))?; send_to_loop .send(KernelMessage { id: rand::random(), source: Address { - node: our.to_string(), + node: our, process: ETH_PROCESS_ID.clone(), }, target: target.clone(), diff --git a/src/eth/types.rs b/src/eth/types.rs index e1f740606..76b4adcbd 100644 --- a/src/eth/types.rs +++ b/src/eth/types.rs @@ -85,10 +85,3 @@ pub fn to_static_str(method: &str) -> Option<&'static str> { _ => None, } } - -/// Primary state object of the `eth` module -pub struct RpcConnections { - // todo generics when they work properly: pub struct RpcConnections, where T: Transport - pub provider: Provider, - pub ws_provider_subscriptions: HashMap<(ProcessId, u64), JoinHandle>>, -} From ae3a480c1f24580ceee9d65b1c4c7683a00873e2 Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Mon, 5 Feb 2024 18:10:21 -0300 Subject: [PATCH 008/171] eth & kns: update kns to new process_lib --- Cargo.lock | 59 +- modules/kns_indexer/kns_indexer/Cargo.lock | 1030 +++++++------------- modules/kns_indexer/kns_indexer/Cargo.toml | 8 +- modules/kns_indexer/kns_indexer/src/lib.rs | 77 +- src/eth/provider.rs | 1 + src/eth/types.rs | 9 +- 6 files changed, 388 insertions(+), 796 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index af56ed3b7..fa3d1a725 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -92,7 +92,7 @@ checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" [[package]] name = "alloy-eips" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" +source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -103,7 +103,7 @@ dependencies = [ [[package]] name = "alloy-json-rpc" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" +source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" dependencies = [ "alloy-primitives", "serde", @@ -114,7 +114,7 @@ dependencies = [ [[package]] name = "alloy-network" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" +source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" dependencies = [ "alloy-eips", "alloy-json-rpc", @@ -148,7 +148,7 @@ dependencies = [ [[package]] name = "alloy-providers" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" +source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" dependencies = [ "alloy-network", "alloy-primitives", @@ -167,7 +167,7 @@ dependencies = [ [[package]] name = "alloy-pubsub" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" +source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -206,7 +206,7 @@ dependencies = [ [[package]] name = "alloy-rpc-client" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" +source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" dependencies = [ "alloy-json-rpc", "alloy-primitives", @@ -227,7 +227,7 @@ dependencies = [ [[package]] name = "alloy-rpc-trace-types" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" +source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" dependencies = [ "alloy-primitives", "alloy-rpc-types", @@ -238,7 +238,7 @@ dependencies = [ [[package]] name = "alloy-rpc-types" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" +source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -251,7 +251,7 @@ dependencies = [ [[package]] name = "alloy-transport" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" +source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" dependencies = [ "alloy-json-rpc", "base64 0.21.7", @@ -267,7 +267,7 @@ dependencies = [ [[package]] name = "alloy-transport-http" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" +source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -280,7 +280,7 @@ dependencies = [ [[package]] name = "alloy-transport-ws" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#2d23d57d78844e04c9ea09cf9e5aea2dccc1c639" +source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" dependencies = [ "alloy-pubsub", "alloy-transport", @@ -330,9 +330,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2faccea4cc4ab4a667ce676a30e8ec13922a692c99bb8f5b11f1502c72e04220" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" @@ -2103,9 +2103,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" +checksum = "1676f435fc1dadde4d03e43f5d62b259e1ce5f40bd4ffb21db2b42ebe59c1382" [[package]] name = "fixed-hash" @@ -2483,9 +2483,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" [[package]] name = "hex" @@ -2630,9 +2630,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.59" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -3264,9 +3264,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] @@ -3651,9 +3651,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.6" +version = "2.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f200d8d83c44a45b21764d1916299752ca035d15ecd46faca3e9a2a2bf6ad06" +checksum = "219c0dcc30b6a27553f9cc242972b67f75b60eb0db71f0b5462f38b058c41546" dependencies = [ "memchr", "thiserror", @@ -5012,13 +5012,12 @@ checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" [[package]] name = "tempfile" -version = "3.9.0" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", "rustix", "windows-sys 0.52.0", ] @@ -5056,9 +5055,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.32" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe80ced77cbfb4cb91a94bf72b378b4b6791a0d9b7f09d0be747d1bdff4e68bd" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", "itoa", @@ -6411,9 +6410,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.36" +version = "0.5.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "818ce546a11a9986bc24f93d0cdf38a8a1a400f1473ea8c82e59f6e0ffab9249" +checksum = "a7cad8365489051ae9f054164e459304af2e7e9bb407c958076c8bf4aef52da5" dependencies = [ "memchr", ] diff --git a/modules/kns_indexer/kns_indexer/Cargo.lock b/modules/kns_indexer/kns_indexer/Cargo.lock index 12c572090..ffa876371 100644 --- a/modules/kns_indexer/kns_indexer/Cargo.lock +++ b/modules/kns_indexer/kns_indexer/Cargo.lock @@ -3,19 +3,36 @@ version = 3 [[package]] -name = "aho-corasick" -version = "1.1.2" +name = "addr2line" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ - "memchr", + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "alloy-json-rpc" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy#32618e9243a761858a0843e7e55575e48fdbf500" +dependencies = [ + "alloy-primitives", + "serde", + "serde_json", + "thiserror", ] [[package]] name = "alloy-primitives" -version = "0.5.4" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c234f92024707f224510ff82419b2be0e1d8e1fd911defcac5a085cd7f83898" +checksum = "f4b6fb2b432ff223d513db7f908937f63c252bee0af9b82bfd25b0a5dd1eb0d8" dependencies = [ "alloy-rlp", "bytes", @@ -24,6 +41,7 @@ dependencies = [ "derive_more", "hex-literal", "itoa", + "k256", "keccak-asm", "proptest", "rand", @@ -34,14 +52,13 @@ dependencies = [ [[package]] name = "alloy-rlp" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc0fac0fc16baf1f63f78b47c3d24718f3619b0714076f6a02957d808d52cbef" +checksum = "8d58d9f5da7b40e9bfff0b7e7816700be4019db97d4b6359fe7f94a9e22e42ac" dependencies = [ "alloy-rlp-derive", "arrayvec", "bytes", - "smol_str", ] [[package]] @@ -52,47 +69,45 @@ checksum = "1a047897373be4bbb0224c1afdabca92648dc57a9c9ef6e7b0be3aff7a859c83" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] name = "alloy-rpc-types" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git?rev=3b1c310#3b1c3108ccd33c78abd7da8191e3744b4ae9a735" +source = "git+https://github.com/alloy-rs/alloy#32618e9243a761858a0843e7e55575e48fdbf500" dependencies = [ "alloy-primitives", "alloy-rlp", - "itertools 0.12.0", - "jsonrpsee-types", + "itertools 0.12.1", "serde", "serde_json", - "serde_with", "thiserror", ] [[package]] name = "alloy-sol-macro" -version = "0.5.4" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "970e5cf1ca089e964d4f7f7afc7c9ad642bfb1bdc695a20b0cba3b3c28954774" +checksum = "8b0b5ab0cb07c21adf9d72e988b34e8200ce648c2bba8d009183bb1c50fb1216" dependencies = [ "const-hex", "dunce", "heck", - "indexmap 2.1.0", + "indexmap", "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", "syn-solidity", "tiny-keccak", ] [[package]] name = "alloy-sol-types" -version = "0.5.4" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a059d4d2c78f8f21e470772c75f9abd9ac6d48c2aaf6b278d1ead06ed9ac664" +checksum = "6c08f62ded7ce03513bfb60ef5cad4fff5d4f67eac6feb4df80426b7b9ffb06e" dependencies = [ "alloy-primitives", "alloy-sol-macro", @@ -101,25 +116,26 @@ dependencies = [ ] [[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +name = "alloy-transport" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy#32618e9243a761858a0843e7e55575e48fdbf500" dependencies = [ - "libc", + "alloy-json-rpc", + "base64", + "serde", + "serde_json", + "thiserror", + "tokio", + "tower", + "url", + "wasm-bindgen-futures", ] [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[package]] name = "ark-ff" @@ -253,14 +269,13 @@ checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "auto_impl" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" +checksum = "823b8bb275161044e2ac7a25879cb3e2480cb403e3943022c7c769c599b756aa" dependencies = [ - "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.48", ] [[package]] @@ -269,6 +284,21 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -277,9 +307,9 @@ checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64ct" @@ -287,15 +317,6 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" -[[package]] -name = "beef" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" -dependencies = [ - "serde", -] - [[package]] name = "bincode" version = "1.3.3" @@ -322,15 +343,9 @@ checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "bitvec" @@ -395,19 +410,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chrono" -version = "0.4.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "num-traits", - "serde", - "windows-targets 0.48.5", -] - [[package]] name = "const-hex" version = "1.10.0" @@ -433,17 +435,11 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" -[[package]] -name = "core-foundation-sys" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" - [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] @@ -476,41 +472,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "darling" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 2.0.40", -] - -[[package]] -name = "darling_macro" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" -dependencies = [ - "darling_core", - "quote", - "syn 2.0.40", -] - [[package]] name = "der" version = "0.7.8" @@ -521,16 +482,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "deranged" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" -dependencies = [ - "powerfmt", - "serde", -] - [[package]] name = "derivative" version = "2.2.0" @@ -634,82 +585,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "ethabi" -version = "18.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7413c5f74cc903ea37386a8965a936cbeb334bd270862fdece542c1b2dcbc898" -dependencies = [ - "ethereum-types", - "hex", - "once_cell", - "regex", - "serde", - "serde_json", - "sha3", - "thiserror", - "uint", -] - -[[package]] -name = "ethbloom" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" -dependencies = [ - "crunchy", - "fixed-hash", - "impl-codec", - "impl-rlp", - "impl-serde", - "scale-info", - "tiny-keccak", -] - -[[package]] -name = "ethereum-types" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" -dependencies = [ - "ethbloom", - "fixed-hash", - "impl-codec", - "impl-rlp", - "impl-serde", - "primitive-types", - "scale-info", - "uint", -] - -[[package]] -name = "ethers-core" -version = "2.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f03e0bdc216eeb9e355b90cf610ef6c5bb8aca631f97b5ae9980ce34ea7878d" -dependencies = [ - "arrayvec", - "bytes", - "chrono", - "const-hex", - "elliptic-curve", - "ethabi", - "generic-array", - "k256", - "num_enum", - "open-fastrlp", - "rand", - "rlp", - "serde", - "serde_json", - "strum", - "tempfile", - "thiserror", - "tiny-keccak", - "unicode-xid", + "windows-sys", ] [[package]] @@ -772,6 +648,30 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" +[[package]] +name = "futures-core" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" + +[[package]] +name = "futures-task" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" + +[[package]] +name = "futures-util" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +dependencies = [ + "futures-core", + "futures-task", + "pin-project-lite", + "pin-utils", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -785,15 +685,21 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "libc", "wasi", ] +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" + [[package]] name = "group" version = "0.13.0" @@ -805,12 +711,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - [[package]] name = "hashbrown" version = "0.14.3" @@ -861,41 +761,12 @@ dependencies = [ "itoa", ] -[[package]] -name = "iana-time-zone" -version = "0.1.59" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - [[package]] name = "id-arena" version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "idna" version = "0.5.0" @@ -915,24 +786,6 @@ dependencies = [ "parity-scale-codec", ] -[[package]] -name = "impl-rlp" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" -dependencies = [ - "rlp", -] - -[[package]] -name = "impl-serde" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" -dependencies = [ - "serde", -] - [[package]] name = "impl-trait-for-tuples" version = "0.2.2" @@ -946,23 +799,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", - "serde", -] - -[[package]] -name = "indexmap" -version = "2.1.0" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown", "serde", ] @@ -977,9 +819,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] @@ -992,47 +834,25 @@ checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" dependencies = [ "wasm-bindgen", ] -[[package]] -name = "jsonrpsee-types" -version = "0.20.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be0be325642e850ed0bdff426674d2e66b2b7117c9be23a7caef68a2902b7d9" -dependencies = [ - "anyhow", - "beef", - "serde", - "serde_json", - "thiserror", - "tracing", -] - [[package]] name = "k256" -version = "0.13.2" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f01b677d82ef7a676aa37e099defd83a28e15687112cafdd112d60236b6115b" +checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" dependencies = [ "cfg-if", "ecdsa", "elliptic-curve", "once_cell", "sha2", -] - -[[package]] -name = "keccak" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" -dependencies = [ - "cpufeatures", + "signature", ] [[package]] @@ -1047,13 +867,15 @@ dependencies = [ [[package]] name = "kinode_process_lib" -version = "0.5.5" -source = "git+https://github.com/kinode-dao/process_lib?tag=v0.5.5-alpha#722f2dbfbcc4d1bf5da1fa5db137632a3cede44c" +version = "0.5.7" +source = "git+https://github.com/kinode-dao/process_lib?rev=032bd43#032bd437a6765a2735a3e93b96f1e26e91ce8af0" dependencies = [ + "alloy-json-rpc", + "alloy-primitives", "alloy-rpc-types", + "alloy-transport", "anyhow", "bincode", - "ethers-core", "http", "mime_guess", "rand", @@ -1095,9 +917,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.151" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libm" @@ -1107,9 +929,9 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "log" @@ -1119,9 +941,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "mime" @@ -1139,6 +961,15 @@ dependencies = [ "unicase", ] +[[package]] +name = "miniz_oxide" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +dependencies = [ + "adler", +] + [[package]] name = "num-bigint" version = "0.4.4" @@ -1171,24 +1002,12 @@ dependencies = [ ] [[package]] -name = "num_enum" -version = "0.7.1" +name = "object" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683751d591e6d81200c39fb0d1032608b77724f34114db54f571ff1317b337c0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c11e44798ad209ccdd91fc192f0526a369a01234f7373e1b141c96d7cee4f0e" -dependencies = [ - "proc-macro-crate 2.0.1", - "proc-macro2", - "quote", - "syn 2.0.40", + "memchr", ] [[package]] @@ -1197,31 +1016,6 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" -[[package]] -name = "open-fastrlp" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" -dependencies = [ - "arrayvec", - "auto_impl", - "bytes", - "ethereum-types", - "open-fastrlp-derive", -] - -[[package]] -name = "open-fastrlp-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" -dependencies = [ - "bytes", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "parity-scale-codec" version = "3.6.9" @@ -1242,7 +1036,7 @@ version = "3.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" dependencies = [ - "proc-macro-crate 2.0.1", + "proc-macro-crate", "proc-macro2", "quote", "syn 1.0.109", @@ -1262,21 +1056,47 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.5" +version = "2.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae9cee2a55a544be8b89dc6848072af97a20f2422603c10865be2a42b580fff5" +checksum = "219c0dcc30b6a27553f9cc242972b67f75b60eb0db71f0b5462f38b058c41546" dependencies = [ "memchr", "thiserror", "ucd-trie", ] +[[package]] +name = "pin-project" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + [[package]] name = "pin-project-lite" version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "pkcs8" version = "0.10.2" @@ -1287,12 +1107,6 @@ dependencies = [ "spki", ] -[[package]] -name = "powerfmt" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" - [[package]] name = "ppv-lite86" version = "0.2.17" @@ -1307,30 +1121,17 @@ checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" dependencies = [ "fixed-hash", "impl-codec", - "impl-rlp", - "impl-serde", - "scale-info", "uint", ] [[package]] name = "proc-macro-crate" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" -dependencies = [ - "once_cell", - "toml_edit 0.19.15", -] - -[[package]] -name = "proc-macro-crate" -version = "2.0.1" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97dc5fea232fc28d2f597b37c4876b348a40e33f3b02cc975c8d006d78d94b1a" +checksum = "b00f26d3400549137f92511a46ac1cd8ce37cb5598a96d382381458b992a5d24" dependencies = [ "toml_datetime", - "toml_edit 0.20.2", + "toml_edit", ] [[package]] @@ -1359,9 +1160,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -1374,7 +1175,7 @@ checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.4.1", + "bitflags", "lazy_static", "num-traits", "rand", @@ -1394,9 +1195,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -1446,38 +1247,6 @@ dependencies = [ "rand_core", ] -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "regex" -version = "1.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - [[package]] name = "regex-syntax" version = "0.8.2" @@ -1501,21 +1270,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" dependencies = [ "bytes", - "rlp-derive", "rustc-hex", ] -[[package]] -name = "rlp-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "rmp" version = "0.8.12" @@ -1568,6 +1325,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e666a5496a0b2186dbcd0ff6106e29e093c15591bde62c20d3842007c6978a09" +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + [[package]] name = "rustc-hex" version = "2.1.0" @@ -1589,28 +1352,22 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.20", + "semver 1.0.21", ] [[package]] name = "rustix" -version = "0.38.28" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ - "bitflags 2.4.1", + "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys", ] -[[package]] -name = "rustversion" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" - [[package]] name = "rusty-fork" version = "0.3.0" @@ -1629,30 +1386,6 @@ version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" -[[package]] -name = "scale-info" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7d66a1128282b7ef025a8ead62a4a9fcf017382ec53b8ffbf4d7bf77bd3c60" -dependencies = [ - "cfg-if", - "derive_more", - "parity-scale-codec", - "scale-info-derive", -] - -[[package]] -name = "scale-info-derive" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abf2c68b89cafb3b8d918dd07b42be0da66ff202cf1155c5739a4e0c1ea0dc19" -dependencies = [ - "proc-macro-crate 1.3.1", - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "sec1" version = "0.7.3" @@ -1678,9 +1411,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" [[package]] name = "semver-parser" @@ -1693,64 +1426,35 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.193" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ "itoa", "ryu", "serde", ] -[[package]] -name = "serde_with" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" -dependencies = [ - "base64", - "chrono", - "hex", - "indexmap 1.9.3", - "indexmap 2.1.0", - "serde", - "serde_json", - "serde_with_macros", - "time", -] - -[[package]] -name = "serde_with_macros" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.40", -] - [[package]] name = "sha2" version = "0.10.8" @@ -1762,16 +1466,6 @@ dependencies = [ "digest 0.10.7", ] -[[package]] -name = "sha3" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" -dependencies = [ - "digest 0.10.7", - "keccak", -] - [[package]] name = "sha3-asm" version = "0.1.0" @@ -1794,24 +1488,15 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" - -[[package]] -name = "smol_str" -version = "0.2.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74212e6bbe9a4352329b2f68ba3130c15a3f26fe88ff22dbdc6cdd58fa85e99c" -dependencies = [ - "serde", -] +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "spdx" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b19b32ed6d899ab23174302ff105c1577e45a06b08d4fe0a9dd13ce804bbbf71" +checksum = "62bde1398b09b9f93fc2fc9b9da86e362693e999d3a54a8ac47a99a5a73f638b" dependencies = [ "smallvec", ] @@ -1832,34 +1517,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "strum" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.25.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "rustversion", - "syn 2.0.40", -] - [[package]] name = "subtle" version = "2.5.0" @@ -1879,9 +1536,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.40" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13fa70a4ee923979ffb522cacce59d34421ebdea5625e1073c4326ef9d2dd42e" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -1890,14 +1547,14 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.5.4" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ede2e5b2c6bfac4bc0ff4499957a11725dc12a7ddb86270e827ef575892553" +checksum = "63bef2e2c735acbc06874eca3a8506f02a3c4700e6e748afc92cc2e4220e8a03" dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] [[package]] @@ -1908,64 +1565,34 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.8.1" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", "rustix", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", -] - -[[package]] -name = "time" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" -dependencies = [ - "deranged", - "itoa", - "powerfmt", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" - -[[package]] -name = "time-macros" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" -dependencies = [ - "time-core", + "syn 2.0.48", ] [[package]] @@ -1992,6 +1619,16 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" +[[package]] +name = "tokio" +version = "1.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" +dependencies = [ + "backtrace", + "pin-project-lite", +] + [[package]] name = "toml_datetime" version = "0.6.3" @@ -2000,32 +1637,49 @@ checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" [[package]] name = "toml_edit" -version = "0.19.15" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" dependencies = [ - "indexmap 2.1.0", + "indexmap", "toml_datetime", "winnow", ] [[package]] -name = "toml_edit" -version = "0.20.2" +name = "tower" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ - "indexmap 2.1.0", - "toml_datetime", - "winnow", + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tower-layer", + "tower-service", + "tracing", ] +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + [[package]] name = "tracing" version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ + "log", "pin-project-lite", "tracing-core", ] @@ -2035,6 +1689,9 @@ name = "tracing-core" version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] [[package]] name = "typenum" @@ -2077,9 +1734,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -2148,9 +1805,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2158,24 +1815,36 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2183,22 +1852,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" [[package]] name = "wasm-encoder" @@ -2209,20 +1878,29 @@ dependencies = [ "leb128", ] +[[package]] +name = "wasm-encoder" +version = "0.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e09bca7d6388637d27fb5edbeab11f56bfabcef8743c55ae34370e1e5030a071" +dependencies = [ + "leb128", +] + [[package]] name = "wasm-metadata" -version = "0.10.14" +version = "0.10.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d835d67708f6374937c550ad8dd1d17c616ae009e3f00d7a0ac9f7825e78c36a" +checksum = "c853d3809fc9fccf3bc0ad63f4f51d8eefad0bacf88f957aa991c1d9b88b016e" dependencies = [ "anyhow", - "indexmap 2.1.0", + "indexmap", "serde", "serde_derive", "serde_json", "spdx", - "wasm-encoder", - "wasmparser", + "wasm-encoder 0.41.0", + "wasmparser 0.121.0", ] [[package]] @@ -2231,26 +1909,29 @@ version = "0.118.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95ee9723b928e735d53000dec9eae7b07a60e490c85ab54abb66659fc61bfcd9" dependencies = [ - "indexmap 2.1.0", - "semver 1.0.20", + "indexmap", + "semver 1.0.21", ] [[package]] -name = "windows-core" -version = "0.52.0" +name = "wasmparser" +version = "0.121.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +checksum = "953cf6a7606ab31382cb1caa5ae403e77ba70c7f8e12eeda167e7040d42bfda8" dependencies = [ - "windows-targets 0.52.0", + "bitflags", + "indexmap", + "semver 1.0.21", ] [[package]] -name = "windows-sys" -version = "0.48.0" +name = "web-sys" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" dependencies = [ - "windows-targets 0.48.5", + "js-sys", + "wasm-bindgen", ] [[package]] @@ -2259,22 +1940,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", + "windows-targets", ] [[package]] @@ -2283,93 +1949,51 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - [[package]] name = "windows_aarch64_gnullvm" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - [[package]] name = "windows_aarch64_msvc" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - [[package]] name = "windows_i686_gnu" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - [[package]] name = "windows_i686_msvc" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - [[package]] name = "windows_x86_64_gnu" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - [[package]] name = "windows_x86_64_gnullvm" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - [[package]] name = "windows_x86_64_msvc" version = "0.52.0" @@ -2378,9 +2002,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.31" +version = "0.5.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a4882e6b134d6c28953a387571f1acdd3496830d5e36c5e3a1075580ea641c" +checksum = "a7cad8365489051ae9f054164e459304af2e7e9bb407c958076c8bf4aef52da5" dependencies = [ "memchr", ] @@ -2390,7 +2014,7 @@ name = "wit-bindgen" version = "0.16.0" source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=efcc759#efcc7592cf3277bcb9be1034e48569c6d822b322" dependencies = [ - "bitflags 2.4.1", + "bitflags", "wit-bindgen-rust-macro", ] @@ -2424,7 +2048,7 @@ dependencies = [ "anyhow", "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", "wit-bindgen-core", "wit-bindgen-rust", "wit-component", @@ -2437,29 +2061,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b8a35a2a9992898c9d27f1664001860595a4bc99d32dd3599d547412e17d7e2" dependencies = [ "anyhow", - "bitflags 2.4.1", - "indexmap 2.1.0", + "bitflags", + "indexmap", "log", "serde", "serde_derive", "serde_json", - "wasm-encoder", + "wasm-encoder 0.38.1", "wasm-metadata", - "wasmparser", + "wasmparser 0.118.1", "wit-parser", ] [[package]] name = "wit-parser" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15df6b7b28ce94b8be39d8df5cb21a08a4f3b9f33b631aedb4aa5776f785ead3" +checksum = "df4913a2219096373fd6512adead1fb77ecdaa59d7fc517972a7d30b12f625be" dependencies = [ "anyhow", "id-arena", - "indexmap 2.1.0", + "indexmap", "log", - "semver 1.0.20", + "semver 1.0.21", "serde", "serde_derive", "serde_json", @@ -2492,5 +2116,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.48", ] diff --git a/modules/kns_indexer/kns_indexer/Cargo.toml b/modules/kns_indexer/kns_indexer/Cargo.toml index 1bd118aab..d321f997d 100644 --- a/modules/kns_indexer/kns_indexer/Cargo.toml +++ b/modules/kns_indexer/kns_indexer/Cargo.toml @@ -12,12 +12,12 @@ lto = true [dependencies] anyhow = "1.0" -alloy-primitives = "0.5.1" -alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy.git", rev = "3b1c310" } -alloy-sol-types = "0.5.1" +alloy-primitives = "0.6.2" +alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy" } +alloy-sol-types = "0.6.2" bincode = "1.3.3" hex = "0.4.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.5.5-alpha", features = ["eth"] } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "032bd43" } rmp-serde = "1.1.2" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/modules/kns_indexer/kns_indexer/src/lib.rs b/modules/kns_indexer/kns_indexer/src/lib.rs index 6e9f48fde..ad14d706f 100644 --- a/modules/kns_indexer/kns_indexer/src/lib.rs +++ b/modules/kns_indexer/kns_indexer/src/lib.rs @@ -6,8 +6,9 @@ use alloy_rpc_types::{ use alloy_sol_types::{sol, SolEvent}; use kinode_process_lib::{ - await_message, get_typed_state, print_to_terminal, println, set_state, Address, Message, - Request, Response, + await_message, + eth::{get_block_number, get_logs, EthResponse}, + get_typed_state, print_to_terminal, println, set_state, Address, Message, Request, Response, }; use serde::{Deserialize, Serialize}; use std::string::FromUtf8Error; @@ -38,34 +39,10 @@ pub enum EthAction { }, /// Kill a SubscribeLogs subscription of a given ID, to stop getting updates. UnsubscribeLogs(u64), - /// get_logs - GetLogs { filter: Filter }, - /// get_block_number - GetBlockNumber, -} - -//TEMP -/// Potential EthResponse type. -/// Can encapsulate all methods in their own response type, -/// or return generic result which can be parsed later.. -#[derive(Debug, Serialize, Deserialize)] -pub enum EthResponse { - // another possible strat, just return RpcResult, - // then try deserializing on the process_lib side. - Ok, - //Err(EthError), - Sub(SubscriptionResult), - GetLogs(Vec), - // GetBlockNumber(u64), - // GetBalance(U256), - // GetGasPrice(U256), - // Call(Vec), // alloy_primimtives::Bytes deserialization.. - // GetTransactionCount(U256), - // GetBlockByNumber(Option), - // GetBlockByHash(Option), - // // raw json vs enum type vs into T? - // RawRequest(serde_json::Value), - // SendRawTransaction(Vec), // alloy_primitives::TxHash deserialization.. + Request { + method: String, + params: serde_json::Value, + }, } #[derive(Clone, Debug, Serialize, Deserialize)] @@ -200,18 +177,10 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> { block: 1, }; } - // shove all state into net::net - Request::new() - .target((&our.node, "net", "distro", "sys")) - .try_body(NetActions::KnsBatchUpdate( - state.nodes.values().cloned().collect::>(), - ))? - .send()?; - let filter = Filter::new() .address(contract_address.unwrap().parse::().unwrap()) - .from_block(0) .to_block(BlockNumberOrTag::Latest) + .from_block(state.block - 1) .events(vec![ "NodeRegistered(bytes32,bytes)", "KeyUpdate(bytes32,bytes32)", @@ -219,15 +188,24 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> { "WsUpdate(bytes32,uint16)", "RoutingUpdate(bytes32,bytes32[])", ]); - - let params = Params::Logs(Box::new(filter.clone())); - let kind = SubscriptionKind::Logs; - + // if block in state is < current_block, get logs from that part. + if state.block < get_block_number()? { + let logs = get_logs(filter.clone())?; + for log in logs { + handle_log(&our, &mut state, &log)?; + } + } + // shove all state into net::net Request::new() - .target((&our.node, "eth", "distro", "sys")) - .body(serde_json::to_vec(&EthAction::GetLogs { filter })?) + .target((&our.node, "net", "distro", "sys")) + .try_body(NetActions::KnsBatchUpdate( + state.nodes.values().cloned().collect::>(), + ))? .send()?; + let params = Params::Logs(Box::new(filter)); + let kind = SubscriptionKind::Logs; + Request::new() .target((&our.node, "eth", "distro", "sys")) .body(serde_json::to_vec(&EthAction::SubscribeLogs { @@ -299,12 +277,7 @@ fn handle_eth_message( }; match res { - EthResponse::GetLogs(logs) => { - for log in logs { - handle_log(our, state, &log)?; - } - } - EthResponse::Sub(result) => match result { + EthResponse::Sub { id, result } => match result { SubscriptionResult::Log(log) => { handle_log(our, state, &log)?; } @@ -350,7 +323,7 @@ fn handle_eth_message( fn handle_log(our: &Address, state: &mut State, log: &Log) -> anyhow::Result<()> { state.block = log.block_number.expect("expect").to::(); - let node_id: alloy_primitives::FixedBytes<32> = log.topics[1]; + let node_id = log.topics[1]; let name = match state.names.entry(node_id.to_string()) { Entry::Occupied(o) => o.into_mut(), diff --git a/src/eth/provider.rs b/src/eth/provider.rs index a9287b437..373a08091 100644 --- a/src/eth/provider.rs +++ b/src/eth/provider.rs @@ -1,5 +1,6 @@ use crate::eth::types::*; use crate::types::*; +use alloy_providers::provider::TempProvider; use alloy_pubsub::{PubSubFrontend, RawSubscription}; use alloy_rpc_client::ClientBuilder; use alloy_rpc_types::pubsub::SubscriptionResult; diff --git a/src/eth/types.rs b/src/eth/types.rs index 76b4adcbd..d70fa7378 100644 --- a/src/eth/types.rs +++ b/src/eth/types.rs @@ -1,12 +1,5 @@ -use crate::types::ProcessId; -use alloy_primitives::{Address, BlockHash, Bytes, ChainId, TxHash, B256, U256}; -use alloy_providers::provider::Provider; -use alloy_pubsub::PubSubFrontend; use alloy_rpc_types::pubsub::{Params, SubscriptionKind, SubscriptionResult}; -use alloy_rpc_types::{Block, BlockId, BlockNumberOrTag, CallRequest, Filter, Log}; use serde::{Deserialize, Serialize}; -use std::collections::HashMap; -use tokio::task::JoinHandle; /// The Request type that can be made to eth:distro:sys. Currently primitive, this /// enum will expand to support more actions in the future. @@ -62,7 +55,9 @@ pub fn to_static_str(method: &str) -> Option<&'static str> { "eth_getBalance" => Some("eth_getBalance"), "eth_sendRawTransaction" => Some("eth_sendRawTransaction"), "eth_call" => Some("eth_call"), + "eth_chainId" => Some("eth_chainId"), "eth_getTransactionReceipt" => Some("eth_getTransactionReceipt"), + "eth_getTransactionCount" => Some("eth_getTransactionCount"), "eth_estimateGas" => Some("eth_estimateGas"), "eth_blockNumber" => Some("eth_blockNumber"), "eth_getBlockByHash" => Some("eth_getBlockByHash"), From 1b903d3831c70d7e7badb0051ee52b732de2b209 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Mon, 5 Feb 2024 19:23:21 -0300 Subject: [PATCH 009/171] WIP --- kinode/src/kernel/mod.rs | 5 +-- kinode/src/kernel/process.rs | 59 +++++++++++++++++------------- kinode/src/kernel/standard_host.rs | 4 +- lib/src/core.rs | 8 ---- 4 files changed, 37 insertions(+), 39 deletions(-) diff --git a/kinode/src/kernel/mod.rs b/kinode/src/kernel/mod.rs index 016845fd7..b114decc8 100644 --- a/kinode/src/kernel/mod.rs +++ b/kinode/src/kernel/mod.rs @@ -43,7 +43,6 @@ enum ProcessSender { } /// persist kernel's process_map state for next bootup -/// and (TODO) wait for filesystem to respond in the affirmative async fn persist_state( our_name: &str, send_to_loop: &t::MessageSender, @@ -76,7 +75,7 @@ async fn persist_state( Ok(()) } -/// handle messages sent directly to kernel. source is always our own node. +/// handle commands inside messages sent directly to kernel. source is always our own node. async fn handle_kernel_request( our_name: String, keypair: Arc, @@ -528,7 +527,7 @@ async fn handle_kernel_request( } } -// double check immediate run +/// spawn a process loop and insert the process in the relevant kernel state maps async fn start_process( our_name: String, keypair: Arc, diff --git a/kinode/src/kernel/process.rs b/kinode/src/kernel/process.rs index 02d355947..979f5ac59 100644 --- a/kinode/src/kernel/process.rs +++ b/kinode/src/kernel/process.rs @@ -1,8 +1,10 @@ use crate::kernel::{ProcessMessageReceiver, ProcessMessageSender}; use crate::KERNEL_PROCESS_ID; use anyhow::Result; -//pub use kinode::process::standard as wit; -//pub use kinode::process::standard::Host as StandardHost; +use lib::types::core as t; +pub use lib::wit; +pub use lib::wit::Host as StandardHost; +pub use lib::Process; use ring::signature::{self, KeyPair}; use std::collections::{HashMap, VecDeque}; use std::sync::Arc; @@ -11,26 +13,31 @@ use wasmtime::component::*; use wasmtime::{Engine, Store}; use wasmtime_wasi::preview2::{pipe::MemoryOutputPipe, Table, WasiCtx, WasiCtxBuilder, WasiView}; -use lib::types::core as t; -pub use lib::wit; -pub use lib::wit::Host as StandardHost; -pub use lib::Process; - -// bindgen!({ -// path: "wit", -// world: "process", -// async: true, -// }); +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct ProcessContext { + // store ultimate in order to set prompting message if needed + pub message: Option, + // can be empty if a request doesn't set context, but still needs to inherit + pub context: Option, +} pub struct ProcessState { + /// our node's networking keypair pub keypair: Arc, + /// information about ourself pub metadata: t::ProcessMetadata, + /// pipe from which we get messages from the main event loop pub recv_in_process: ProcessMessageReceiver, + /// pipe to send messages to ourself (received in `recv_in_process`) pub self_sender: ProcessMessageSender, + /// pipe for sending messages to the main event loop pub send_to_loop: t::MessageSender, + /// pipe for sending [`t::Printout`]s to the terminal pub send_to_terminal: t::PrintSender, - pub prompting_message: Option, - pub last_blob: Option, + /// store the nested request, if any + pub nested_request: Option, + /// store the current incoming message that we've gotten from receive() + pub current_incoming_message: Option, pub contexts: HashMap)>, pub message_queue: VecDeque>, pub caps_oracle: t::CapMessageSender, @@ -124,9 +131,9 @@ impl ProcessState { // otherwise, id is generated randomly let request_id: u64 = if request.inherit && request.expects_response.is_none() - && self.prompting_message.is_some() + && self.current_incoming_message.is_some() { - self.prompting_message.as_ref().unwrap().id + self.current_incoming_message.as_ref().unwrap().id } else { loop { let id = rand::random(); @@ -178,7 +185,7 @@ impl ProcessState { rsvp: match ( request.inherit, request.expects_response, - &self.prompting_message, + &self.current_incoming_message, ) { // this request expects response, so receives any response // make sure to use the real source, not a fake injected-by-kernel source @@ -219,8 +226,8 @@ impl ProcessState { request_id, ( t::ProcessContext { - prompting_message: if self.prompting_message.is_some() { - self.prompting_message.clone() + prompting_message: if self.current_incoming_message.is_some() { + self.current_incoming_message.clone() } else { None }, @@ -341,21 +348,21 @@ impl ProcessState { Ok(km) => match &km.message { t::Message::Request(_) => { self.last_blob = km.lazy_load_blob.clone(); - self.prompting_message = Some(km.clone()); + self.current_incoming_message = Some(km.clone()); (None, km) } t::Message::Response(_) => { if let Some((context, timeout_handle)) = self.contexts.remove(&km.id) { timeout_handle.abort(); self.last_blob = km.lazy_load_blob.clone(); - self.prompting_message = match context.prompting_message { + self.current_incoming_message = match context.prompting_message { None => Some(km.clone()), Some(prompting_message) => Some(prompting_message), }; (context.context, km) } else { self.last_blob = km.lazy_load_blob.clone(); - self.prompting_message = Some(km.clone()); + self.current_incoming_message = Some(km.clone()); (None, km) } } @@ -364,7 +371,7 @@ impl ProcessState { None => return Err((t::en_wit_send_error(e.error), None)), Some((context, timeout_handle)) => { timeout_handle.abort(); - self.prompting_message = context.prompting_message; + self.current_incoming_message = context.prompting_message; return Err((t::en_wit_send_error(e.error), context.context)); } }, @@ -431,7 +438,7 @@ impl ProcessState { /// a response it emits should have. This takes into /// account the `rsvp` of the prompting message, if any. async fn make_response_id_target(&self) -> Option<(u64, t::Address)> { - let Some(ref prompting_message) = self.prompting_message else { + let Some(ref prompting_message) = self.current_incoming_message else { println!("need non-None prompting_message to handle Response"); return None; }; @@ -513,8 +520,8 @@ pub async fn make_process_loop( self_sender: send_to_process, send_to_loop: send_to_loop.clone(), send_to_terminal: send_to_terminal.clone(), - prompting_message: None, - last_blob: None, + nested_request: None, + current_incoming_message: None, contexts: HashMap::new(), message_queue: VecDeque::new(), caps_oracle: caps_oracle.clone(), diff --git a/kinode/src/kernel/standard_host.rs b/kinode/src/kernel/standard_host.rs index 3e9c30f41..52ae80896 100644 --- a/kinode/src/kernel/standard_host.rs +++ b/kinode/src/kernel/standard_host.rs @@ -1,6 +1,4 @@ use crate::kernel::process; -//use crate::kernel::process::kinode::process::standard as wit; -//use crate::kernel::process::StandardHost; use crate::KERNEL_PROCESS_ID; use crate::VFS_PROCESS_ID; use anyhow::Result; @@ -27,6 +25,7 @@ impl StandardHost for process::ProcessWasi { // // system utils: // + async fn print_to_terminal(&mut self, verbosity: u8, content: String) -> Result<()> { self.process .send_to_terminal @@ -376,6 +375,7 @@ impl StandardHost for process::ProcessWasi { print_debug(&self.process, "spawned a new process").await; Ok(Ok(new_process_id.en_wit().to_owned())) } + // // capabilities management // diff --git a/lib/src/core.rs b/lib/src/core.rs index d9885be79..398f6ab8d 100644 --- a/lib/src/core.rs +++ b/lib/src/core.rs @@ -1030,14 +1030,6 @@ impl std::fmt::Display for PersistedProcess { } } -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct ProcessContext { - // store ultimate in order to set prompting message if needed - pub prompting_message: Option, - // can be empty if a request doesn't set context, but still needs to inherit - pub context: Option, -} - pub type PackageVersion = (u32, u32, u32); /// the type that gets deserialized from `metadata.json` in a package From f80c36717aac2de6610e480f25606d510582b4fc Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Tue, 6 Feb 2024 17:22:25 -0300 Subject: [PATCH 010/171] WIP; minor performance enhancements --- kinode/src/kernel/mod.rs | 9 +- kinode/src/kernel/process.rs | 290 +++++++++++++++++++++-------------- 2 files changed, 174 insertions(+), 125 deletions(-) diff --git a/kinode/src/kernel/mod.rs b/kinode/src/kernel/mod.rs index b114decc8..1083da6a7 100644 --- a/kinode/src/kernel/mod.rs +++ b/kinode/src/kernel/mod.rs @@ -1096,11 +1096,11 @@ pub async fn kernel( match process_map.get(&on) { None => vec![], Some(p) => { - caps.iter().filter_map(|cap| { + caps.into_iter().filter_map(|cap| { // if issuer is message source, then sign the cap if cap.issuer.process == on { Some(( - cap.clone(), + cap, keypair .sign(&rmp_serde::to_vec(&cap).unwrap()) .as_ref() @@ -1109,10 +1109,7 @@ pub async fn kernel( // otherwise, only attach previously saved caps // NOTE we don't need to verify the sigs! } else { - match p.capabilities.get(cap) { - None => None, - Some(sig) => Some((cap.clone(), sig.clone())) - } + p.capabilities.get(&cap).map(|sig| (cap, sig.clone())) } }).collect() }, diff --git a/kinode/src/kernel/process.rs b/kinode/src/kernel/process.rs index 979f5ac59..76494026a 100644 --- a/kinode/src/kernel/process.rs +++ b/kinode/src/kernel/process.rs @@ -13,6 +13,8 @@ use wasmtime::component::*; use wasmtime::{Engine, Store}; use wasmtime_wasi::preview2::{pipe::MemoryOutputPipe, Table, WasiCtx, WasiCtxBuilder, WasiView}; +const STACK_TRACE_SIZE: usize = 5000; + #[derive(Clone, Debug, Serialize, Deserialize)] pub struct ProcessContext { // store ultimate in order to set prompting message if needed @@ -38,8 +40,12 @@ pub struct ProcessState { pub nested_request: Option, /// store the current incoming message that we've gotten from receive() pub current_incoming_message: Option, + /// store the contexts and timeout task of all outstanding requests pub contexts: HashMap)>, + /// store the messages that we've gotten from event loop but haven't processed yet + /// TODO make this an ordered map for O(1) retrieval by ID pub message_queue: VecDeque>, + /// pipe for getting info about capabilities pub caps_oracle: t::CapMessageSender, } @@ -64,8 +70,6 @@ impl WasiView for ProcessWasi { } } -const STACK_TRACE_SIZE: usize = 5000; - pub async fn send_and_await_response( process: &mut ProcessWasi, source: Option, @@ -98,42 +102,95 @@ pub async fn send_and_await_response( } impl ProcessState { - /// Ingest latest message directed to this process, and mark it as the prompting message. + /// Ingest latest message directed to this process, and save it as the current message. /// If there is no message in the queue, wait async until one is received. - /// The message will only be saved as the prompting-message if it's a Request. pub async fn get_next_message_for_process( &mut self, ) -> Result<(wit::Address, wit::Message), (wit::SendError, Option)> { let res = match self.message_queue.pop_front() { Some(message_from_queue) => message_from_queue, - None => self.recv_in_process.recv().await.unwrap(), + None => self + .recv_in_process + .recv() + .await + .expect("fatal: process couldn't receive next message"), }; self.kernel_message_to_process_receive(res) } + /// instead of ingesting latest, wait for a specific ID and queue all others + async fn get_specific_message_for_process( + &mut self, + awaited_message_id: u64, + ) -> Result<(wit::Address, wit::Message), (wit::SendError, Option)> { + // first, check if the awaited message is already in the queue and handle if so + for (i, message) in self.message_queue.iter().enumerate() { + match message { + Ok(ref km) if km.id == awaited_message_id => { + let km = self.message_queue.remove(i).unwrap(); + return self.kernel_message_to_process_receive(km); + } + _ => continue, + } + } + // next, wait for the awaited message to arrive + loop { + let res = self + .recv_in_process + .recv() + .await + .expect("fatal: process couldn't receive next message"); + let id = match &res { + Ok(km) => km.id, + Err(e) => e.id, + }; + if id == awaited_message_id { + return self.kernel_message_to_process_receive(res); + } else { + self.message_queue.push_back(res); + } + } + } + /// takes Request generated by a process and sends it to the main event loop. /// will only fail if process does not have capability to send to target. /// if the request has a timeout (expects response), start a task to track /// that timeout and return timeout error if it expires. pub async fn send_request( &mut self, - fake_source: Option, // only used when kernel steps in to get/set state + /// only used when kernel steps in to get/set state + fake_source: Option, target: wit::Address, request: wit::Request, new_context: Option, blob: Option, ) -> Result { - let source = match &fake_source { - Some(_) => fake_source.unwrap(), - None => self.metadata.our.clone(), + let source = fake_source.unwrap_or(self.metadata.our.clone()); + let mut request = t::de_wit_request(request); + + // if request chooses to inherit, it means to take the lazy_load_blob, if any, + // from the last request it ingested. if current_incoming_message is a request, + // it will be the inherited one. if not, we check nested_request and inherit + // from that if it exists. + // if neither exist as requests, inherit flag will be ignored. + let predecessor_request = match &self.current_incoming_message { + Some(t::KernelMessage { + message: t::Message::Request(request), + .. + }) => self.current_incoming_message.as_ref(), + _ => match &self.nested_request { + Some(t::KernelMessage { + message: t::Message::Request(request), + .. + }) => self.nested_request.as_ref(), + _ => None, + }, }; - // if request chooses to inherit context, match id to prompting_message + + // if request chooses to inherit, match id to precedessor // otherwise, id is generated randomly - let request_id: u64 = if request.inherit - && request.expects_response.is_none() - && self.current_incoming_message.is_some() - { - self.current_incoming_message.as_ref().unwrap().id + let request_id: u64 = if request.inherit && predecessor_request.is_some() { + predecessor_request.unwrap().id } else { loop { let id = rand::random(); @@ -143,81 +200,57 @@ impl ProcessState { } }; + // if a blob is provided, it will be used; otherwise, if inherit is true, + // and a predecessor exists, its blob will be used; otherwise, no blob will be used. let blob = match blob { Some(p) => Some(t::LazyLoadBlob { mime: p.mime, bytes: p.bytes, }), None => match request.inherit { - true => self.last_blob.clone(), + true => predecessor_request + .and_then(|km| km.lazy_load_blob.clone()) + .or(None), false => None, }, }; - let mut inner_request = t::de_wit_request(request.clone()); - - inner_request.capabilities = { - let (tx, rx) = tokio::sync::oneshot::channel(); - self.caps_oracle - .send(t::CapMessage::FilterCaps { - on: self.metadata.our.process.clone(), - caps: request - .capabilities - .iter() - .map(|cap| t::de_wit_capability(cap.clone()).0) - .collect(), - responder: tx, - }) - .await?; - rx.await? - }; - - // rsvp is set if there was a Request expecting Response - // followed by inheriting Request(s) not expecting Response; - // this is done such that the ultimate request handler knows that, - // in fact, a Response *is* expected. - // could also be None if entire chain of Requests are - // not expecting Response - let kernel_message = t::KernelMessage { - id: request_id, - source: source.clone(), - target: t::Address::de_wit(target.clone()), - rsvp: match ( - request.inherit, - request.expects_response, - &self.current_incoming_message, - ) { - // this request expects response, so receives any response - // make sure to use the real source, not a fake injected-by-kernel source - (_, Some(_), _) => Some(self.metadata.our.clone()), - // this request inherits, so response will be routed to prompting message - (true, None, Some(ref prompt)) => prompt.rsvp.clone(), - // this request doesn't inherit, and doesn't itself want a response - (false, None, _) => None, - // no rsvp because neither prompting message nor this request wants a response - (_, None, None) => None, - }, - message: t::Message::Request(inner_request), - lazy_load_blob: blob.clone(), - }; + if !request.capabilities.is_empty() { + request.capabilities = { + let (tx, rx) = tokio::sync::oneshot::channel(); + self.caps_oracle + .send(t::CapMessage::FilterCaps { + on: self.metadata.our.process.clone(), + caps: request + .capabilities + .iter() + .map(|cap| t::de_wit_capability(cap.clone()).0) + .collect(), + responder: tx, + }) + .await?; + rx.await? + }; + } - // modify the process' context map as needed. - // if there is a prompting message, we need to store the ultimate - // even if there is no new context string. - // TODO optimize this significantly + // if the request expects a response, modify the process' context map as needed + // and set a timer. + // TODO optimize this SIGNIFICANTLY: stop spawning tasks + // and use a global clock + garbage collect step to check for timeouts if let Some(timeout_secs) = request.expects_response { let self_sender = self.self_sender.clone(); + let original_target = t::Address::de_wit(target.clone()); let timeout_handle = tokio::spawn(async move { tokio::time::sleep(std::time::Duration::from_secs(timeout_secs)).await; let _ = self_sender .send(Err(t::WrappedSendError { id: request_id, - source: t::Address::de_wit(target.clone()), // TODO check this + source: original_target.clone(), error: t::SendError { kind: t::SendErrorKind::Timeout, - target: t::Address::de_wit(target), - message: t::Message::Request(t::de_wit_request(request.clone())), - lazy_load_blob: blob, + target: original_target, + message: t::Message::Request(request.clone()), + lazy_load_blob: blob.clone(), }, })) .await; @@ -225,12 +258,8 @@ impl ProcessState { self.contexts.insert( request_id, ( - t::ProcessContext { - prompting_message: if self.current_incoming_message.is_some() { - self.current_incoming_message.clone() - } else { - None - }, + ProcessContext { + message: predecessor_request.cloned(), context: new_context, }, timeout_handle, @@ -238,6 +267,34 @@ impl ProcessState { ); } + // rsvp is set based on this priority: + // 1. whether this request expects a response -- if so, rsvp = our address, always + // 2. whether this request inherits -- if so, rsvp = prompting message's rsvp + // 3. if neither, rsvp = None + let kernel_message = t::KernelMessage { + id: request_id, + source, + target: t::Address::de_wit(target), + rsvp: match ( + request.expects_response, + request.inherit, + &self.current_incoming_message, + ) { + (Some(_), _, _) => { + // this request expects response, so receives any response + // make sure to use the real source, not a fake injected-by-kernel source + Some(self.metadata.our.clone()) + } + (None, true, Some(ref prompt)) => { + // this request inherits, so response will be routed to prompting message + prompt.rsvp.clone() + } + _ => None, + }, + message: t::Message::Request(request), + lazy_load_blob: blob, + }; + self.send_to_loop .send(kernel_message) .await @@ -307,39 +364,10 @@ impl ProcessState { .expect("fatal: kernel couldn't send response"); } - /// instead of ingesting latest, wait for a specific ID and queue all others - async fn get_specific_message_for_process( - &mut self, - awaited_message_id: u64, - ) -> Result<(wit::Address, wit::Message), (wit::SendError, Option)> { - // first, check if the awaited message is already in the queue and handle if so - for (i, message) in self.message_queue.iter().enumerate() { - match message { - Ok(ref km) if km.id == awaited_message_id => { - let km = self.message_queue.remove(i).unwrap(); - return self.kernel_message_to_process_receive(km.clone()); - } - _ => continue, - } - } - // next, wait for the awaited message to arrive - loop { - let res = self.recv_in_process.recv().await.unwrap(); - match res { - Ok(ref km) if km.id == awaited_message_id => { - return self.kernel_message_to_process_receive(Ok(km.clone())) - } - Ok(km) => self.message_queue.push_back(Ok(km)), - Err(e) if e.id == awaited_message_id => { - return self.kernel_message_to_process_receive(Err(e)) - } - Err(e) => self.message_queue.push_back(Err(e)), - } - } - } - - /// convert a message from the main event loop into a result for the process to receive - /// if the message is a response or error, get context if we have one + /// Convert a message from the main event loop into a result for the process to receive. + /// If the message is a response or error, get context if we have one. + /// If there exists a current message before this, if it is a Request, it will get + /// saved as nested_request. fn kernel_message_to_process_receive( &mut self, res: Result, @@ -436,19 +464,43 @@ impl ProcessState { /// Given the current process state, return the id and target that /// a response it emits should have. This takes into - /// account the `rsvp` of the prompting message, if any. + /// account the `rsvp` of the current or nested message, if any. async fn make_response_id_target(&self) -> Option<(u64, t::Address)> { - let Some(ref prompting_message) = self.current_incoming_message else { - println!("need non-None prompting_message to handle Response"); + let Some(ref current_incoming_message) = self.current_incoming_message else { + println!("need non-None incoming_message to handle Response\r"); return None; }; - Some(( - prompting_message.id, - match &prompting_message.rsvp { - None => prompting_message.source.clone(), - Some(address) => address.clone(), - }, - )) + match current_incoming_message.message { + t::Message::Request(ref request) => { + // if the current message is a Request, the response will always go there. + Some(( + current_incoming_message.id, + match ¤t_incoming_message.rsvp { + None => current_incoming_message.source.clone(), + Some(address) => address.clone(), + }, + )) + } + t::Message::Response((ref response, ref _maybe_context)) => { + // if the current message is a Response, we look at the nested request + // to see where the response should go. + match &self.nested_request { + None => { + println!( + "need non-None incoming message or nested_request to handle Response\r" + ); + return None; + } + Some(ref nested) => Some(( + nested.id, + match &nested.rsvp { + None => nested.source.clone(), + Some(address) => address.clone(), + }, + )), + } + } + } } } From 62489b3ac311412ef9d744d051142c941539d8b6 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Tue, 6 Feb 2024 17:48:36 -0500 Subject: [PATCH 011/171] DropCapabilities working in OnExit for scripts --- Cargo.lock | 2 +- kinode/packages/terminal/terminal/Cargo.toml | 2 +- kinode/packages/terminal/terminal/src/lib.rs | 220 ++++++++++++------- kinode/src/kernel/mod.rs | 36 ++- kinode/src/kernel/process.rs | 107 +++++---- lib/src/core.rs | 11 +- 6 files changed, 245 insertions(+), 133 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 74b313af7..144afee19 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3312,7 +3312,7 @@ dependencies = [ [[package]] name = "kinode_process_lib" version = "0.5.8" -source = "git+https://github.com/uqbar-dao/process_lib.git?tag=v0.5.9-alpha#09d411dfab23f9049fbbcbef1c56157191269ab2" +source = "git+https://github.com/uqbar-dao/process_lib.git?rev=9668c82#9668c820986e32f7b8430648147c2498d5abb9f8" dependencies = [ "anyhow", "bincode", diff --git a/kinode/packages/terminal/terminal/Cargo.toml b/kinode/packages/terminal/terminal/Cargo.toml index c036ab502..111a3c401 100644 --- a/kinode/packages/terminal/terminal/Cargo.toml +++ b/kinode/packages/terminal/terminal/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] anyhow = "1.0" bincode = "1.3.3" -kinode_process_lib = { git = "https://github.com/uqbar-dao/process_lib.git", tag = "v0.5.9-alpha" } +kinode_process_lib = { git = "https://github.com/uqbar-dao/process_lib.git", rev = "9668c82" } rand = "0.8" regex = "1.10.3" serde = { version = "1.0", features = ["derive"] } diff --git a/kinode/packages/terminal/terminal/src/lib.rs b/kinode/packages/terminal/terminal/src/lib.rs index 3636477f1..cf8348655 100644 --- a/kinode/packages/terminal/terminal/src/lib.rs +++ b/kinode/packages/terminal/terminal/src/lib.rs @@ -18,9 +18,12 @@ wit_bindgen::generate!({ }); #[derive(Debug, Serialize, Deserialize)] -struct EditAliases { - alias: String, - process: Option, +enum TerminalAction { + EditAlias { + alias: String, + process: Option, + }, + ProcessEnded(Vec<(ProcessId, Capability)>), } #[derive(Serialize, Deserialize)] @@ -130,33 +133,30 @@ impl Guest for Component { Ok(()) => continue, Err(e) => println!("terminal: {e}"), } - } else if state.our.node == source.node { - let Ok(edit_aliases) = serde_json::from_slice::(&body) else { - println!("terminal: invalid action!"); + } else if state.our.node == source.node + && state.our.package() == source.package() + { + let Ok(action) = serde_json::from_slice::(&body) else { + println!("terminal: failed to parse action from: {}", source); continue; }; - - match edit_aliases.process { - Some(process) => { - state - .aliases - .insert(edit_aliases.alias.clone(), process.clone()); - println!( - "terminal: alias {} set to {}", - edit_aliases.alias, process - ); + match action { + TerminalAction::EditAlias { alias, process } => { + match handle_alias_change(&mut state, alias, process) { + Ok(()) => continue, + Err(e) => println!("terminal: {e}"), + }; } - None => { - state.aliases.remove(&edit_aliases.alias); - println!("terminal: alias {} removed", edit_aliases.alias); + TerminalAction::ProcessEnded(drop_caps) => { + println!("terminal: process ended: {}", source); + match handle_process_cleanup(drop_caps) { + Ok(()) => continue, + Err(e) => println!("terminal: {e}"), + } } } - if let Ok(new_state) = bincode::serialize(&state) { - set_state(&new_state); - } else { - println!("terminal: failed to serialize state!"); - } } else { + println!("terminal: ignoring message from: {}", source); continue; } } @@ -205,7 +205,7 @@ fn handle_run( }; let wasm_path = format!("{}{}", drive_path, wasm_path); // build initial caps - let process_id = format!("{}:{}", rand::random::(), package); // all scripts are given random process IDs + let process_id = format!("{}:terminal:sys", rand::random::()); // all scripts are given random process IDs let Ok(parsed_new_process_id) = process_id.parse::() else { return Err(anyhow::anyhow!("app store: invalid process id!")); }; @@ -217,13 +217,79 @@ fn handle_run( action: vfs::VfsAction::Read, })?) .send_and_await_response(5)??; + // process the caps we are going to grant to other processes + let mut granted_caps: Vec<(ProcessId, Capability)> = vec![]; + if let Some(to_grant) = &entry.grant_capabilities { + for value in to_grant { + match value { + serde_json::Value::String(process_name) => { + if let Ok(parsed_process_id) = process_name.parse::() { + granted_caps.push(( + parsed_process_id, + Capability { + issuer: Address { + node: our.node.clone(), + process: parsed_new_process_id.clone(), + }, + params: "\"messaging\"".into(), + }, + )); + } + } + serde_json::Value::Object(map) => { + if let Some(process_name) = map.get("process") { + if let Ok(parsed_process_id) = process_name + .as_str() + .unwrap_or_default() + .parse::() + { + if let Some(params) = map.get("params") { + granted_caps.push(( + parsed_process_id, + Capability { + issuer: Address { + node: our.node.clone(), + process: parsed_new_process_id.clone(), + }, + params: params.to_string(), + }, + )); + } + } + } + } + _ => { + continue; + } + } + } + } + for (process, cap) in granted_caps.clone().into_iter() { + Request::new() + .target(("our", "kernel", "distro", "sys")) + .body(serde_json::to_vec(&kt::KernelCommand::GrantCapabilities { + target: process, + capabilities: vec![kt::de_wit_capability(cap)], + })?) + .send()?; + } Request::new() .target(("our", "kernel", "distro", "sys")) .body(serde_json::to_vec(&kt::KernelCommand::InitializeProcess { id: parsed_new_process_id.clone(), wasm_bytes_handle: wasm_path.clone(), wit_version: None, - on_exit: kt::OnExit::None, // TODO this should send a message back to runner:script:sys so that it can Drop capabilities + on_exit: kt::OnExit::Requests(vec![( + kt::de_wit_address(our.clone()), + kt::Request { + inherit: false, + expects_response: None, + body: serde_json::to_vec(&TerminalAction::ProcessEnded(granted_caps))?, + metadata: None, + capabilities: vec![], + }, + None, + )]), initial_capabilities: HashSet::new(), public: entry.public, })?) @@ -269,6 +335,12 @@ fn handle_run( } } } + // always give it the cap to message the terminal back + // NOTE a malicious script could use this to drop a ton of caps from other processes + requested_caps.push(kt::de_wit_capability(Capability { + issuer: our.clone(), + params: "\"messaging\"".to_string(), + })); if entry.request_networking { requested_caps.push(kt::de_wit_capability(Capability { issuer: Address::new(&our.node, ("kernel", "distro", "sys")), @@ -287,7 +359,7 @@ fn handle_run( parsed_new_process_id.clone(), wasm_path.clone(), "None", - kt::OnExit::None, + kt::OnExit::None, // TODO fix this entry.public, { let mut caps_string = "[".to_string(); @@ -305,63 +377,6 @@ fn handle_run( capabilities: requested_caps, })?) .send()?; - if let Some(to_grant) = &entry.grant_capabilities { - for value in to_grant { - match value { - serde_json::Value::String(process_name) => { - if let Ok(parsed_process_id) = process_name.parse::() { - let _ = Request::new() - .target(("our", "kernel", "distro", "sys")) - .body( - serde_json::to_vec(&kt::KernelCommand::GrantCapabilities { - target: parsed_process_id, - capabilities: vec![kt::Capability { - issuer: Address { - node: our.node.clone(), - process: parsed_new_process_id.clone(), - }, - params: "\"messaging\"".into(), - }], - }) - .unwrap(), - ) - .send()?; - } - } - serde_json::Value::Object(map) => { - if let Some(process_name) = map.get("process") { - if let Ok(parsed_process_id) = process_name - .as_str() - .unwrap_or_default() - .parse::() - { - if let Some(params) = map.get("params") { - let _ = Request::new() - .target(("our", "kernel", "distro", "sys")) - .body( - serde_json::to_vec(&kt::KernelCommand::GrantCapabilities { - target: parsed_process_id, - capabilities: vec![kt::Capability { - issuer: Address { - node: our.node.clone(), - process: parsed_new_process_id.clone(), - }, - params: params.to_string(), - }], - }) - .unwrap(), - ) - .send()?; - } - } - } - } - _ => { - continue; - } - } - } - } let _ = Request::new() .target(("our", "kernel", "distro", "sys")) .body(serde_json::to_vec(&kt::KernelCommand::RunProcess( @@ -396,3 +411,40 @@ fn handle_run( Ok(()) } + +fn handle_alias_change( + state: &mut TerminalState, + alias: String, + process: Option, +) -> anyhow::Result<()> { + match process { + Some(process) => { + state.aliases.insert(alias.clone(), process.clone()); + println!("terminal: alias {} set to {}", alias, process); + } + None => { + state.aliases.remove(&alias); + println!("terminal: alias {} removed", alias); + } + } + if let Ok(new_state) = bincode::serialize(&state) { + set_state(&new_state); + Ok(()) + } else { + Err(anyhow!("failed to serialize state!")) + } +} + +fn handle_process_cleanup(caps_to_remove: Vec<(ProcessId, Capability)>) -> anyhow::Result<()> { + for (process, cap) in caps_to_remove { + println!("terminal: cleaning up process {}, {}", process, cap); + Request::new() + .target(("our", "kernel", "distro", "sys")) + .body(serde_json::to_vec(&kt::KernelCommand::DropCapabilities { + target: process, + capabilities: vec![kt::de_wit_capability(cap)], + })?) + .send()?; + } + Ok(()) +} diff --git a/kinode/src/kernel/mod.rs b/kinode/src/kernel/mod.rs index 8e1be6a05..ff34b71d4 100644 --- a/kinode/src/kernel/mod.rs +++ b/kinode/src/kernel/mod.rs @@ -337,6 +337,36 @@ async fn handle_kernel_request( entry.capabilities.extend(signed_caps); let _ = persist_state(&our_name, &send_to_loop, process_map).await; } + t::KernelCommand::DropCapabilities { + target, + capabilities, + } => { + let Some(entry) = process_map.get_mut(&target) else { + let _ = send_to_terminal + .send(t::Printout { + verbosity: 0, + content: format!( + "kernel: no such process {:?} to DropCapabilities", + target + ), + }) + .await; + return; + }; + let _ = send_to_terminal + .send(t::Printout { + verbosity: 0, + content: format!( + "kernel: got DropCapabilities {:?}", + capabilities.clone() + ), + }) + .await; + for cap in capabilities { + entry.capabilities.remove(&cap); + } + let _ = persist_state(&our_name, &send_to_loop, process_map).await; + } // send 'run' message to a process that's already been initialized t::KernelCommand::RunProcess(process_id) => { if let Some(ProcessSender::Userspace(process_sender)) = senders.get(&process_id) { @@ -1058,13 +1088,15 @@ pub async fn kernel( let _ = persist_state(&our.name, &send_to_loop, &process_map).await; let _ = responder.send(true); }, - t::CapMessage::_Drop { on, cap, responder } => { + t::CapMessage::Drop { on, caps, responder } => { // remove cap from process map let Some(entry) = process_map.get_mut(&on) else { let _ = responder.send(false); continue; }; - entry.capabilities.remove(&cap); + for cap in &caps { + entry.capabilities.remove(&cap); + } let _ = persist_state(&our.name, &send_to_loop, &process_map).await; let _ = responder.send(true); }, diff --git a/kinode/src/kernel/process.rs b/kinode/src/kernel/process.rs index 02d355947..3e929d07b 100644 --- a/kinode/src/kernel/process.rs +++ b/kinode/src/kernel/process.rs @@ -597,30 +597,28 @@ pub async fn make_process_loop( }) .collect(); - // send message to tell main kernel loop to remove handler - send_to_loop - .send(t::KernelMessage { - id: rand::random(), - source: our_kernel.clone(), - target: our_kernel.clone(), - rsvp: None, - message: t::Message::Request(t::Request { - inherit: false, - expects_response: None, - body: serde_json::to_vec(&t::KernelCommand::KillProcess( - metadata.our.process.clone(), - )) - .unwrap(), - metadata: None, - capabilities: vec![], - }), - lazy_load_blob: None, - }) - .await?; - // fulfill the designated OnExit behavior match metadata.on_exit { t::OnExit::None => { + send_to_loop + .send(t::KernelMessage { + id: rand::random(), + source: our_kernel.clone(), + target: our_kernel.clone(), + rsvp: None, + message: t::Message::Request(t::Request { + inherit: false, + expects_response: None, + body: serde_json::to_vec(&t::KernelCommand::KillProcess( + metadata.our.process.clone(), + )) + .unwrap(), + metadata: None, + capabilities: vec![], + }), + lazy_load_blob: None, + }) + .await?; let _ = send_to_terminal .send(t::Printout { verbosity: 1, @@ -630,6 +628,25 @@ pub async fn make_process_loop( } // if restart, tell ourselves to init the app again, with same capabilities t::OnExit::Restart => { + send_to_loop + .send(t::KernelMessage { + id: rand::random(), + source: our_kernel.clone(), + target: our_kernel.clone(), + rsvp: None, + message: t::Message::Request(t::Request { + inherit: false, + expects_response: None, + body: serde_json::to_vec(&t::KernelCommand::KillProcess( + metadata.our.process.clone(), + )) + .unwrap(), + metadata: None, + capabilities: vec![], + }), + lazy_load_blob: None, + }) + .await?; if is_error { let _ = send_to_terminal .send(t::Printout { @@ -712,30 +729,36 @@ pub async fn make_process_loop( .await?; for (address, mut request, blob) in requests { request.expects_response = None; - let (tx, rx) = tokio::sync::oneshot::channel(); - caps_oracle - .send(t::CapMessage::Has { - on: metadata.our.process.clone(), - cap: t::Capability { - issuer: address.clone(), - params: "\"messaging\"".into(), - }, - responder: tx, + send_to_loop + .send(t::KernelMessage { + id: rand::random(), + source: metadata.our.clone(), + target: address, + rsvp: None, + message: t::Message::Request(request), + lazy_load_blob: blob, }) .await?; - if let Ok(true) = rx.await { - send_to_loop - .send(t::KernelMessage { - id: rand::random(), - source: metadata.our.clone(), - target: address, - rsvp: None, - message: t::Message::Request(request), - lazy_load_blob: blob, - }) - .await?; - } } + send_to_loop + .send(t::KernelMessage { + id: rand::random(), + source: our_kernel.clone(), + target: our_kernel.clone(), + rsvp: None, + message: t::Message::Request(t::Request { + inherit: false, + expects_response: None, + body: serde_json::to_vec(&t::KernelCommand::KillProcess( + metadata.our.process.clone(), + )) + .unwrap(), + metadata: None, + capabilities: vec![], + }), + lazy_load_blob: None, + }) + .await?; } } Ok(()) diff --git a/lib/src/core.rs b/lib/src/core.rs index d9885be79..a6f39096d 100644 --- a/lib/src/core.rs +++ b/lib/src/core.rs @@ -928,6 +928,11 @@ pub enum KernelCommand { target: ProcessId, capabilities: Vec, }, + /// Drop capabilities. Does nothing if process doesn't have these caps + DropCapabilities { + target: ProcessId, + capabilities: Vec, + }, /// Tell the kernel to run a process that has already been installed. /// TODO: in the future, this command could be extended to allow for /// resource provision. @@ -966,10 +971,10 @@ pub enum CapMessage { caps: Vec, responder: tokio::sync::oneshot::Sender, }, - _Drop { - // not used yet! + /// root delete: uncritically remove all `caps` from `on` + Drop { on: ProcessId, - cap: Capability, + caps: Vec, responder: tokio::sync::oneshot::Sender, }, /// does `on` have `cap` in its store? From b33af8e9581bfb92ebdee425f42d56173bb8c56f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 6 Feb 2024 22:49:07 +0000 Subject: [PATCH 012/171] Format Rust code using rustfmt --- kinode/src/kernel/mod.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/kinode/src/kernel/mod.rs b/kinode/src/kernel/mod.rs index ff34b71d4..1195213f2 100644 --- a/kinode/src/kernel/mod.rs +++ b/kinode/src/kernel/mod.rs @@ -356,10 +356,7 @@ async fn handle_kernel_request( let _ = send_to_terminal .send(t::Printout { verbosity: 0, - content: format!( - "kernel: got DropCapabilities {:?}", - capabilities.clone() - ), + content: format!("kernel: got DropCapabilities {:?}", capabilities.clone()), }) .await; for cap in capabilities { From b0efd27f537a1f9a28f55b14e7769e9da1d8b916 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Wed, 7 Feb 2024 12:42:05 -0300 Subject: [PATCH 013/171] version bump (0.6.0) --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- kinode/Cargo.lock | 2 +- kinode/Cargo.toml | 2 +- lib/Cargo.toml | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e217f4e9c..57ce19aa7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3086,7 +3086,7 @@ dependencies = [ [[package]] name = "kinode" -version = "0.5.3" +version = "0.6.0" dependencies = [ "aes-gcm", "anyhow", @@ -3150,7 +3150,7 @@ dependencies = [ [[package]] name = "kinode_lib" -version = "0.5.3" +version = "0.6.0" dependencies = [ "lib", ] @@ -3283,7 +3283,7 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "lib" -version = "0.5.3" +version = "0.6.0" dependencies = [ "ethers", "ethers-providers", diff --git a/Cargo.toml b/Cargo.toml index cd2c20f38..5e8178580 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "kinode_lib" authors = ["KinodeDAO"] -version = "0.5.3" +version = "0.6.0" edition = "2021" description = "A general-purpose sovereign cloud computing platform" homepage = "https://kinode.org" diff --git a/kinode/Cargo.lock b/kinode/Cargo.lock index f9119e453..617d2dcf9 100644 --- a/kinode/Cargo.lock +++ b/kinode/Cargo.lock @@ -2703,7 +2703,7 @@ dependencies = [ [[package]] name = "kinode" -version = "0.5.3" +version = "0.6.0" dependencies = [ "aes-gcm 0.10.2", "anyhow", diff --git a/kinode/Cargo.toml b/kinode/Cargo.toml index 2a8a51979..74c702e1d 100644 --- a/kinode/Cargo.toml +++ b/kinode/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "kinode" authors = ["KinodeDAO"] -version = "0.5.3" +version = "0.6.0" edition = "2021" description = "A general-purpose sovereign cloud computing platform" homepage = "https://kinode.org" diff --git a/lib/Cargo.toml b/lib/Cargo.toml index fe8e6592f..24de5a927 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "lib" authors = ["KinodeDAO"] -version = "0.5.3" +version = "0.6.0" edition = "2021" description = "A general-purpose sovereign cloud computing platform" homepage = "https://kinode.org" From b31a95ae669d889b319b6d3b92c0d5699cee5a56 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Wed, 7 Feb 2024 14:08:54 -0500 Subject: [PATCH 014/171] drop_capabilities added to standard_host --- kinode/src/kernel/standard_host.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/kinode/src/kernel/standard_host.rs b/kinode/src/kernel/standard_host.rs index 3e9c30f41..b30022da4 100644 --- a/kinode/src/kernel/standard_host.rs +++ b/kinode/src/kernel/standard_host.rs @@ -398,6 +398,24 @@ impl StandardHost for process::ProcessWasi { Ok(()) } + async fn drop_capabilities(&mut self, caps: Vec) -> Result<()> { + let (tx, rx) = tokio::sync::oneshot::channel(); + let _ = self + .process + .caps_oracle + .send(t::CapMessage::Drop { + on: self.process.metadata.our.process.clone(), + caps: caps + .iter() + .map(|cap| t::de_wit_capability(cap.clone()).0) + .collect(), + responder: tx, + }) + .await?; + let _ = rx.await?; + Ok(()) + } + async fn our_capabilities(&mut self) -> Result> { let (tx, rx) = tokio::sync::oneshot::channel(); let _ = self From 371a31bf28aad79bef29d5cdea86574619541a30 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Wed, 7 Feb 2024 16:34:01 -0500 Subject: [PATCH 015/171] alias: better printout if alias dne --- kinode/packages/terminal/terminal/src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kinode/packages/terminal/terminal/src/lib.rs b/kinode/packages/terminal/terminal/src/lib.rs index cf8348655..93f4c1762 100644 --- a/kinode/packages/terminal/terminal/src/lib.rs +++ b/kinode/packages/terminal/terminal/src/lib.rs @@ -423,8 +423,12 @@ fn handle_alias_change( println!("terminal: alias {} set to {}", alias, process); } None => { - state.aliases.remove(&alias); - println!("terminal: alias {} removed", alias); + if state.aliases.contains_key(&alias) { + state.aliases.remove(&alias); + println!("terminal: alias {} removed", alias); + } else { + println!("terminal: alias {} not found", alias); + } } } if let Ok(new_state) = bincode::serialize(&state) { From c59a6b0b2edd62c8ec6b3d5aa06ba274ac967b83 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Wed, 7 Feb 2024 16:58:51 -0500 Subject: [PATCH 016/171] alias fixed --- kinode/packages/terminal/alias/src/lib.rs | 14 +++++++----- kinode/packages/terminal/terminal/src/lib.rs | 23 +++++++++++++++++++- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/kinode/packages/terminal/alias/src/lib.rs b/kinode/packages/terminal/alias/src/lib.rs index f7143ffc7..ed6fbca8f 100644 --- a/kinode/packages/terminal/alias/src/lib.rs +++ b/kinode/packages/terminal/alias/src/lib.rs @@ -12,10 +12,12 @@ wit_bindgen::generate!({ }, }); -#[derive(Serialize, Deserialize)] -struct EditAliases { - alias: String, - process: Option, +#[derive(Debug, Serialize, Deserialize)] +enum TerminalAction { + EditAlias { + alias: String, + process: Option, + }, } call_init!(init); @@ -38,7 +40,7 @@ fn init(_our: Address) { let _ = Request::new() .target(("our", "terminal", "terminal", "sys")) .body( - json!(EditAliases { + json!(TerminalAction::EditAlias { alias: alias.to_string(), process: None }) @@ -53,7 +55,7 @@ fn init(_our: Address) { let _ = Request::new() .target(("our", "terminal", "terminal", "sys")) .body( - json!(EditAliases { + json!(TerminalAction::EditAlias { alias: alias.to_string(), process: Some(process) }) diff --git a/kinode/packages/terminal/terminal/src/lib.rs b/kinode/packages/terminal/terminal/src/lib.rs index 93f4c1762..92cf55ec7 100644 --- a/kinode/packages/terminal/terminal/src/lib.rs +++ b/kinode/packages/terminal/terminal/src/lib.rs @@ -137,6 +137,7 @@ impl Guest for Component { && state.our.package() == source.package() { let Ok(action) = serde_json::from_slice::(&body) else { + println!("HERE {}", String::from_utf8(body).unwrap_or_default()); println!("terminal: failed to parse action from: {}", source); continue; }; @@ -148,7 +149,6 @@ impl Guest for Component { }; } TerminalAction::ProcessEnded(drop_caps) => { - println!("terminal: process ended: {}", source); match handle_process_cleanup(drop_caps) { Ok(()) => continue, Err(e) => println!("terminal: {e}"), @@ -419,6 +419,27 @@ fn handle_alias_change( ) -> anyhow::Result<()> { match process { Some(process) => { + // check to make sure the script is actually a script + let drive_path = format!("/{}:{}/pkg", process.package(), process.publisher()); + Request::new() + .target(("our", "vfs", "distro", "sys")) + .body(serde_json::to_vec(&vfs::VfsRequest { + path: format!("{}/scripts.json", drive_path), + action: vfs::VfsAction::Read, + })?) + .send_and_await_response(5)??; + let Some(blob) = get_blob() else { + return Err(anyhow::anyhow!( + "couldn't find /{}/pkg/scripts.json", + process.package() + )); + }; + let dot_scripts = String::from_utf8(blob.bytes)?; + let dot_scripts = + serde_json::from_str::>(&dot_scripts)?; + let Some(_) = dot_scripts.get(&format!("{}.wasm", process.process())) else { + return Err(anyhow::anyhow!("script not in scripts.json file")); + }; state.aliases.insert(alias.clone(), process.clone()); println!("terminal: alias {} set to {}", alias, process); } From dd64718e404aef469ffed8e84f8fa2a356f15cf5 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Wed, 7 Feb 2024 17:16:35 -0500 Subject: [PATCH 017/171] reversions --- README.md | 2 +- kinode/src/kernel/standard_host.rs | 35 +++++++++++++++--------------- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index cb0260a96..867acfa80 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you have questions, join the [Kinode discord](https://discord.gg/TCgdca5Bjt) ```bash # Clone the repo. -git clone https://github.com/kinode-dao/kinode.git +git clone git@github.com:kinode-dao/kinode.git # Get some stuff so we can build Wasm. diff --git a/kinode/src/kernel/standard_host.rs b/kinode/src/kernel/standard_host.rs index b30022da4..b4cbaac69 100644 --- a/kinode/src/kernel/standard_host.rs +++ b/kinode/src/kernel/standard_host.rs @@ -398,23 +398,24 @@ impl StandardHost for process::ProcessWasi { Ok(()) } - async fn drop_capabilities(&mut self, caps: Vec) -> Result<()> { - let (tx, rx) = tokio::sync::oneshot::channel(); - let _ = self - .process - .caps_oracle - .send(t::CapMessage::Drop { - on: self.process.metadata.our.process.clone(), - caps: caps - .iter() - .map(|cap| t::de_wit_capability(cap.clone()).0) - .collect(), - responder: tx, - }) - .await?; - let _ = rx.await?; - Ok(()) - } + // TODO 0.6.0 + // async fn drop_capabilities(&mut self, caps: Vec) -> Result<()> { + // let (tx, rx) = tokio::sync::oneshot::channel(); + // let _ = self + // .process + // .caps_oracle + // .send(t::CapMessage::Drop { + // on: self.process.metadata.our.process.clone(), + // caps: caps + // .iter() + // .map(|cap| t::de_wit_capability(cap.clone()).0) + // .collect(), + // responder: tx, + // }) + // .await?; + // let _ = rx.await?; + // Ok(()) + // } async fn our_capabilities(&mut self) -> Result> { let (tx, rx) = tokio::sync::oneshot::channel(); From e3ae30846134296e422d8564de4727379533841c Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Wed, 7 Feb 2024 17:18:51 -0500 Subject: [PATCH 018/171] debug print removed --- kinode/packages/terminal/terminal/src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kinode/packages/terminal/terminal/src/lib.rs b/kinode/packages/terminal/terminal/src/lib.rs index 92cf55ec7..d70f9dce2 100644 --- a/kinode/packages/terminal/terminal/src/lib.rs +++ b/kinode/packages/terminal/terminal/src/lib.rs @@ -137,7 +137,6 @@ impl Guest for Component { && state.our.package() == source.package() { let Ok(action) = serde_json::from_slice::(&body) else { - println!("HERE {}", String::from_utf8(body).unwrap_or_default()); println!("terminal: failed to parse action from: {}", source); continue; }; @@ -473,3 +472,5 @@ fn handle_process_cleanup(caps_to_remove: Vec<(ProcessId, Capability)>) -> anyho } Ok(()) } + +fn get_entry() -> anyhow::Result<()> {} From 3e6594f11cb3841f9905c54bf2919c62df81951b Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Wed, 7 Feb 2024 18:45:22 -0500 Subject: [PATCH 019/171] terminal refactor --- Cargo.lock | 23 +++++- kinode/packages/terminal/terminal/Cargo.toml | 2 +- kinode/packages/terminal/terminal/src/lib.rs | 76 +++++++++----------- 3 files changed, 53 insertions(+), 48 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 48f04c1a0..6549b700f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3191,8 +3191,25 @@ dependencies = [ [[package]] name = "kinode_process_lib" -version = "0.5.8" -source = "git+https://github.com/uqbar-dao/process_lib.git?rev=9668c82#9668c820986e32f7b8430648147c2498d5abb9f8" +version = "0.5.9" +source = "git+https://github.com/uqbar-dao/process_lib.git?tag=v0.5.9-alpha#5e705086bbd10fde89e11d3e3671f6a618a875a7" +dependencies = [ + "anyhow", + "bincode", + "http 1.0.0", + "mime_guess", + "rand 0.8.5", + "serde", + "serde_json", + "thiserror", + "url", + "wit-bindgen", +] + +[[package]] +name = "kinode_process_lib" +version = "0.6.0" +source = "git+https://github.com/uqbar-dao/process_lib.git?rev=509b1ed#509b1ed65041762dc6dfa7dd85811b7783c1997c" dependencies = [ "anyhow", "bincode", @@ -5535,7 +5552,7 @@ version = "0.1.0" dependencies = [ "anyhow", "bincode", - "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", + "kinode_process_lib 0.6.0", "rand 0.8.5", "regex", "serde", diff --git a/kinode/packages/terminal/terminal/Cargo.toml b/kinode/packages/terminal/terminal/Cargo.toml index 111a3c401..a46918194 100644 --- a/kinode/packages/terminal/terminal/Cargo.toml +++ b/kinode/packages/terminal/terminal/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] anyhow = "1.0" bincode = "1.3.3" -kinode_process_lib = { git = "https://github.com/uqbar-dao/process_lib.git", rev = "9668c82" } +kinode_process_lib = { git = "https://github.com/uqbar-dao/process_lib.git", rev = "509b1ed" } rand = "0.8" regex = "1.10.3" serde = { version = "1.0", features = ["derive"] } diff --git a/kinode/packages/terminal/terminal/src/lib.rs b/kinode/packages/terminal/terminal/src/lib.rs index d70f9dce2..414aef517 100644 --- a/kinode/packages/terminal/terminal/src/lib.rs +++ b/kinode/packages/terminal/terminal/src/lib.rs @@ -3,7 +3,7 @@ use kinode_process_lib::kernel_types as kt; use kinode_process_lib::kinode::process::standard as wit; use kinode_process_lib::{ get_blob, get_typed_state, our_capabilities, print_to_terminal, println, set_state, vfs, - Address, Capability, PackageId, ProcessId, Request, + Address, Capability, ProcessId, Request, }; use regex::Regex; use serde::{Deserialize, Serialize}; @@ -70,9 +70,7 @@ fn parse_command(state: &mut TerminalState, line: &str) -> anyhow::Result<()> { None => (args.to_string(), None), }; - let wasm_path = format!("{}.wasm", process.process()); - let package = PackageId::new(process.package(), process.publisher()); - match handle_run(&state.our, &package, wasm_path, pipe.0, pipe.1) { + match handle_run(&state.our, &process, pipe.0, pipe.1) { Ok(_) => Ok(()), // TODO clean up process Err(e) => Err(anyhow!("failed to instantiate script: {}", e)), } @@ -173,28 +171,13 @@ impl Guest for Component { fn handle_run( our: &Address, - package: &PackageId, - wasm_path: String, + process: &ProcessId, args: String, pipe: Option<(String, u64)>, ) -> anyhow::Result<()> { - let drive_path = format!("/{}/pkg", package); - Request::new() - .target(("our", "vfs", "distro", "sys")) - .body(serde_json::to_vec(&vfs::VfsRequest { - path: format!("{}/scripts.json", drive_path), - action: vfs::VfsAction::Read, - })?) - .send_and_await_response(5)??; - let Some(blob) = get_blob() else { - return Err(anyhow::anyhow!( - "couldn't find /{}/pkg/scripts.json", - package - )); - }; - let dot_scripts = String::from_utf8(blob.bytes)?; - let dot_scripts = serde_json::from_str::>(&dot_scripts)?; - let Some(entry) = dot_scripts.get(&wasm_path) else { + let wasm_path = format!("{}.wasm", process.process()); + let drive_path = format!("/{}:{}/pkg", process.package(), process.publisher()); + let Ok(entry) = get_entry(process) else { return Err(anyhow::anyhow!("script not in scripts.json file")); }; let wasm_path = if wasm_path.starts_with("/") { @@ -418,27 +401,11 @@ fn handle_alias_change( ) -> anyhow::Result<()> { match process { Some(process) => { - // check to make sure the script is actually a script - let drive_path = format!("/{}:{}/pkg", process.package(), process.publisher()); - Request::new() - .target(("our", "vfs", "distro", "sys")) - .body(serde_json::to_vec(&vfs::VfsRequest { - path: format!("{}/scripts.json", drive_path), - action: vfs::VfsAction::Read, - })?) - .send_and_await_response(5)??; - let Some(blob) = get_blob() else { - return Err(anyhow::anyhow!( - "couldn't find /{}/pkg/scripts.json", - process.package() - )); - }; - let dot_scripts = String::from_utf8(blob.bytes)?; - let dot_scripts = - serde_json::from_str::>(&dot_scripts)?; - let Some(_) = dot_scripts.get(&format!("{}.wasm", process.process())) else { - return Err(anyhow::anyhow!("script not in scripts.json file")); + // first check to make sure the script is actually a script + let Ok(_) = get_entry(&process) else { + return Err(anyhow!("terminal: process {} not found", process)); }; + state.aliases.insert(alias.clone(), process.clone()); println!("terminal: alias {} set to {}", alias, process); } @@ -473,4 +440,25 @@ fn handle_process_cleanup(caps_to_remove: Vec<(ProcessId, Capability)>) -> anyho Ok(()) } -fn get_entry() -> anyhow::Result<()> {} +fn get_entry(process: &ProcessId) -> anyhow::Result { + let drive_path = format!("/{}:{}/pkg", process.package(), process.publisher()); + Request::new() + .target(("our", "vfs", "distro", "sys")) + .body(serde_json::to_vec(&vfs::VfsRequest { + path: format!("{}/scripts.json", drive_path), + action: vfs::VfsAction::Read, + })?) + .send_and_await_response(5)??; + let Some(blob) = get_blob() else { + return Err(anyhow::anyhow!( + "couldn't find /{}/pkg/scripts.json", + process.package() + )); + }; + let dot_scripts = String::from_utf8(blob.bytes)?; + let dot_scripts = serde_json::from_str::>(&dot_scripts)?; + let Some(entry) = dot_scripts.get(&format!("{}.wasm", process.process())) else { + return Err(anyhow::anyhow!("script not in scripts.json file")); + }; + Ok(entry.clone()) +} From f0c8c2308ca924239af2e26c3dbace2e78d9aefb Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Wed, 7 Feb 2024 18:51:51 -0500 Subject: [PATCH 020/171] debug print removed --- kinode/src/kernel/mod.rs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/kinode/src/kernel/mod.rs b/kinode/src/kernel/mod.rs index 01424e9b5..3eeab9c7d 100644 --- a/kinode/src/kernel/mod.rs +++ b/kinode/src/kernel/mod.rs @@ -353,12 +353,6 @@ async fn handle_kernel_request( .await; return; }; - let _ = send_to_terminal - .send(t::Printout { - verbosity: 0, - content: format!("kernel: got DropCapabilities {:?}", capabilities.clone()), - }) - .await; for cap in capabilities { entry.capabilities.remove(&cap); } From 4d97def768bef86c0025ad907fbb29edaf6c4337 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Thu, 8 Feb 2024 10:22:03 -0500 Subject: [PATCH 021/171] caps revoked on process kill --- kinode/packages/terminal/terminal/src/lib.rs | 36 +------------- kinode/src/kernel/mod.rs | 49 ++++++++++++++++++-- lib/src/core.rs | 7 +++ 3 files changed, 55 insertions(+), 37 deletions(-) diff --git a/kinode/packages/terminal/terminal/src/lib.rs b/kinode/packages/terminal/terminal/src/lib.rs index 414aef517..1b740389f 100644 --- a/kinode/packages/terminal/terminal/src/lib.rs +++ b/kinode/packages/terminal/terminal/src/lib.rs @@ -23,7 +23,6 @@ enum TerminalAction { alias: String, process: Option, }, - ProcessEnded(Vec<(ProcessId, Capability)>), } #[derive(Serialize, Deserialize)] @@ -145,12 +144,6 @@ impl Guest for Component { Err(e) => println!("terminal: {e}"), }; } - TerminalAction::ProcessEnded(drop_caps) => { - match handle_process_cleanup(drop_caps) { - Ok(()) => continue, - Err(e) => println!("terminal: {e}"), - } - } } } else { println!("terminal: ignoring message from: {}", source); @@ -261,17 +254,7 @@ fn handle_run( id: parsed_new_process_id.clone(), wasm_bytes_handle: wasm_path.clone(), wit_version: None, - on_exit: kt::OnExit::Requests(vec![( - kt::de_wit_address(our.clone()), - kt::Request { - inherit: false, - expects_response: None, - body: serde_json::to_vec(&TerminalAction::ProcessEnded(granted_caps))?, - metadata: None, - capabilities: vec![], - }, - None, - )]), + on_exit: kt::OnExit::None, initial_capabilities: HashSet::new(), public: entry.public, })?) @@ -318,7 +301,6 @@ fn handle_run( } } // always give it the cap to message the terminal back - // NOTE a malicious script could use this to drop a ton of caps from other processes requested_caps.push(kt::de_wit_capability(Capability { issuer: our.clone(), params: "\"messaging\"".to_string(), @@ -341,7 +323,7 @@ fn handle_run( parsed_new_process_id.clone(), wasm_path.clone(), "None", - kt::OnExit::None, // TODO fix this + kt::OnExit::None, entry.public, { let mut caps_string = "[".to_string(); @@ -426,20 +408,6 @@ fn handle_alias_change( } } -fn handle_process_cleanup(caps_to_remove: Vec<(ProcessId, Capability)>) -> anyhow::Result<()> { - for (process, cap) in caps_to_remove { - println!("terminal: cleaning up process {}, {}", process, cap); - Request::new() - .target(("our", "kernel", "distro", "sys")) - .body(serde_json::to_vec(&kt::KernelCommand::DropCapabilities { - target: process, - capabilities: vec![kt::de_wit_capability(cap)], - })?) - .send()?; - } - Ok(()) -} - fn get_entry(process: &ProcessId) -> anyhow::Result { let drive_path = format!("/{}:{}/pkg", process.package(), process.publisher()); Request::new() diff --git a/kinode/src/kernel/mod.rs b/kinode/src/kernel/mod.rs index 3eeab9c7d..9f4dcacda 100644 --- a/kinode/src/kernel/mod.rs +++ b/kinode/src/kernel/mod.rs @@ -86,6 +86,7 @@ async fn handle_kernel_request( senders: &mut Senders, process_handles: &mut ProcessHandles, process_map: &mut t::ProcessMap, + reverse_cap_index: &mut t::ReverseCapIndex, caps_oracle: t::CapMessageSender, engine: &Engine, ) { @@ -334,7 +335,16 @@ async fn handle_kernel_request( ) }) .collect(); - entry.capabilities.extend(signed_caps); + entry.capabilities.extend(signed_caps.clone()); + // add these to reverse cap index + for (cap, _) in &signed_caps { + reverse_cap_index + .entry(cap.clone().issuer.process) + .or_insert_with(HashMap::new) + .entry(target.clone()) + .or_insert_with(Vec::new) + .push(cap.clone()); + } let _ = persist_state(&our_name, &send_to_loop, process_map).await; } t::KernelCommand::DropCapabilities { @@ -444,7 +454,14 @@ async fn handle_kernel_request( t::KernelCommand::KillProcess(process_id) => { // brutal and savage killing: aborting the task. // do not do this to a process if you don't want to risk - // dropped messages / un-replied-to-requests + // dropped messages / un-replied-to-requests / revoked caps + caps_oracle + .send(t::CapMessage::RevokeAll { + on: process_id.clone(), + responder: tokio::sync::oneshot::channel().0, + }) + .await + .expect("event loop: fatal: sender died"); let _ = senders.remove(&process_id); let process_handle = match process_handles.remove(&process_id) { Some(ph) => ph, @@ -643,6 +660,7 @@ pub async fn kernel( our: t::Identity, keypair: Arc, mut process_map: t::ProcessMap, + mut reverse_cap_index: t::ReverseCapIndex, caps_oracle_sender: t::CapMessageSender, mut caps_oracle_receiver: t::CapMessageReceiver, send_to_loop: t::MessageSender, @@ -1025,6 +1043,7 @@ pub async fn kernel( &mut senders, &mut process_handles, &mut process_map, + &mut reverse_cap_index, caps_oracle_sender.clone(), &engine, ).await; @@ -1081,7 +1100,16 @@ pub async fn kernel( cap.clone(), keypair.sign(&rmp_serde::to_vec(&cap).unwrap()).as_ref().to_vec() )).collect(); - entry.capabilities.extend(signed_caps); + entry.capabilities.extend(signed_caps.clone()); + // now we have to insert all caps into the reverse cap index + for (cap, _) in &signed_caps { + reverse_cap_index + .entry(cap.clone().issuer.process) + .or_insert_with(HashMap::new) + .entry(on.clone()) + .or_insert_with(Vec::new) + .push(cap.clone()); + } let _ = persist_state(&our.name, &send_to_loop, &process_map).await; let _ = responder.send(true); }, @@ -1115,6 +1143,21 @@ pub async fn kernel( } ); }, + t::CapMessage::RevokeAll { on, responder } => { + let Some(granter) = reverse_cap_index.get(&on) else { + let _ = responder.send(true); + continue; + }; + for (grantee, caps) in granter { + let Some(entry) = process_map.get_mut(&grantee) else { + continue; + }; + for cap in caps { + entry.capabilities.remove(&cap); + } + } + let _ = responder.send(true); + } t::CapMessage::FilterCaps { on, caps, responder } => { let _ = responder.send( match process_map.get(&on) { diff --git a/lib/src/core.rs b/lib/src/core.rs index a6f39096d..5188d9dee 100644 --- a/lib/src/core.rs +++ b/lib/src/core.rs @@ -989,6 +989,11 @@ pub enum CapMessage { on: ProcessId, responder: tokio::sync::oneshot::Sender)>>, }, + /// Remove all caps issued by `on` from every process on the entire system + RevokeAll { + on: ProcessId, + responder: tokio::sync::oneshot::Sender, + }, /// before `on` sends a message, filter out any bogus caps it may have attached, sign any new /// caps it may have created, and retreive the signature for the caps in its store. FilterCaps { @@ -998,6 +1003,8 @@ pub enum CapMessage { }, } +pub type ReverseCapIndex = HashMap>>; + pub type ProcessMap = HashMap; #[derive(Clone, Debug, Serialize, Deserialize)] From 88ff12d14ffe3b11c854b865670d1dd703b9444f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 8 Feb 2024 15:22:27 +0000 Subject: [PATCH 022/171] Format Rust code using rustfmt --- kinode/src/kernel/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kinode/src/kernel/mod.rs b/kinode/src/kernel/mod.rs index 9f4dcacda..4dd0ba1d7 100644 --- a/kinode/src/kernel/mod.rs +++ b/kinode/src/kernel/mod.rs @@ -461,7 +461,7 @@ async fn handle_kernel_request( responder: tokio::sync::oneshot::channel().0, }) .await - .expect("event loop: fatal: sender died"); + .expect("event loop: fatal: sender died"); let _ = senders.remove(&process_id); let process_handle = match process_handles.remove(&process_id) { Some(ph) => ph, From 0e4cd175e3ccd1a75d8094748831d14abbffde90 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Thu, 8 Feb 2024 10:22:25 -0500 Subject: [PATCH 023/171] forgot to commit main --- kinode/src/main.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kinode/src/main.rs b/kinode/src/main.rs index 065cd4467..918dbbcdc 100644 --- a/kinode/src/main.rs +++ b/kinode/src/main.rs @@ -2,6 +2,7 @@ use anyhow::Result; use clap::{arg, value_parser, Command}; +use std::collections::HashMap; use std::env; use std::sync::Arc; use tokio::sync::{mpsc, oneshot}; @@ -445,6 +446,7 @@ async fn main() { our.clone(), networking_keypair_arc.clone(), kernel_process_map.clone(), + HashMap::new(), // TODO need to persist this caps_oracle_sender.clone(), caps_oracle_receiver, kernel_message_sender.clone(), From 990854b390db68226d179914f60d1c635af6b2f1 Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Thu, 8 Feb 2024 12:44:57 -0300 Subject: [PATCH 024/171] remove rpc-url flag requirement draft --- src/eth/provider.rs | 8 +++----- src/main.rs | 9 ++++----- src/register.rs | 6 ------ 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/src/eth/provider.rs b/src/eth/provider.rs index 373a08091..d1cb99ebf 100644 --- a/src/eth/provider.rs +++ b/src/eth/provider.rs @@ -1,6 +1,5 @@ use crate::eth::types::*; use crate::types::*; -use alloy_providers::provider::TempProvider; use alloy_pubsub::{PubSubFrontend, RawSubscription}; use alloy_rpc_client::ClientBuilder; use alloy_rpc_types::pubsub::SubscriptionResult; @@ -17,15 +16,14 @@ use url::Url; /// indexing and ETH node responsibilities. pub async fn provider( our: String, - rpc_url: String, + rpc_url: Option, // if None, bootstrap from router, can set settings later? send_to_loop: MessageSender, mut recv_in_client: MessageReceiver, _print_tx: PrintSender, ) -> Result<()> { let our = Arc::new(our); - // for now, we can only handle WebSocket RPC URLs. In the future, we should - // be able to handle HTTP too, at least. - // todo add http reqwest.. + // make this generalizable. + let rpc_url = rpc_url.unwrap(); match Url::parse(&rpc_url)?.scheme() { "http" | "https" => { return Err(anyhow::anyhow!( diff --git a/src/main.rs b/src/main.rs index 34381ddd2..69473dbd3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -49,7 +49,6 @@ async fn serve_register_fe( home_directory_path: &str, our_ip: String, http_server_port: u16, - rpc_url: String, testnet: bool, ) -> (Identity, Vec, Keyfile) { // check if we have keys saved on disk, encrypted @@ -71,7 +70,7 @@ async fn serve_register_fe( let (tx, mut rx) = mpsc::channel::<(Identity, Keyfile, Vec)>(1); let (our, decoded_keyfile, encoded_keyfile) = tokio::select! { - _ = register::register(tx, kill_rx, our_ip, http_server_port, rpc_url, disk_keyfile, testnet) => { + _ = register::register(tx, kill_rx, our_ip, http_server_port, disk_keyfile, testnet) => { panic!("registration failed") } Some((our, decoded_keyfile, encoded_keyfile)) = rx.recv() => { @@ -109,7 +108,8 @@ async fn main() { ); #[cfg(not(feature = "simulation-mode"))] - let app = app.arg(arg!(--rpc "Ethereum RPC endpoint (must be wss://)").required(true)); + let app = + app.arg(arg!(--rpc "Ethereum RPC endpoint (must be wss://)").required(false)); #[cfg(feature = "simulation-mode")] let app = app @@ -141,7 +141,7 @@ async fn main() { }; #[cfg(not(feature = "simulation-mode"))] - let (rpc_url, is_detached) = (matches.get_one::("rpc").unwrap(), false); + let (rpc_url, is_detached) = (matches.get_one::("rpc").cloned(), false); #[cfg(feature = "simulation-mode")] let (rpc_url, password, network_router_port, fake_node_name, is_detached) = ( @@ -252,7 +252,6 @@ async fn main() { home_directory_path, our_ip.to_string(), http_server_port, - rpc_url.clone(), on_testnet, // true if testnet mode ) .await; diff --git a/src/register.rs b/src/register.rs index 532bd45e5..c43f06903 100644 --- a/src/register.rs +++ b/src/register.rs @@ -100,7 +100,6 @@ pub async fn register( kill_rx: oneshot::Receiver, ip: String, port: u16, - rpc_url: String, keyfile: Option>, testnet: bool, ) { @@ -134,7 +133,6 @@ pub async fn register( let net_keypair = warp::any().map(move || net_keypair.clone()); let tx = warp::any().map(move || tx.clone()); let ip = warp::any().map(move || ip.clone()); - let rpc_url = warp::any().map(move || rpc_url.clone()); let static_files = warp::path("static").and(static_dir!("src/register-ui/build/static/")); @@ -199,7 +197,6 @@ pub async fn register( .and(warp::body::content_length_limit(1024 * 16)) .and(warp::body::json()) .and(ip.clone()) - .and(rpc_url.clone()) .and(tx.clone()) .and_then(handle_import_keyfile), )) @@ -208,7 +205,6 @@ pub async fn register( .and(warp::body::content_length_limit(1024 * 16)) .and(warp::body::json()) .and(ip) - .and(rpc_url) .and(tx.clone()) .and(keyfile.clone()) .and_then(handle_login), @@ -344,7 +340,6 @@ async fn handle_boot( async fn handle_import_keyfile( info: ImportKeyfileInfo, ip: String, - _rpc_url: String, sender: Arc, ) -> Result { // if keyfile was not present in node and is present from user upload @@ -408,7 +403,6 @@ async fn handle_import_keyfile( async fn handle_login( info: LoginInfo, ip: String, - _rpc_url: String, sender: Arc, encoded_keyfile: Option>, ) -> Result { From e69e39f8bbbd3c08f197bf9eb63df5cc2b3c77ba Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Thu, 8 Feb 2024 12:19:53 -0500 Subject: [PATCH 025/171] rebuilding the persisted reverse_cap_index --- kinode/src/main.rs | 5 ++--- kinode/src/state.rs | 21 +++++++++++++++++---- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/kinode/src/main.rs b/kinode/src/main.rs index 918dbbcdc..0512ee921 100644 --- a/kinode/src/main.rs +++ b/kinode/src/main.rs @@ -2,7 +2,6 @@ use anyhow::Result; use clap::{arg, value_parser, Command}; -use std::collections::HashMap; use std::env; use std::sync::Arc; use tokio::sync::{mpsc, oneshot}; @@ -432,7 +431,7 @@ async fn main() { */ let networking_keypair_arc = Arc::new(decoded_keyfile.networking_keypair); - let (kernel_process_map, db) = state::load_state( + let (kernel_process_map, db, reverse_cap_index) = state::load_state( our.name.clone(), networking_keypair_arc.clone(), home_directory_path.clone(), @@ -446,7 +445,7 @@ async fn main() { our.clone(), networking_keypair_arc.clone(), kernel_process_map.clone(), - HashMap::new(), // TODO need to persist this + reverse_cap_index, caps_oracle_sender.clone(), caps_oracle_receiver, kernel_message_sender.clone(), diff --git a/kinode/src/state.rs b/kinode/src/state.rs index 58c332a4a..93f7ebf95 100644 --- a/kinode/src/state.rs +++ b/kinode/src/state.rs @@ -19,7 +19,7 @@ pub async fn load_state( keypair: Arc, home_directory_path: String, runtime_extensions: Vec<(ProcessId, MessageSender, bool)>, -) -> Result<(ProcessMap, DB), StateError> { +) -> Result<(ProcessMap, DB, ReverseCapIndex), StateError> { let state_path = format!("{}/kernel", &home_directory_path); if let Err(e) = fs::create_dir_all(&state_path).await { @@ -37,6 +37,7 @@ pub async fn load_state( // let cf_descriptor = ColumnFamilyDescriptor::new(cf_name, Options::default()); let db = DB::open_default(state_path).unwrap(); let mut process_map: ProcessMap = HashMap::new(); + let mut reverse_cap_index: ReverseCapIndex = HashMap::new(); let kernel_id = process_to_vec(KERNEL_PROCESS_ID.clone()); match db.get(&kernel_id) { @@ -73,11 +74,12 @@ pub async fn load_state( home_directory_path.clone(), runtime_extensions.clone(), &mut process_map, + &mut reverse_cap_index, ) .await .unwrap(); - Ok((process_map, db)) + Ok((process_map, db, reverse_cap_index)) } pub async fn state_sender( @@ -307,6 +309,7 @@ async fn bootstrap( home_directory_path: String, runtime_extensions: Vec<(ProcessId, MessageSender, bool)>, process_map: &mut ProcessMap, + reverse_cap_index: &mut ReverseCapIndex, ) -> Result<()> { // println!("bootstrapping node...\r"); @@ -699,7 +702,12 @@ async fn bootstrap( }; process .capabilities - .insert(cap.clone(), sign_cap(cap, keypair.clone())); + .insert(cap.clone(), sign_cap(cap.clone(), keypair.clone())); + reverse_cap_index.entry(cap.clone().issuer.process) + .or_insert_with(HashMap::new) + .entry(our_process_id.parse().unwrap()) + .or_insert_with(Vec::new) + .push(cap); } } } @@ -719,7 +727,12 @@ async fn bootstrap( }; process .capabilities - .insert(cap.clone(), sign_cap(cap, keypair.clone())); + .insert(cap.clone(), sign_cap(cap.clone(), keypair.clone())); + reverse_cap_index.entry(cap.clone().issuer.process) + .or_insert_with(HashMap::new) + .entry(our_process_id.parse().unwrap()) + .or_insert_with(Vec::new) + .push(cap); } } } From c58f010af736c4be34b5852cca2ecf8825fe7cb6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 8 Feb 2024 17:20:19 +0000 Subject: [PATCH 026/171] Format Rust code using rustfmt --- kinode/src/state.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/kinode/src/state.rs b/kinode/src/state.rs index 93f7ebf95..a4dd06323 100644 --- a/kinode/src/state.rs +++ b/kinode/src/state.rs @@ -703,7 +703,8 @@ async fn bootstrap( process .capabilities .insert(cap.clone(), sign_cap(cap.clone(), keypair.clone())); - reverse_cap_index.entry(cap.clone().issuer.process) + reverse_cap_index + .entry(cap.clone().issuer.process) .or_insert_with(HashMap::new) .entry(our_process_id.parse().unwrap()) .or_insert_with(Vec::new) @@ -725,10 +726,12 @@ async fn bootstrap( }, params: params.to_string(), }; - process - .capabilities - .insert(cap.clone(), sign_cap(cap.clone(), keypair.clone())); - reverse_cap_index.entry(cap.clone().issuer.process) + process.capabilities.insert( + cap.clone(), + sign_cap(cap.clone(), keypair.clone()), + ); + reverse_cap_index + .entry(cap.clone().issuer.process) .or_insert_with(HashMap::new) .entry(our_process_id.parse().unwrap()) .or_insert_with(Vec::new) From 3471951ac78b8ab8b239a7fd7273e9b6192c2c47 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Thu, 8 Feb 2024 13:02:12 -0500 Subject: [PATCH 027/171] usage strings added to scripts --- kinode/packages/terminal/alias/src/lib.rs | 6 ++++++ kinode/packages/terminal/cat/src/lib.rs | 8 +++++++- kinode/packages/terminal/hi/src/lib.rs | 5 +++++ kinode/packages/terminal/m/src/lib.rs | 5 +++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/kinode/packages/terminal/alias/src/lib.rs b/kinode/packages/terminal/alias/src/lib.rs index ed6fbca8f..925139466 100644 --- a/kinode/packages/terminal/alias/src/lib.rs +++ b/kinode/packages/terminal/alias/src/lib.rs @@ -29,6 +29,12 @@ fn init(_our: Address) { }; let line = String::from_utf8(args).unwrap_or("alias: error".into()); + if line.is_empty() { + println!("Change alias for a process"); + println!("\x1b[1mUsage:\x1b[0m alias "); + return; + } + let (alias, process) = line.split_once(" ").unwrap_or((&line, "")); if alias.is_empty() { diff --git a/kinode/packages/terminal/cat/src/lib.rs b/kinode/packages/terminal/cat/src/lib.rs index 704a51efb..5c065ba76 100644 --- a/kinode/packages/terminal/cat/src/lib.rs +++ b/kinode/packages/terminal/cat/src/lib.rs @@ -19,10 +19,16 @@ fn init(_our: Address) { }; let Ok(file_path) = String::from_utf8(args) else { - println!("bad file path"); + println!("cat: bad args, aborting"); return; }; + if file_path.is_empty() { + println!("Print the contents of a file to the terminal"); + println!("\x1b[1mUsage:\x1b[0m cat "); + return; + } + Request::new() .target(("our", "vfs", "distro", "sys")) .body( diff --git a/kinode/packages/terminal/hi/src/lib.rs b/kinode/packages/terminal/hi/src/lib.rs index 71d090359..35b736640 100644 --- a/kinode/packages/terminal/hi/src/lib.rs +++ b/kinode/packages/terminal/hi/src/lib.rs @@ -19,6 +19,11 @@ fn init(our: Address) { }; let tail = String::from_utf8(args).unwrap(); + if tail.is_empty() { + println!("Send a Message to another node's terminal"); + println!("\x1b[1mUsage:\x1b[0m hi "); + return; + } let (node_id, message) = match tail.split_once(" ") { Some((s, t)) => (s, t), diff --git a/kinode/packages/terminal/m/src/lib.rs b/kinode/packages/terminal/m/src/lib.rs index 573633387..34a468d6c 100644 --- a/kinode/packages/terminal/m/src/lib.rs +++ b/kinode/packages/terminal/m/src/lib.rs @@ -18,6 +18,11 @@ fn init(_our: Address) { return; }; let body_string = String::from_utf8(body).unwrap(); + if body_string.is_empty() { + println!("Send a Request to a Process"); + println!("\x1b[1mUsage:\x1b[0m m [-a ]"); + return; + } let re = Regex::new(r#"'[^']*'|\S+"#).unwrap(); let mut args: Vec = re From 05e6e422b12c760b844514cdb94b8ae1fcb58c00 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Thu, 8 Feb 2024 16:08:57 -0300 Subject: [PATCH 028/171] refactor process.rs for less copying and legibility --- kinode/src/kernel/mod.rs | 9 +- kinode/src/kernel/process.rs | 310 +++++++++++++++-------------------- 2 files changed, 137 insertions(+), 182 deletions(-) diff --git a/kinode/src/kernel/mod.rs b/kinode/src/kernel/mod.rs index 1083da6a7..08b9293ce 100644 --- a/kinode/src/kernel/mod.rs +++ b/kinode/src/kernel/mod.rs @@ -1099,13 +1099,8 @@ pub async fn kernel( caps.into_iter().filter_map(|cap| { // if issuer is message source, then sign the cap if cap.issuer.process == on { - Some(( - cap, - keypair - .sign(&rmp_serde::to_vec(&cap).unwrap()) - .as_ref() - .to_vec() - )) + let sig = keypair.sign(&rmp_serde::to_vec(&cap).unwrap()); + Some((cap, sig.as_ref().to_vec())) // otherwise, only attach previously saved caps // NOTE we don't need to verify the sigs! } else { diff --git a/kinode/src/kernel/process.rs b/kinode/src/kernel/process.rs index 76494026a..0b9dbe43f 100644 --- a/kinode/src/kernel/process.rs +++ b/kinode/src/kernel/process.rs @@ -15,12 +15,11 @@ use wasmtime_wasi::preview2::{pipe::MemoryOutputPipe, Table, WasiCtx, WasiCtxBui const STACK_TRACE_SIZE: usize = 5000; -#[derive(Clone, Debug, Serialize, Deserialize)] pub struct ProcessContext { - // store ultimate in order to set prompting message if needed - pub message: Option, + // store predecessor in order to set prompting message when popped + pub prompting_message: Option, // can be empty if a request doesn't set context, but still needs to inherit - pub context: Option, + pub context: Option, } pub struct ProcessState { @@ -36,12 +35,16 @@ pub struct ProcessState { pub send_to_loop: t::MessageSender, /// pipe for sending [`t::Printout`]s to the terminal pub send_to_terminal: t::PrintSender, - /// store the nested request, if any - pub nested_request: Option, - /// store the current incoming message that we've gotten from receive() - pub current_incoming_message: Option, + /// store the current incoming message that we've gotten from receive(), if it + /// is a request. if it is a response, the context map will be used to set this + /// as the message it was when the outgoing request for that response was made. + /// however, the blob stored here will **always** be the blob of the last message + /// received from the event loop. + /// the prompting_message won't have a blob, rather it is stored in last_blob. + pub prompting_message: Option, + pub last_blob: Option, /// store the contexts and timeout task of all outstanding requests - pub contexts: HashMap)>, + pub contexts: HashMap)>, /// store the messages that we've gotten from event loop but haven't processed yet /// TODO make this an ordered map for O(1) retrieval by ID pub message_queue: VecDeque>, @@ -158,7 +161,7 @@ impl ProcessState { /// that timeout and return timeout error if it expires. pub async fn send_request( &mut self, - /// only used when kernel steps in to get/set state + // only used when kernel steps in to get/set state fake_source: Option, target: wit::Address, request: wit::Request, @@ -168,29 +171,13 @@ impl ProcessState { let source = fake_source.unwrap_or(self.metadata.our.clone()); let mut request = t::de_wit_request(request); - // if request chooses to inherit, it means to take the lazy_load_blob, if any, - // from the last request it ingested. if current_incoming_message is a request, - // it will be the inherited one. if not, we check nested_request and inherit - // from that if it exists. - // if neither exist as requests, inherit flag will be ignored. - let predecessor_request = match &self.current_incoming_message { - Some(t::KernelMessage { - message: t::Message::Request(request), - .. - }) => self.current_incoming_message.as_ref(), - _ => match &self.nested_request { - Some(t::KernelMessage { - message: t::Message::Request(request), - .. - }) => self.nested_request.as_ref(), - _ => None, - }, - }; + // if request chooses to inherit, it means to take the ID and lazy_load_blob, + // if any, from the last message it ingested // if request chooses to inherit, match id to precedessor // otherwise, id is generated randomly - let request_id: u64 = if request.inherit && predecessor_request.is_some() { - predecessor_request.unwrap().id + let request_id: u64 = if request.inherit && self.prompting_message.is_some() { + self.prompting_message.as_ref().unwrap().id } else { loop { let id = rand::random(); @@ -208,9 +195,7 @@ impl ProcessState { bytes: p.bytes, }), None => match request.inherit { - true => predecessor_request - .and_then(|km| km.lazy_load_blob.clone()) - .or(None), + true => self.last_blob.clone(), false => None, }, }; @@ -223,13 +208,15 @@ impl ProcessState { on: self.metadata.our.process.clone(), caps: request .capabilities - .iter() - .map(|cap| t::de_wit_capability(cap.clone()).0) + .into_iter() + .map(|(cap, _)| cap) .collect(), responder: tx, }) - .await?; - rx.await? + .await + .expect("fatal: process couldn't access capabilities oracle"); + rx.await + .expect("fatal: process couldn't receive capabilities") }; } @@ -238,6 +225,8 @@ impl ProcessState { // TODO optimize this SIGNIFICANTLY: stop spawning tasks // and use a global clock + garbage collect step to check for timeouts if let Some(timeout_secs) = request.expects_response { + let this_request = request.clone(); + let this_blob = blob.clone(); let self_sender = self.self_sender.clone(); let original_target = t::Address::de_wit(target.clone()); let timeout_handle = tokio::spawn(async move { @@ -249,8 +238,8 @@ impl ProcessState { error: t::SendError { kind: t::SendErrorKind::Timeout, target: original_target, - message: t::Message::Request(request.clone()), - lazy_load_blob: blob.clone(), + message: t::Message::Request(this_request), + lazy_load_blob: this_blob, }, })) .await; @@ -259,7 +248,7 @@ impl ProcessState { request_id, ( ProcessContext { - message: predecessor_request.cloned(), + prompting_message: self.prompting_message.clone(), context: new_context, }, timeout_handle, @@ -278,7 +267,7 @@ impl ProcessState { rsvp: match ( request.expects_response, request.inherit, - &self.current_incoming_message, + &self.prompting_message, ) { (Some(_), _, _) => { // this request expects response, so receives any response @@ -309,43 +298,53 @@ impl ProcessState { response: wit::Response, blob: Option, ) { - let (id, target) = match self.make_response_id_target().await { - Some(r) => r, - None => { - let _ = self - .send_to_terminal - .send(t::Printout { - verbosity: 2, - content: format!("kernel: dropping Response {:?}", response), - }) - .await; - return; - } + let mut response = t::de_wit_response(response); + + // the process requires a prompting_message in order to issue a response + let Some(ref prompting_message) = self.prompting_message else { + print( + &self.send_to_terminal, + 0, + format!("kernel: need non-None prompting_message to handle Response {response:?}"), + ) + .await; + return; }; + // given the current process state, produce the id and target that + // a response it emits should have. + let (id, target) = ( + prompting_message.id, + match &prompting_message.rsvp { + None => prompting_message.source.clone(), + Some(rsvp) => rsvp.clone(), + }, + ); + let blob = match response.inherit { true => self.last_blob.clone(), false => t::de_wit_blob(blob), }; - let mut inner_response = t::de_wit_response(response.clone()); - - inner_response.capabilities = { - let (tx, rx) = tokio::sync::oneshot::channel(); - let _ = self - .caps_oracle - .send(t::CapMessage::FilterCaps { - on: self.metadata.our.process.clone(), - caps: response - .capabilities - .iter() - .map(|cap| t::de_wit_capability(cap.clone()).0) - .collect(), - responder: tx, - }) - .await; - rx.await.expect("fatal: process couldn't get caps") - }; + if !response.capabilities.is_empty() { + response.capabilities = { + let (tx, rx) = tokio::sync::oneshot::channel(); + self.caps_oracle + .send(t::CapMessage::FilterCaps { + on: self.metadata.our.process.clone(), + caps: response + .capabilities + .into_iter() + .map(|(cap, _)| cap) + .collect(), + responder: tx, + }) + .await + .expect("fatal: process couldn't access capabilities oracle"); + rx.await + .expect("fatal: process couldn't receive capabilities") + }; + } self.send_to_loop .send(t::KernelMessage { @@ -354,7 +353,7 @@ impl ProcessState { target, rsvp: None, message: t::Message::Response(( - inner_response, + response, // the context will be set by the process receiving this Response. None, )), @@ -366,32 +365,30 @@ impl ProcessState { /// Convert a message from the main event loop into a result for the process to receive. /// If the message is a response or error, get context if we have one. - /// If there exists a current message before this, if it is a Request, it will get - /// saved as nested_request. fn kernel_message_to_process_receive( &mut self, - res: Result, + incoming: Result, ) -> Result<(wit::Address, wit::Message), (wit::SendError, Option)> { - let (context, km) = match res { - Ok(km) => match &km.message { + let (mut km, context) = match incoming { + Ok(mut km) => match km.message { t::Message::Request(_) => { - self.last_blob = km.lazy_load_blob.clone(); - self.current_incoming_message = Some(km.clone()); - (None, km) + self.last_blob = km.lazy_load_blob; + km.lazy_load_blob = None; + self.prompting_message = Some(km.clone()); + (km, None) } t::Message::Response(_) => { if let Some((context, timeout_handle)) = self.contexts.remove(&km.id) { timeout_handle.abort(); - self.last_blob = km.lazy_load_blob.clone(); - self.current_incoming_message = match context.prompting_message { - None => Some(km.clone()), - Some(prompting_message) => Some(prompting_message), - }; - (context.context, km) + self.last_blob = km.lazy_load_blob; + km.lazy_load_blob = None; + self.prompting_message = context.prompting_message; + (km, context.context) } else { - self.last_blob = km.lazy_load_blob.clone(); - self.current_incoming_message = Some(km.clone()); - (None, km) + self.last_blob = km.lazy_load_blob; + km.lazy_load_blob = None; + self.prompting_message = Some(km.clone()); + (km, None) } } }, @@ -399,7 +396,7 @@ impl ProcessState { None => return Err((t::en_wit_send_error(e.error), None)), Some((context, timeout_handle)) => { timeout_handle.abort(); - self.current_incoming_message = context.prompting_message; + self.prompting_message = context.prompting_message; return Err((t::en_wit_send_error(e.error), context.context)); } }, @@ -410,98 +407,54 @@ impl ProcessState { self.keypair.as_ref().public_key(), ); + // prune any invalid capabilities before handing to process + // where invalid = supposedly issued by us, but not signed properly by us + match &mut km.message { + t::Message::Request(request) => { + request.capabilities.retain(|(cap, sig)| { + // The only time we verify a cap's signature is when a foreign node + // sends us a cap that we (allegedly) issued + if km.source.node != self.metadata.our.node + && cap.issuer.node == self.metadata.our.node + { + match pk.verify(&rmp_serde::to_vec(&cap).unwrap_or_default(), sig) { + Ok(_) => true, + Err(_) => false, + } + } else { + return true; + } + }); + } + t::Message::Response((response, _)) => { + response.capabilities.retain(|(cap, sig)| { + // The only time we verify a cap's signature is when a foreign node + // sends us a cap that we (allegedly) issued + if km.source.node != self.metadata.our.node + && cap.issuer.node == self.metadata.our.node + { + match pk.verify(&rmp_serde::to_vec(&cap).unwrap_or_default(), sig) { + Ok(_) => true, + Err(_) => false, + } + } else { + return true; + } + }); + } + }; + Ok(( km.source.en_wit(), match km.message { - t::Message::Request(mut request) => { - // prune any invalid caps before sending - request.capabilities = request - .capabilities - .iter() - .filter_map(|(cap, sig)| { - // The only time we verify a cap's signature is when a foreign node - // sends us a cap that we (allegedly) issued - if km.source.node != self.metadata.our.node - && cap.issuer.node == self.metadata.our.node - { - match pk.verify(&rmp_serde::to_vec(&cap).unwrap_or_default(), sig) { - Ok(_) => Some((cap.clone(), sig.clone())), - Err(_) => None, - } - } else { - return Some((cap.clone(), sig.clone())); - } - }) - .collect::)>>(); - wit::Message::Request(t::en_wit_request(request)) - } + t::Message::Request(request) => wit::Message::Request(t::en_wit_request(request)), // NOTE: we throw away whatever context came from the sender, that's not ours - t::Message::Response((mut response, _context)) => { - // prune any invalid caps before sending - response.capabilities = response - .capabilities - .iter() - .filter_map(|(cap, sig)| { - // The only time we verify a cap's signature is when a foreign node - // sends us a cap that we (allegedly) issued - if km.source.node != self.metadata.our.node - && cap.issuer.node == self.metadata.our.node - { - match pk.verify(&rmp_serde::to_vec(&cap).unwrap_or_default(), sig) { - Ok(_) => Some((cap.clone(), sig.clone())), - Err(_) => None, - } - } else { - return Some((cap.clone(), sig.clone())); - } - }) - .collect::)>>(); + t::Message::Response((response, _sent_context)) => { wit::Message::Response((t::en_wit_response(response), context)) } }, )) } - - /// Given the current process state, return the id and target that - /// a response it emits should have. This takes into - /// account the `rsvp` of the current or nested message, if any. - async fn make_response_id_target(&self) -> Option<(u64, t::Address)> { - let Some(ref current_incoming_message) = self.current_incoming_message else { - println!("need non-None incoming_message to handle Response\r"); - return None; - }; - match current_incoming_message.message { - t::Message::Request(ref request) => { - // if the current message is a Request, the response will always go there. - Some(( - current_incoming_message.id, - match ¤t_incoming_message.rsvp { - None => current_incoming_message.source.clone(), - Some(address) => address.clone(), - }, - )) - } - t::Message::Response((ref response, ref _maybe_context)) => { - // if the current message is a Response, we look at the nested request - // to see where the response should go. - match &self.nested_request { - None => { - println!( - "need non-None incoming message or nested_request to handle Response\r" - ); - return None; - } - Some(ref nested) => Some(( - nested.id, - match &nested.rsvp { - None => nested.source.clone(), - Some(address) => address.clone(), - }, - )), - } - } - } - } } /// create a specific process, and generate a task that will run it. @@ -572,8 +525,8 @@ pub async fn make_process_loop( self_sender: send_to_process, send_to_loop: send_to_loop.clone(), send_to_terminal: send_to_terminal.clone(), - nested_request: None, - current_incoming_message: None, + prompting_message: None, + last_blob: None, contexts: HashMap::new(), message_queue: VecDeque::new(), caps_oracle: caps_oracle.clone(), @@ -799,3 +752,10 @@ pub async fn make_process_loop( } Ok(()) } + +async fn print(sender: &t::PrintSender, verbosity: u8, content: String) { + let _ = sender + .send(t::Printout { verbosity, content }) + .await + .expect("fatal: kernel terminal print pipe died!"); +} From 0833489ce7fac97c3b7fa7f3a19f072295015e49 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Thu, 8 Feb 2024 14:44:19 -0500 Subject: [PATCH 029/171] script processids reverted to use package they come from --- Cargo.lock | 2 +- kinode/packages/terminal/terminal/Cargo.toml | 2 +- kinode/packages/terminal/terminal/src/lib.rs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6549b700f..b91430501 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3209,7 +3209,7 @@ dependencies = [ [[package]] name = "kinode_process_lib" version = "0.6.0" -source = "git+https://github.com/uqbar-dao/process_lib.git?rev=509b1ed#509b1ed65041762dc6dfa7dd85811b7783c1997c" +source = "git+https://github.com/uqbar-dao/process_lib.git?rev=e8c2cac#e8c2cac7c4a4ed7ce3b49717ae3fe0ce4ae708d0" dependencies = [ "anyhow", "bincode", diff --git a/kinode/packages/terminal/terminal/Cargo.toml b/kinode/packages/terminal/terminal/Cargo.toml index a46918194..463a05370 100644 --- a/kinode/packages/terminal/terminal/Cargo.toml +++ b/kinode/packages/terminal/terminal/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] anyhow = "1.0" bincode = "1.3.3" -kinode_process_lib = { git = "https://github.com/uqbar-dao/process_lib.git", rev = "509b1ed" } +kinode_process_lib = { git = "https://github.com/uqbar-dao/process_lib.git", rev = "e8c2cac" } rand = "0.8" regex = "1.10.3" serde = { version = "1.0", features = ["derive"] } diff --git a/kinode/packages/terminal/terminal/src/lib.rs b/kinode/packages/terminal/terminal/src/lib.rs index 1b740389f..732fe4c87 100644 --- a/kinode/packages/terminal/terminal/src/lib.rs +++ b/kinode/packages/terminal/terminal/src/lib.rs @@ -180,7 +180,7 @@ fn handle_run( }; let wasm_path = format!("{}{}", drive_path, wasm_path); // build initial caps - let process_id = format!("{}:terminal:sys", rand::random::()); // all scripts are given random process IDs + let process_id = format!("{}:{}", rand::random::(), package); // all scripts are given random process IDs let Ok(parsed_new_process_id) = process_id.parse::() else { return Err(anyhow::anyhow!("app store: invalid process id!")); }; From 4ad3dcbbabd7fb2e72bfab214f15c04650b31939 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Thu, 8 Feb 2024 14:52:57 -0500 Subject: [PATCH 030/171] serde issues fixed in alias --- kinode/packages/terminal/alias/src/lib.rs | 17 ++++++----------- kinode/packages/terminal/terminal/src/lib.rs | 3 ++- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/kinode/packages/terminal/alias/src/lib.rs b/kinode/packages/terminal/alias/src/lib.rs index 925139466..39acab59e 100644 --- a/kinode/packages/terminal/alias/src/lib.rs +++ b/kinode/packages/terminal/alias/src/lib.rs @@ -2,7 +2,6 @@ use kinode_process_lib::{ await_next_request_body, call_init, println, Address, ProcessId, Request, }; use serde::{Deserialize, Serialize}; -use serde_json::json; wit_bindgen::generate!({ path: "wit", @@ -46,13 +45,11 @@ fn init(_our: Address) { let _ = Request::new() .target(("our", "terminal", "terminal", "sys")) .body( - json!(TerminalAction::EditAlias { + serde_json::to_vec(&TerminalAction::EditAlias { alias: alias.to_string(), - process: None + process: None, }) - .to_string() - .as_bytes() - .to_vec(), + .unwrap(), ) .send(); } else { @@ -61,13 +58,11 @@ fn init(_our: Address) { let _ = Request::new() .target(("our", "terminal", "terminal", "sys")) .body( - json!(TerminalAction::EditAlias { + serde_json::to_vec(&TerminalAction::EditAlias { alias: alias.to_string(), - process: Some(process) + process: Some(process), }) - .to_string() - .as_bytes() - .to_vec(), + .unwrap(), ) .send(); } diff --git a/kinode/packages/terminal/terminal/src/lib.rs b/kinode/packages/terminal/terminal/src/lib.rs index 732fe4c87..98354d9aa 100644 --- a/kinode/packages/terminal/terminal/src/lib.rs +++ b/kinode/packages/terminal/terminal/src/lib.rs @@ -169,7 +169,8 @@ fn handle_run( pipe: Option<(String, u64)>, ) -> anyhow::Result<()> { let wasm_path = format!("{}.wasm", process.process()); - let drive_path = format!("/{}:{}/pkg", process.package(), process.publisher()); + let package = format!("{}:{}", process.package(), process.publisher()); + let drive_path = format!("/{}/pkg", package); let Ok(entry) = get_entry(process) else { return Err(anyhow::anyhow!("script not in scripts.json file")); }; From 78d90aa5dd528e5979e7071af2cf0de21275ebcb Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Thu, 8 Feb 2024 14:57:50 -0500 Subject: [PATCH 031/171] removed unnecessary clone --- kinode/packages/terminal/terminal/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kinode/packages/terminal/terminal/src/lib.rs b/kinode/packages/terminal/terminal/src/lib.rs index 98354d9aa..645ac2065 100644 --- a/kinode/packages/terminal/terminal/src/lib.rs +++ b/kinode/packages/terminal/terminal/src/lib.rs @@ -240,7 +240,7 @@ fn handle_run( } } } - for (process, cap) in granted_caps.clone().into_iter() { + for (process, cap) in granted_caps.into_iter() { Request::new() .target(("our", "kernel", "distro", "sys")) .body(serde_json::to_vec(&kt::KernelCommand::GrantCapabilities { From 3218e98123408150ba23cb1dfd0d8001dbf53e6b Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Thu, 8 Feb 2024 14:59:09 -0500 Subject: [PATCH 032/171] state persists after RevokeAll --- kinode/src/kernel/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/kinode/src/kernel/mod.rs b/kinode/src/kernel/mod.rs index 4dd0ba1d7..f445166dc 100644 --- a/kinode/src/kernel/mod.rs +++ b/kinode/src/kernel/mod.rs @@ -1156,6 +1156,7 @@ pub async fn kernel( entry.capabilities.remove(&cap); } } + let _ = persist_state(&our.name, &send_to_loop, &process_map).await; let _ = responder.send(true); } t::CapMessage::FilterCaps { on, caps, responder } => { From a1208cbd7176563aaa52a710c9749e2da1c38ab4 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Thu, 8 Feb 2024 15:04:19 -0500 Subject: [PATCH 033/171] updated process_lib to 0.6.0 --- Cargo.lock | 2 +- kinode/packages/terminal/terminal/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b91430501..980a9c88b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3209,7 +3209,7 @@ dependencies = [ [[package]] name = "kinode_process_lib" version = "0.6.0" -source = "git+https://github.com/uqbar-dao/process_lib.git?rev=e8c2cac#e8c2cac7c4a4ed7ce3b49717ae3fe0ce4ae708d0" +source = "git+https://github.com/kinode-dao/process_lib.git?tag=v0.6.0-alpha#4c49368e1945c041dfcabbe15734322012239d25" dependencies = [ "anyhow", "bincode", diff --git a/kinode/packages/terminal/terminal/Cargo.toml b/kinode/packages/terminal/terminal/Cargo.toml index 463a05370..554ddb856 100644 --- a/kinode/packages/terminal/terminal/Cargo.toml +++ b/kinode/packages/terminal/terminal/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] anyhow = "1.0" bincode = "1.3.3" -kinode_process_lib = { git = "https://github.com/uqbar-dao/process_lib.git", rev = "e8c2cac" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib.git", tag = "v0.6.0-alpha" } rand = "0.8" regex = "1.10.3" serde = { version = "1.0", features = ["derive"] } From 6dd455cc8e11b03fd0c4311a1785ed7f1a463a04 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Thu, 8 Feb 2024 15:07:12 -0500 Subject: [PATCH 034/171] removed .git --- Cargo.lock | 2 +- kinode/packages/terminal/terminal/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 980a9c88b..37e83f1a5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3209,7 +3209,7 @@ dependencies = [ [[package]] name = "kinode_process_lib" version = "0.6.0" -source = "git+https://github.com/kinode-dao/process_lib.git?tag=v0.6.0-alpha#4c49368e1945c041dfcabbe15734322012239d25" +source = "git+https://github.com/kinode-dao/process_lib?tag=v0.6.0-alpha#4c49368e1945c041dfcabbe15734322012239d25" dependencies = [ "anyhow", "bincode", diff --git a/kinode/packages/terminal/terminal/Cargo.toml b/kinode/packages/terminal/terminal/Cargo.toml index 554ddb856..43871bdd3 100644 --- a/kinode/packages/terminal/terminal/Cargo.toml +++ b/kinode/packages/terminal/terminal/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] anyhow = "1.0" bincode = "1.3.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib.git", tag = "v0.6.0-alpha" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.0-alpha" } rand = "0.8" regex = "1.10.3" serde = { version = "1.0", features = ["derive"] } From 923fb10449bb5880fbeb7851dbc45685c3a71df0 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Thu, 8 Feb 2024 15:08:09 -0500 Subject: [PATCH 035/171] verb 1 --- kinode/src/kernel/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kinode/src/kernel/mod.rs b/kinode/src/kernel/mod.rs index f445166dc..ba0028e90 100644 --- a/kinode/src/kernel/mod.rs +++ b/kinode/src/kernel/mod.rs @@ -354,7 +354,7 @@ async fn handle_kernel_request( let Some(entry) = process_map.get_mut(&target) else { let _ = send_to_terminal .send(t::Printout { - verbosity: 0, + verbosity: 1, content: format!( "kernel: no such process {:?} to DropCapabilities", target From 5c9f09dda679177ed5625e8728d24aa3336986e5 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Thu, 8 Feb 2024 15:13:24 -0500 Subject: [PATCH 036/171] cleaning --- kinode/packages/terminal/terminal/src/lib.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/kinode/packages/terminal/terminal/src/lib.rs b/kinode/packages/terminal/terminal/src/lib.rs index 645ac2065..0bb426202 100644 --- a/kinode/packages/terminal/terminal/src/lib.rs +++ b/kinode/packages/terminal/terminal/src/lib.rs @@ -183,7 +183,7 @@ fn handle_run( // build initial caps let process_id = format!("{}:{}", rand::random::(), package); // all scripts are given random process IDs let Ok(parsed_new_process_id) = process_id.parse::() else { - return Err(anyhow::anyhow!("app store: invalid process id!")); + return Err(anyhow::anyhow!("terminal: invalid process id!")); }; let _bytes_response = Request::new() @@ -401,12 +401,8 @@ fn handle_alias_change( } } } - if let Ok(new_state) = bincode::serialize(&state) { - set_state(&new_state); - Ok(()) - } else { - Err(anyhow!("failed to serialize state!")) - } + set_state(&bincode::serialize(&state)?); + Ok(()) } fn get_entry(process: &ProcessId) -> anyhow::Result { From 8bb5f7f834a350e0dcb8917edf4a1df8f09476e2 Mon Sep 17 00:00:00 2001 From: hosted-fornet Date: Thu, 8 Feb 2024 15:34:23 -0800 Subject: [PATCH 037/171] bump kit version to avoid compile warnings --- kinode/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kinode/Cargo.toml b/kinode/Cargo.toml index 3a9d1528b..eaf59b102 100644 --- a/kinode/Cargo.toml +++ b/kinode/Cargo.toml @@ -14,7 +14,7 @@ path = "src/main.rs" [build-dependencies] anyhow = "1.0.71" -kit = { git = "https://github.com/kinode-dao/kit", rev = "25b098f" } +kit = { git = "https://github.com/kinode-dao/kit", rev = "0c43430" } reqwest = { version = "0.11.22", features = ["blocking"] } sha2 = "0.10" tokio = { version = "1.28", features = ["macros"] } From 131438b1cbc2b4f755af8c9152e02579901d5551 Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Fri, 9 Feb 2024 15:01:01 -0300 Subject: [PATCH 038/171] kns_indexer: make passthrough rpc proof --- modules/kns_indexer/kns_indexer/src/lib.rs | 13 +++++++++++++ modules/kns_indexer/pkg/manifest.json | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/modules/kns_indexer/kns_indexer/src/lib.rs b/modules/kns_indexer/kns_indexer/src/lib.rs index ad14d706f..4d045c281 100644 --- a/modules/kns_indexer/kns_indexer/src/lib.rs +++ b/modules/kns_indexer/kns_indexer/src/lib.rs @@ -170,6 +170,7 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> { ); // if contract address changed from a previous run, reset state if state.contract_address != contract_address { + println!("resetting state for some reason."); state = State { contract_address: contract_address.clone(), names: HashMap::new(), @@ -177,6 +178,15 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> { block: 1, }; } + + // shove all state into net::net + Request::new() + .target((&our.node, "net", "distro", "sys")) + .try_body(NetActions::KnsBatchUpdate( + state.nodes.values().cloned().collect::>(), + ))? + .send()?; + let filter = Filter::new() .address(contract_address.unwrap().parse::().unwrap()) .to_block(BlockNumberOrTag::Latest) @@ -188,6 +198,7 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> { "WsUpdate(bytes32,uint16)", "RoutingUpdate(bytes32,bytes32[])", ]); + // std::thread::sleep(std::time::Duration::from_secs(10)); // if block in state is < current_block, get logs from that part. if state.block < get_block_number()? { let logs = get_logs(filter.clone())?; @@ -203,6 +214,8 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> { ))? .send()?; + set_state(&bincode::serialize(&state)?); + let params = Params::Logs(Box::new(filter)); let kind = SubscriptionKind::Logs; diff --git a/modules/kns_indexer/pkg/manifest.json b/modules/kns_indexer/pkg/manifest.json index d29393b94..531fc0029 100644 --- a/modules/kns_indexer/pkg/manifest.json +++ b/modules/kns_indexer/pkg/manifest.json @@ -3,7 +3,7 @@ "process_name": "kns_indexer", "process_wasm_path": "/kns_indexer.wasm", "on_exit": "Restart", - "request_networking": false, + "request_networking": true, "request_capabilities": [ "eth:distro:sys", "http_server:distro:sys", From aefee9598d77de67b2c396f9eb7e065431cd3dfb Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Fri, 9 Feb 2024 15:01:42 -0300 Subject: [PATCH 039/171] kernel & main: eth passthrough hardcoded routers --- src/eth/provider.rs | 253 ++++++++++++++++++++++++++------------------ src/kernel/mod.rs | 96 +++++++++++++++++ src/main.rs | 9 ++ 3 files changed, 255 insertions(+), 103 deletions(-) diff --git a/src/eth/provider.rs b/src/eth/provider.rs index d1cb99ebf..5cd4839bd 100644 --- a/src/eth/provider.rs +++ b/src/eth/provider.rs @@ -17,45 +17,54 @@ use url::Url; pub async fn provider( our: String, rpc_url: Option, // if None, bootstrap from router, can set settings later? + public: bool, // todo, whitelists etc. send_to_loop: MessageSender, mut recv_in_client: MessageReceiver, _print_tx: PrintSender, ) -> Result<()> { let our = Arc::new(our); - // make this generalizable. - let rpc_url = rpc_url.unwrap(); - match Url::parse(&rpc_url)?.scheme() { - "http" | "https" => { - return Err(anyhow::anyhow!( - "eth: you provided a `http(s)://` Ethereum RPC, but only `ws(s)://` is supported. Please try again with a `ws(s)://` provider" - )); - } - "ws" | "wss" => {} - s => { - return Err(anyhow::anyhow!( - "eth: you provided a `{s:?}` Ethereum RPC, but only `ws(s)://` is supported. Please try again with a `ws(s)://` provider" - )); - } - } - let connector = WsConnect { - url: rpc_url.clone(), - auth: None, - }; + // Initialize the provider conditionally based on rpc_url + // Todo: make provider support multiple transports, one direct and another passthrough. + let provider = if let Some(rpc_url) = rpc_url { + // If rpc_url is Some, proceed with URL parsing and client setup + match Url::parse(&rpc_url)?.scheme() { + "http" | "https" => { + return Err(anyhow::anyhow!( + "eth: you provided a `http(s)://` Ethereum RPC, but only `ws(s)://` is supported. Please try again with a `ws(s)://` provider" + )); + } + "ws" | "wss" => {} + s => { + return Err(anyhow::anyhow!( + "eth: you provided a `{s:?}` Ethereum RPC, but only `ws(s)://` is supported. Please try again with a `ws(s)://` provider" + )); + } + } - // note, reqwest::http is an option here, although doesn't implement .get_watcher() - // polling should be an option, investigating - // let client = ClientBuilder::default().reqwest_http(Url::from_str(&rpc_url)?); + let connector = WsConnect { + url: rpc_url, + auth: None, + }; - let client = ClientBuilder::default().pubsub(connector).await?; + let client = ClientBuilder::default().pubsub(connector).await?; + Some(alloy_providers::provider::Provider::new_with_client(client)) + } else { + None + }; - let provider = alloy_providers::provider::Provider::new_with_client(client); + let provider = Arc::new(provider); // handles of longrunning subscriptions. let connections: DashMap<(ProcessId, u64), JoinHandle>> = DashMap::new(); - let connections = Arc::new(connections); - let provider = Arc::new(provider); + + // passthrough responses + let responses: DashMap = DashMap::new(); + let responses = Arc::new(responses); + + // add whitelist, logic in provider middleware? + let public = Arc::new(public); while let Some(km) = recv_in_client.recv().await { // clone Arcs @@ -63,6 +72,8 @@ pub async fn provider( let send_to_loop = send_to_loop.clone(); let provider = provider.clone(); let connections = connections.clone(); + let responses = responses.clone(); + let public = public.clone(); tokio::spawn(async move { if let Err(e) = handle_request( @@ -71,6 +82,8 @@ pub async fn provider( &send_to_loop, provider.clone(), connections.clone(), + responses.clone(), + public.clone(), ) .await { @@ -85,8 +98,10 @@ async fn handle_request( our: &str, km: &KernelMessage, send_to_loop: &MessageSender, - provider: Arc>, + provider: Arc>>, connections: Arc>>>, + responses: Arc>, + public: Arc, ) -> Result<(), EthError> { let Message::Request(req) = &km.message else { return Err(EthError::ProviderError( @@ -94,95 +109,127 @@ async fn handle_request( )); }; - let action = serde_json::from_slice::(&req.body).map_err(|e| { - EthError::ProviderError(format!("eth: failed to deserialize request: {:?}", e)) - })?; - - // we might want some of these in payloads.. sub items? - let return_body: EthResponse = match action { - EthAction::SubscribeLogs { - sub_id, - kind, - params, - } => { - let sub_id = (km.target.process.clone(), sub_id); - - let kind = serde_json::to_value(&kind).unwrap(); - let params = serde_json::to_value(¶ms).unwrap(); - - let id = provider - .inner() - .prepare("eth_subscribe", [kind, params]) - .await - .unwrap(); + if let Some(provider) = provider.as_ref() { + let action = serde_json::from_slice::(&req.body).map_err(|e| { + EthError::ProviderError(format!("eth: failed to deserialize request: {:?}", e)) + })?; - let target = km.source.clone(); // rsvp? - - let rx = provider.inner().get_raw_subscription(id).await; - let handle = tokio::spawn(handle_subscription_stream( - our.to_string(), - sub_id.1.clone(), - rx, - target, - send_to_loop.clone(), + if !*public && km.source.node != our { + return Err(EthError::ProviderError( + "eth: only accepts requests from apps".to_string(), )); - - connections.insert(sub_id, handle); - EthResponse::Ok - } - EthAction::UnsubscribeLogs(sub_id) => { - let sub_id = (km.target.process.clone(), sub_id); - let handle = connections - .remove(&sub_id) - .ok_or(EthError::SubscriptionNotFound)?; - - handle.1.abort(); - EthResponse::Ok } - EthAction::Request { method, params } => { - let method = to_static_str(&method).ok_or(EthError::ProviderError(format!( - "eth: method not found: {}", - method - )))?; - // throw transportErrorKinds straight back to process - let response: serde_json::Value = - provider.inner().prepare(method, params).await.unwrap(); + // we might want some of these in payloads.. sub items? + let return_body: EthResponse = match action { + EthAction::SubscribeLogs { + sub_id, + kind, + params, + } => { + let sub_id = (km.target.process.clone(), sub_id); - EthResponse::Request(response) - } - }; + let kind = serde_json::to_value(&kind).unwrap(); + let params = serde_json::to_value(¶ms).unwrap(); - // todo: fix km.clone() and metadata.clone() - if let Some(target) = km.clone().rsvp.or_else(|| { - req.expects_response.map(|_| Address { - node: our.to_string(), - process: km.source.process.clone(), - }) - }) { - let response = KernelMessage { + let id = provider + .inner() + .prepare("eth_subscribe", [kind, params]) + .await + .unwrap(); + + let target = km.rsvp.clone().unwrap_or_else(|| Address { + node: our.to_string(), + process: km.source.process.clone(), + }); + + let rx = provider.inner().get_raw_subscription(id).await; + let handle = tokio::spawn(handle_subscription_stream( + our.to_string(), + sub_id.1.clone(), + rx, + target, + send_to_loop.clone(), + )); + + connections.insert(sub_id, handle); + EthResponse::Ok + } + EthAction::UnsubscribeLogs(sub_id) => { + let sub_id = (km.target.process.clone(), sub_id); + let handle = connections + .remove(&sub_id) + .ok_or(EthError::SubscriptionNotFound)?; + + handle.1.abort(); + EthResponse::Ok + } + EthAction::Request { method, params } => { + let method = to_static_str(&method).ok_or(EthError::ProviderError(format!( + "eth: method not found: {}", + method + )))?; + + // throw transportErrorKinds straight back to process + let response: serde_json::Value = + provider.inner().prepare(method, params).await.unwrap(); + + EthResponse::Request(response) + } + }; + + // todo: fix km.clone() and metadata.clone() + if let Some(target) = km.clone().rsvp.or_else(|| { + req.expects_response.map(|_| Address { + node: our.to_string(), + process: km.source.process.clone(), + }) + }) { + let response = KernelMessage { + id: km.id, + source: Address { + node: our.to_string(), + process: ETH_PROCESS_ID.clone(), + }, + target: target.clone(), + rsvp: None, + message: Message::Response(( + Response { + inherit: false, + body: serde_json::to_vec(&return_body).unwrap(), + metadata: req.metadata.clone(), + capabilities: vec![], + }, + None, + )), + lazy_load_blob: None, + }; + + // Send the response, handling potential errors appropriately + let _ = send_to_loop.send(response).await; + }; + } else { + // passthrough + // if node == our, forward to provider + // hoping that rsvp can fix the rest. + let request = KernelMessage { id: km.id, source: Address { node: our.to_string(), - process: VFS_PROCESS_ID.clone(), + process: ETH_PROCESS_ID.clone(), }, - target: target.clone(), - rsvp: None, - message: Message::Response(( - Response { - inherit: false, - body: serde_json::to_vec(&return_body).unwrap(), - metadata: req.metadata.clone(), - capabilities: vec![], - }, - None, - )), + target: Address { + node: "jugodenaranja.os".to_string(), + process: ETH_PROCESS_ID.clone(), + }, + rsvp: Some(km.source.clone()), + message: Message::Request(req.clone()), lazy_load_blob: None, }; - // Send the response, handling potential errors appropriately - let _ = send_to_loop.send(response).await; - }; + let _ = send_to_loop.send(request).await; + } + Ok(()) } diff --git a/src/kernel/mod.rs b/src/kernel/mod.rs index 848aa1587..824858e16 100644 --- a/src/kernel/mod.rs +++ b/src/kernel/mod.rs @@ -5,11 +5,31 @@ use anyhow::Result; use ring::signature; use serde::{Deserialize, Serialize}; use std::collections::HashMap; +use std::str::FromStr; use std::sync::Arc; use tokio::sync::mpsc; use tokio::task::JoinHandle; use wasmtime::{Config, Engine, WasmBacktraceDetails}; +/// TEMP IMPORT, crate::net::????? +/// Must be parsed from message pack vector. +#[derive(Clone, Debug, Serialize, Deserialize)] +pub enum NetActions { + KnsUpdate(KnsUpdate), + KnsBatchUpdate(Vec), +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct KnsUpdate { + pub name: String, // actual username / domain name + pub owner: String, + pub node: String, // hex namehash of node + pub public_key: String, + pub ip: String, + pub port: u16, + pub routers: Vec, +} + /// Manipulate a single process. pub mod process; /// Implement the functions served to processes by `kinode.wit`. @@ -782,6 +802,82 @@ pub async fn kernel( }) .await .expect("fatal: kernel event loop died"); + // sending hard coded routers into networking for bootstrapped rpc + let kns_updates = vec![ + KnsUpdate { + name: "default-router-1.os".to_string(), + owner: "who?".to_string(), + node: "0x".to_string(), + public_key: "0xb1b1cf23c89f651aac3e5fd4decb04aa177ab0ec8ce5f1d3877b90bb6f5779db" + .to_string(), + ip: "147.135.114.167".to_string(), + port: 9002, + routers: vec![], + }, + KnsUpdate { + name: "default-router-2.os".to_string(), + owner: "who?".to_string(), + node: "0x".to_string(), + public_key: "0xab9f1a996db3a4e1dbcd31d765daedeb3af9af4f570c0968463b5be3a7d1e992" + .to_string(), + ip: "147.135.114.167".to_string(), + port: 9003, + routers: vec![], + }, + KnsUpdate { + name: "default-router-3.os".to_string(), + owner: "who?".to_string(), + node: "0x".to_string(), + public_key: "0x536e30785e64dd0349a697285af365b5ed7c4d300010139261cfc4dbdd5b254b" + .to_string(), + ip: "147.135.114.167".to_string(), + port: 9004, + routers: vec![], + }, + // I want to use ben.eth + // --rpc-node ben.eth + // first index and then change + // no-rpc + // settings -> rpc from router-01 -> ben.eth + KnsUpdate { + name: "jugodenaranja.os".to_string(), + owner: "who?".to_string(), + node: "0x".to_string(), + public_key: "0xf8a3e9667756306a0a25894a8cfe053dc9e7f34e6a61b8d65e92b79f77e05dff" + .to_string(), + ip: "this should not be parsed.".to_string(), + port: 0, + routers: vec![ + "0xb35eb347deb896bc3fb6132a07fca1601f83462385ed11e835c24c33ba4ef73d".to_string(), + "0xd827ae579fafa604af79fbed977e8abe048497f10885c6473dfd343a3b7b4458".to_string(), + "0x96e36331c8f0882f2c0c46c13b15d812def04fe8606d503bc0e2be39db26486a".to_string(), + ], + }, + ]; + send_to_loop + .send(t::KernelMessage { + id: rand::random(), + source: t::Address { + node: our.name.clone(), + process: KERNEL_PROCESS_ID.clone(), + }, + target: t::Address { + node: our.name.clone(), + process: t::ProcessId::from_str("net:distro:sys").unwrap(), + }, + rsvp: None, + message: t::Message::Request(t::Request { + inherit: false, + expects_response: None, + body: rmp_serde::to_vec(&NetActions::KnsBatchUpdate(kns_updates)).unwrap(), + metadata: None, + capabilities: vec![], + }), + lazy_load_blob: None, + }) + .await + .expect("fatal: kernel event loop died"); + // finally, in order to trigger the kns_indexer app to find the right // contract, queue up a message that will send the contract address // to it on boot. diff --git a/src/main.rs b/src/main.rs index 69473dbd3..876fb5e63 100644 --- a/src/main.rs +++ b/src/main.rs @@ -111,6 +111,12 @@ async fn main() { let app = app.arg(arg!(--rpc "Ethereum RPC endpoint (must be wss://)").required(false)); + let app = app.arg( + arg!(--public "If set, allow rpc passthrough") + .default_value("false") + .value_parser(value_parser!(bool)), + ); + #[cfg(feature = "simulation-mode")] let app = app .arg(arg!(--rpc "Ethereum RPC endpoint (must be wss://)")) @@ -134,6 +140,8 @@ async fn main() { None => (8080, false), }; let on_testnet = *matches.get_one::("testnet").unwrap(); + let public = *matches.get_one::("public").unwrap(); + let contract_address = if on_testnet { register::KNS_SEPOLIA_ADDRESS } else { @@ -501,6 +509,7 @@ async fn main() { tasks.spawn(eth::provider::provider( our.name.clone(), rpc_url.clone(), + public, kernel_message_sender.clone(), eth_provider_receiver, print_sender.clone(), From 5ccd2c2dfd3bd6cd855bb99c2eda33c17ac82d5a Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Fri, 9 Feb 2024 17:03:19 -0300 Subject: [PATCH 040/171] merge new repo style --- Cargo.lock | 746 ++++++++---------- kinode/Cargo.toml | 5 + .../kns_indexer/kns_indexer/Cargo.toml | 4 +- kinode/src/eth/provider.rs | 6 +- kinode/src/register.rs | 2 +- lib/Cargo.toml | 4 +- lib/src/eth.rs | 2 - 7 files changed, 341 insertions(+), 428 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 581837a78..d78bec65e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -101,12 +101,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" [[package]] -<<<<<<< HEAD name = "alloy-eips" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" +source = "git+https://github.com/alloy-rs/alloy?rev=098ad56#098ad5657d55bbc5fe9469ede2a9ca79def738f2" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.6.2", "alloy-rlp", "serde", "thiserror", @@ -115,9 +114,9 @@ dependencies = [ [[package]] name = "alloy-json-rpc" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" +source = "git+https://github.com/alloy-rs/alloy?rev=098ad56#098ad5657d55bbc5fe9469ede2a9ca79def738f2" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.6.2", "serde", "serde_json", "thiserror", @@ -126,26 +125,20 @@ dependencies = [ [[package]] name = "alloy-network" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" +source = "git+https://github.com/alloy-rs/alloy?rev=098ad56#098ad5657d55bbc5fe9469ede2a9ca79def738f2" dependencies = [ "alloy-eips", "alloy-json-rpc", - "alloy-primitives", + "alloy-primitives 0.6.2", "alloy-rlp", "serde", ] [[package]] name = "alloy-primitives" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b6fb2b432ff223d513db7f908937f63c252bee0af9b82bfd25b0a5dd1eb0d8" -======= -name = "alloy-primitives" version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c234f92024707f224510ff82419b2be0e1d8e1fd911defcac5a085cd7f83898" ->>>>>>> develop dependencies = [ "alloy-rlp", "bytes", @@ -154,32 +147,46 @@ dependencies = [ "derive_more", "hex-literal", "itoa", -<<<<<<< HEAD - "k256", "keccak-asm", "proptest", - "rand", -======= + "rand 0.8.5", + "ruint", + "serde", + "tiny-keccak", +] + +[[package]] +name = "alloy-primitives" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4b6fb2b432ff223d513db7f908937f63c252bee0af9b82bfd25b0a5dd1eb0d8" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more", + "hex-literal", + "itoa", + "k256", "keccak-asm", "proptest", "rand 0.8.5", ->>>>>>> develop "ruint", "serde", "tiny-keccak", ] [[package]] -<<<<<<< HEAD name = "alloy-providers" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" +source = "git+https://github.com/alloy-rs/alloy?rev=098ad56#098ad5657d55bbc5fe9469ede2a9ca79def738f2" dependencies = [ "alloy-network", - "alloy-primitives", + "alloy-primitives 0.6.2", "alloy-rpc-client", "alloy-rpc-trace-types", - "alloy-rpc-types", + "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=098ad56)", "alloy-transport", "alloy-transport-http", "async-trait", @@ -192,10 +199,10 @@ dependencies = [ [[package]] name = "alloy-pubsub" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" +source = "git+https://github.com/alloy-rs/alloy?rev=098ad56#098ad5657d55bbc5fe9469ede2a9ca79def738f2" dependencies = [ "alloy-json-rpc", - "alloy-primitives", + "alloy-primitives 0.6.2", "alloy-transport", "bimap", "futures", @@ -207,8 +214,6 @@ dependencies = [ ] [[package]] -======= ->>>>>>> develop name = "alloy-rlp" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -231,13 +236,12 @@ dependencies = [ ] [[package]] -<<<<<<< HEAD name = "alloy-rpc-client" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" +source = "git+https://github.com/alloy-rs/alloy?rev=098ad56#098ad5657d55bbc5fe9469ede2a9ca79def738f2" dependencies = [ "alloy-json-rpc", - "alloy-primitives", + "alloy-primitives 0.6.2", "alloy-pubsub", "alloy-transport", "alloy-transport-http", @@ -255,10 +259,10 @@ dependencies = [ [[package]] name = "alloy-rpc-trace-types" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" +source = "git+https://github.com/alloy-rs/alloy?rev=098ad56#098ad5657d55bbc5fe9469ede2a9ca79def738f2" dependencies = [ - "alloy-primitives", - "alloy-rpc-types", + "alloy-primitives 0.6.2", + "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=098ad56)", "serde", "serde_json", ] @@ -266,33 +270,95 @@ dependencies = [ [[package]] name = "alloy-rpc-types" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" -======= +source = "git+https://github.com/alloy-rs/alloy?rev=098ad56#098ad5657d55bbc5fe9469ede2a9ca79def738f2" +dependencies = [ + "alloy-primitives 0.6.2", + "alloy-rlp", + "itertools 0.12.1", + "serde", + "serde_json", + "thiserror", +] + +[[package]] name = "alloy-rpc-types" version = "0.1.0" source = "git+https://github.com/alloy-rs/alloy.git?rev=3b1c310#3b1c3108ccd33c78abd7da8191e3744b4ae9a735" ->>>>>>> develop dependencies = [ - "alloy-primitives", + "alloy-primitives 0.5.4", "alloy-rlp", "itertools 0.12.1", -<<<<<<< HEAD - "serde", - "serde_json", -======= "jsonrpsee-types", "serde", "serde_json", "serde_with", ->>>>>>> develop "thiserror", ] [[package]] -<<<<<<< HEAD +name = "alloy-sol-macro" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "970e5cf1ca089e964d4f7f7afc7c9ad642bfb1bdc695a20b0cba3b3c28954774" +dependencies = [ + "const-hex", + "dunce", + "heck", + "indexmap 2.2.2", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.48", + "syn-solidity 0.5.4", + "tiny-keccak", +] + +[[package]] +name = "alloy-sol-macro" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b0b5ab0cb07c21adf9d72e988b34e8200ce648c2bba8d009183bb1c50fb1216" +dependencies = [ + "const-hex", + "dunce", + "heck", + "indexmap 2.2.2", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.48", + "syn-solidity 0.6.2", + "tiny-keccak", +] + +[[package]] +name = "alloy-sol-types" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a059d4d2c78f8f21e470772c75f9abd9ac6d48c2aaf6b278d1ead06ed9ac664" +dependencies = [ + "alloy-primitives 0.5.4", + "alloy-sol-macro 0.5.4", + "const-hex", + "serde", +] + +[[package]] +name = "alloy-sol-types" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c08f62ded7ce03513bfb60ef5cad4fff5d4f67eac6feb4df80426b7b9ffb06e" +dependencies = [ + "alloy-primitives 0.6.2", + "alloy-sol-macro 0.6.2", + "const-hex", + "serde", +] + +[[package]] name = "alloy-transport" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" +source = "git+https://github.com/alloy-rs/alloy?rev=098ad56#098ad5657d55bbc5fe9469ede2a9ca79def738f2" dependencies = [ "alloy-json-rpc", "base64 0.21.7", @@ -308,7 +374,7 @@ dependencies = [ [[package]] name = "alloy-transport-http" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" +source = "git+https://github.com/alloy-rs/alloy?rev=098ad56#098ad5657d55bbc5fe9469ede2a9ca79def738f2" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -321,46 +387,17 @@ dependencies = [ [[package]] name = "alloy-transport-ws" version = "0.1.0" -source = "git+https://github.com/alloy-rs/alloy.git#32618e9243a761858a0843e7e55575e48fdbf500" +source = "git+https://github.com/alloy-rs/alloy?rev=098ad56#098ad5657d55bbc5fe9469ede2a9ca79def738f2" dependencies = [ "alloy-pubsub", "alloy-transport", "futures", - "http", + "http 0.2.11", "serde_json", "tokio", - "tokio-tungstenite", + "tokio-tungstenite 0.20.1", "tracing", "ws_stream_wasm", -======= -name = "alloy-sol-macro" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "970e5cf1ca089e964d4f7f7afc7c9ad642bfb1bdc695a20b0cba3b3c28954774" -dependencies = [ - "const-hex", - "dunce", - "heck", - "indexmap 2.2.2", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.48", - "syn-solidity", - "tiny-keccak", -] - -[[package]] -name = "alloy-sol-types" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a059d4d2c78f8f21e470772c75f9abd9ac6d48c2aaf6b278d1ead06ed9ac664" -dependencies = [ - "alloy-primitives", - "alloy-sol-macro", - "const-hex", - "serde", ->>>>>>> develop ] [[package]] @@ -400,15 +437,9 @@ dependencies = [ [[package]] name = "anstyle" -<<<<<<< HEAD version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" -======= -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2faccea4cc4ab4a667ce676a30e8ec13922a692c99bb8f5b11f1502c72e04220" ->>>>>>> develop [[package]] name = "anstyle-parse" @@ -443,16 +474,14 @@ name = "anyhow" version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" -<<<<<<< HEAD -======= [[package]] name = "app_store" version = "0.3.0" dependencies = [ - "alloy-primitives", - "alloy-rpc-types", - "alloy-sol-types", + "alloy-primitives 0.5.4", + "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy.git?rev=3b1c310)", + "alloy-sol-types 0.5.4", "anyhow", "bincode", "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", @@ -466,7 +495,6 @@ dependencies = [ "wit-bindgen", "zip", ] ->>>>>>> develop [[package]] name = "arbitrary" @@ -585,11 +613,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" dependencies = [ "num-traits", -<<<<<<< HEAD - "rand", -======= "rand 0.8.5", ->>>>>>> develop ] [[package]] @@ -599,11 +623,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" dependencies = [ "num-traits", -<<<<<<< HEAD - "rand", -======= "rand 0.8.5", ->>>>>>> develop ] [[package]] @@ -658,8 +678,6 @@ dependencies = [ "proc-macro2", "quote", "syn 2.0.48", -<<<<<<< HEAD -======= ] [[package]] @@ -669,7 +687,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" dependencies = [ "autocfg 1.1.0", ->>>>>>> develop ] [[package]] @@ -724,12 +741,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" [[package]] -<<<<<<< HEAD -name = "bimap" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "230c5f1ca6a325a32553f8640d31ac9b49f2411e901e427570154868b46da4f7" -======= name = "beef" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -737,7 +748,12 @@ checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" dependencies = [ "serde", ] ->>>>>>> develop + +[[package]] +name = "bimap" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "230c5f1ca6a325a32553f8640d31ac9b49f2411e901e427570154868b46da4f7" [[package]] name = "bincode" @@ -985,9 +1001,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d" +checksum = "694c8807f2ae16faecc43dc17d74b3eb042482789fd0eb64b39a2e04e087053f" dependencies = [ "serde", ] @@ -1120,9 +1136,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.18" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" +checksum = "80c21025abd42669a92efc996ef13cfb2c5c627858421ea58d5c3b331a6c134f" dependencies = [ "clap_builder", "clap_derive", @@ -1130,21 +1146,21 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.18" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" +checksum = "458bf1f341769dfcf849846f65dffdf9146daa56bcd2a47cb4e1de9915567c99" dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim 0.10.0", + "strsim 0.11.0", ] [[package]] name = "clap_derive" -version = "4.4.7" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" dependencies = [ "heck", "proc-macro2", @@ -1154,9 +1170,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "cloudabi" @@ -1227,9 +1243,9 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "const-hex" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5104de16b218eddf8e34ffe2f86f74bfa4e61e95a1b89732fccf6325efd0557" +checksum = "18d59688ad0945eaf6b84cb44fedbe93484c81b48970e98f09db8a22832d7961" dependencies = [ "cfg-if", "cpufeatures", @@ -1505,9 +1521,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.1" +version = "4.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" +checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" dependencies = [ "cfg-if", "cpufeatures", @@ -1645,10 +1661,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", -<<<<<<< HEAD -======= "serde", ->>>>>>> develop ] [[package]] @@ -2086,7 +2099,7 @@ dependencies = [ "serde", "serde_json", "syn 2.0.48", - "toml 0.8.9", + "toml 0.8.10", "walkdir", ] @@ -2207,7 +2220,7 @@ dependencies = [ "serde_json", "thiserror", "tokio", - "tokio-tungstenite", + "tokio-tungstenite 0.20.1", "tracing", "tracing-futures", "url", @@ -2608,11 +2621,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" dependencies = [ "fallible-iterator", -<<<<<<< HEAD - "indexmap", -======= "indexmap 2.2.2", ->>>>>>> develop "stable_deref_trait", ] @@ -2671,19 +2680,20 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", -<<<<<<< HEAD - "http", - "indexmap", -======= "http 0.2.11", "indexmap 2.2.2", ->>>>>>> develop "slab", "tokio", "tokio-util", "tracing", ] +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[package]] name = "hashbrown" version = "0.13.2" @@ -2756,15 +2766,9 @@ dependencies = [ [[package]] name = "hermit-abi" -<<<<<<< HEAD version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" -======= -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" ->>>>>>> develop [[package]] name = "hex" @@ -2780,8 +2784,6 @@ name = "hex-literal" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" -<<<<<<< HEAD -======= [[package]] name = "hi" @@ -2792,7 +2794,6 @@ dependencies = [ "serde_json", "wit-bindgen", ] ->>>>>>> develop [[package]] name = "hkdf" @@ -2819,8 +2820,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" dependencies = [ "windows-sys 0.52.0", -<<<<<<< HEAD -======= ] [[package]] @@ -2833,7 +2832,6 @@ dependencies = [ "serde", "serde_json", "wit-bindgen", ->>>>>>> develop ] [[package]] @@ -2841,8 +2839,6 @@ name = "http" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" -<<<<<<< HEAD -======= dependencies = [ "bytes", "fnv", @@ -2854,7 +2850,6 @@ name = "http" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" ->>>>>>> develop dependencies = [ "bytes", "fnv", @@ -3074,10 +3069,8 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "2.2.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -<<<<<<< HEAD -======= checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg 1.1.0", @@ -3089,7 +3082,6 @@ dependencies = [ name = "indexmap" version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" ->>>>>>> develop checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" dependencies = [ "equivalent", @@ -3159,12 +3151,12 @@ dependencies = [ [[package]] name = "is-terminal" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" +checksum = "fe8f25ce1159c7740ff0b9b2f5cdf4a8428742ba7c112b9f20f22cd5219c7dab" dependencies = [ "hermit-abi", - "rustix", + "libc", "windows-sys 0.52.0", ] @@ -3233,18 +3225,18 @@ dependencies = [ [[package]] name = "jobserver" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.67" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" +checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" dependencies = [ "wasm-bindgen", ] @@ -3320,7 +3312,6 @@ name = "keccak-asm" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb8515fff80ed850aea4a1595f2e519c003e2a00a82fe168ebf5269196caf444" -<<<<<<< HEAD dependencies = [ "digest 0.10.7", "sha3-asm", @@ -3328,30 +3319,14 @@ dependencies = [ [[package]] name = "kinode" -version = "0.5.2" +version = "0.6.0" dependencies = [ "aes-gcm", - "alloy-network", - "alloy-primitives", "alloy-providers", "alloy-pubsub", "alloy-rpc-client", - "alloy-rpc-types", - "alloy-transport", - "alloy-transport-http", + "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=098ad56)", "alloy-transport-ws", -======= -dependencies = [ - "digest 0.10.7", - "sha3-asm", -] - -[[package]] -name = "kinode" -version = "0.6.0" -dependencies = [ - "aes-gcm", ->>>>>>> develop "anyhow", "async-trait", "base64 0.13.1", @@ -3401,7 +3376,7 @@ dependencies = [ "thiserror", "tokio", "tokio-stream", - "tokio-tungstenite", + "tokio-tungstenite 0.20.1", "url", "uuid 1.7.0", "walkdir", @@ -3423,7 +3398,7 @@ name = "kinode_process_lib" version = "0.5.9" source = "git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha#5e705086bbd10fde89e11d3e3671f6a618a875a7" dependencies = [ - "alloy-rpc-types", + "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy.git?rev=3b1c310)", "anyhow", "bincode", "ethers-core", @@ -3471,10 +3446,31 @@ dependencies = [ "wit-bindgen", ] +[[package]] +name = "kinode_process_lib" +version = "0.6.0" +source = "git+https://github.com/kinode-dao/process_lib?rev=8d58cfb#8d58cfba0302681b6971cac26ea3f7e49d4602ec" +dependencies = [ + "alloy-json-rpc", + "alloy-primitives 0.6.2", + "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=098ad56)", + "alloy-transport", + "anyhow", + "bincode", + "http 1.0.0", + "mime_guess", + "rand 0.8.5", + "serde", + "serde_json", + "thiserror", + "url", + "wit-bindgen", +] + [[package]] name = "kit" version = "0.1.0" -source = "git+https://github.com/kinode-dao/kit?rev=25b098f#25b098fab136387065d6058162d33c727d277ab8" +source = "git+https://github.com/kinode-dao/kit?rev=0c43430#0c434306fdce55e11d3309959fc4a0fe6ae28def" dependencies = [ "anyhow", "base64 0.21.7", @@ -3493,8 +3489,8 @@ dependencies = [ "serde_json", "thiserror", "tokio", - "tokio-tungstenite", - "toml 0.8.9", + "tokio-tungstenite 0.21.0", + "toml 0.8.10", "walkdir", "zip", ] @@ -3503,13 +3499,13 @@ dependencies = [ name = "kns_indexer" version = "0.2.0" dependencies = [ - "alloy-primitives", - "alloy-rpc-types", - "alloy-sol-types", + "alloy-primitives 0.6.2", + "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=098ad56)", + "alloy-sol-types 0.6.2", "anyhow", "bincode", "hex", - "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=8d58cfb)", "rmp-serde", "serde", "serde_json", @@ -3566,8 +3562,8 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" name = "lib" version = "0.6.0" dependencies = [ - "ethers", - "ethers-providers", + "alloy-pubsub", + "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=098ad56)", "lazy_static", "rand 0.8.5", "reqwest", @@ -3585,8 +3581,6 @@ name = "libc" version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" -<<<<<<< HEAD -======= [[package]] name = "libgit2-sys" @@ -3601,7 +3595,6 @@ dependencies = [ "openssl-sys", "pkg-config", ] ->>>>>>> develop [[package]] name = "libloading" @@ -3658,17 +3651,10 @@ dependencies = [ ] [[package]] -<<<<<<< HEAD -name = "libz-sys" -version = "1.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037731f5d3aaa87a5675e895b63ddff1a87624bc29f77004ea829809654e48f6" -======= name = "libssh2-sys" version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dc8a030b787e2119a731f1951d6a773e2280c660f8ec4b0f5e1505a386e71ee" ->>>>>>> develop dependencies = [ "cc", "libc", @@ -3891,8 +3877,6 @@ dependencies = [ ] [[package]] -<<<<<<< HEAD -======= name = "nix" version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3904,7 +3888,6 @@ dependencies = [ ] [[package]] ->>>>>>> develop name = "nohash-hasher" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -3939,25 +3922,20 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg 1.1.0", "num-traits", ] [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ -<<<<<<< HEAD - "autocfg", -======= "autocfg 1.1.0", ->>>>>>> develop "libm", ] @@ -4000,11 +3978,7 @@ checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "crc32fast", "hashbrown 0.14.3", -<<<<<<< HEAD - "indexmap", -======= "indexmap 2.2.2", ->>>>>>> develop "memchr", ] @@ -4245,11 +4219,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", -<<<<<<< HEAD - "indexmap", -======= "indexmap 2.2.2", ->>>>>>> develop ] [[package]] @@ -4366,8 +4336,6 @@ name = "platforms" version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "626dec3cac7cc0e1577a2ec3fc496277ec2baa084bebad95bb6fdbfae235f84c" -<<<<<<< HEAD -======= [[package]] name = "pleco" @@ -4382,7 +4350,6 @@ dependencies = [ "rand 0.6.5", "rayon", ] ->>>>>>> develop [[package]] name = "poly1305" @@ -4457,8 +4424,6 @@ checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ "once_cell", "toml_edit 0.19.15", -<<<<<<< HEAD -======= ] [[package]] @@ -4477,25 +4442,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ "toml_edit 0.21.1", ->>>>>>> develop ] [[package]] -name = "proc-macro-crate" -version = "2.0.0" +name = "proc-macro-error" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ - "toml_edit 0.20.7", + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", ] [[package]] -name = "proc-macro-crate" -version = "3.1.0" +name = "proc-macro-error-attr" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "toml_edit 0.21.1", + "proc-macro2", + "quote", + "version_check", ] [[package]] @@ -4524,15 +4494,9 @@ dependencies = [ "bitflags 2.4.2", "lazy_static", "num-traits", -<<<<<<< HEAD - "rand", - "rand_chacha", - "rand_xorshift", -======= "rand 0.8.5", "rand_chacha 0.3.1", "rand_xorshift 0.3.0", ->>>>>>> develop "regex-syntax 0.8.2", "rusty-fork", "tempfile", @@ -4675,14 +4639,6 @@ dependencies = [ ] [[package]] -<<<<<<< HEAD -name = "rand_xorshift" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" -dependencies = [ - "rand_core", -======= name = "rand_hc" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -4751,7 +4707,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" dependencies = [ "rand_core 0.6.4", ->>>>>>> develop ] [[package]] @@ -4775,11 +4730,6 @@ dependencies = [ ] [[package]] -<<<<<<< HEAD -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -======= name = "rdrand" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -4792,7 +4742,6 @@ dependencies = [ name = "redox_syscall" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" ->>>>>>> develop checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", @@ -5025,11 +4974,7 @@ dependencies = [ "parity-scale-codec", "primitive-types", "proptest", -<<<<<<< HEAD - "rand", -======= "rand 0.8.5", ->>>>>>> develop "rlp", "ruint-macro", "serde", @@ -5377,15 +5322,10 @@ dependencies = [ ] [[package]] -<<<<<<< HEAD -name = "sha1" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -======= name = "serde_with" -version = "3.6.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b0ed1662c5a68664f45b76d18deb0e234aff37207086803165c961eb695e981" +checksum = "15d167997bd841ec232f5b2b8e0e26606df2e7caa4c31b95ea9ca52b200bd270" dependencies = [ "base64 0.21.7", "chrono", @@ -5393,6 +5333,7 @@ dependencies = [ "indexmap 1.9.3", "indexmap 2.2.2", "serde", + "serde_derive", "serde_json", "serde_with_macros", "time", @@ -5400,9 +5341,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.6.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "568577ff0ef47b879f736cd66740e022f3672788cdf002a05a4e609ea5a6fb15" +checksum = "865f9743393e638991566a8b7a479043c2c8da94a33e0a31f18214c9cae0a64d" dependencies = [ "darling 0.20.5", "proc-macro2", @@ -5414,7 +5355,6 @@ dependencies = [ name = "sha1" version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" ->>>>>>> develop checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", @@ -5505,11 +5445,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest 0.10.7", -<<<<<<< HEAD - "rand_core", -======= "rand_core 0.6.4", ->>>>>>> develop ] [[package]] @@ -5561,11 +5497,7 @@ dependencies = [ "blake2", "chacha20poly1305", "curve25519-dalek", -<<<<<<< HEAD - "rand_core", -======= "rand_core 0.6.4", ->>>>>>> develop "ring 0.17.7", "rustc_version 0.4.0", "sha2", @@ -5697,6 +5629,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strsim" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" + [[package]] name = "strum" version = "0.25.0" @@ -5768,8 +5706,6 @@ dependencies = [ ] [[package]] -<<<<<<< HEAD -======= name = "syn-solidity" version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -5782,7 +5718,18 @@ dependencies = [ ] [[package]] ->>>>>>> develop +name = "syn-solidity" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63bef2e2c735acbc06874eca3a8506f02a3c4700e6e748afc92cc2e4220e8a03" +dependencies = [ + "paste", + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] name = "sync_wrapper" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -5839,22 +5786,12 @@ checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" [[package]] name = "tempfile" -<<<<<<< HEAD version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" dependencies = [ "cfg-if", "fastrand", -======= -version = "3.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" -dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall", ->>>>>>> develop "rustix", "windows-sys 0.52.0", ] @@ -5876,7 +5813,7 @@ version = "0.1.0" dependencies = [ "anyhow", "bincode", - "kinode_process_lib 0.6.0", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0-alpha)", "rand 0.8.5", "regex", "serde", @@ -6057,10 +5994,22 @@ dependencies = [ "rustls", "tokio", "tokio-rustls", - "tungstenite", + "tungstenite 0.20.1", "webpki-roots", ] +[[package]] +name = "tokio-tungstenite" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" +dependencies = [ + "futures-util", + "log", + "tokio", + "tungstenite 0.21.0", +] + [[package]] name = "tokio-util" version = "0.7.10" @@ -6086,14 +6035,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.9" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6a4b9e8023eb94392d3dca65d717c53abc5dad49c07cb65bb8fcd87115fa325" +checksum = "9a9aad4a3066010876e8dcf5a8a06e70a558751117a145c6ce2b82c2e2054290" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.21.1", + "toml_edit 0.22.4", ] [[package]] @@ -6111,11 +6060,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ -<<<<<<< HEAD - "indexmap", -======= "indexmap 2.2.2", ->>>>>>> develop "toml_datetime", "winnow", ] @@ -6126,11 +6071,7 @@ version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ -<<<<<<< HEAD - "indexmap", -======= "indexmap 2.2.2", ->>>>>>> develop "toml_datetime", "winnow", ] @@ -6141,11 +6082,18 @@ version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ -<<<<<<< HEAD - "indexmap", -======= "indexmap 2.2.2", ->>>>>>> develop + "toml_datetime", + "winnow", +] + +[[package]] +name = "toml_edit" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c9ffdf896f8daaabf9b66ba8e77ea1ed5ed0f72821b398aba62352e95062951" +dependencies = [ + "indexmap 2.2.2", "serde", "serde_spanned", "toml_datetime", @@ -6153,7 +6101,17 @@ dependencies = [ ] [[package]] -<<<<<<< HEAD +name = "top" +version = "0.1.0" +dependencies = [ + "anyhow", + "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", + "serde", + "serde_json", + "wit-bindgen", +] + +[[package]] name = "tower" version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -6175,19 +6133,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" [[package]] -======= -name = "top" -version = "0.1.0" -dependencies = [ - "anyhow", - "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", - "serde", - "serde_json", - "wit-bindgen", -] - -[[package]] ->>>>>>> develop name = "tower-service" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -6274,11 +6219,7 @@ dependencies = [ "ipnet", "lazy_static", "log", -<<<<<<< HEAD - "rand", -======= "rand 0.8.5", ->>>>>>> develop "smallvec", "thiserror", "tinyvec", @@ -6312,6 +6253,25 @@ dependencies = [ "utf-8", ] +[[package]] +name = "tungstenite" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http 1.0.0", + "httparse", + "log", + "rand 0.8.5", + "sha1", + "thiserror", + "url", + "utf-8", +] + [[package]] name = "typenum" version = "1.17.0" @@ -6373,21 +6333,15 @@ dependencies = [ ] [[package]] -<<<<<<< HEAD -name = "unicode-width" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -======= name = "unicode-segmentation" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-width" version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" ->>>>>>> develop checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] @@ -6397,8 +6351,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] -<<<<<<< HEAD -======= name = "uninstall" version = "0.1.0" dependencies = [ @@ -6410,7 +6362,6 @@ dependencies = [ ] [[package]] ->>>>>>> develop name = "universal-hash" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -6558,7 +6509,7 @@ dependencies = [ "serde_urlencoded", "tokio", "tokio-stream", - "tokio-tungstenite", + "tokio-tungstenite 0.20.1", "tokio-util", "tower-service", "tracing", @@ -6615,9 +6566,9 @@ dependencies = [ [[package]] name = "wasm-bindgen" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" +checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -6625,9 +6576,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" +checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" dependencies = [ "bumpalo", "log", @@ -6640,9 +6591,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.40" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" +checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" dependencies = [ "cfg-if", "js-sys", @@ -6652,9 +6603,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" +checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -6662,9 +6613,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" +checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", @@ -6675,9 +6626,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" +checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" [[package]] name = "wasm-encoder" @@ -6690,35 +6641,27 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.41.0" +version = "0.38.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e09bca7d6388637d27fb5edbeab11f56bfabcef8743c55ae34370e1e5030a071" +checksum = "0ad2b51884de9c7f4fe2fd1043fccb8dcad4b1e29558146ee57a144d15779f3f" dependencies = [ "leb128", ] [[package]] -<<<<<<< HEAD -name = "wasmparser" -version = "0.116.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a58e28b80dd8340cb07b8242ae654756161f6fc8d0038123d679b7b99964fa50" -dependencies = [ - "indexmap", -======= name = "wasm-encoder" -version = "0.41.0" +version = "0.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e09bca7d6388637d27fb5edbeab11f56bfabcef8743c55ae34370e1e5030a071" +checksum = "6ce14de623d48dda4c10698c4dadae2366b5c2c8e81bad981d5a0625a5fcf68c" dependencies = [ "leb128", ] [[package]] name = "wasm-metadata" -version = "0.10.17" +version = "0.10.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c853d3809fc9fccf3bc0ad63f4f51d8eefad0bacf88f957aa991c1d9b88b016e" +checksum = "977038054fd97977d2b7889005b5f20b62fd3563f2dc8dedfb534e3fdea6b7a7" dependencies = [ "anyhow", "indexmap 2.2.2", @@ -6726,8 +6669,8 @@ dependencies = [ "serde_derive", "serde_json", "spdx", - "wasm-encoder 0.41.0", - "wasmparser 0.121.0", + "wasm-encoder 0.41.1", + "wasmparser 0.121.1", ] [[package]] @@ -6737,44 +6680,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a58e28b80dd8340cb07b8242ae654756161f6fc8d0038123d679b7b99964fa50" dependencies = [ "indexmap 2.2.2", ->>>>>>> develop "semver 1.0.21", ] [[package]] name = "wasmparser" -version = "0.121.0" +version = "0.118.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953cf6a7606ab31382cb1caa5ae403e77ba70c7f8e12eeda167e7040d42bfda8" +checksum = "95ee9723b928e735d53000dec9eae7b07a60e490c85ab54abb66659fc61bfcd9" dependencies = [ -<<<<<<< HEAD - "bitflags 2.4.2", - "indexmap", -======= "indexmap 2.2.2", "semver 1.0.21", ] [[package]] name = "wasmparser" -version = "0.121.0" +version = "0.121.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953cf6a7606ab31382cb1caa5ae403e77ba70c7f8e12eeda167e7040d42bfda8" +checksum = "99ffe16b4aa1ebab8724f61c9ee38cd5481c89caf10bf1a5af9eab8f0c2e6c05" dependencies = [ "bitflags 2.4.2", "indexmap 2.2.2", ->>>>>>> develop "semver 1.0.21", ] [[package]] name = "wasmprinter" -version = "0.2.78" +version = "0.2.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05e32c13c59fdc64d3f6998a1d52eb1d362b6904a88b754190ccb85661ad577a" +checksum = "b4a76a9228f2e6653f0b3d912b2f3a9b6ac79c690e5642c9ee2dfd914c545cf0" dependencies = [ "anyhow", - "wasmparser 0.121.0", + "wasmparser 0.121.1", ] [[package]] @@ -6790,11 +6727,7 @@ dependencies = [ "cfg-if", "encoding_rs", "fxprof-processed-profile", -<<<<<<< HEAD - "indexmap", -======= "indexmap 2.2.2", ->>>>>>> develop "libc", "log", "object", @@ -6921,11 +6854,7 @@ dependencies = [ "anyhow", "cranelift-entity", "gimli", -<<<<<<< HEAD - "indexmap", -======= "indexmap 2.2.2", ->>>>>>> develop "log", "object", "serde", @@ -7014,22 +6943,14 @@ dependencies = [ "cc", "cfg-if", "encoding_rs", -<<<<<<< HEAD - "indexmap", -======= "indexmap 2.2.2", ->>>>>>> develop "libc", "log", "mach", "memfd", "memoffset", "paste", -<<<<<<< HEAD - "rand", -======= "rand 0.8.5", ->>>>>>> develop "rustix", "sptr", "wasm-encoder 0.36.2", @@ -7126,11 +7047,7 @@ checksum = "4b804dfd3d0c0d6d37aa21026fe7772ba1a769c89ee4f5c4f13b82d91d75216f" dependencies = [ "anyhow", "heck", -<<<<<<< HEAD - "indexmap", -======= "indexmap 2.2.2", ->>>>>>> develop "wit-parser", ] @@ -7151,31 +7068,31 @@ dependencies = [ [[package]] name = "wast" -version = "70.0.2" +version = "71.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3d5061300042ff5065123dae1e27d00c03f567d34a2937c8472255148a216dc" +checksum = "a10dad39ea4623ed4c304fb42bd455eca6d212f7e5e0cb59681fed7e4d128a2e" dependencies = [ "bumpalo", "leb128", "memchr", "unicode-width", - "wasm-encoder 0.41.0", + "wasm-encoder 0.41.1", ] [[package]] name = "wat" -version = "1.0.85" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afd7357b6cc46d46a2509c43dcb1dd4131dafbf4e75562d87017b5a05ffad2d6" +checksum = "b724419d3bffeff174745b924f6ed053095ac58f9ae72e87d2e0f8ef6df6df96" dependencies = [ - "wast 70.0.2", + "wast 71.0.0", ] [[package]] name = "web-sys" -version = "0.3.67" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" +checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" dependencies = [ "js-sys", "wasm-bindgen", @@ -7419,9 +7336,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.37" +version = "0.5.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cad8365489051ae9f054164e459304af2e7e9bb407c958076c8bf4aef52da5" +checksum = "5389a154b01683d28c77f8f68f49dea75f0a4da32557a58f68ee51ebba472d29" dependencies = [ "memchr", ] @@ -7444,8 +7361,6 @@ checksum = "f9643b83820c0cd246ecabe5fa454dd04ba4fa67996369466d0747472d337346" dependencies = [ "bitflags 2.4.2", "windows-sys 0.52.0", -<<<<<<< HEAD -======= ] [[package]] @@ -7510,22 +7425,17 @@ dependencies = [ "wasm-metadata", "wasmparser 0.118.1", "wit-parser", ->>>>>>> develop ] [[package]] name = "wit-parser" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df4913a2219096373fd6512adead1fb77ecdaa59d7fc517972a7d30b12f625be" +checksum = "316b36a9f0005f5aa4b03c39bc3728d045df136f8c13a73b7db4510dec725e08" dependencies = [ "anyhow", "id-arena", -<<<<<<< HEAD - "indexmap", -======= "indexmap 2.2.2", ->>>>>>> develop "log", "semver 1.0.21", "serde", diff --git a/kinode/Cargo.toml b/kinode/Cargo.toml index eaf59b102..ed140848b 100644 --- a/kinode/Cargo.toml +++ b/kinode/Cargo.toml @@ -26,6 +26,11 @@ simulation-mode = [] [dependencies] aes-gcm = "0.10.2" +alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "098ad56" } +alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "098ad56" } +alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "098ad56", features = ["ws"]} +alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "098ad56" } +alloy-providers = { git = "https://github.com/alloy-rs/alloy", rev = "098ad56" } anyhow = "1.0.71" async-trait = "0.1.71" base64 = "0.13" diff --git a/kinode/packages/kns_indexer/kns_indexer/Cargo.toml b/kinode/packages/kns_indexer/kns_indexer/Cargo.toml index a7b23579f..f7bfb61be 100644 --- a/kinode/packages/kns_indexer/kns_indexer/Cargo.toml +++ b/kinode/packages/kns_indexer/kns_indexer/Cargo.toml @@ -7,11 +7,11 @@ edition = "2021" [dependencies] anyhow = "1.0" alloy-primitives = "0.6.2" -alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy" } +alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "098ad56"} alloy-sol-types = "0.6.2" bincode = "1.3.3" hex = "0.4.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "032bd43" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "8d58cfb" } rmp-serde = "1.1.2" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/kinode/src/eth/provider.rs b/kinode/src/eth/provider.rs index 5cd4839bd..6c6a8cb03 100644 --- a/kinode/src/eth/provider.rs +++ b/kinode/src/eth/provider.rs @@ -1,11 +1,11 @@ -use crate::eth::types::*; -use crate::types::*; use alloy_pubsub::{PubSubFrontend, RawSubscription}; use alloy_rpc_client::ClientBuilder; use alloy_rpc_types::pubsub::SubscriptionResult; use alloy_transport_ws::WsConnect; use anyhow::Result; use dashmap::DashMap; +use lib::types::core::*; +use lib::types::eth::*; use std::sync::Arc; use tokio::task::JoinHandle; use url::Url; @@ -47,7 +47,7 @@ pub async fn provider( auth: None, }; - let client = ClientBuilder::default().pubsub(connector).await?; + let client = ClientBuilder::default().ws(connector).await?; Some(alloy_providers::provider::Provider::new_with_client(client)) } else { None diff --git a/kinode/src/register.rs b/kinode/src/register.rs index 181ce37f3..09f1e920e 100644 --- a/kinode/src/register.rs +++ b/kinode/src/register.rs @@ -262,7 +262,7 @@ async fn get_unencrypted_info(keyfile: Option>) -> Result Date: Fri, 9 Feb 2024 19:47:27 -0300 Subject: [PATCH 041/171] vfs: hotfix remove bug --- kinode/src/vfs.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kinode/src/vfs.rs b/kinode/src/vfs.rs index 731f593ea..1c40ec533 100644 --- a/kinode/src/vfs.rs +++ b/kinode/src/vfs.rs @@ -361,7 +361,8 @@ async fn handle_request( ) } VfsAction::RemoveFile => { - fs::remove_file(path).await?; + fs::remove_file(&path).await?; + open_files.remove(&path); (serde_json::to_vec(&VfsResponse::Ok).unwrap(), None) } VfsAction::RemoveDir => { From 190a077989ecb19f694a5334122a7fd1d0ea43a9 Mon Sep 17 00:00:00 2001 From: Will Galebach Date: Sat, 10 Feb 2024 09:32:10 +0000 Subject: [PATCH 042/171] Fix app detail page when no app found --- .../{index-pkTLhk2L.js => index-A09g5OKk.js} | 18 +++++++++--------- kinode/packages/app_store/pkg/ui/index.html | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) rename kinode/packages/app_store/pkg/ui/assets/{index-pkTLhk2L.js => index-A09g5OKk.js} (89%) diff --git a/kinode/packages/app_store/pkg/ui/assets/index-pkTLhk2L.js b/kinode/packages/app_store/pkg/ui/assets/index-A09g5OKk.js similarity index 89% rename from kinode/packages/app_store/pkg/ui/assets/index-pkTLhk2L.js rename to kinode/packages/app_store/pkg/ui/assets/index-A09g5OKk.js index af5883ec2..e4eb126cf 100644 --- a/kinode/packages/app_store/pkg/ui/assets/index-pkTLhk2L.js +++ b/kinode/packages/app_store/pkg/ui/assets/index-A09g5OKk.js @@ -22,7 +22,7 @@ var nw=Object.defineProperty;var iw=(t,e,r)=>e in t?nw(t,e,{enumerable:!0,config * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(t){function e(b,M){var R=b.length;b.push(M);e:for(;0>>1,h=b[S];if(0>>1;Si(y,R))Di(U,y)?(b[S]=U,b[D]=R,S=D):(b[S]=y,b[te]=R,S=te);else if(Di(U,R))b[S]=U,b[D]=R,S=D;else break e}}return M}function i(b,M){var R=b.sortIndex-M.sortIndex;return R!==0?R:b.id-M.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,l=s.now();t.unstable_now=function(){return s.now()-l}}var a=[],u=[],c=1,d=null,m=3,v=!1,p=!1,x=!1,k=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(b){for(var M=r(u);M!==null;){if(M.callback===null)n(u);else if(M.startTime<=b)n(u),M.sortIndex=M.expirationTime,e(a,M);else break;M=r(u)}}function O(b){if(x=!1,_(b),!p)if(r(a)!==null)p=!0,A(B);else{var M=r(u);M!==null&&N(O,M.startTime-b)}}function B(b,M){p=!1,x&&(x=!1,E(H),H=-1),v=!0;var R=m;try{for(_(M),d=r(a);d!==null&&(!(d.expirationTime>M)||b&&!G());){var S=d.callback;if(typeof S=="function"){d.callback=null,m=d.priorityLevel;var h=S(d.expirationTime<=M);M=t.unstable_now(),typeof h=="function"?d.callback=h:d===r(a)&&n(a),_(M)}else n(a);d=r(a)}if(d!==null)var P=!0;else{var te=r(u);te!==null&&N(O,te.startTime-M),P=!1}return P}finally{d=null,m=R,v=!1}}var j=!1,$=null,H=-1,ie=5,X=-1;function G(){return!(t.unstable_now()-Xb||125S?(b.sortIndex=R,e(u,b),r(a)===null&&b===r(u)&&(x?(E(H),H=-1):x=!0,N(O,R-S))):(b.sortIndex=h,e(a,b),p||v||(p=!0,A(B))),b},t.unstable_shouldYield=G,t.unstable_wrapCallback=function(b){var M=m;return function(){var R=m;m=M;try{return b.apply(this,arguments)}finally{m=R}}}})(Km);Vm.exports=Km;var Pw=Vm.exports;/** + */(function(t){function e(b,M){var R=b.length;b.push(M);e:for(;0>>1,h=b[S];if(0>>1;Si(y,R))Di(U,y)?(b[S]=U,b[D]=R,S=D):(b[S]=y,b[te]=R,S=te);else if(Di(U,R))b[S]=U,b[D]=R,S=D;else break e}}return M}function i(b,M){var R=b.sortIndex-M.sortIndex;return R!==0?R:b.id-M.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,l=s.now();t.unstable_now=function(){return s.now()-l}}var a=[],u=[],c=1,d=null,p=3,v=!1,g=!1,x=!1,k=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(b){for(var M=r(u);M!==null;){if(M.callback===null)n(u);else if(M.startTime<=b)n(u),M.sortIndex=M.expirationTime,e(a,M);else break;M=r(u)}}function O(b){if(x=!1,_(b),!g)if(r(a)!==null)g=!0,A(B);else{var M=r(u);M!==null&&N(O,M.startTime-b)}}function B(b,M){g=!1,x&&(x=!1,E(H),H=-1),v=!0;var R=p;try{for(_(M),d=r(a);d!==null&&(!(d.expirationTime>M)||b&&!G());){var S=d.callback;if(typeof S=="function"){d.callback=null,p=d.priorityLevel;var h=S(d.expirationTime<=M);M=t.unstable_now(),typeof h=="function"?d.callback=h:d===r(a)&&n(a),_(M)}else n(a);d=r(a)}if(d!==null)var P=!0;else{var te=r(u);te!==null&&N(O,te.startTime-M),P=!1}return P}finally{d=null,p=R,v=!1}}var j=!1,$=null,H=-1,ie=5,X=-1;function G(){return!(t.unstable_now()-Xb||125S?(b.sortIndex=R,e(u,b),r(a)===null&&b===r(u)&&(x?(E(H),H=-1):x=!0,N(O,R-S))):(b.sortIndex=h,e(a,b),g||v||(g=!0,A(B))),b},t.unstable_shouldYield=G,t.unstable_wrapCallback=function(b){var M=p;return function(){var R=p;p=M;try{return b.apply(this,arguments)}finally{p=R}}}})(Km);Vm.exports=Km;var Pw=Vm.exports;/** * @license React * react-dom.production.min.js * @@ -34,10 +34,10 @@ var nw=Object.defineProperty;var iw=(t,e,r)=>e in t?nw(t,e,{enumerable:!0,config `+dc+t}var hc=!1;function pc(t,e){if(!t||hc)return"";hc=!0;var r=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(u){var n=u}Reflect.construct(t,[],e)}else{try{e.call()}catch(u){n=u}t.call(e.prototype)}else{try{throw Error()}catch(u){n=u}t()}}catch(u){if(u&&n&&typeof u.stack=="string"){for(var i=u.stack.split(` `),o=n.stack.split(` `),s=i.length-1,l=o.length-1;1<=s&&0<=l&&i[s]!==o[l];)l--;for(;1<=s&&0<=l;s--,l--)if(i[s]!==o[l]){if(s!==1||l!==1)do if(s--,l--,0>l||i[s]!==o[l]){var a=` -`+i[s].replace(" at new "," at ");return t.displayName&&a.includes("")&&(a=a.replace("",t.displayName)),a}while(1<=s&&0<=l);break}}}finally{hc=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?fs(t):""}function Tw(t){switch(t.tag){case 5:return fs(t.type);case 16:return fs("Lazy");case 13:return fs("Suspense");case 19:return fs("SuspenseList");case 0:case 2:case 15:return t=pc(t.type,!1),t;case 11:return t=pc(t.type.render,!1),t;case 1:return t=pc(t.type,!0),t;default:return""}}function mf(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Zi:return"Fragment";case Xi:return"Portal";case df:return"Profiler";case Rd:return"StrictMode";case hf:return"Suspense";case pf:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Xm:return(t.displayName||"Context")+".Consumer";case Ym:return(t._context.displayName||"Context")+".Provider";case Td:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Od:return e=t.displayName||null,e!==null?e:mf(t.type)||"Memo";case Jn:e=t._payload,t=t._init;try{return mf(t(e))}catch{}}return null}function Ow(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return mf(e);case 8:return e===Rd?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function pi(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function eg(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Lw(t){var e=eg(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,o=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){n=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(s){n=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function kl(t){t._valueTracker||(t._valueTracker=Lw(t))}function tg(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=eg(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function Sa(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function gf(t,e){var r=e.checked;return ft({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function Kh(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=pi(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function rg(t,e){e=e.checked,e!=null&&Id(t,"checked",e,!1)}function vf(t,e){rg(t,e);var r=pi(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?yf(t,e.type,r):e.hasOwnProperty("defaultValue")&&yf(t,e.type,pi(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Qh(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function yf(t,e,r){(e!=="number"||Sa(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var ds=Array.isArray;function go(t,e,r,n){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Nl.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ts(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var ws={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Bw=["Webkit","ms","Moz","O"];Object.keys(ws).forEach(function(t){Bw.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ws[e]=ws[t]})});function sg(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||ws.hasOwnProperty(t)&&ws[t]?(""+e).trim():e+"px"}function lg(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=sg(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,i):t[r]=i}}var Dw=ft({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function xf(t,e){if(e){if(Dw[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(q(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(q(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(q(61))}if(e.style!=null&&typeof e.style!="object")throw Error(q(62))}}function Af(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var bf=null;function Ld(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var _f=null,vo=null,yo=null;function Xh(t){if(t=ml(t)){if(typeof _f!="function")throw Error(q(280));var e=t.stateNode;e&&(e=vu(e),_f(t.stateNode,t.type,e))}}function ag(t){vo?yo?yo.push(t):yo=[t]:vo=t}function ug(){if(vo){var t=vo,e=yo;if(yo=vo=null,Xh(t),e)for(t=0;t>>=0,t===0?32:31-(Kw(t)/Qw|0)|0}var Pl=64,Cl=4194304;function hs(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Ca(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,i=t.suspendedLanes,o=t.pingedLanes,s=r&268435455;if(s!==0){var l=s&~i;l!==0?n=hs(l):(o&=s,o!==0&&(n=hs(o)))}else s=r&~i,s!==0?n=hs(s):o!==0&&(n=hs(o));if(n===0)return 0;if(e!==0&&e!==n&&!(e&i)&&(i=n&-n,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0r;r++)e.push(t);return e}function hl(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Wr(e),t[e]=r}function Zw(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0=xs),l0=" ",a0=!1;function Cg(t,e){switch(t){case"keyup":return N2.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Mg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var eo=!1;function C2(t,e){switch(t){case"compositionend":return Mg(e);case"keypress":return e.which!==32?null:(a0=!0,l0);case"textInput":return t=e.data,t===l0&&a0?null:t;default:return null}}function M2(t,e){if(eo)return t==="compositionend"||!Hd&&Cg(t,e)?(t=Ng(),na=Fd=ri=null,eo=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=d0(r)}}function Og(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Og(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Lg(){for(var t=window,e=Sa();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=Sa(t.document)}return e}function qd(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function U2(t){var e=Lg(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&Og(r.ownerDocument.documentElement,r)){if(n!==null&&qd(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=r.textContent.length,o=Math.min(n.start,i);n=n.end===void 0?o:Math.min(n.end,i),!t.extend&&o>n&&(i=n,n=o,o=i),i=h0(r,o);var s=h0(r,n);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>n?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,to=null,Mf=null,bs=null,If=!1;function p0(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;If||to==null||to!==Sa(n)||(n=to,"selectionStart"in n&&qd(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),bs&&Us(bs,n)||(bs=n,n=Ra(Mf,"onSelect"),0io||(t.current=Df[io],Df[io]=null,io--)}function Qe(t,e){io++,Df[io]=t.current,t.current=e}var mi={},zt=wi(mi),er=wi(!1),Ri=mi;function ko(t,e){var r=t.type.contextTypes;if(!r)return mi;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in r)i[o]=e[o];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function tr(t){return t=t.childContextTypes,t!=null}function Oa(){tt(er),tt(zt)}function x0(t,e,r){if(zt.current!==mi)throw Error(q(168));Qe(zt,e),Qe(er,r)}function qg(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in e))throw Error(q(108,Ow(t)||"Unknown",i));return ft({},r,n)}function La(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||mi,Ri=zt.current,Qe(zt,t),Qe(er,er.current),!0}function A0(t,e,r){var n=t.stateNode;if(!n)throw Error(q(169));r?(t=qg(t,e,Ri),n.__reactInternalMemoizedMergedChildContext=t,tt(er),tt(zt),Qe(zt,t)):tt(er),Qe(er,r)}var An=null,yu=!1,Pc=!1;function Wg(t){An===null?An=[t]:An.push(t)}function Y2(t){yu=!0,Wg(t)}function Ei(){if(!Pc&&An!==null){Pc=!0;var t=0,e=Re;try{var r=An;for(Re=1;t>=s,i-=s,Sn=1<<32-Wr(e)+i|r<H?(ie=$,$=null):ie=$.sibling;var X=m(E,$,_[H],O);if(X===null){$===null&&($=ie);break}t&&$&&X.alternate===null&&e(E,$),w=o(X,w,H),j===null?B=X:j.sibling=X,j=X,$=ie}if(H===_.length)return r(E,$),nt&&bi(E,H),B;if($===null){for(;H<_.length;H++)$=d(E,_[H],O),$!==null&&(w=o($,w,H),j===null?B=$:j.sibling=$,j=$);return nt&&bi(E,H),B}for($=n(E,$);H<_.length;H++)ie=v($,E,H,_[H],O),ie!==null&&(t&&ie.alternate!==null&&$.delete(ie.key===null?H:ie.key),w=o(ie,w,H),j===null?B=ie:j.sibling=ie,j=ie);return t&&$.forEach(function(G){return e(E,G)}),nt&&bi(E,H),B}function x(E,w,_,O){var B=Jo(_);if(typeof B!="function")throw Error(q(150));if(_=B.call(_),_==null)throw Error(q(151));for(var j=B=null,$=w,H=w=0,ie=null,X=_.next();$!==null&&!X.done;H++,X=_.next()){$.index>H?(ie=$,$=null):ie=$.sibling;var G=m(E,$,X.value,O);if(G===null){$===null&&($=ie);break}t&&$&&G.alternate===null&&e(E,$),w=o(G,w,H),j===null?B=G:j.sibling=G,j=G,$=ie}if(X.done)return r(E,$),nt&&bi(E,H),B;if($===null){for(;!X.done;H++,X=_.next())X=d(E,X.value,O),X!==null&&(w=o(X,w,H),j===null?B=X:j.sibling=X,j=X);return nt&&bi(E,H),B}for($=n(E,$);!X.done;H++,X=_.next())X=v($,E,H,X.value,O),X!==null&&(t&&X.alternate!==null&&$.delete(X.key===null?H:X.key),w=o(X,w,H),j===null?B=X:j.sibling=X,j=X);return t&&$.forEach(function(J){return e(E,J)}),nt&&bi(E,H),B}function k(E,w,_,O){if(typeof _=="object"&&_!==null&&_.type===Zi&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case Sl:e:{for(var B=_.key,j=w;j!==null;){if(j.key===B){if(B=_.type,B===Zi){if(j.tag===7){r(E,j.sibling),w=i(j,_.props.children),w.return=E,E=w;break e}}else if(j.elementType===B||typeof B=="object"&&B!==null&&B.$$typeof===Jn&&C0(B)===j.type){r(E,j.sibling),w=i(j,_.props),w.ref=ts(E,j,_),w.return=E,E=w;break e}r(E,j);break}else e(E,j);j=j.sibling}_.type===Zi?(w=Mi(_.props.children,E.mode,O,_.key),w.return=E,E=w):(O=fa(_.type,_.key,_.props,null,E.mode,O),O.ref=ts(E,w,_),O.return=E,E=O)}return s(E);case Xi:e:{for(j=_.key;w!==null;){if(w.key===j)if(w.tag===4&&w.stateNode.containerInfo===_.containerInfo&&w.stateNode.implementation===_.implementation){r(E,w.sibling),w=i(w,_.children||[]),w.return=E,E=w;break e}else{r(E,w);break}else e(E,w);w=w.sibling}w=Bc(_,E.mode,O),w.return=E,E=w}return s(E);case Jn:return j=_._init,k(E,w,j(_._payload),O)}if(ds(_))return p(E,w,_,O);if(Jo(_))return x(E,w,_,O);Bl(E,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,w!==null&&w.tag===6?(r(E,w.sibling),w=i(w,_),w.return=E,E=w):(r(E,w),w=Lc(_,E.mode,O),w.return=E,E=w),s(E)):r(E,w)}return k}var Po=Zg(!0),ev=Zg(!1),gl={},an=wi(gl),Hs=wi(gl),qs=wi(gl);function Pi(t){if(t===gl)throw Error(q(174));return t}function Zd(t,e){switch(Qe(qs,e),Qe(Hs,t),Qe(an,gl),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Ef(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Ef(e,t)}tt(an),Qe(an,e)}function Co(){tt(an),tt(Hs),tt(qs)}function tv(t){Pi(qs.current);var e=Pi(an.current),r=Ef(e,t.type);e!==r&&(Qe(Hs,t),Qe(an,r))}function eh(t){Hs.current===t&&(tt(an),tt(Hs))}var at=wi(0);function za(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Cc=[];function th(){for(var t=0;tr?r:4,t(!0);var n=Mc.transition;Mc.transition={};try{t(!1),e()}finally{Re=r,Mc.transition=n}}function vv(){return Pr().memoizedState}function tE(t,e,r){var n=di(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},yv(t))wv(e,r);else if(r=Qg(t,e,r,n),r!==null){var i=Wt();Gr(r,t,n,i),Ev(r,e,n)}}function rE(t,e,r){var n=di(t),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(yv(t))wv(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,l=o(s,r);if(i.hasEagerState=!0,i.eagerState=l,Vr(l,s)){var a=e.interleaved;a===null?(i.next=i,Yd(e)):(i.next=a.next,a.next=i),e.interleaved=i;return}}catch{}finally{}r=Qg(t,e,i,n),r!==null&&(i=Wt(),Gr(r,t,n,i),Ev(r,e,n))}}function yv(t){var e=t.alternate;return t===ct||e!==null&&e===ct}function wv(t,e){_s=$a=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function Ev(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,Dd(t,r)}}var Ha={readContext:Nr,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useInsertionEffect:Lt,useLayoutEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useMutableSource:Lt,useSyncExternalStore:Lt,useId:Lt,unstable_isNewReconciler:!1},nE={readContext:Nr,useCallback:function(t,e){return Zr().memoizedState=[t,e===void 0?null:e],t},useContext:Nr,useEffect:I0,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,la(4194308,4,dv.bind(null,e,t),r)},useLayoutEffect:function(t,e){return la(4194308,4,t,e)},useInsertionEffect:function(t,e){return la(4,2,t,e)},useMemo:function(t,e){var r=Zr();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=Zr();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=tE.bind(null,ct,t),[n.memoizedState,t]},useRef:function(t){var e=Zr();return t={current:t},e.memoizedState=t},useState:M0,useDebugValue:sh,useDeferredValue:function(t){return Zr().memoizedState=t},useTransition:function(){var t=M0(!1),e=t[0];return t=eE.bind(null,t[1]),Zr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=ct,i=Zr();if(nt){if(r===void 0)throw Error(q(407));r=r()}else{if(r=e(),Nt===null)throw Error(q(349));Oi&30||iv(n,e,r)}i.memoizedState=r;var o={value:r,getSnapshot:e};return i.queue=o,I0(sv.bind(null,n,o,t),[t]),n.flags|=2048,Vs(9,ov.bind(null,n,o,r,e),void 0,null),r},useId:function(){var t=Zr(),e=Nt.identifierPrefix;if(nt){var r=kn,n=Sn;r=(n&~(1<<32-Wr(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=Ws++,0")&&(a=a.replace("",t.displayName)),a}while(1<=s&&0<=l);break}}}finally{hc=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?fs(t):""}function Tw(t){switch(t.tag){case 5:return fs(t.type);case 16:return fs("Lazy");case 13:return fs("Suspense");case 19:return fs("SuspenseList");case 0:case 2:case 15:return t=pc(t.type,!1),t;case 11:return t=pc(t.type.render,!1),t;case 1:return t=pc(t.type,!0),t;default:return""}}function mf(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Zi:return"Fragment";case Xi:return"Portal";case df:return"Profiler";case Rd:return"StrictMode";case hf:return"Suspense";case pf:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Xm:return(t.displayName||"Context")+".Consumer";case Ym:return(t._context.displayName||"Context")+".Provider";case Td:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Od:return e=t.displayName||null,e!==null?e:mf(t.type)||"Memo";case Jn:e=t._payload,t=t._init;try{return mf(t(e))}catch{}}return null}function Ow(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return mf(e);case 8:return e===Rd?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function pi(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function eg(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Lw(t){var e=eg(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,o=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){n=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(s){n=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function kl(t){t._valueTracker||(t._valueTracker=Lw(t))}function tg(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=eg(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function Sa(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function gf(t,e){var r=e.checked;return ft({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function Kh(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=pi(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function rg(t,e){e=e.checked,e!=null&&Id(t,"checked",e,!1)}function vf(t,e){rg(t,e);var r=pi(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?yf(t,e.type,r):e.hasOwnProperty("defaultValue")&&yf(t,e.type,pi(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Qh(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function yf(t,e,r){(e!=="number"||Sa(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var ds=Array.isArray;function go(t,e,r,n){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Nl.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ts(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var ws={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Bw=["Webkit","ms","Moz","O"];Object.keys(ws).forEach(function(t){Bw.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ws[e]=ws[t]})});function sg(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||ws.hasOwnProperty(t)&&ws[t]?(""+e).trim():e+"px"}function lg(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=sg(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,i):t[r]=i}}var Dw=ft({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function xf(t,e){if(e){if(Dw[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(q(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(q(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(q(61))}if(e.style!=null&&typeof e.style!="object")throw Error(q(62))}}function Af(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var bf=null;function Ld(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var _f=null,vo=null,yo=null;function Xh(t){if(t=ml(t)){if(typeof _f!="function")throw Error(q(280));var e=t.stateNode;e&&(e=vu(e),_f(t.stateNode,t.type,e))}}function ag(t){vo?yo?yo.push(t):yo=[t]:vo=t}function ug(){if(vo){var t=vo,e=yo;if(yo=vo=null,Xh(t),e)for(t=0;t>>=0,t===0?32:31-(Kw(t)/Qw|0)|0}var Pl=64,Cl=4194304;function hs(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Ca(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,i=t.suspendedLanes,o=t.pingedLanes,s=r&268435455;if(s!==0){var l=s&~i;l!==0?n=hs(l):(o&=s,o!==0&&(n=hs(o)))}else s=r&~i,s!==0?n=hs(s):o!==0&&(n=hs(o));if(n===0)return 0;if(e!==0&&e!==n&&!(e&i)&&(i=n&-n,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0r;r++)e.push(t);return e}function hl(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Wr(e),t[e]=r}function Zw(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0=xs),l0=" ",a0=!1;function Cg(t,e){switch(t){case"keyup":return N2.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Mg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var eo=!1;function C2(t,e){switch(t){case"compositionend":return Mg(e);case"keypress":return e.which!==32?null:(a0=!0,l0);case"textInput":return t=e.data,t===l0&&a0?null:t;default:return null}}function M2(t,e){if(eo)return t==="compositionend"||!Hd&&Cg(t,e)?(t=Ng(),na=Fd=ri=null,eo=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=d0(r)}}function Og(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Og(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Lg(){for(var t=window,e=Sa();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=Sa(t.document)}return e}function qd(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function U2(t){var e=Lg(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&Og(r.ownerDocument.documentElement,r)){if(n!==null&&qd(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=r.textContent.length,o=Math.min(n.start,i);n=n.end===void 0?o:Math.min(n.end,i),!t.extend&&o>n&&(i=n,n=o,o=i),i=h0(r,o);var s=h0(r,n);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>n?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,to=null,Mf=null,bs=null,If=!1;function p0(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;If||to==null||to!==Sa(n)||(n=to,"selectionStart"in n&&qd(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),bs&&Us(bs,n)||(bs=n,n=Ra(Mf,"onSelect"),0io||(t.current=Df[io],Df[io]=null,io--)}function Qe(t,e){io++,Df[io]=t.current,t.current=e}var mi={},zt=wi(mi),er=wi(!1),Ri=mi;function ko(t,e){var r=t.type.contextTypes;if(!r)return mi;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in r)i[o]=e[o];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function tr(t){return t=t.childContextTypes,t!=null}function Oa(){tt(er),tt(zt)}function x0(t,e,r){if(zt.current!==mi)throw Error(q(168));Qe(zt,e),Qe(er,r)}function qg(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in e))throw Error(q(108,Ow(t)||"Unknown",i));return ft({},r,n)}function La(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||mi,Ri=zt.current,Qe(zt,t),Qe(er,er.current),!0}function A0(t,e,r){var n=t.stateNode;if(!n)throw Error(q(169));r?(t=qg(t,e,Ri),n.__reactInternalMemoizedMergedChildContext=t,tt(er),tt(zt),Qe(zt,t)):tt(er),Qe(er,r)}var An=null,yu=!1,Pc=!1;function Wg(t){An===null?An=[t]:An.push(t)}function Y2(t){yu=!0,Wg(t)}function Ei(){if(!Pc&&An!==null){Pc=!0;var t=0,e=Re;try{var r=An;for(Re=1;t>=s,i-=s,Sn=1<<32-Wr(e)+i|r<H?(ie=$,$=null):ie=$.sibling;var X=p(E,$,_[H],O);if(X===null){$===null&&($=ie);break}t&&$&&X.alternate===null&&e(E,$),w=o(X,w,H),j===null?B=X:j.sibling=X,j=X,$=ie}if(H===_.length)return r(E,$),nt&&bi(E,H),B;if($===null){for(;H<_.length;H++)$=d(E,_[H],O),$!==null&&(w=o($,w,H),j===null?B=$:j.sibling=$,j=$);return nt&&bi(E,H),B}for($=n(E,$);H<_.length;H++)ie=v($,E,H,_[H],O),ie!==null&&(t&&ie.alternate!==null&&$.delete(ie.key===null?H:ie.key),w=o(ie,w,H),j===null?B=ie:j.sibling=ie,j=ie);return t&&$.forEach(function(G){return e(E,G)}),nt&&bi(E,H),B}function x(E,w,_,O){var B=Jo(_);if(typeof B!="function")throw Error(q(150));if(_=B.call(_),_==null)throw Error(q(151));for(var j=B=null,$=w,H=w=0,ie=null,X=_.next();$!==null&&!X.done;H++,X=_.next()){$.index>H?(ie=$,$=null):ie=$.sibling;var G=p(E,$,X.value,O);if(G===null){$===null&&($=ie);break}t&&$&&G.alternate===null&&e(E,$),w=o(G,w,H),j===null?B=G:j.sibling=G,j=G,$=ie}if(X.done)return r(E,$),nt&&bi(E,H),B;if($===null){for(;!X.done;H++,X=_.next())X=d(E,X.value,O),X!==null&&(w=o(X,w,H),j===null?B=X:j.sibling=X,j=X);return nt&&bi(E,H),B}for($=n(E,$);!X.done;H++,X=_.next())X=v($,E,H,X.value,O),X!==null&&(t&&X.alternate!==null&&$.delete(X.key===null?H:X.key),w=o(X,w,H),j===null?B=X:j.sibling=X,j=X);return t&&$.forEach(function(J){return e(E,J)}),nt&&bi(E,H),B}function k(E,w,_,O){if(typeof _=="object"&&_!==null&&_.type===Zi&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case Sl:e:{for(var B=_.key,j=w;j!==null;){if(j.key===B){if(B=_.type,B===Zi){if(j.tag===7){r(E,j.sibling),w=i(j,_.props.children),w.return=E,E=w;break e}}else if(j.elementType===B||typeof B=="object"&&B!==null&&B.$$typeof===Jn&&C0(B)===j.type){r(E,j.sibling),w=i(j,_.props),w.ref=ts(E,j,_),w.return=E,E=w;break e}r(E,j);break}else e(E,j);j=j.sibling}_.type===Zi?(w=Mi(_.props.children,E.mode,O,_.key),w.return=E,E=w):(O=fa(_.type,_.key,_.props,null,E.mode,O),O.ref=ts(E,w,_),O.return=E,E=O)}return s(E);case Xi:e:{for(j=_.key;w!==null;){if(w.key===j)if(w.tag===4&&w.stateNode.containerInfo===_.containerInfo&&w.stateNode.implementation===_.implementation){r(E,w.sibling),w=i(w,_.children||[]),w.return=E,E=w;break e}else{r(E,w);break}else e(E,w);w=w.sibling}w=Bc(_,E.mode,O),w.return=E,E=w}return s(E);case Jn:return j=_._init,k(E,w,j(_._payload),O)}if(ds(_))return g(E,w,_,O);if(Jo(_))return x(E,w,_,O);Bl(E,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,w!==null&&w.tag===6?(r(E,w.sibling),w=i(w,_),w.return=E,E=w):(r(E,w),w=Lc(_,E.mode,O),w.return=E,E=w),s(E)):r(E,w)}return k}var Po=Zg(!0),ev=Zg(!1),gl={},an=wi(gl),Hs=wi(gl),qs=wi(gl);function Pi(t){if(t===gl)throw Error(q(174));return t}function Zd(t,e){switch(Qe(qs,e),Qe(Hs,t),Qe(an,gl),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Ef(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Ef(e,t)}tt(an),Qe(an,e)}function Co(){tt(an),tt(Hs),tt(qs)}function tv(t){Pi(qs.current);var e=Pi(an.current),r=Ef(e,t.type);e!==r&&(Qe(Hs,t),Qe(an,r))}function eh(t){Hs.current===t&&(tt(an),tt(Hs))}var at=wi(0);function za(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Cc=[];function th(){for(var t=0;tr?r:4,t(!0);var n=Mc.transition;Mc.transition={};try{t(!1),e()}finally{Re=r,Mc.transition=n}}function vv(){return Pr().memoizedState}function tE(t,e,r){var n=di(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},yv(t))wv(e,r);else if(r=Qg(t,e,r,n),r!==null){var i=Wt();Gr(r,t,n,i),Ev(r,e,n)}}function rE(t,e,r){var n=di(t),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(yv(t))wv(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,l=o(s,r);if(i.hasEagerState=!0,i.eagerState=l,Vr(l,s)){var a=e.interleaved;a===null?(i.next=i,Yd(e)):(i.next=a.next,a.next=i),e.interleaved=i;return}}catch{}finally{}r=Qg(t,e,i,n),r!==null&&(i=Wt(),Gr(r,t,n,i),Ev(r,e,n))}}function yv(t){var e=t.alternate;return t===ct||e!==null&&e===ct}function wv(t,e){_s=$a=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function Ev(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,Dd(t,r)}}var Ha={readContext:Nr,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useInsertionEffect:Lt,useLayoutEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useMutableSource:Lt,useSyncExternalStore:Lt,useId:Lt,unstable_isNewReconciler:!1},nE={readContext:Nr,useCallback:function(t,e){return Zr().memoizedState=[t,e===void 0?null:e],t},useContext:Nr,useEffect:I0,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,la(4194308,4,dv.bind(null,e,t),r)},useLayoutEffect:function(t,e){return la(4194308,4,t,e)},useInsertionEffect:function(t,e){return la(4,2,t,e)},useMemo:function(t,e){var r=Zr();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=Zr();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=tE.bind(null,ct,t),[n.memoizedState,t]},useRef:function(t){var e=Zr();return t={current:t},e.memoizedState=t},useState:M0,useDebugValue:sh,useDeferredValue:function(t){return Zr().memoizedState=t},useTransition:function(){var t=M0(!1),e=t[0];return t=eE.bind(null,t[1]),Zr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=ct,i=Zr();if(nt){if(r===void 0)throw Error(q(407));r=r()}else{if(r=e(),Nt===null)throw Error(q(349));Oi&30||iv(n,e,r)}i.memoizedState=r;var o={value:r,getSnapshot:e};return i.queue=o,I0(sv.bind(null,n,o,t),[t]),n.flags|=2048,Vs(9,ov.bind(null,n,o,r,e),void 0,null),r},useId:function(){var t=Zr(),e=Nt.identifierPrefix;if(nt){var r=kn,n=Sn;r=(n&~(1<<32-Wr(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=Ws++,0<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=s.createElement(r,{is:n.is}):(t=s.createElement(r),r==="select"&&(s=t,n.multiple?s.multiple=!0:n.size&&(s.size=n.size))):t=s.createElementNS(t,r),t[nn]=e,t[$s]=n,Cv(t,e,!1,!1),e.stateNode=t;e:{switch(s=Af(r,n),r){case"dialog":et("cancel",t),et("close",t),i=n;break;case"iframe":case"object":case"embed":et("load",t),i=n;break;case"video":case"audio":for(i=0;iIo&&(e.flags|=128,n=!0,rs(o,!1),e.lanes=4194304)}else{if(!n)if(t=za(s),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),rs(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!nt)return Bt(e),null}else 2*vt()-o.renderingStartTime>Io&&r!==1073741824&&(e.flags|=128,n=!0,rs(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(r=o.last,r!==null?r.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=vt(),e.sibling=null,r=at.current,Qe(at,n?r&1|2:r&1),e):(Bt(e),null);case 22:case 23:return dh(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?lr&1073741824&&(Bt(e),e.subtreeFlags&6&&(e.flags|=8192)):Bt(e),null;case 24:return null;case 25:return null}throw Error(q(156,e.tag))}function fE(t,e){switch(Gd(e),e.tag){case 1:return tr(e.type)&&Oa(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Co(),tt(er),tt(zt),th(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return eh(e),null;case 13:if(tt(at),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(q(340));No()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return tt(at),null;case 4:return Co(),null;case 10:return Jd(e.type._context),null;case 22:case 23:return dh(),null;case 24:return null;default:return null}}var jl=!1,Dt=!1,dE=typeof WeakSet=="function"?WeakSet:Set,Z=null;function ao(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){ht(t,e,n)}else r.current=null}function Qf(t,e,r){try{r()}catch(n){ht(t,e,n)}}var F0=!1;function hE(t,e){if(Rf=Ma,t=Lg(),qd(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break e}var s=0,l=-1,a=-1,u=0,c=0,d=t,m=null;t:for(;;){for(var v;d!==r||i!==0&&d.nodeType!==3||(l=s+i),d!==o||n!==0&&d.nodeType!==3||(a=s+n),d.nodeType===3&&(s+=d.nodeValue.length),(v=d.firstChild)!==null;)m=d,d=v;for(;;){if(d===t)break t;if(m===r&&++u===i&&(l=s),m===o&&++c===n&&(a=s),(v=d.nextSibling)!==null)break;d=m,m=d.parentNode}d=v}r=l===-1||a===-1?null:{start:l,end:a}}else r=null}r=r||{start:0,end:0}}else r=null;for(Tf={focusedElem:t,selectionRange:r},Ma=!1,Z=e;Z!==null;)if(e=Z,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Z=t;else for(;Z!==null;){e=Z;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var x=p.memoizedProps,k=p.memoizedState,E=e.stateNode,w=E.getSnapshotBeforeUpdate(e.elementType===e.type?x:jr(e.type,x),k);E.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var _=e.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(q(163))}}catch(O){ht(e,e.return,O)}if(t=e.sibling,t!==null){t.return=e.return,Z=t;break}Z=e.return}return p=F0,F0=!1,p}function Ss(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&Qf(e,r,o)}i=i.next}while(i!==n)}}function xu(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function Jf(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function Rv(t){var e=t.alternate;e!==null&&(t.alternate=null,Rv(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[nn],delete e[$s],delete e[Bf],delete e[Q2],delete e[J2])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Tv(t){return t.tag===5||t.tag===3||t.tag===4}function z0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Tv(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Yf(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=Ta));else if(n!==4&&(t=t.child,t!==null))for(Yf(t,e,r),t=t.sibling;t!==null;)Yf(t,e,r),t=t.sibling}function Xf(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(Xf(t,e,r),t=t.sibling;t!==null;)Xf(t,e,r),t=t.sibling}var Mt=null,Fr=!1;function Vn(t,e,r){for(r=r.child;r!==null;)Ov(t,e,r),r=r.sibling}function Ov(t,e,r){if(ln&&typeof ln.onCommitFiberUnmount=="function")try{ln.onCommitFiberUnmount(hu,r)}catch{}switch(r.tag){case 5:Dt||ao(r,e);case 6:var n=Mt,i=Fr;Mt=null,Vn(t,e,r),Mt=n,Fr=i,Mt!==null&&(Fr?(t=Mt,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Mt.removeChild(r.stateNode));break;case 18:Mt!==null&&(Fr?(t=Mt,r=r.stateNode,t.nodeType===8?Nc(t.parentNode,r):t.nodeType===1&&Nc(t,r),Ds(t)):Nc(Mt,r.stateNode));break;case 4:n=Mt,i=Fr,Mt=r.stateNode.containerInfo,Fr=!0,Vn(t,e,r),Mt=n,Fr=i;break;case 0:case 11:case 14:case 15:if(!Dt&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&Qf(r,e,s),i=i.next}while(i!==n)}Vn(t,e,r);break;case 1:if(!Dt&&(ao(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){ht(r,e,l)}Vn(t,e,r);break;case 21:Vn(t,e,r);break;case 22:r.mode&1?(Dt=(n=Dt)||r.memoizedState!==null,Vn(t,e,r),Dt=n):Vn(t,e,r);break;default:Vn(t,e,r)}}function $0(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new dE),e.forEach(function(n){var i=AE.bind(null,t,n);r.has(n)||(r.add(n),n.then(i,i))})}}function Tr(t,e){var r=e.deletions;if(r!==null)for(var n=0;ni&&(i=s),n&=~o}if(n=i,n=vt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*mE(n/1960))-n,10t?16:t,ni===null)var n=!1;else{if(t=ni,ni=null,Ga=0,Ae&6)throw Error(q(331));var i=Ae;for(Ae|=4,Z=t.current;Z!==null;){var o=Z,s=o.child;if(Z.flags&16){var l=o.deletions;if(l!==null){for(var a=0;avt()-ch?Ci(t,0):uh|=r),rr(t,e)}function $v(t,e){e===0&&(t.mode&1?(e=Cl,Cl<<=1,!(Cl&130023424)&&(Cl=4194304)):e=1);var r=Wt();t=Rn(t,e),t!==null&&(hl(t,e,r),rr(t,r))}function xE(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),$v(t,r)}function AE(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,i=t.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(q(314))}n!==null&&n.delete(e),$v(t,r)}var Hv;Hv=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||er.current)Zt=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return Zt=!1,uE(t,e,r);Zt=!!(t.flags&131072)}else Zt=!1,nt&&e.flags&1048576&&Gg(e,Da,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;aa(t,e),t=e.pendingProps;var i=ko(e,zt.current);Eo(e,r),i=nh(null,e,n,t,i,r);var o=ih();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,tr(n)?(o=!0,La(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Xd(e),i.updater=wu,e.stateNode=i,i._reactInternals=e,$f(e,n,t,r),e=Wf(null,e,n,!0,o,r)):(e.tag=0,nt&&o&&Wd(e),qt(null,e,i,r),e=e.child),e;case 16:n=e.elementType;e:{switch(aa(t,e),t=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=_E(n),t=jr(n,t),i){case 0:e=qf(null,e,n,t,r);break e;case 1:e=D0(null,e,n,t,r);break e;case 11:e=L0(null,e,n,t,r);break e;case 14:e=B0(null,e,n,jr(n.type,t),r);break e}throw Error(q(306,n,""))}return e;case 0:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),qf(t,e,n,i,r);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),D0(t,e,n,i,r);case 3:e:{if(kv(e),t===null)throw Error(q(387));n=e.pendingProps,o=e.memoizedState,i=o.element,Jg(t,e),Fa(e,n,null,r);var s=e.memoizedState;if(n=s.element,o.isDehydrated)if(o={element:n,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=Mo(Error(q(423)),e),e=j0(t,e,n,r,i);break e}else if(n!==i){i=Mo(Error(q(424)),e),e=j0(t,e,n,r,i);break e}else for(cr=ui(e.stateNode.containerInfo.firstChild),dr=e,nt=!0,zr=null,r=ev(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(No(),n===i){e=Tn(t,e,r);break e}qt(t,e,n,r)}e=e.child}return e;case 5:return tv(e),t===null&&Uf(e),n=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,Of(n,i)?s=null:o!==null&&Of(n,o)&&(e.flags|=32),Sv(t,e),qt(t,e,s,r),e.child;case 6:return t===null&&Uf(e),null;case 13:return Nv(t,e,r);case 4:return Zd(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Po(e,null,n,r):qt(t,e,n,r),e.child;case 11:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),L0(t,e,n,i,r);case 7:return qt(t,e,e.pendingProps,r),e.child;case 8:return qt(t,e,e.pendingProps.children,r),e.child;case 12:return qt(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,Qe(ja,n._currentValue),n._currentValue=s,o!==null)if(Vr(o.value,s)){if(o.children===i.children&&!er.current){e=Tn(t,e,r);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var l=o.dependencies;if(l!==null){s=o.child;for(var a=l.firstContext;a!==null;){if(a.context===n){if(o.tag===1){a=Pn(-1,r&-r),a.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}o.lanes|=r,a=o.alternate,a!==null&&(a.lanes|=r),Ff(o.return,r,e),l.lanes|=r;break}a=a.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(q(341));s.lanes|=r,l=s.alternate,l!==null&&(l.lanes|=r),Ff(s,r,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}qt(t,e,i.children,r),e=e.child}return e;case 9:return i=e.type,n=e.pendingProps.children,Eo(e,r),i=Nr(i),n=n(i),e.flags|=1,qt(t,e,n,r),e.child;case 14:return n=e.type,i=jr(n,e.pendingProps),i=jr(n.type,i),B0(t,e,n,i,r);case 15:return bv(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),aa(t,e),e.tag=1,tr(n)?(t=!0,La(e)):t=!1,Eo(e,r),Xg(e,n,i),$f(e,n,i,r),Wf(null,e,n,!0,t,r);case 19:return Pv(t,e,r);case 22:return _v(t,e,r)}throw Error(q(156,e.tag))};function qv(t,e){return gg(t,e)}function bE(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sr(t,e,r,n){return new bE(t,e,r,n)}function ph(t){return t=t.prototype,!(!t||!t.isReactComponent)}function _E(t){if(typeof t=="function")return ph(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Td)return 11;if(t===Od)return 14}return 2}function hi(t,e){var r=t.alternate;return r===null?(r=Sr(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function fa(t,e,r,n,i,o){var s=2;if(n=t,typeof t=="function")ph(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case Zi:return Mi(r.children,i,o,e);case Rd:s=8,i|=8;break;case df:return t=Sr(12,r,e,i|2),t.elementType=df,t.lanes=o,t;case hf:return t=Sr(13,r,e,i),t.elementType=hf,t.lanes=o,t;case pf:return t=Sr(19,r,e,i),t.elementType=pf,t.lanes=o,t;case Zm:return bu(r,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Ym:s=10;break e;case Xm:s=9;break e;case Td:s=11;break e;case Od:s=14;break e;case Jn:s=16,n=null;break e}throw Error(q(130,t==null?t:typeof t,""))}return e=Sr(s,r,e,i),e.elementType=t,e.type=n,e.lanes=o,e}function Mi(t,e,r,n){return t=Sr(7,t,n,e),t.lanes=r,t}function bu(t,e,r,n){return t=Sr(22,t,n,e),t.elementType=Zm,t.lanes=r,t.stateNode={isHidden:!1},t}function Lc(t,e,r){return t=Sr(6,t,null,e),t.lanes=r,t}function Bc(t,e,r){return e=Sr(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function SE(t,e,r,n,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=gc(0),this.expirationTimes=gc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gc(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function mh(t,e,r,n,i,o,s,l,a){return t=new SE(t,e,r,l,a),e===1?(e=1,o===!0&&(e|=8)):e=0,o=Sr(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xd(o),t}function kE(t,e,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Kv)}catch(t){console.error(t)}}Kv(),Gm.exports=gr;var Qs=Gm.exports,J0=Qs;cf.createRoot=J0.createRoot,cf.hydrateRoot=J0.hydrateRoot;/** +`+o.stack}return{value:t,source:e,stack:i,digest:null}}function Tc(t,e,r){return{value:t,source:null,stack:r??null,digest:e??null}}function Hf(t,e){try{console.error(e.value)}catch(r){setTimeout(function(){throw r})}}var sE=typeof WeakMap=="function"?WeakMap:Map;function xv(t,e,r){r=Pn(-1,r),r.tag=3,r.payload={element:null};var n=e.value;return r.callback=function(){Wa||(Wa=!0,Zf=n),Hf(t,e)},r}function Av(t,e,r){r=Pn(-1,r),r.tag=3;var n=t.type.getDerivedStateFromError;if(typeof n=="function"){var i=e.value;r.payload=function(){return n(i)},r.callback=function(){Hf(t,e)}}var o=t.stateNode;return o!==null&&typeof o.componentDidCatch=="function"&&(r.callback=function(){Hf(t,e),typeof n!="function"&&(fi===null?fi=new Set([this]):fi.add(this));var s=e.stack;this.componentDidCatch(e.value,{componentStack:s!==null?s:""})}),r}function R0(t,e,r){var n=t.pingCache;if(n===null){n=t.pingCache=new sE;var i=new Set;n.set(e,i)}else i=n.get(e),i===void 0&&(i=new Set,n.set(e,i));i.has(r)||(i.add(r),t=EE.bind(null,t,e,r),e.then(t,t))}function T0(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function O0(t,e,r,n,i){return t.mode&1?(t.flags|=65536,t.lanes=i,t):(t===e?t.flags|=65536:(t.flags|=128,r.flags|=131072,r.flags&=-52805,r.tag===1&&(r.alternate===null?r.tag=17:(e=Pn(-1,1),e.tag=2,ci(r,e,1))),r.lanes|=1),t)}var lE=Dn.ReactCurrentOwner,Zt=!1;function qt(t,e,r,n){e.child=t===null?ev(e,null,r,n):Po(e,t.child,r,n)}function L0(t,e,r,n,i){r=r.render;var o=e.ref;return Eo(e,i),n=nh(t,e,r,n,o,i),r=ih(),t!==null&&!Zt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Tn(t,e,i)):(nt&&r&&Wd(e),e.flags|=1,qt(t,e,n,i),e.child)}function B0(t,e,r,n,i){if(t===null){var o=r.type;return typeof o=="function"&&!ph(o)&&o.defaultProps===void 0&&r.compare===null&&r.defaultProps===void 0?(e.tag=15,e.type=o,bv(t,e,o,n,i)):(t=fa(r.type,null,n,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}if(o=t.child,!(t.lanes&i)){var s=o.memoizedProps;if(r=r.compare,r=r!==null?r:Us,r(s,n)&&t.ref===e.ref)return Tn(t,e,i)}return e.flags|=1,t=hi(o,n),t.ref=e.ref,t.return=e,e.child=t}function bv(t,e,r,n,i){if(t!==null){var o=t.memoizedProps;if(Us(o,n)&&t.ref===e.ref)if(Zt=!1,e.pendingProps=n=o,(t.lanes&i)!==0)t.flags&131072&&(Zt=!0);else return e.lanes=t.lanes,Tn(t,e,i)}return qf(t,e,r,n,i)}function _v(t,e,r){var n=e.pendingProps,i=n.children,o=t!==null?t.memoizedState:null;if(n.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Qe(uo,lr),lr|=r;else{if(!(r&1073741824))return t=o!==null?o.baseLanes|r:r,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Qe(uo,lr),lr|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},n=o!==null?o.baseLanes:r,Qe(uo,lr),lr|=n}else o!==null?(n=o.baseLanes|r,e.memoizedState=null):n=r,Qe(uo,lr),lr|=n;return qt(t,e,i,r),e.child}function Sv(t,e){var r=e.ref;(t===null&&r!==null||t!==null&&t.ref!==r)&&(e.flags|=512,e.flags|=2097152)}function qf(t,e,r,n,i){var o=tr(r)?Ri:zt.current;return o=ko(e,o),Eo(e,i),r=nh(t,e,r,n,o,i),n=ih(),t!==null&&!Zt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~i,Tn(t,e,i)):(nt&&n&&Wd(e),e.flags|=1,qt(t,e,r,i),e.child)}function D0(t,e,r,n,i){if(tr(r)){var o=!0;La(e)}else o=!1;if(Eo(e,i),e.stateNode===null)aa(t,e),Xg(e,r,n),$f(e,r,n,i),n=!0;else if(t===null){var s=e.stateNode,l=e.memoizedProps;s.props=l;var a=s.context,u=r.contextType;typeof u=="object"&&u!==null?u=Nr(u):(u=tr(r)?Ri:zt.current,u=ko(e,u));var c=r.getDerivedStateFromProps,d=typeof c=="function"||typeof s.getSnapshotBeforeUpdate=="function";d||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==n||a!==u)&&P0(e,s,n,u),Yn=!1;var p=e.memoizedState;s.state=p,Fa(e,n,s,i),a=e.memoizedState,l!==n||p!==a||er.current||Yn?(typeof c=="function"&&(zf(e,r,c,n),a=e.memoizedState),(l=Yn||N0(e,r,l,n,p,a,u))?(d||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(e.flags|=4194308)):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=n,e.memoizedState=a),s.props=n,s.state=a,s.context=u,n=l):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),n=!1)}else{s=e.stateNode,Jg(t,e),l=e.memoizedProps,u=e.type===e.elementType?l:jr(e.type,l),s.props=u,d=e.pendingProps,p=s.context,a=r.contextType,typeof a=="object"&&a!==null?a=Nr(a):(a=tr(r)?Ri:zt.current,a=ko(e,a));var v=r.getDerivedStateFromProps;(c=typeof v=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==d||p!==a)&&P0(e,s,n,a),Yn=!1,p=e.memoizedState,s.state=p,Fa(e,n,s,i);var g=e.memoizedState;l!==d||p!==g||er.current||Yn?(typeof v=="function"&&(zf(e,r,v,n),g=e.memoizedState),(u=Yn||N0(e,r,u,n,p,g,a)||!1)?(c||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(n,g,a),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(n,g,a)),typeof s.componentDidUpdate=="function"&&(e.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof s.componentDidUpdate!="function"||l===t.memoizedProps&&p===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&p===t.memoizedState||(e.flags|=1024),e.memoizedProps=n,e.memoizedState=g),s.props=n,s.state=g,s.context=a,n=u):(typeof s.componentDidUpdate!="function"||l===t.memoizedProps&&p===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&p===t.memoizedState||(e.flags|=1024),n=!1)}return Wf(t,e,r,n,o,i)}function Wf(t,e,r,n,i,o){Sv(t,e);var s=(e.flags&128)!==0;if(!n&&!s)return i&&A0(e,r,!1),Tn(t,e,o);n=e.stateNode,lE.current=e;var l=s&&typeof r.getDerivedStateFromError!="function"?null:n.render();return e.flags|=1,t!==null&&s?(e.child=Po(e,t.child,null,o),e.child=Po(e,null,l,o)):qt(t,e,l,o),e.memoizedState=n.state,i&&A0(e,r,!0),e.child}function kv(t){var e=t.stateNode;e.pendingContext?x0(t,e.pendingContext,e.pendingContext!==e.context):e.context&&x0(t,e.context,!1),Zd(t,e.containerInfo)}function j0(t,e,r,n,i){return No(),Vd(i),e.flags|=256,qt(t,e,r,n),e.child}var Gf={dehydrated:null,treeContext:null,retryLane:0};function Vf(t){return{baseLanes:t,cachePool:null,transitions:null}}function Nv(t,e,r){var n=e.pendingProps,i=at.current,o=!1,s=(e.flags&128)!==0,l;if((l=s)||(l=t!==null&&t.memoizedState===null?!1:(i&2)!==0),l?(o=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(i|=1),Qe(at,i&1),t===null)return Uf(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(s=n.children,t=n.fallback,o?(n=e.mode,o=e.child,s={mode:"hidden",children:s},!(n&1)&&o!==null?(o.childLanes=0,o.pendingProps=s):o=bu(s,n,0,null),t=Mi(t,n,r,null),o.return=e,t.return=e,o.sibling=t,e.child=o,e.child.memoizedState=Vf(r),e.memoizedState=Gf,t):lh(e,s));if(i=t.memoizedState,i!==null&&(l=i.dehydrated,l!==null))return aE(t,e,s,n,l,i,r);if(o){o=n.fallback,s=e.mode,i=t.child,l=i.sibling;var a={mode:"hidden",children:n.children};return!(s&1)&&e.child!==i?(n=e.child,n.childLanes=0,n.pendingProps=a,e.deletions=null):(n=hi(i,a),n.subtreeFlags=i.subtreeFlags&14680064),l!==null?o=hi(l,o):(o=Mi(o,s,r,null),o.flags|=2),o.return=e,n.return=e,n.sibling=o,e.child=n,n=o,o=e.child,s=t.child.memoizedState,s=s===null?Vf(r):{baseLanes:s.baseLanes|r,cachePool:null,transitions:s.transitions},o.memoizedState=s,o.childLanes=t.childLanes&~r,e.memoizedState=Gf,n}return o=t.child,t=o.sibling,n=hi(o,{mode:"visible",children:n.children}),!(e.mode&1)&&(n.lanes=r),n.return=e,n.sibling=null,t!==null&&(r=e.deletions,r===null?(e.deletions=[t],e.flags|=16):r.push(t)),e.child=n,e.memoizedState=null,n}function lh(t,e){return e=bu({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Dl(t,e,r,n){return n!==null&&Vd(n),Po(e,t.child,null,r),t=lh(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function aE(t,e,r,n,i,o,s){if(r)return e.flags&256?(e.flags&=-257,n=Tc(Error(q(422))),Dl(t,e,s,n)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(o=n.fallback,i=e.mode,n=bu({mode:"visible",children:n.children},i,0,null),o=Mi(o,i,s,null),o.flags|=2,n.return=e,o.return=e,n.sibling=o,e.child=n,e.mode&1&&Po(e,t.child,null,s),e.child.memoizedState=Vf(s),e.memoizedState=Gf,o);if(!(e.mode&1))return Dl(t,e,s,null);if(i.data==="$!"){if(n=i.nextSibling&&i.nextSibling.dataset,n)var l=n.dgst;return n=l,o=Error(q(419)),n=Tc(o,n,void 0),Dl(t,e,s,n)}if(l=(s&t.childLanes)!==0,Zt||l){if(n=Nt,n!==null){switch(s&-s){case 4:i=2;break;case 16:i=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:i=32;break;case 536870912:i=268435456;break;default:i=0}i=i&(n.suspendedLanes|s)?0:i,i!==0&&i!==o.retryLane&&(o.retryLane=i,Rn(t,i),Gr(n,t,i,-1))}return hh(),n=Tc(Error(q(421))),Dl(t,e,s,n)}return i.data==="$?"?(e.flags|=128,e.child=t.child,e=xE.bind(null,t),i._reactRetry=e,null):(t=o.treeContext,cr=ui(i.nextSibling),dr=e,nt=!0,zr=null,t!==null&&(br[_r++]=Sn,br[_r++]=kn,br[_r++]=Ti,Sn=t.id,kn=t.overflow,Ti=e),e=lh(e,n.children),e.flags|=4096,e)}function U0(t,e,r){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),Ff(t.return,e,r)}function Oc(t,e,r,n,i){var o=t.memoizedState;o===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:n,tail:r,tailMode:i}:(o.isBackwards=e,o.rendering=null,o.renderingStartTime=0,o.last=n,o.tail=r,o.tailMode=i)}function Pv(t,e,r){var n=e.pendingProps,i=n.revealOrder,o=n.tail;if(qt(t,e,n.children,r),n=at.current,n&2)n=n&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&U0(t,r,e);else if(t.tag===19)U0(t,r,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}n&=1}if(Qe(at,n),!(e.mode&1))e.memoizedState=null;else switch(i){case"forwards":for(r=e.child,i=null;r!==null;)t=r.alternate,t!==null&&za(t)===null&&(i=r),r=r.sibling;r=i,r===null?(i=e.child,e.child=null):(i=r.sibling,r.sibling=null),Oc(e,!1,i,r,o);break;case"backwards":for(r=null,i=e.child,e.child=null;i!==null;){if(t=i.alternate,t!==null&&za(t)===null){e.child=i;break}t=i.sibling,i.sibling=r,r=i,i=t}Oc(e,!0,r,null,o);break;case"together":Oc(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function aa(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Tn(t,e,r){if(t!==null&&(e.dependencies=t.dependencies),Li|=e.lanes,!(r&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(q(153));if(e.child!==null){for(t=e.child,r=hi(t,t.pendingProps),e.child=r,r.return=e;t.sibling!==null;)t=t.sibling,r=r.sibling=hi(t,t.pendingProps),r.return=e;r.sibling=null}return e.child}function uE(t,e,r){switch(e.tag){case 3:kv(e),No();break;case 5:tv(e);break;case 1:tr(e.type)&&La(e);break;case 4:Zd(e,e.stateNode.containerInfo);break;case 10:var n=e.type._context,i=e.memoizedProps.value;Qe(ja,n._currentValue),n._currentValue=i;break;case 13:if(n=e.memoizedState,n!==null)return n.dehydrated!==null?(Qe(at,at.current&1),e.flags|=128,null):r&e.child.childLanes?Nv(t,e,r):(Qe(at,at.current&1),t=Tn(t,e,r),t!==null?t.sibling:null);Qe(at,at.current&1);break;case 19:if(n=(r&e.childLanes)!==0,t.flags&128){if(n)return Pv(t,e,r);e.flags|=128}if(i=e.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),Qe(at,at.current),n)break;return null;case 22:case 23:return e.lanes=0,_v(t,e,r)}return Tn(t,e,r)}var Cv,Kf,Mv,Iv;Cv=function(t,e){for(var r=e.child;r!==null;){if(r.tag===5||r.tag===6)t.appendChild(r.stateNode);else if(r.tag!==4&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===e)break;for(;r.sibling===null;){if(r.return===null||r.return===e)return;r=r.return}r.sibling.return=r.return,r=r.sibling}};Kf=function(){};Mv=function(t,e,r,n){var i=t.memoizedProps;if(i!==n){t=e.stateNode,Pi(an.current);var o=null;switch(r){case"input":i=gf(t,i),n=gf(t,n),o=[];break;case"select":i=ft({},i,{value:void 0}),n=ft({},n,{value:void 0}),o=[];break;case"textarea":i=wf(t,i),n=wf(t,n),o=[];break;default:typeof i.onClick!="function"&&typeof n.onClick=="function"&&(t.onclick=Ta)}xf(r,n);var s;r=null;for(u in i)if(!n.hasOwnProperty(u)&&i.hasOwnProperty(u)&&i[u]!=null)if(u==="style"){var l=i[u];for(s in l)l.hasOwnProperty(s)&&(r||(r={}),r[s]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Rs.hasOwnProperty(u)?o||(o=[]):(o=o||[]).push(u,null));for(u in n){var a=n[u];if(l=i!=null?i[u]:void 0,n.hasOwnProperty(u)&&a!==l&&(a!=null||l!=null))if(u==="style")if(l){for(s in l)!l.hasOwnProperty(s)||a&&a.hasOwnProperty(s)||(r||(r={}),r[s]="");for(s in a)a.hasOwnProperty(s)&&l[s]!==a[s]&&(r||(r={}),r[s]=a[s])}else r||(o||(o=[]),o.push(u,r)),r=a;else u==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,l=l?l.__html:void 0,a!=null&&l!==a&&(o=o||[]).push(u,a)):u==="children"?typeof a!="string"&&typeof a!="number"||(o=o||[]).push(u,""+a):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Rs.hasOwnProperty(u)?(a!=null&&u==="onScroll"&&et("scroll",t),o||l===a||(o=[])):(o=o||[]).push(u,a))}r&&(o=o||[]).push("style",r);var u=o;(e.updateQueue=u)&&(e.flags|=4)}};Iv=function(t,e,r,n){r!==n&&(e.flags|=4)};function rs(t,e){if(!nt)switch(t.tailMode){case"hidden":e=t.tail;for(var r=null;e!==null;)e.alternate!==null&&(r=e),e=e.sibling;r===null?t.tail=null:r.sibling=null;break;case"collapsed":r=t.tail;for(var n=null;r!==null;)r.alternate!==null&&(n=r),r=r.sibling;n===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:n.sibling=null}}function Bt(t){var e=t.alternate!==null&&t.alternate.child===t.child,r=0,n=0;if(e)for(var i=t.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags&14680064,n|=i.flags&14680064,i.return=t,i=i.sibling;else for(i=t.child;i!==null;)r|=i.lanes|i.childLanes,n|=i.subtreeFlags,n|=i.flags,i.return=t,i=i.sibling;return t.subtreeFlags|=n,t.childLanes=r,e}function cE(t,e,r){var n=e.pendingProps;switch(Gd(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Bt(e),null;case 1:return tr(e.type)&&Oa(),Bt(e),null;case 3:return n=e.stateNode,Co(),tt(er),tt(zt),th(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(Ll(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,zr!==null&&(rd(zr),zr=null))),Kf(t,e),Bt(e),null;case 5:eh(e);var i=Pi(qs.current);if(r=e.type,t!==null&&e.stateNode!=null)Mv(t,e,r,n,i),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!n){if(e.stateNode===null)throw Error(q(166));return Bt(e),null}if(t=Pi(an.current),Ll(e)){n=e.stateNode,r=e.type;var o=e.memoizedProps;switch(n[nn]=e,n[$s]=o,t=(e.mode&1)!==0,r){case"dialog":et("cancel",n),et("close",n);break;case"iframe":case"object":case"embed":et("load",n);break;case"video":case"audio":for(i=0;i<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=s.createElement(r,{is:n.is}):(t=s.createElement(r),r==="select"&&(s=t,n.multiple?s.multiple=!0:n.size&&(s.size=n.size))):t=s.createElementNS(t,r),t[nn]=e,t[$s]=n,Cv(t,e,!1,!1),e.stateNode=t;e:{switch(s=Af(r,n),r){case"dialog":et("cancel",t),et("close",t),i=n;break;case"iframe":case"object":case"embed":et("load",t),i=n;break;case"video":case"audio":for(i=0;iIo&&(e.flags|=128,n=!0,rs(o,!1),e.lanes=4194304)}else{if(!n)if(t=za(s),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),rs(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!nt)return Bt(e),null}else 2*vt()-o.renderingStartTime>Io&&r!==1073741824&&(e.flags|=128,n=!0,rs(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(r=o.last,r!==null?r.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=vt(),e.sibling=null,r=at.current,Qe(at,n?r&1|2:r&1),e):(Bt(e),null);case 22:case 23:return dh(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?lr&1073741824&&(Bt(e),e.subtreeFlags&6&&(e.flags|=8192)):Bt(e),null;case 24:return null;case 25:return null}throw Error(q(156,e.tag))}function fE(t,e){switch(Gd(e),e.tag){case 1:return tr(e.type)&&Oa(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Co(),tt(er),tt(zt),th(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return eh(e),null;case 13:if(tt(at),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(q(340));No()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return tt(at),null;case 4:return Co(),null;case 10:return Jd(e.type._context),null;case 22:case 23:return dh(),null;case 24:return null;default:return null}}var jl=!1,Dt=!1,dE=typeof WeakSet=="function"?WeakSet:Set,Z=null;function ao(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){ht(t,e,n)}else r.current=null}function Qf(t,e,r){try{r()}catch(n){ht(t,e,n)}}var F0=!1;function hE(t,e){if(Rf=Ma,t=Lg(),qd(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break e}var s=0,l=-1,a=-1,u=0,c=0,d=t,p=null;t:for(;;){for(var v;d!==r||i!==0&&d.nodeType!==3||(l=s+i),d!==o||n!==0&&d.nodeType!==3||(a=s+n),d.nodeType===3&&(s+=d.nodeValue.length),(v=d.firstChild)!==null;)p=d,d=v;for(;;){if(d===t)break t;if(p===r&&++u===i&&(l=s),p===o&&++c===n&&(a=s),(v=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=v}r=l===-1||a===-1?null:{start:l,end:a}}else r=null}r=r||{start:0,end:0}}else r=null;for(Tf={focusedElem:t,selectionRange:r},Ma=!1,Z=e;Z!==null;)if(e=Z,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Z=t;else for(;Z!==null;){e=Z;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var x=g.memoizedProps,k=g.memoizedState,E=e.stateNode,w=E.getSnapshotBeforeUpdate(e.elementType===e.type?x:jr(e.type,x),k);E.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var _=e.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(q(163))}}catch(O){ht(e,e.return,O)}if(t=e.sibling,t!==null){t.return=e.return,Z=t;break}Z=e.return}return g=F0,F0=!1,g}function Ss(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&Qf(e,r,o)}i=i.next}while(i!==n)}}function xu(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function Jf(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function Rv(t){var e=t.alternate;e!==null&&(t.alternate=null,Rv(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[nn],delete e[$s],delete e[Bf],delete e[Q2],delete e[J2])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Tv(t){return t.tag===5||t.tag===3||t.tag===4}function z0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Tv(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Yf(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=Ta));else if(n!==4&&(t=t.child,t!==null))for(Yf(t,e,r),t=t.sibling;t!==null;)Yf(t,e,r),t=t.sibling}function Xf(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(Xf(t,e,r),t=t.sibling;t!==null;)Xf(t,e,r),t=t.sibling}var Mt=null,Fr=!1;function Vn(t,e,r){for(r=r.child;r!==null;)Ov(t,e,r),r=r.sibling}function Ov(t,e,r){if(ln&&typeof ln.onCommitFiberUnmount=="function")try{ln.onCommitFiberUnmount(hu,r)}catch{}switch(r.tag){case 5:Dt||ao(r,e);case 6:var n=Mt,i=Fr;Mt=null,Vn(t,e,r),Mt=n,Fr=i,Mt!==null&&(Fr?(t=Mt,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Mt.removeChild(r.stateNode));break;case 18:Mt!==null&&(Fr?(t=Mt,r=r.stateNode,t.nodeType===8?Nc(t.parentNode,r):t.nodeType===1&&Nc(t,r),Ds(t)):Nc(Mt,r.stateNode));break;case 4:n=Mt,i=Fr,Mt=r.stateNode.containerInfo,Fr=!0,Vn(t,e,r),Mt=n,Fr=i;break;case 0:case 11:case 14:case 15:if(!Dt&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&Qf(r,e,s),i=i.next}while(i!==n)}Vn(t,e,r);break;case 1:if(!Dt&&(ao(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){ht(r,e,l)}Vn(t,e,r);break;case 21:Vn(t,e,r);break;case 22:r.mode&1?(Dt=(n=Dt)||r.memoizedState!==null,Vn(t,e,r),Dt=n):Vn(t,e,r);break;default:Vn(t,e,r)}}function $0(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new dE),e.forEach(function(n){var i=AE.bind(null,t,n);r.has(n)||(r.add(n),n.then(i,i))})}}function Tr(t,e){var r=e.deletions;if(r!==null)for(var n=0;ni&&(i=s),n&=~o}if(n=i,n=vt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*mE(n/1960))-n,10t?16:t,ni===null)var n=!1;else{if(t=ni,ni=null,Ga=0,Ae&6)throw Error(q(331));var i=Ae;for(Ae|=4,Z=t.current;Z!==null;){var o=Z,s=o.child;if(Z.flags&16){var l=o.deletions;if(l!==null){for(var a=0;avt()-ch?Ci(t,0):uh|=r),rr(t,e)}function $v(t,e){e===0&&(t.mode&1?(e=Cl,Cl<<=1,!(Cl&130023424)&&(Cl=4194304)):e=1);var r=Wt();t=Rn(t,e),t!==null&&(hl(t,e,r),rr(t,r))}function xE(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),$v(t,r)}function AE(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,i=t.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(q(314))}n!==null&&n.delete(e),$v(t,r)}var Hv;Hv=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||er.current)Zt=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return Zt=!1,uE(t,e,r);Zt=!!(t.flags&131072)}else Zt=!1,nt&&e.flags&1048576&&Gg(e,Da,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;aa(t,e),t=e.pendingProps;var i=ko(e,zt.current);Eo(e,r),i=nh(null,e,n,t,i,r);var o=ih();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,tr(n)?(o=!0,La(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Xd(e),i.updater=wu,e.stateNode=i,i._reactInternals=e,$f(e,n,t,r),e=Wf(null,e,n,!0,o,r)):(e.tag=0,nt&&o&&Wd(e),qt(null,e,i,r),e=e.child),e;case 16:n=e.elementType;e:{switch(aa(t,e),t=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=_E(n),t=jr(n,t),i){case 0:e=qf(null,e,n,t,r);break e;case 1:e=D0(null,e,n,t,r);break e;case 11:e=L0(null,e,n,t,r);break e;case 14:e=B0(null,e,n,jr(n.type,t),r);break e}throw Error(q(306,n,""))}return e;case 0:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),qf(t,e,n,i,r);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),D0(t,e,n,i,r);case 3:e:{if(kv(e),t===null)throw Error(q(387));n=e.pendingProps,o=e.memoizedState,i=o.element,Jg(t,e),Fa(e,n,null,r);var s=e.memoizedState;if(n=s.element,o.isDehydrated)if(o={element:n,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=Mo(Error(q(423)),e),e=j0(t,e,n,r,i);break e}else if(n!==i){i=Mo(Error(q(424)),e),e=j0(t,e,n,r,i);break e}else for(cr=ui(e.stateNode.containerInfo.firstChild),dr=e,nt=!0,zr=null,r=ev(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(No(),n===i){e=Tn(t,e,r);break e}qt(t,e,n,r)}e=e.child}return e;case 5:return tv(e),t===null&&Uf(e),n=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,Of(n,i)?s=null:o!==null&&Of(n,o)&&(e.flags|=32),Sv(t,e),qt(t,e,s,r),e.child;case 6:return t===null&&Uf(e),null;case 13:return Nv(t,e,r);case 4:return Zd(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Po(e,null,n,r):qt(t,e,n,r),e.child;case 11:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),L0(t,e,n,i,r);case 7:return qt(t,e,e.pendingProps,r),e.child;case 8:return qt(t,e,e.pendingProps.children,r),e.child;case 12:return qt(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,Qe(ja,n._currentValue),n._currentValue=s,o!==null)if(Vr(o.value,s)){if(o.children===i.children&&!er.current){e=Tn(t,e,r);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var l=o.dependencies;if(l!==null){s=o.child;for(var a=l.firstContext;a!==null;){if(a.context===n){if(o.tag===1){a=Pn(-1,r&-r),a.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}o.lanes|=r,a=o.alternate,a!==null&&(a.lanes|=r),Ff(o.return,r,e),l.lanes|=r;break}a=a.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(q(341));s.lanes|=r,l=s.alternate,l!==null&&(l.lanes|=r),Ff(s,r,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}qt(t,e,i.children,r),e=e.child}return e;case 9:return i=e.type,n=e.pendingProps.children,Eo(e,r),i=Nr(i),n=n(i),e.flags|=1,qt(t,e,n,r),e.child;case 14:return n=e.type,i=jr(n,e.pendingProps),i=jr(n.type,i),B0(t,e,n,i,r);case 15:return bv(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),aa(t,e),e.tag=1,tr(n)?(t=!0,La(e)):t=!1,Eo(e,r),Xg(e,n,i),$f(e,n,i,r),Wf(null,e,n,!0,t,r);case 19:return Pv(t,e,r);case 22:return _v(t,e,r)}throw Error(q(156,e.tag))};function qv(t,e){return gg(t,e)}function bE(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sr(t,e,r,n){return new bE(t,e,r,n)}function ph(t){return t=t.prototype,!(!t||!t.isReactComponent)}function _E(t){if(typeof t=="function")return ph(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Td)return 11;if(t===Od)return 14}return 2}function hi(t,e){var r=t.alternate;return r===null?(r=Sr(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function fa(t,e,r,n,i,o){var s=2;if(n=t,typeof t=="function")ph(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case Zi:return Mi(r.children,i,o,e);case Rd:s=8,i|=8;break;case df:return t=Sr(12,r,e,i|2),t.elementType=df,t.lanes=o,t;case hf:return t=Sr(13,r,e,i),t.elementType=hf,t.lanes=o,t;case pf:return t=Sr(19,r,e,i),t.elementType=pf,t.lanes=o,t;case Zm:return bu(r,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Ym:s=10;break e;case Xm:s=9;break e;case Td:s=11;break e;case Od:s=14;break e;case Jn:s=16,n=null;break e}throw Error(q(130,t==null?t:typeof t,""))}return e=Sr(s,r,e,i),e.elementType=t,e.type=n,e.lanes=o,e}function Mi(t,e,r,n){return t=Sr(7,t,n,e),t.lanes=r,t}function bu(t,e,r,n){return t=Sr(22,t,n,e),t.elementType=Zm,t.lanes=r,t.stateNode={isHidden:!1},t}function Lc(t,e,r){return t=Sr(6,t,null,e),t.lanes=r,t}function Bc(t,e,r){return e=Sr(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function SE(t,e,r,n,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=gc(0),this.expirationTimes=gc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gc(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function mh(t,e,r,n,i,o,s,l,a){return t=new SE(t,e,r,l,a),e===1?(e=1,o===!0&&(e|=8)):e=0,o=Sr(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xd(o),t}function kE(t,e,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Kv)}catch(t){console.error(t)}}Kv(),Gm.exports=gr;var Qs=Gm.exports,J0=Qs;cf.createRoot=J0.createRoot,cf.hydrateRoot=J0.hydrateRoot;/** * @remix-run/router v1.14.2 * * Copyright (c) Remix Software Inc. @@ -46,7 +46,7 @@ Error generating stack: `+o.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Js(){return Js=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function wh(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function RE(){return Math.random().toString(36).substr(2,8)}function X0(t,e){return{usr:t.state,key:t.key,idx:e}}function nd(t,e,r,n){return r===void 0&&(r=null),Js({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Ho(e):e,{state:r,key:e&&e.key||n||RE()})}function Qv(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Ho(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function TE(t,e,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:o=!1}=n,s=i.history,l=ii.Pop,a=null,u=c();u==null&&(u=0,s.replaceState(Js({},s.state,{idx:u}),""));function c(){return(s.state||{idx:null}).idx}function d(){l=ii.Pop;let k=c(),E=k==null?null:k-u;u=k,a&&a({action:l,location:x.location,delta:E})}function m(k,E){l=ii.Push;let w=nd(x.location,k,E);r&&r(w,k),u=c()+1;let _=X0(w,u),O=x.createHref(w);try{s.pushState(_,"",O)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;i.location.assign(O)}o&&a&&a({action:l,location:x.location,delta:1})}function v(k,E){l=ii.Replace;let w=nd(x.location,k,E);r&&r(w,k),u=c();let _=X0(w,u),O=x.createHref(w);s.replaceState(_,"",O),o&&a&&a({action:l,location:x.location,delta:0})}function p(k){let E=i.location.origin!=="null"?i.location.origin:i.location.href,w=typeof k=="string"?k:Qv(k);return _t(E,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,E)}let x={get action(){return l},get location(){return t(i,s)},listen(k){if(a)throw new Error("A history only accepts one active listener");return i.addEventListener(Y0,d),a=k,()=>{i.removeEventListener(Y0,d),a=null}},createHref(k){return e(i,k)},createURL:p,encodeLocation(k){let E=p(k);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:m,replace:v,go(k){return s.go(k)}};return x}var Z0;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Z0||(Z0={}));function OE(t,e,r){r===void 0&&(r="/");let n=typeof e=="string"?Ho(e):e,i=Xv(n.pathname||"/",r);if(i==null)return null;let o=Jv(t);LE(o);let s=null;for(let l=0;s==null&&l{let a={relativePath:l===void 0?o.path||"":l,caseSensitive:o.caseSensitive===!0,childrenIndex:s,route:o};a.relativePath.startsWith("/")&&(_t(a.relativePath.startsWith(n),'Absolute route path "'+a.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),a.relativePath=a.relativePath.slice(n.length));let u=Ii([n,a.relativePath]),c=r.concat(a);o.children&&o.children.length>0&&(_t(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Jv(o.children,e,c,u)),!(o.path==null&&!o.index)&&e.push({path:u,score:$E(u,o.index),routesMeta:c})};return t.forEach((o,s)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))i(o,s);else for(let a of Yv(o.path))i(o,s,a)}),e}function Yv(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,i=r.endsWith("?"),o=r.replace(/\?$/,"");if(n.length===0)return i?[o,""]:[o];let s=Yv(n.join("/")),l=[];return l.push(...s.map(a=>a===""?o:[o,a].join("/"))),i&&l.push(...s),l.map(a=>t.startsWith("/")&&a===""?"/":a)}function LE(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:HE(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const BE=/^:[\w-]+$/,DE=3,jE=2,UE=1,FE=10,zE=-2,ep=t=>t==="*";function $E(t,e){let r=t.split("/"),n=r.length;return r.some(ep)&&(n+=zE),e&&(n+=jE),r.filter(i=>!ep(i)).reduce((i,o)=>i+(BE.test(o)?DE:o===""?UE:FE),n)}function HE(t,e){return t.length===e.length&&t.slice(0,-1).every((n,i)=>n===e[i])?t[t.length-1]-e[e.length-1]:0}function qE(t,e){let{routesMeta:r}=t,n={},i="/",o=[];for(let s=0;s{let{paramName:m,isOptional:v}=c;if(m==="*"){let x=l[d]||"";s=o.slice(0,o.length-x.length).replace(/(.)\/+$/,"$1")}const p=l[d];return v&&!p?u[m]=void 0:u[m]=KE(p||"",m),u},{}),pathname:o,pathnameBase:s,pattern:t}}function GE(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),wh(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,l,a)=>(n.push({paramName:l,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),n]}function VE(t){try{return decodeURI(t)}catch(e){return wh(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function KE(t,e){try{return decodeURIComponent(t)}catch(r){return wh(!1,'The value for the URL param "'+e+'" will not be decoded because'+(' the string "'+t+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+r+").")),t}}function Xv(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function QE(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:i=""}=typeof t=="string"?Ho(t):t;return{pathname:r?r.startsWith("/")?r:JE(r,e):e,search:tx(n),hash:rx(i)}}function JE(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function Dc(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function YE(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function XE(t,e){let r=YE(t);return e?r.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function ZE(t,e,r,n){n===void 0&&(n=!1);let i;typeof t=="string"?i=Ho(t):(i=Js({},t),_t(!i.pathname||!i.pathname.includes("?"),Dc("?","pathname","search",i)),_t(!i.pathname||!i.pathname.includes("#"),Dc("#","pathname","hash",i)),_t(!i.search||!i.search.includes("#"),Dc("#","search","hash",i)));let o=t===""||i.pathname==="",s=o?"/":i.pathname,l;if(s==null)l=r;else{let d=e.length-1;if(!n&&s.startsWith("..")){let m=s.split("/");for(;m[0]==="..";)m.shift(),d-=1;i.pathname=m.join("/")}l=d>=0?e[d]:"/"}let a=QE(i,l),u=s&&s!=="/"&&s.endsWith("/"),c=(o||s===".")&&r.endsWith("/");return!a.pathname.endsWith("/")&&(u||c)&&(a.pathname+="/"),a}const Ii=t=>t.join("/").replace(/\/\/+/g,"/"),ex=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),tx=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,rx=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function nx(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Zv=["post","put","patch","delete"];new Set(Zv);const ix=["get",...Zv];new Set(ix);/** + */function Js(){return Js=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function wh(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function RE(){return Math.random().toString(36).substr(2,8)}function X0(t,e){return{usr:t.state,key:t.key,idx:e}}function nd(t,e,r,n){return r===void 0&&(r=null),Js({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Ho(e):e,{state:r,key:e&&e.key||n||RE()})}function Qv(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Ho(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function TE(t,e,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:o=!1}=n,s=i.history,l=ii.Pop,a=null,u=c();u==null&&(u=0,s.replaceState(Js({},s.state,{idx:u}),""));function c(){return(s.state||{idx:null}).idx}function d(){l=ii.Pop;let k=c(),E=k==null?null:k-u;u=k,a&&a({action:l,location:x.location,delta:E})}function p(k,E){l=ii.Push;let w=nd(x.location,k,E);r&&r(w,k),u=c()+1;let _=X0(w,u),O=x.createHref(w);try{s.pushState(_,"",O)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;i.location.assign(O)}o&&a&&a({action:l,location:x.location,delta:1})}function v(k,E){l=ii.Replace;let w=nd(x.location,k,E);r&&r(w,k),u=c();let _=X0(w,u),O=x.createHref(w);s.replaceState(_,"",O),o&&a&&a({action:l,location:x.location,delta:0})}function g(k){let E=i.location.origin!=="null"?i.location.origin:i.location.href,w=typeof k=="string"?k:Qv(k);return _t(E,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,E)}let x={get action(){return l},get location(){return t(i,s)},listen(k){if(a)throw new Error("A history only accepts one active listener");return i.addEventListener(Y0,d),a=k,()=>{i.removeEventListener(Y0,d),a=null}},createHref(k){return e(i,k)},createURL:g,encodeLocation(k){let E=g(k);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:p,replace:v,go(k){return s.go(k)}};return x}var Z0;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Z0||(Z0={}));function OE(t,e,r){r===void 0&&(r="/");let n=typeof e=="string"?Ho(e):e,i=Xv(n.pathname||"/",r);if(i==null)return null;let o=Jv(t);LE(o);let s=null;for(let l=0;s==null&&l{let a={relativePath:l===void 0?o.path||"":l,caseSensitive:o.caseSensitive===!0,childrenIndex:s,route:o};a.relativePath.startsWith("/")&&(_t(a.relativePath.startsWith(n),'Absolute route path "'+a.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),a.relativePath=a.relativePath.slice(n.length));let u=Ii([n,a.relativePath]),c=r.concat(a);o.children&&o.children.length>0&&(_t(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Jv(o.children,e,c,u)),!(o.path==null&&!o.index)&&e.push({path:u,score:$E(u,o.index),routesMeta:c})};return t.forEach((o,s)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))i(o,s);else for(let a of Yv(o.path))i(o,s,a)}),e}function Yv(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,i=r.endsWith("?"),o=r.replace(/\?$/,"");if(n.length===0)return i?[o,""]:[o];let s=Yv(n.join("/")),l=[];return l.push(...s.map(a=>a===""?o:[o,a].join("/"))),i&&l.push(...s),l.map(a=>t.startsWith("/")&&a===""?"/":a)}function LE(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:HE(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const BE=/^:[\w-]+$/,DE=3,jE=2,UE=1,FE=10,zE=-2,ep=t=>t==="*";function $E(t,e){let r=t.split("/"),n=r.length;return r.some(ep)&&(n+=zE),e&&(n+=jE),r.filter(i=>!ep(i)).reduce((i,o)=>i+(BE.test(o)?DE:o===""?UE:FE),n)}function HE(t,e){return t.length===e.length&&t.slice(0,-1).every((n,i)=>n===e[i])?t[t.length-1]-e[e.length-1]:0}function qE(t,e){let{routesMeta:r}=t,n={},i="/",o=[];for(let s=0;s{let{paramName:p,isOptional:v}=c;if(p==="*"){let x=l[d]||"";s=o.slice(0,o.length-x.length).replace(/(.)\/+$/,"$1")}const g=l[d];return v&&!g?u[p]=void 0:u[p]=KE(g||"",p),u},{}),pathname:o,pathnameBase:s,pattern:t}}function GE(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),wh(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,l,a)=>(n.push({paramName:l,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),n]}function VE(t){try{return decodeURI(t)}catch(e){return wh(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function KE(t,e){try{return decodeURIComponent(t)}catch(r){return wh(!1,'The value for the URL param "'+e+'" will not be decoded because'+(' the string "'+t+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+r+").")),t}}function Xv(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function QE(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:i=""}=typeof t=="string"?Ho(t):t;return{pathname:r?r.startsWith("/")?r:JE(r,e):e,search:tx(n),hash:rx(i)}}function JE(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function Dc(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function YE(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function XE(t,e){let r=YE(t);return e?r.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function ZE(t,e,r,n){n===void 0&&(n=!1);let i;typeof t=="string"?i=Ho(t):(i=Js({},t),_t(!i.pathname||!i.pathname.includes("?"),Dc("?","pathname","search",i)),_t(!i.pathname||!i.pathname.includes("#"),Dc("#","pathname","hash",i)),_t(!i.search||!i.search.includes("#"),Dc("#","search","hash",i)));let o=t===""||i.pathname==="",s=o?"/":i.pathname,l;if(s==null)l=r;else{let d=e.length-1;if(!n&&s.startsWith("..")){let p=s.split("/");for(;p[0]==="..";)p.shift(),d-=1;i.pathname=p.join("/")}l=d>=0?e[d]:"/"}let a=QE(i,l),u=s&&s!=="/"&&s.endsWith("/"),c=(o||s===".")&&r.endsWith("/");return!a.pathname.endsWith("/")&&(u||c)&&(a.pathname+="/"),a}const Ii=t=>t.join("/").replace(/\/\/+/g,"/"),ex=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),tx=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,rx=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function nx(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Zv=["post","put","patch","delete"];new Set(Zv);const ix=["get",...Zv];new Set(ix);/** * React Router v6.21.3 * * Copyright (c) Remix Software Inc. @@ -55,7 +55,7 @@ Error generating stack: `+o.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function Ys(){return Ys=Object.assign?Object.assign.bind():function(t){for(var e=1;e{l.current=!0}),L.useCallback(function(u,c){if(c===void 0&&(c={}),!l.current)return;if(typeof u=="number"){n.go(u);return}let d=ZE(u,JSON.parse(s),o,c.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:Ii([e,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[e,n,s,o,t])}function lx(){let{matches:t}=L.useContext($i),e=t[t.length-1];return e?e.params:{}}function ax(t,e){return ux(t,e)}function ux(t,e,r,n){Mu()||_t(!1);let{navigator:i}=L.useContext(Pu),{matches:o}=L.useContext($i),s=o[o.length-1],l=s?s.params:{};s&&s.pathname;let a=s?s.pathnameBase:"/";s&&s.route;let u=xh(),c;if(e){var d;let k=typeof e=="string"?Ho(e):e;a==="/"||(d=k.pathname)!=null&&d.startsWith(a)||_t(!1),c=k}else c=u;let m=c.pathname||"/",v=a==="/"?m:m.slice(a.length)||"/",p=OE(t,{pathname:v}),x=px(p&&p.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:Ii([a,i.encodeLocation?i.encodeLocation(k.pathname).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?a:Ii([a,i.encodeLocation?i.encodeLocation(k.pathnameBase).pathname:k.pathnameBase])})),o,r,n);return e&&x?L.createElement(Cu.Provider,{value:{location:Ys({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:ii.Pop}},x):x}function cx(){let t=yx(),e=nx(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},o=null;return L.createElement(L.Fragment,null,L.createElement("h2",null,"Unexpected Application Error!"),L.createElement("h3",{style:{fontStyle:"italic"}},e),r?L.createElement("pre",{style:i},r):null,o)}const fx=L.createElement(cx,null);class dx extends L.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?L.createElement($i.Provider,{value:this.props.routeContext},L.createElement(ey.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function hx(t){let{routeContext:e,match:r,children:n}=t,i=L.useContext(Eh);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),L.createElement($i.Provider,{value:e},n)}function px(t,e,r,n){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var o;if((o=r)!=null&&o.errors)t=r.matches;else return null}let s=t,l=(i=r)==null?void 0:i.errors;if(l!=null){let c=s.findIndex(d=>d.route.id&&(l==null?void 0:l[d.route.id]));c>=0||_t(!1),s=s.slice(0,Math.min(s.length,c+1))}let a=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let c=0;c=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((c,d,m)=>{let v,p=!1,x=null,k=null;r&&(v=l&&d.route.id?l[d.route.id]:void 0,x=d.route.errorElement||fx,a&&(u<0&&m===0?(Ex("route-fallback",!1),p=!0,k=null):u===m&&(p=!0,k=d.route.hydrateFallbackElement||null)));let E=e.concat(s.slice(0,m+1)),w=()=>{let _;return v?_=x:p?_=k:d.route.Component?_=L.createElement(d.route.Component,null):d.route.element?_=d.route.element:_=c,L.createElement(hx,{match:d,routeContext:{outlet:c,matches:E,isDataRoute:r!=null},children:_})};return r&&(d.route.ErrorBoundary||d.route.errorElement||m===0)?L.createElement(dx,{location:r.location,revalidation:r.revalidation,component:x,error:v,children:w(),routeContext:{outlet:null,matches:E,isDataRoute:!0}}):w()},null)}var ry=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(ry||{}),Qa=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Qa||{});function mx(t){let e=L.useContext(Eh);return e||_t(!1),e}function gx(t){let e=L.useContext(ox);return e||_t(!1),e}function vx(t){let e=L.useContext($i);return e||_t(!1),e}function ny(t){let e=vx(),r=e.matches[e.matches.length-1];return r.route.id||_t(!1),r.route.id}function yx(){var t;let e=L.useContext(ey),r=gx(Qa.UseRouteError),n=ny(Qa.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function wx(){let{router:t}=mx(ry.UseNavigateStable),e=ny(Qa.UseNavigateStable),r=L.useRef(!1);return ty(()=>{r.current=!0}),L.useCallback(function(i,o){o===void 0&&(o={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Ys({fromRouteId:e},o)))},[t,e])}const tp={};function Ex(t,e,r){!e&&!tp[t]&&(tp[t]=!0)}function ms(t){_t(!1)}function xx(t){let{basename:e="/",children:r=null,location:n,navigationType:i=ii.Pop,navigator:o,static:s=!1,future:l}=t;Mu()&&_t(!1);let a=e.replace(/^\/*/,"/"),u=L.useMemo(()=>({basename:a,navigator:o,static:s,future:Ys({v7_relativeSplatPath:!1},l)}),[a,l,o,s]);typeof n=="string"&&(n=Ho(n));let{pathname:c="/",search:d="",hash:m="",state:v=null,key:p="default"}=n,x=L.useMemo(()=>{let k=Xv(c,a);return k==null?null:{location:{pathname:k,search:d,hash:m,state:v,key:p},navigationType:i}},[a,c,d,m,v,p,i]);return x==null?null:L.createElement(Pu.Provider,{value:u},L.createElement(Cu.Provider,{children:r,value:x}))}function Ax(t){let{children:e,location:r}=t;return ax(id(e),r)}new Promise(()=>{});function id(t,e){e===void 0&&(e=[]);let r=[];return L.Children.forEach(t,(n,i)=>{if(!L.isValidElement(n))return;let o=[...e,i];if(n.type===L.Fragment){r.push.apply(r,id(n.props.children,o));return}n.type!==ms&&_t(!1),!n.props.index||!n.props.children||_t(!1);let s={id:n.props.id||o.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(s.children=id(n.props.children,o)),r.push(s)}),r}/** + */function Ys(){return Ys=Object.assign?Object.assign.bind():function(t){for(var e=1;e{l.current=!0}),L.useCallback(function(u,c){if(c===void 0&&(c={}),!l.current)return;if(typeof u=="number"){n.go(u);return}let d=ZE(u,JSON.parse(s),o,c.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:Ii([e,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[e,n,s,o,t])}function lx(){let{matches:t}=L.useContext($i),e=t[t.length-1];return e?e.params:{}}function ax(t,e){return ux(t,e)}function ux(t,e,r,n){Mu()||_t(!1);let{navigator:i}=L.useContext(Pu),{matches:o}=L.useContext($i),s=o[o.length-1],l=s?s.params:{};s&&s.pathname;let a=s?s.pathnameBase:"/";s&&s.route;let u=xh(),c;if(e){var d;let k=typeof e=="string"?Ho(e):e;a==="/"||(d=k.pathname)!=null&&d.startsWith(a)||_t(!1),c=k}else c=u;let p=c.pathname||"/",v=a==="/"?p:p.slice(a.length)||"/",g=OE(t,{pathname:v}),x=px(g&&g.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:Ii([a,i.encodeLocation?i.encodeLocation(k.pathname).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?a:Ii([a,i.encodeLocation?i.encodeLocation(k.pathnameBase).pathname:k.pathnameBase])})),o,r,n);return e&&x?L.createElement(Cu.Provider,{value:{location:Ys({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:ii.Pop}},x):x}function cx(){let t=yx(),e=nx(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},o=null;return L.createElement(L.Fragment,null,L.createElement("h2",null,"Unexpected Application Error!"),L.createElement("h3",{style:{fontStyle:"italic"}},e),r?L.createElement("pre",{style:i},r):null,o)}const fx=L.createElement(cx,null);class dx extends L.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?L.createElement($i.Provider,{value:this.props.routeContext},L.createElement(ey.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function hx(t){let{routeContext:e,match:r,children:n}=t,i=L.useContext(Eh);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),L.createElement($i.Provider,{value:e},n)}function px(t,e,r,n){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var o;if((o=r)!=null&&o.errors)t=r.matches;else return null}let s=t,l=(i=r)==null?void 0:i.errors;if(l!=null){let c=s.findIndex(d=>d.route.id&&(l==null?void 0:l[d.route.id]));c>=0||_t(!1),s=s.slice(0,Math.min(s.length,c+1))}let a=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let c=0;c=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((c,d,p)=>{let v,g=!1,x=null,k=null;r&&(v=l&&d.route.id?l[d.route.id]:void 0,x=d.route.errorElement||fx,a&&(u<0&&p===0?(Ex("route-fallback",!1),g=!0,k=null):u===p&&(g=!0,k=d.route.hydrateFallbackElement||null)));let E=e.concat(s.slice(0,p+1)),w=()=>{let _;return v?_=x:g?_=k:d.route.Component?_=L.createElement(d.route.Component,null):d.route.element?_=d.route.element:_=c,L.createElement(hx,{match:d,routeContext:{outlet:c,matches:E,isDataRoute:r!=null},children:_})};return r&&(d.route.ErrorBoundary||d.route.errorElement||p===0)?L.createElement(dx,{location:r.location,revalidation:r.revalidation,component:x,error:v,children:w(),routeContext:{outlet:null,matches:E,isDataRoute:!0}}):w()},null)}var ry=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(ry||{}),Qa=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Qa||{});function mx(t){let e=L.useContext(Eh);return e||_t(!1),e}function gx(t){let e=L.useContext(ox);return e||_t(!1),e}function vx(t){let e=L.useContext($i);return e||_t(!1),e}function ny(t){let e=vx(),r=e.matches[e.matches.length-1];return r.route.id||_t(!1),r.route.id}function yx(){var t;let e=L.useContext(ey),r=gx(Qa.UseRouteError),n=ny(Qa.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function wx(){let{router:t}=mx(ry.UseNavigateStable),e=ny(Qa.UseNavigateStable),r=L.useRef(!1);return ty(()=>{r.current=!0}),L.useCallback(function(i,o){o===void 0&&(o={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Ys({fromRouteId:e},o)))},[t,e])}const tp={};function Ex(t,e,r){!e&&!tp[t]&&(tp[t]=!0)}function ms(t){_t(!1)}function xx(t){let{basename:e="/",children:r=null,location:n,navigationType:i=ii.Pop,navigator:o,static:s=!1,future:l}=t;Mu()&&_t(!1);let a=e.replace(/^\/*/,"/"),u=L.useMemo(()=>({basename:a,navigator:o,static:s,future:Ys({v7_relativeSplatPath:!1},l)}),[a,l,o,s]);typeof n=="string"&&(n=Ho(n));let{pathname:c="/",search:d="",hash:p="",state:v=null,key:g="default"}=n,x=L.useMemo(()=>{let k=Xv(c,a);return k==null?null:{location:{pathname:k,search:d,hash:p,state:v,key:g},navigationType:i}},[a,c,d,p,v,g,i]);return x==null?null:L.createElement(Pu.Provider,{value:u},L.createElement(Cu.Provider,{children:r,value:x}))}function Ax(t){let{children:e,location:r}=t;return ax(id(e),r)}new Promise(()=>{});function id(t,e){e===void 0&&(e=[]);let r=[];return L.Children.forEach(t,(n,i)=>{if(!L.isValidElement(n))return;let o=[...e,i];if(n.type===L.Fragment){r.push.apply(r,id(n.props.children,o));return}n.type!==ms&&_t(!1),!n.props.index||!n.props.children||_t(!1);let s={id:n.props.id||o.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(s.children=id(n.props.children,o)),r.push(s)}),r}/** * React Router DOM v6.21.3 * * Copyright (c) Remix Software Inc. @@ -64,14 +64,14 @@ Error generating stack: `+o.message+` * LICENSE.md file in the root directory of this source tree. * * @license MIT - */const bx="startTransition",rp=xw[bx];function _x(t){let{basename:e,children:r,future:n,window:i}=t,o=L.useRef();o.current==null&&(o.current=IE({window:i,v5Compat:!0}));let s=o.current,[l,a]=L.useState({action:s.action,location:s.location}),{v7_startTransition:u}=n||{},c=L.useCallback(d=>{u&&rp?rp(()=>a(d)):a(d)},[a,u]);return L.useLayoutEffect(()=>s.listen(c),[s,c]),L.createElement(xx,{basename:e,children:r,location:l.location,navigationType:l.action,navigator:s,future:n})}var np;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(np||(np={}));var ip;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(ip||(ip={}));var Ah={exports:{}};const Sx={},kx=Object.freeze(Object.defineProperty({__proto__:null,default:Sx},Symbol.toStringTag,{value:"Module"})),Nx=Uo(kx);Ah.exports;(function(t){(function(e,r){function n(C,f){if(!C)throw new Error(f||"Assertion failed")}function i(C,f){C.super_=f;var g=function(){};g.prototype=f.prototype,C.prototype=new g,C.prototype.constructor=C}function o(C,f,g){if(o.isBN(C))return C;this.negative=0,this.words=null,this.length=0,this.red=null,C!==null&&((f==="le"||f==="be")&&(g=f,f=10),this._init(C||0,f||10,g||"be"))}typeof e=="object"?e.exports=o:r.BN=o,o.BN=o,o.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=Nx.Buffer}catch{}o.isBN=function(f){return f instanceof o?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===o.wordSize&&Array.isArray(f.words)},o.max=function(f,g){return f.cmp(g)>0?f:g},o.min=function(f,g){return f.cmp(g)<0?f:g},o.prototype._init=function(f,g,A){if(typeof f=="number")return this._initNumber(f,g,A);if(typeof f=="object")return this._initArray(f,g,A);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),f=f.toString().replace(/\s+/g,"");var N=0;f[0]==="-"&&(N++,this.negative=1),N=0;N-=3)M=f[N]|f[N-1]<<8|f[N-2]<<16,this.words[b]|=M<>>26-R&67108863,R+=24,R>=26&&(R-=26,b++);else if(A==="le")for(N=0,b=0;N>>26-R&67108863,R+=24,R>=26&&(R-=26,b++);return this._strip()};function l(C,f){var g=C.charCodeAt(f);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+C)}function a(C,f,g){var A=l(C,g);return g-1>=f&&(A|=l(C,g-1)<<4),A}o.prototype._parseHex=function(f,g,A){this.length=Math.ceil((f.length-g)/6),this.words=new Array(this.length);for(var N=0;N=g;N-=2)R=a(f,g,N)<=18?(b-=18,M+=1,this.words[M]|=R>>>26):b+=8;else{var S=f.length-g;for(N=S%2===0?g+1:g;N=18?(b-=18,M+=1,this.words[M]|=R>>>26):b+=8}this._strip()};function u(C,f,g,A){for(var N=0,b=0,M=Math.min(C.length,g),R=f;R=49?b=S-49+10:S>=17?b=S-17+10:b=S,n(S>=0&&b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch{o.prototype.inspect=d}else o.prototype.inspect=d;function d(){return(this.red?""}var m=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],v=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(f,g){f=f||10,g=g|0||1;var A;if(f===16||f==="hex"){A="";for(var N=0,b=0,M=0;M>>24-N&16777215,N+=2,N>=26&&(N-=26,M--),b!==0||M!==this.length-1?A=m[6-S.length]+S+A:A=S+A}for(b!==0&&(A=b.toString(16)+A);A.length%g!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}if(f===(f|0)&&f>=2&&f<=36){var h=v[f],P=p[f];A="";var te=this.clone();for(te.negative=0;!te.isZero();){var y=te.modrn(P).toString(f);te=te.idivn(P),te.isZero()?A=y+A:A=m[h-y.length]+y+A}for(this.isZero()&&(A="0"+A);A.length%g!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(f,g){return this.toArrayLike(s,f,g)}),o.prototype.toArray=function(f,g){return this.toArrayLike(Array,f,g)};var x=function(f,g){return f.allocUnsafe?f.allocUnsafe(g):new f(g)};o.prototype.toArrayLike=function(f,g,A){this._strip();var N=this.byteLength(),b=A||Math.max(1,N);n(N<=b,"byte array longer than desired length"),n(b>0,"Requested array length <= 0");var M=x(f,b),R=g==="le"?"LE":"BE";return this["_toArrayLike"+R](M,N),M},o.prototype._toArrayLikeLE=function(f,g){for(var A=0,N=0,b=0,M=0;b>8&255),A>16&255),M===6?(A>24&255),N=0,M=0):(N=R>>>24,M+=2)}if(A=0&&(f[A--]=R>>8&255),A>=0&&(f[A--]=R>>16&255),M===6?(A>=0&&(f[A--]=R>>24&255),N=0,M=0):(N=R>>>24,M+=2)}if(A>=0)for(f[A--]=N;A>=0;)f[A--]=0},Math.clz32?o.prototype._countBits=function(f){return 32-Math.clz32(f)}:o.prototype._countBits=function(f){var g=f,A=0;return g>=4096&&(A+=13,g>>>=13),g>=64&&(A+=7,g>>>=7),g>=8&&(A+=4,g>>>=4),g>=2&&(A+=2,g>>>=2),A+g},o.prototype._zeroBits=function(f){if(f===0)return 26;var g=f,A=0;return g&8191||(A+=13,g>>>=13),g&127||(A+=7,g>>>=7),g&15||(A+=4,g>>>=4),g&3||(A+=2,g>>>=2),g&1||A++,A},o.prototype.bitLength=function(){var f=this.words[this.length-1],g=this._countBits(f);return(this.length-1)*26+g};function k(C){for(var f=new Array(C.bitLength()),g=0;g>>N&1}return f}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,g=0;gf.length?this.clone().ior(f):f.clone().ior(this)},o.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},o.prototype.iuand=function(f){var g;this.length>f.length?g=f:g=this;for(var A=0;Af.length?this.clone().iand(f):f.clone().iand(this)},o.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},o.prototype.iuxor=function(f){var g,A;this.length>f.length?(g=this,A=f):(g=f,A=this);for(var N=0;Nf.length?this.clone().ixor(f):f.clone().ixor(this)},o.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},o.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var g=Math.ceil(f/26)|0,A=f%26;this._expand(g),A>0&&g--;for(var N=0;N0&&(this.words[N]=~this.words[N]&67108863>>26-A),this._strip()},o.prototype.notn=function(f){return this.clone().inotn(f)},o.prototype.setn=function(f,g){n(typeof f=="number"&&f>=0);var A=f/26|0,N=f%26;return this._expand(A+1),g?this.words[A]=this.words[A]|1<f.length?(A=this,N=f):(A=f,N=this);for(var b=0,M=0;M>>26;for(;b!==0&&M>>26;if(this.length=A.length,b!==0)this.words[this.length]=b,this.length++;else if(A!==this)for(;Mf.length?this.clone().iadd(f):f.clone().iadd(this)},o.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var g=this.iadd(f);return f.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var A=this.cmp(f);if(A===0)return this.negative=0,this.length=1,this.words[0]=0,this;var N,b;A>0?(N=this,b=f):(N=f,b=this);for(var M=0,R=0;R>26,this.words[R]=g&67108863;for(;M!==0&&R>26,this.words[R]=g&67108863;if(M===0&&R>>26,te=S&67108863,y=Math.min(h,f.length-1),D=Math.max(0,h-C.length+1);D<=y;D++){var U=h-D|0;N=C.words[U]|0,b=f.words[D]|0,M=N*b+te,P+=M/67108864|0,te=M&67108863}g.words[h]=te|0,S=P|0}return S!==0?g.words[h]=S|0:g.length--,g._strip()}var w=function(f,g,A){var N=f.words,b=g.words,M=A.words,R=0,S,h,P,te=N[0]|0,y=te&8191,D=te>>>13,U=N[1]|0,F=U&8191,W=U>>>13,oe=N[2]|0,Y=oe&8191,K=oe>>>13,Je=N[3]|0,Q=Je&8191,le=Je>>>13,Qr=N[4]|0,Te=Qr&8191,Ne=Qr>>>13,Jr=N[5]|0,Pe=Jr&8191,ce=Jr>>>13,wr=N[6]|0,fe=wr&8191,Oe=wr>>>13,Yr=N[7]|0,me=Yr&8191,ze=Yr>>>13,gn=N[8]|0,$e=gn&8191,He=gn>>>13,Ht=N[9]|0,Le=Ht&8191,qe=Ht>>>13,Rr=b[0]|0,Ce=Rr&8191,We=Rr>>>13,vn=b[1]|0,Be=vn&8191,Ge=vn>>>13,yn=b[2]|0,De=yn&8191,ne=yn>>>13,ot=b[3]|0,ge=ot&8191,de=ot>>>13,rt=b[4]|0,be=rt&8191,_e=rt>>>13,Ct=b[5]|0,Me=Ct&8191,je=Ct>>>13,Kt=b[6]|0,Ve=Kt&8191,Ke=Kt>>>13,Qt=b[7]|0,Ie=Qt&8191,Ue=Qt>>>13,Er=b[8]|0,ke=Er&8191,Ye=Er>>>13,Ai=b[9]|0,Xe=Ai&8191,Ze=Ai>>>13;A.negative=f.negative^g.negative,A.length=19,S=Math.imul(y,Ce),h=Math.imul(y,We),h=h+Math.imul(D,Ce)|0,P=Math.imul(D,We);var $n=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+($n>>>26)|0,$n&=67108863,S=Math.imul(F,Ce),h=Math.imul(F,We),h=h+Math.imul(W,Ce)|0,P=Math.imul(W,We),S=S+Math.imul(y,Be)|0,h=h+Math.imul(y,Ge)|0,h=h+Math.imul(D,Be)|0,P=P+Math.imul(D,Ge)|0;var Hn=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Hn>>>26)|0,Hn&=67108863,S=Math.imul(Y,Ce),h=Math.imul(Y,We),h=h+Math.imul(K,Ce)|0,P=Math.imul(K,We),S=S+Math.imul(F,Be)|0,h=h+Math.imul(F,Ge)|0,h=h+Math.imul(W,Be)|0,P=P+Math.imul(W,Ge)|0,S=S+Math.imul(y,De)|0,h=h+Math.imul(y,ne)|0,h=h+Math.imul(D,De)|0,P=P+Math.imul(D,ne)|0;var qn=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(qn>>>26)|0,qn&=67108863,S=Math.imul(Q,Ce),h=Math.imul(Q,We),h=h+Math.imul(le,Ce)|0,P=Math.imul(le,We),S=S+Math.imul(Y,Be)|0,h=h+Math.imul(Y,Ge)|0,h=h+Math.imul(K,Be)|0,P=P+Math.imul(K,Ge)|0,S=S+Math.imul(F,De)|0,h=h+Math.imul(F,ne)|0,h=h+Math.imul(W,De)|0,P=P+Math.imul(W,ne)|0,S=S+Math.imul(y,ge)|0,h=h+Math.imul(y,de)|0,h=h+Math.imul(D,ge)|0,P=P+Math.imul(D,de)|0;var Wn=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,S=Math.imul(Te,Ce),h=Math.imul(Te,We),h=h+Math.imul(Ne,Ce)|0,P=Math.imul(Ne,We),S=S+Math.imul(Q,Be)|0,h=h+Math.imul(Q,Ge)|0,h=h+Math.imul(le,Be)|0,P=P+Math.imul(le,Ge)|0,S=S+Math.imul(Y,De)|0,h=h+Math.imul(Y,ne)|0,h=h+Math.imul(K,De)|0,P=P+Math.imul(K,ne)|0,S=S+Math.imul(F,ge)|0,h=h+Math.imul(F,de)|0,h=h+Math.imul(W,ge)|0,P=P+Math.imul(W,de)|0,S=S+Math.imul(y,be)|0,h=h+Math.imul(y,_e)|0,h=h+Math.imul(D,be)|0,P=P+Math.imul(D,_e)|0;var Gn=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Gn>>>26)|0,Gn&=67108863,S=Math.imul(Pe,Ce),h=Math.imul(Pe,We),h=h+Math.imul(ce,Ce)|0,P=Math.imul(ce,We),S=S+Math.imul(Te,Be)|0,h=h+Math.imul(Te,Ge)|0,h=h+Math.imul(Ne,Be)|0,P=P+Math.imul(Ne,Ge)|0,S=S+Math.imul(Q,De)|0,h=h+Math.imul(Q,ne)|0,h=h+Math.imul(le,De)|0,P=P+Math.imul(le,ne)|0,S=S+Math.imul(Y,ge)|0,h=h+Math.imul(Y,de)|0,h=h+Math.imul(K,ge)|0,P=P+Math.imul(K,de)|0,S=S+Math.imul(F,be)|0,h=h+Math.imul(F,_e)|0,h=h+Math.imul(W,be)|0,P=P+Math.imul(W,_e)|0,S=S+Math.imul(y,Me)|0,h=h+Math.imul(y,je)|0,h=h+Math.imul(D,Me)|0,P=P+Math.imul(D,je)|0;var Yu=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Yu>>>26)|0,Yu&=67108863,S=Math.imul(fe,Ce),h=Math.imul(fe,We),h=h+Math.imul(Oe,Ce)|0,P=Math.imul(Oe,We),S=S+Math.imul(Pe,Be)|0,h=h+Math.imul(Pe,Ge)|0,h=h+Math.imul(ce,Be)|0,P=P+Math.imul(ce,Ge)|0,S=S+Math.imul(Te,De)|0,h=h+Math.imul(Te,ne)|0,h=h+Math.imul(Ne,De)|0,P=P+Math.imul(Ne,ne)|0,S=S+Math.imul(Q,ge)|0,h=h+Math.imul(Q,de)|0,h=h+Math.imul(le,ge)|0,P=P+Math.imul(le,de)|0,S=S+Math.imul(Y,be)|0,h=h+Math.imul(Y,_e)|0,h=h+Math.imul(K,be)|0,P=P+Math.imul(K,_e)|0,S=S+Math.imul(F,Me)|0,h=h+Math.imul(F,je)|0,h=h+Math.imul(W,Me)|0,P=P+Math.imul(W,je)|0,S=S+Math.imul(y,Ve)|0,h=h+Math.imul(y,Ke)|0,h=h+Math.imul(D,Ve)|0,P=P+Math.imul(D,Ke)|0;var Xu=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,S=Math.imul(me,Ce),h=Math.imul(me,We),h=h+Math.imul(ze,Ce)|0,P=Math.imul(ze,We),S=S+Math.imul(fe,Be)|0,h=h+Math.imul(fe,Ge)|0,h=h+Math.imul(Oe,Be)|0,P=P+Math.imul(Oe,Ge)|0,S=S+Math.imul(Pe,De)|0,h=h+Math.imul(Pe,ne)|0,h=h+Math.imul(ce,De)|0,P=P+Math.imul(ce,ne)|0,S=S+Math.imul(Te,ge)|0,h=h+Math.imul(Te,de)|0,h=h+Math.imul(Ne,ge)|0,P=P+Math.imul(Ne,de)|0,S=S+Math.imul(Q,be)|0,h=h+Math.imul(Q,_e)|0,h=h+Math.imul(le,be)|0,P=P+Math.imul(le,_e)|0,S=S+Math.imul(Y,Me)|0,h=h+Math.imul(Y,je)|0,h=h+Math.imul(K,Me)|0,P=P+Math.imul(K,je)|0,S=S+Math.imul(F,Ve)|0,h=h+Math.imul(F,Ke)|0,h=h+Math.imul(W,Ve)|0,P=P+Math.imul(W,Ke)|0,S=S+Math.imul(y,Ie)|0,h=h+Math.imul(y,Ue)|0,h=h+Math.imul(D,Ie)|0,P=P+Math.imul(D,Ue)|0;var Zu=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Zu>>>26)|0,Zu&=67108863,S=Math.imul($e,Ce),h=Math.imul($e,We),h=h+Math.imul(He,Ce)|0,P=Math.imul(He,We),S=S+Math.imul(me,Be)|0,h=h+Math.imul(me,Ge)|0,h=h+Math.imul(ze,Be)|0,P=P+Math.imul(ze,Ge)|0,S=S+Math.imul(fe,De)|0,h=h+Math.imul(fe,ne)|0,h=h+Math.imul(Oe,De)|0,P=P+Math.imul(Oe,ne)|0,S=S+Math.imul(Pe,ge)|0,h=h+Math.imul(Pe,de)|0,h=h+Math.imul(ce,ge)|0,P=P+Math.imul(ce,de)|0,S=S+Math.imul(Te,be)|0,h=h+Math.imul(Te,_e)|0,h=h+Math.imul(Ne,be)|0,P=P+Math.imul(Ne,_e)|0,S=S+Math.imul(Q,Me)|0,h=h+Math.imul(Q,je)|0,h=h+Math.imul(le,Me)|0,P=P+Math.imul(le,je)|0,S=S+Math.imul(Y,Ve)|0,h=h+Math.imul(Y,Ke)|0,h=h+Math.imul(K,Ve)|0,P=P+Math.imul(K,Ke)|0,S=S+Math.imul(F,Ie)|0,h=h+Math.imul(F,Ue)|0,h=h+Math.imul(W,Ie)|0,P=P+Math.imul(W,Ue)|0,S=S+Math.imul(y,ke)|0,h=h+Math.imul(y,Ye)|0,h=h+Math.imul(D,ke)|0,P=P+Math.imul(D,Ye)|0;var ec=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ec>>>26)|0,ec&=67108863,S=Math.imul(Le,Ce),h=Math.imul(Le,We),h=h+Math.imul(qe,Ce)|0,P=Math.imul(qe,We),S=S+Math.imul($e,Be)|0,h=h+Math.imul($e,Ge)|0,h=h+Math.imul(He,Be)|0,P=P+Math.imul(He,Ge)|0,S=S+Math.imul(me,De)|0,h=h+Math.imul(me,ne)|0,h=h+Math.imul(ze,De)|0,P=P+Math.imul(ze,ne)|0,S=S+Math.imul(fe,ge)|0,h=h+Math.imul(fe,de)|0,h=h+Math.imul(Oe,ge)|0,P=P+Math.imul(Oe,de)|0,S=S+Math.imul(Pe,be)|0,h=h+Math.imul(Pe,_e)|0,h=h+Math.imul(ce,be)|0,P=P+Math.imul(ce,_e)|0,S=S+Math.imul(Te,Me)|0,h=h+Math.imul(Te,je)|0,h=h+Math.imul(Ne,Me)|0,P=P+Math.imul(Ne,je)|0,S=S+Math.imul(Q,Ve)|0,h=h+Math.imul(Q,Ke)|0,h=h+Math.imul(le,Ve)|0,P=P+Math.imul(le,Ke)|0,S=S+Math.imul(Y,Ie)|0,h=h+Math.imul(Y,Ue)|0,h=h+Math.imul(K,Ie)|0,P=P+Math.imul(K,Ue)|0,S=S+Math.imul(F,ke)|0,h=h+Math.imul(F,Ye)|0,h=h+Math.imul(W,ke)|0,P=P+Math.imul(W,Ye)|0,S=S+Math.imul(y,Xe)|0,h=h+Math.imul(y,Ze)|0,h=h+Math.imul(D,Xe)|0,P=P+Math.imul(D,Ze)|0;var tc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(tc>>>26)|0,tc&=67108863,S=Math.imul(Le,Be),h=Math.imul(Le,Ge),h=h+Math.imul(qe,Be)|0,P=Math.imul(qe,Ge),S=S+Math.imul($e,De)|0,h=h+Math.imul($e,ne)|0,h=h+Math.imul(He,De)|0,P=P+Math.imul(He,ne)|0,S=S+Math.imul(me,ge)|0,h=h+Math.imul(me,de)|0,h=h+Math.imul(ze,ge)|0,P=P+Math.imul(ze,de)|0,S=S+Math.imul(fe,be)|0,h=h+Math.imul(fe,_e)|0,h=h+Math.imul(Oe,be)|0,P=P+Math.imul(Oe,_e)|0,S=S+Math.imul(Pe,Me)|0,h=h+Math.imul(Pe,je)|0,h=h+Math.imul(ce,Me)|0,P=P+Math.imul(ce,je)|0,S=S+Math.imul(Te,Ve)|0,h=h+Math.imul(Te,Ke)|0,h=h+Math.imul(Ne,Ve)|0,P=P+Math.imul(Ne,Ke)|0,S=S+Math.imul(Q,Ie)|0,h=h+Math.imul(Q,Ue)|0,h=h+Math.imul(le,Ie)|0,P=P+Math.imul(le,Ue)|0,S=S+Math.imul(Y,ke)|0,h=h+Math.imul(Y,Ye)|0,h=h+Math.imul(K,ke)|0,P=P+Math.imul(K,Ye)|0,S=S+Math.imul(F,Xe)|0,h=h+Math.imul(F,Ze)|0,h=h+Math.imul(W,Xe)|0,P=P+Math.imul(W,Ze)|0;var rc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(rc>>>26)|0,rc&=67108863,S=Math.imul(Le,De),h=Math.imul(Le,ne),h=h+Math.imul(qe,De)|0,P=Math.imul(qe,ne),S=S+Math.imul($e,ge)|0,h=h+Math.imul($e,de)|0,h=h+Math.imul(He,ge)|0,P=P+Math.imul(He,de)|0,S=S+Math.imul(me,be)|0,h=h+Math.imul(me,_e)|0,h=h+Math.imul(ze,be)|0,P=P+Math.imul(ze,_e)|0,S=S+Math.imul(fe,Me)|0,h=h+Math.imul(fe,je)|0,h=h+Math.imul(Oe,Me)|0,P=P+Math.imul(Oe,je)|0,S=S+Math.imul(Pe,Ve)|0,h=h+Math.imul(Pe,Ke)|0,h=h+Math.imul(ce,Ve)|0,P=P+Math.imul(ce,Ke)|0,S=S+Math.imul(Te,Ie)|0,h=h+Math.imul(Te,Ue)|0,h=h+Math.imul(Ne,Ie)|0,P=P+Math.imul(Ne,Ue)|0,S=S+Math.imul(Q,ke)|0,h=h+Math.imul(Q,Ye)|0,h=h+Math.imul(le,ke)|0,P=P+Math.imul(le,Ye)|0,S=S+Math.imul(Y,Xe)|0,h=h+Math.imul(Y,Ze)|0,h=h+Math.imul(K,Xe)|0,P=P+Math.imul(K,Ze)|0;var nc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(nc>>>26)|0,nc&=67108863,S=Math.imul(Le,ge),h=Math.imul(Le,de),h=h+Math.imul(qe,ge)|0,P=Math.imul(qe,de),S=S+Math.imul($e,be)|0,h=h+Math.imul($e,_e)|0,h=h+Math.imul(He,be)|0,P=P+Math.imul(He,_e)|0,S=S+Math.imul(me,Me)|0,h=h+Math.imul(me,je)|0,h=h+Math.imul(ze,Me)|0,P=P+Math.imul(ze,je)|0,S=S+Math.imul(fe,Ve)|0,h=h+Math.imul(fe,Ke)|0,h=h+Math.imul(Oe,Ve)|0,P=P+Math.imul(Oe,Ke)|0,S=S+Math.imul(Pe,Ie)|0,h=h+Math.imul(Pe,Ue)|0,h=h+Math.imul(ce,Ie)|0,P=P+Math.imul(ce,Ue)|0,S=S+Math.imul(Te,ke)|0,h=h+Math.imul(Te,Ye)|0,h=h+Math.imul(Ne,ke)|0,P=P+Math.imul(Ne,Ye)|0,S=S+Math.imul(Q,Xe)|0,h=h+Math.imul(Q,Ze)|0,h=h+Math.imul(le,Xe)|0,P=P+Math.imul(le,Ze)|0;var ic=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ic>>>26)|0,ic&=67108863,S=Math.imul(Le,be),h=Math.imul(Le,_e),h=h+Math.imul(qe,be)|0,P=Math.imul(qe,_e),S=S+Math.imul($e,Me)|0,h=h+Math.imul($e,je)|0,h=h+Math.imul(He,Me)|0,P=P+Math.imul(He,je)|0,S=S+Math.imul(me,Ve)|0,h=h+Math.imul(me,Ke)|0,h=h+Math.imul(ze,Ve)|0,P=P+Math.imul(ze,Ke)|0,S=S+Math.imul(fe,Ie)|0,h=h+Math.imul(fe,Ue)|0,h=h+Math.imul(Oe,Ie)|0,P=P+Math.imul(Oe,Ue)|0,S=S+Math.imul(Pe,ke)|0,h=h+Math.imul(Pe,Ye)|0,h=h+Math.imul(ce,ke)|0,P=P+Math.imul(ce,Ye)|0,S=S+Math.imul(Te,Xe)|0,h=h+Math.imul(Te,Ze)|0,h=h+Math.imul(Ne,Xe)|0,P=P+Math.imul(Ne,Ze)|0;var oc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(oc>>>26)|0,oc&=67108863,S=Math.imul(Le,Me),h=Math.imul(Le,je),h=h+Math.imul(qe,Me)|0,P=Math.imul(qe,je),S=S+Math.imul($e,Ve)|0,h=h+Math.imul($e,Ke)|0,h=h+Math.imul(He,Ve)|0,P=P+Math.imul(He,Ke)|0,S=S+Math.imul(me,Ie)|0,h=h+Math.imul(me,Ue)|0,h=h+Math.imul(ze,Ie)|0,P=P+Math.imul(ze,Ue)|0,S=S+Math.imul(fe,ke)|0,h=h+Math.imul(fe,Ye)|0,h=h+Math.imul(Oe,ke)|0,P=P+Math.imul(Oe,Ye)|0,S=S+Math.imul(Pe,Xe)|0,h=h+Math.imul(Pe,Ze)|0,h=h+Math.imul(ce,Xe)|0,P=P+Math.imul(ce,Ze)|0;var sc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(sc>>>26)|0,sc&=67108863,S=Math.imul(Le,Ve),h=Math.imul(Le,Ke),h=h+Math.imul(qe,Ve)|0,P=Math.imul(qe,Ke),S=S+Math.imul($e,Ie)|0,h=h+Math.imul($e,Ue)|0,h=h+Math.imul(He,Ie)|0,P=P+Math.imul(He,Ue)|0,S=S+Math.imul(me,ke)|0,h=h+Math.imul(me,Ye)|0,h=h+Math.imul(ze,ke)|0,P=P+Math.imul(ze,Ye)|0,S=S+Math.imul(fe,Xe)|0,h=h+Math.imul(fe,Ze)|0,h=h+Math.imul(Oe,Xe)|0,P=P+Math.imul(Oe,Ze)|0;var lc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(lc>>>26)|0,lc&=67108863,S=Math.imul(Le,Ie),h=Math.imul(Le,Ue),h=h+Math.imul(qe,Ie)|0,P=Math.imul(qe,Ue),S=S+Math.imul($e,ke)|0,h=h+Math.imul($e,Ye)|0,h=h+Math.imul(He,ke)|0,P=P+Math.imul(He,Ye)|0,S=S+Math.imul(me,Xe)|0,h=h+Math.imul(me,Ze)|0,h=h+Math.imul(ze,Xe)|0,P=P+Math.imul(ze,Ze)|0;var ac=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ac>>>26)|0,ac&=67108863,S=Math.imul(Le,ke),h=Math.imul(Le,Ye),h=h+Math.imul(qe,ke)|0,P=Math.imul(qe,Ye),S=S+Math.imul($e,Xe)|0,h=h+Math.imul($e,Ze)|0,h=h+Math.imul(He,Xe)|0,P=P+Math.imul(He,Ze)|0;var uc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(uc>>>26)|0,uc&=67108863,S=Math.imul(Le,Xe),h=Math.imul(Le,Ze),h=h+Math.imul(qe,Xe)|0,P=Math.imul(qe,Ze);var cc=(R+S|0)+((h&8191)<<13)|0;return R=(P+(h>>>13)|0)+(cc>>>26)|0,cc&=67108863,M[0]=$n,M[1]=Hn,M[2]=qn,M[3]=Wn,M[4]=Gn,M[5]=Yu,M[6]=Xu,M[7]=Zu,M[8]=ec,M[9]=tc,M[10]=rc,M[11]=nc,M[12]=ic,M[13]=oc,M[14]=sc,M[15]=lc,M[16]=ac,M[17]=uc,M[18]=cc,R!==0&&(M[19]=R,A.length++),A};Math.imul||(w=E);function _(C,f,g){g.negative=f.negative^C.negative,g.length=C.length+f.length;for(var A=0,N=0,b=0;b>>26)|0,N+=M>>>26,M&=67108863}g.words[b]=R,A=M,M=N}return A!==0?g.words[b]=A:g.length--,g._strip()}function O(C,f,g){return _(C,f,g)}o.prototype.mulTo=function(f,g){var A,N=this.length+f.length;return this.length===10&&f.length===10?A=w(this,f,g):N<63?A=E(this,f,g):N<1024?A=_(this,f,g):A=O(this,f,g),A},o.prototype.mul=function(f){var g=new o(null);return g.words=new Array(this.length+f.length),this.mulTo(f,g)},o.prototype.mulf=function(f){var g=new o(null);return g.words=new Array(this.length+f.length),O(this,f,g)},o.prototype.imul=function(f){return this.clone().mulTo(f,this)},o.prototype.imuln=function(f){var g=f<0;g&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var A=0,N=0;N>=26,A+=b/67108864|0,A+=M>>>26,this.words[N]=M&67108863}return A!==0&&(this.words[N]=A,this.length++),g?this.ineg():this},o.prototype.muln=function(f){return this.clone().imuln(f)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(f){var g=k(f);if(g.length===0)return new o(1);for(var A=this,N=0;N=0);var g=f%26,A=(f-g)/26,N=67108863>>>26-g<<26-g,b;if(g!==0){var M=0;for(b=0;b>>26-g}M&&(this.words[b]=M,this.length++)}if(A!==0){for(b=this.length-1;b>=0;b--)this.words[b+A]=this.words[b];for(b=0;b=0);var N;g?N=(g-g%26)/26:N=0;var b=f%26,M=Math.min((f-b)/26,this.length),R=67108863^67108863>>>b<M)for(this.length-=M,h=0;h=0&&(P!==0||h>=N);h--){var te=this.words[h]|0;this.words[h]=P<<26-b|te>>>b,P=te&R}return S&&P!==0&&(S.words[S.length++]=P),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(f,g,A){return n(this.negative===0),this.iushrn(f,g,A)},o.prototype.shln=function(f){return this.clone().ishln(f)},o.prototype.ushln=function(f){return this.clone().iushln(f)},o.prototype.shrn=function(f){return this.clone().ishrn(f)},o.prototype.ushrn=function(f){return this.clone().iushrn(f)},o.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var g=f%26,A=(f-g)/26,N=1<=0);var g=f%26,A=(f-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=A)return this;if(g!==0&&A++,this.length=Math.min(A,this.length),g!==0){var N=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},o.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(S/67108864|0),this.words[b+A]=M&67108863}for(;b>26,this.words[b+A]=M&67108863;if(R===0)return this._strip();for(n(R===-1),R=0,b=0;b>26,this.words[b]=M&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(f,g){var A=this.length-f.length,N=this.clone(),b=f,M=b.words[b.length-1]|0,R=this._countBits(M);A=26-R,A!==0&&(b=b.ushln(A),N.iushln(A),M=b.words[b.length-1]|0);var S=N.length-b.length,h;if(g!=="mod"){h=new o(null),h.length=S+1,h.words=new Array(h.length);for(var P=0;P=0;y--){var D=(N.words[b.length+y]|0)*67108864+(N.words[b.length+y-1]|0);for(D=Math.min(D/M|0,67108863),N._ishlnsubmul(b,D,y);N.negative!==0;)D--,N.negative=0,N._ishlnsubmul(b,1,y),N.isZero()||(N.negative^=1);h&&(h.words[y]=D)}return h&&h._strip(),N._strip(),g!=="div"&&A!==0&&N.iushrn(A),{div:h||null,mod:N}},o.prototype.divmod=function(f,g,A){if(n(!f.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var N,b,M;return this.negative!==0&&f.negative===0?(M=this.neg().divmod(f,g),g!=="mod"&&(N=M.div.neg()),g!=="div"&&(b=M.mod.neg(),A&&b.negative!==0&&b.iadd(f)),{div:N,mod:b}):this.negative===0&&f.negative!==0?(M=this.divmod(f.neg(),g),g!=="mod"&&(N=M.div.neg()),{div:N,mod:M.mod}):this.negative&f.negative?(M=this.neg().divmod(f.neg(),g),g!=="div"&&(b=M.mod.neg(),A&&b.negative!==0&&b.isub(f)),{div:M.div,mod:b}):f.length>this.length||this.cmp(f)<0?{div:new o(0),mod:this}:f.length===1?g==="div"?{div:this.divn(f.words[0]),mod:null}:g==="mod"?{div:null,mod:new o(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new o(this.modrn(f.words[0]))}:this._wordDiv(f,g)},o.prototype.div=function(f){return this.divmod(f,"div",!1).div},o.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},o.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},o.prototype.divRound=function(f){var g=this.divmod(f);if(g.mod.isZero())return g.div;var A=g.div.negative!==0?g.mod.isub(f):g.mod,N=f.ushrn(1),b=f.andln(1),M=A.cmp(N);return M<0||b===1&&M===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},o.prototype.modrn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var A=(1<<26)%f,N=0,b=this.length-1;b>=0;b--)N=(A*N+(this.words[b]|0))%f;return g?-N:N},o.prototype.modn=function(f){return this.modrn(f)},o.prototype.idivn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var A=0,N=this.length-1;N>=0;N--){var b=(this.words[N]|0)+A*67108864;this.words[N]=b/f|0,A=b%f}return this._strip(),g?this.ineg():this},o.prototype.divn=function(f){return this.clone().idivn(f)},o.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var g=this,A=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var N=new o(1),b=new o(0),M=new o(0),R=new o(1),S=0;g.isEven()&&A.isEven();)g.iushrn(1),A.iushrn(1),++S;for(var h=A.clone(),P=g.clone();!g.isZero();){for(var te=0,y=1;!(g.words[0]&y)&&te<26;++te,y<<=1);if(te>0)for(g.iushrn(te);te-- >0;)(N.isOdd()||b.isOdd())&&(N.iadd(h),b.isub(P)),N.iushrn(1),b.iushrn(1);for(var D=0,U=1;!(A.words[0]&U)&&D<26;++D,U<<=1);if(D>0)for(A.iushrn(D);D-- >0;)(M.isOdd()||R.isOdd())&&(M.iadd(h),R.isub(P)),M.iushrn(1),R.iushrn(1);g.cmp(A)>=0?(g.isub(A),N.isub(M),b.isub(R)):(A.isub(g),M.isub(N),R.isub(b))}return{a:M,b:R,gcd:A.iushln(S)}},o.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var g=this,A=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var N=new o(1),b=new o(0),M=A.clone();g.cmpn(1)>0&&A.cmpn(1)>0;){for(var R=0,S=1;!(g.words[0]&S)&&R<26;++R,S<<=1);if(R>0)for(g.iushrn(R);R-- >0;)N.isOdd()&&N.iadd(M),N.iushrn(1);for(var h=0,P=1;!(A.words[0]&P)&&h<26;++h,P<<=1);if(h>0)for(A.iushrn(h);h-- >0;)b.isOdd()&&b.iadd(M),b.iushrn(1);g.cmp(A)>=0?(g.isub(A),N.isub(b)):(A.isub(g),b.isub(N))}var te;return g.cmpn(1)===0?te=N:te=b,te.cmpn(0)<0&&te.iadd(f),te},o.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var g=this.clone(),A=f.clone();g.negative=0,A.negative=0;for(var N=0;g.isEven()&&A.isEven();N++)g.iushrn(1),A.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;A.isEven();)A.iushrn(1);var b=g.cmp(A);if(b<0){var M=g;g=A,A=M}else if(b===0||A.cmpn(1)===0)break;g.isub(A)}while(!0);return A.iushln(N)},o.prototype.invm=function(f){return this.egcd(f).a.umod(f)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(f){return this.words[0]&f},o.prototype.bincn=function(f){n(typeof f=="number");var g=f%26,A=(f-g)/26,N=1<>>26,R&=67108863,this.words[M]=R}return b!==0&&(this.words[M]=b,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(f){var g=f<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var A;if(this.length>1)A=1;else{g&&(f=-f),n(f<=67108863,"Number is too big");var N=this.words[0]|0;A=N===f?0:Nf.length)return 1;if(this.length=0;A--){var N=this.words[A]|0,b=f.words[A]|0;if(N!==b){Nb&&(g=1);break}}return g},o.prototype.gtn=function(f){return this.cmpn(f)===1},o.prototype.gt=function(f){return this.cmp(f)===1},o.prototype.gten=function(f){return this.cmpn(f)>=0},o.prototype.gte=function(f){return this.cmp(f)>=0},o.prototype.ltn=function(f){return this.cmpn(f)===-1},o.prototype.lt=function(f){return this.cmp(f)===-1},o.prototype.lten=function(f){return this.cmpn(f)<=0},o.prototype.lte=function(f){return this.cmp(f)<=0},o.prototype.eqn=function(f){return this.cmpn(f)===0},o.prototype.eq=function(f){return this.cmp(f)===0},o.red=function(f){return new G(f)},o.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(f){return this.red=f,this},o.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},o.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},o.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},o.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},o.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},o.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},o.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},o.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var B={k256:null,p224:null,p192:null,p25519:null};function j(C,f){this.name=C,this.p=new o(f,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}j.prototype._tmp=function(){var f=new o(null);return f.words=new Array(Math.ceil(this.n/13)),f},j.prototype.ireduce=function(f){var g=f,A;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),A=g.bitLength();while(A>this.n);var N=A0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},j.prototype.split=function(f,g){f.iushrn(this.n,0,g)},j.prototype.imulK=function(f){return f.imul(this.k)};function $(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i($,j),$.prototype.split=function(f,g){for(var A=4194303,N=Math.min(f.length,9),b=0;b>>22,M=R}M>>>=22,f.words[b-10]=M,M===0&&f.length>10?f.length-=10:f.length-=9},$.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var g=0,A=0;A>>=26,f.words[A]=b,g=N}return g!==0&&(f.words[f.length++]=g),f},o._prime=function(f){if(B[f])return B[f];var g;if(f==="k256")g=new $;else if(f==="p224")g=new H;else if(f==="p192")g=new ie;else if(f==="p25519")g=new X;else throw new Error("Unknown prime "+f);return B[f]=g,g};function G(C){if(typeof C=="string"){var f=o._prime(C);this.m=f.p,this.prime=f}else n(C.gtn(1),"modulus must be greater than 1"),this.m=C,this.prime=null}G.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},G.prototype._verify2=function(f,g){n((f.negative|g.negative)===0,"red works only with positives"),n(f.red&&f.red===g.red,"red works only with red numbers")},G.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(c(f,f.umod(this.m)._forceRed(this)),f)},G.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},G.prototype.add=function(f,g){this._verify2(f,g);var A=f.add(g);return A.cmp(this.m)>=0&&A.isub(this.m),A._forceRed(this)},G.prototype.iadd=function(f,g){this._verify2(f,g);var A=f.iadd(g);return A.cmp(this.m)>=0&&A.isub(this.m),A},G.prototype.sub=function(f,g){this._verify2(f,g);var A=f.sub(g);return A.cmpn(0)<0&&A.iadd(this.m),A._forceRed(this)},G.prototype.isub=function(f,g){this._verify2(f,g);var A=f.isub(g);return A.cmpn(0)<0&&A.iadd(this.m),A},G.prototype.shl=function(f,g){return this._verify1(f),this.imod(f.ushln(g))},G.prototype.imul=function(f,g){return this._verify2(f,g),this.imod(f.imul(g))},G.prototype.mul=function(f,g){return this._verify2(f,g),this.imod(f.mul(g))},G.prototype.isqr=function(f){return this.imul(f,f.clone())},G.prototype.sqr=function(f){return this.mul(f,f)},G.prototype.sqrt=function(f){if(f.isZero())return f.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var A=this.m.add(new o(1)).iushrn(2);return this.pow(f,A)}for(var N=this.m.subn(1),b=0;!N.isZero()&&N.andln(1)===0;)b++,N.iushrn(1);n(!N.isZero());var M=new o(1).toRed(this),R=M.redNeg(),S=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);this.pow(h,S).cmp(R)!==0;)h.redIAdd(R);for(var P=this.pow(h,N),te=this.pow(f,N.addn(1).iushrn(1)),y=this.pow(f,N),D=b;y.cmp(M)!==0;){for(var U=y,F=0;U.cmp(M)!==0;F++)U=U.redSqr();n(F=0;b--){for(var P=g.words[b],te=h-1;te>=0;te--){var y=P>>te&1;if(M!==N[0]&&(M=this.sqr(M)),y===0&&R===0){S=0;continue}R<<=1,R|=y,S++,!(S!==A&&(b!==0||te!==0))&&(M=this.mul(M,N[R]),S=0,R=0)}h=26}return M},G.prototype.convertTo=function(f){var g=f.umod(this.m);return g===f?g.clone():g},G.prototype.convertFrom=function(f){var g=f.clone();return g.red=null,g},o.mont=function(f){return new J(f)};function J(C){G.call(this,C),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(J,G),J.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},J.prototype.convertFrom=function(f){var g=this.imod(f.mul(this.rinv));return g.red=null,g},J.prototype.imul=function(f,g){if(f.isZero()||g.isZero())return f.words[0]=0,f.length=1,f;var A=f.imul(g),N=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=A.isub(N).iushrn(this.shift),M=b;return b.cmp(this.m)>=0?M=b.isub(this.m):b.cmpn(0)<0&&(M=b.iadd(this.m)),M._forceRed(this)},J.prototype.mul=function(f,g){if(f.isZero()||g.isZero())return new o(0)._forceRed(this);var A=f.mul(g),N=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=A.isub(N).iushrn(this.shift),M=b;return b.cmp(this.m)>=0?M=b.isub(this.m):b.cmpn(0)<0&&(M=b.iadd(this.m)),M._forceRed(this)},J.prototype.invm=function(f){var g=this.imod(f._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(t,Fe)})(Ah);var Px=Ah.exports;const ue=jo(Px),Cx="logger/5.7.0";let op=!1,sp=!1;const da={debug:1,default:2,info:2,warning:3,error:4,off:5};let lp=da.default,jc=null;function Mx(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const ap=Mx();var od;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(od||(od={}));var Ur;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(Ur||(Ur={}));const up="0123456789abcdef";class T{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();da[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(lp>da[n])&&console.log.apply(console,r)}debug(...e){this._log(T.levels.DEBUG,e)}info(...e){this._log(T.levels.INFO,e)}warn(...e){this._log(T.levels.WARNING,e)}makeError(e,r,n){if(sp)return this.makeError("censored error",r,{});r||(r=T.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(a=>{const u=n[a];try{if(u instanceof Uint8Array){let c="";for(let d=0;d>4],c+=up[u[d]&15];i.push(a+"=Uint8Array(0x"+c+")")}else i.push(a+"="+JSON.stringify(u))}catch{i.push(a+"="+JSON.stringify(n[a].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const o=e;let s="";switch(r){case Ur.NUMERIC_FAULT:{s="NUMERIC_FAULT";const a=e;switch(a){case"overflow":case"underflow":case"division-by-zero":s+="-"+a;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result";break}break}case Ur.CALL_EXCEPTION:case Ur.INSUFFICIENT_FUNDS:case Ur.MISSING_NEW:case Ur.NONCE_EXPIRED:case Ur.REPLACEMENT_UNDERPRICED:case Ur.TRANSACTION_REPLACED:case Ur.UNPREDICTABLE_GAS_LIMIT:s=r;break}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const l=new Error(e);return l.reason=o,l.code=r,Object.keys(n).forEach(function(a){l[a]=n[a]}),l}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,T.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){ap&&this.throwError("platform missing String.prototype.normalize",T.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ap})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,T.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,T.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,T.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",T.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",T.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",T.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return jc||(jc=new T(Cx)),jc}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",T.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),op){if(!e)return;this.globalLogger().throwError("error censorship permanent",T.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}sp=!!e,op=!!r}static setLogLevel(e){const r=da[e.toLowerCase()];if(r==null){T.globalLogger().warn("invalid log level - "+e);return}lp=r}static from(e){return new T(e)}}T.errors=Ur;T.levels=od;const Ix="bytes/5.7.0",dt=new T(Ix);function iy(t){return!!t.toHexString}function Ao(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Ao(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function bh(t){return pe(t)&&!(t.length%2)||Ru(t)}function cp(t){return typeof t=="number"&&t==t&&t%1===0}function Ru(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!cp(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function se(t,e){if(e||(e={}),typeof t=="number"){dt.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Ao(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),iy(t)&&(t=t.toHexString()),pe(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":dt.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ise(i)),r=e.reduce((i,o)=>i+o.length,0),n=new Uint8Array(r);return e.reduce((i,o)=>(n.set(o,i),i+o.length),0),Ao(n)}function Ro(t){let e=se(t);if(e.length===0)return e;let r=0;for(;re&&dt.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),Ao(r)}function pe(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const Uc="0123456789abcdef";function re(t,e){if(e||(e={}),typeof t=="number"){dt.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=Uc[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),iy(t))return t.toHexString();if(pe(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":dt.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Ru(t)){let r="0x";for(let n=0;n>4]+Uc[i&15]}return r}return dt.throwArgumentError("invalid hexlify value","value",t)}function On(t){if(typeof t!="string")t=re(t);else if(!pe(t)||t.length%2)return null;return(t.length-2)/2}function It(t,e,r){return typeof t!="string"?t=re(t):(!pe(t)||t.length%2)&&dt.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Xt(t){let e="0x";return t.forEach(r=>{e+=re(r).substring(2)}),e}function Tu(t){const e=Rx(re(t,{hexPad:"left"}));return e==="0x"?"0x0":e}function Rx(t){typeof t!="string"&&(t=re(t)),pe(t)||dt.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e2*e+2&&dt.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Ou(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(bh(t)){let r=se(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=re(r.slice(0,32)),e.s=re(r.slice(32,64))):r.length===65?(e.r=re(r.slice(0,32)),e.s=re(r.slice(32,64)),e.v=r[64]):dt.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:dt.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=re(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=ha(se(e._vs),32);e._vs=re(i);const o=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=o:e.recoveryParam!==o&&dt.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const s=re(i);e.s==null?e.s=s:e.s!==s&&dt.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?dt.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&dt.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!pe(e.r)?dt.throwArgumentError("signature missing or invalid r","signature",t):e.r=pt(e.r,32),e.s==null||!pe(e.s)?dt.throwArgumentError("signature missing or invalid s","signature",t):e.s=pt(e.s,32);const r=se(e.s);r[0]>=128&&dt.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=re(r);e._vs&&(pe(e._vs)||dt.throwArgumentError("signature invalid _vs","signature",t),e._vs=pt(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&dt.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const Tx="bignumber/5.7.0";var Xs=ue.BN;const En=new T(Tx),Fc={},fp=9007199254740991;let dp=!1;class V{constructor(e,r){e!==Fc&&En.throwError("cannot call constructor directly; use BigNumber.from",T.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Jt(ve(this).fromTwos(e))}toTwos(e){return Jt(ve(this).toTwos(e))}abs(){return this._hex[0]==="-"?V.from(this._hex.substring(1)):this}add(e){return Jt(ve(this).add(ve(e)))}sub(e){return Jt(ve(this).sub(ve(e)))}div(e){return V.from(e).isZero()&&xr("division-by-zero","div"),Jt(ve(this).div(ve(e)))}mul(e){return Jt(ve(this).mul(ve(e)))}mod(e){const r=ve(e);return r.isNeg()&&xr("division-by-zero","mod"),Jt(ve(this).umod(r))}pow(e){const r=ve(e);return r.isNeg()&&xr("negative-power","pow"),Jt(ve(this).pow(r))}and(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","and"),Jt(ve(this).and(r))}or(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","or"),Jt(ve(this).or(r))}xor(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","xor"),Jt(ve(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&xr("negative-width","mask"),Jt(ve(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&xr("negative-width","shl"),Jt(ve(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&xr("negative-width","shr"),Jt(ve(this).shrn(e))}eq(e){return ve(this).eq(ve(e))}lt(e){return ve(this).lt(ve(e))}lte(e){return ve(this).lte(ve(e))}gt(e){return ve(this).gt(ve(e))}gte(e){return ve(this).gte(ve(e))}isNegative(){return this._hex[0]==="-"}isZero(){return ve(this).isZero()}toNumber(){try{return ve(this).toNumber()}catch{xr("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return En.throwError("this platform does not support BigInt",T.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?dp||(dp=!0,En.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?En.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",T.errors.UNEXPECTED_ARGUMENT,{}):En.throwError("BigNumber.toString does not accept parameters",T.errors.UNEXPECTED_ARGUMENT,{})),ve(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof V)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new V(Fc,Zs(e)):e.match(/^-?[0-9]+$/)?new V(Fc,Zs(new Xs(e))):En.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&xr("underflow","BigNumber.from",e),(e>=fp||e<=-fp)&&xr("overflow","BigNumber.from",e),V.from(String(e));const r=e;if(typeof r=="bigint")return V.from(r.toString());if(Ru(r))return V.from(re(r));if(r)if(r.toHexString){const n=r.toHexString();if(typeof n=="string")return V.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(pe(n)||n[0]==="-"&&pe(n.substring(1))))return V.from(n)}return En.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function Zs(t){if(typeof t!="string")return Zs(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&En.throwArgumentError("invalid hex","value",t),t=Zs(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function Jt(t){return V.from(Zs(t))}function ve(t){const e=V.from(t).toHexString();return e[0]==="-"?new Xs("-"+e.substring(3),16):new Xs(e.substring(2),16)}function xr(t,e,r){const n={fault:t,operation:e};return r!=null&&(n.value=r),En.throwError(t,T.errors.NUMERIC_FAULT,n)}function Ox(t){return new Xs(t,36).toString(16)}function Lx(t){return new Xs(t,16).toString(36)}const Bx="properties/5.7.0";var Dx=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Ja=new T(Bx);function z(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function fr(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||typeof t.prototype!="object")break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function yt(t){return Dx(this,void 0,void 0,function*(){const e=Object.keys(t).map(n=>{const i=t[n];return Promise.resolve(i).then(o=>({key:n,value:o}))});return(yield Promise.all(e)).reduce((n,i)=>(n[i.key]=i.value,n),{})})}function jx(t,e){(!t||typeof t!="object")&&Ja.throwArgumentError("invalid object","object",t),Object.keys(t).forEach(r=>{e[r]||Ja.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)})}function it(t){const e={};for(const r in t)e[r]=t[r];return e}const Ux={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function oy(t){if(t==null||Ux[typeof t])return!0;if(Array.isArray(t)||typeof t=="object"){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;rnr(e)));if(typeof t=="object"){const e={};for(const r in t){const n=t[r];n!==void 0&&z(e,r,nr(n))}return e}return Ja.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function nr(t){return Fx(t)}class vl{constructor(e){for(const r in e)this[r]=nr(e[r])}}const yl="abi/5.7.0",Ee=new T(yl),Di={};let hp={calldata:!0,memory:!0,storage:!0},zx={calldata:!0,memory:!0};function zl(t,e){if(t==="bytes"||t==="string"){if(hp[e])return!0}else if(t==="address"){if(e==="payable")return!0}else if((t.indexOf("[")>=0||t==="tuple")&&zx[e])return!0;return(hp[e]||e==="payable")&&Ee.throwArgumentError("invalid modifier","name",e),!1}function $x(t,e){let r=t;function n(l){Ee.throwArgumentError(`unexpected character at position ${l}`,"param",t)}t=t.replace(/\s/g," ");function i(l){let a={type:"",name:"",parent:l,state:{allowType:!0}};return e&&(a.indexed=!1),a}let o={type:"",name:"",state:{allowType:!0}},s=o;for(let l=0;lJSON.parse(i.format(e)))),JSON.stringify(n)}let r="";return this.baseType==="array"?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==Se.sighash&&(r+=this.type),r+="("+this.components.map(n=>n.format(e)).join(e===Se.full?", ":",")+")"):r+=this.type,e!==Se.sighash&&(this.indexed===!0&&(r+=" indexed"),e===Se.full&&this.name&&(r+=" "+this.name)),r}static from(e,r){return typeof e=="string"?kt.fromString(e,r):kt.fromObject(e)}static fromObject(e){return kt.isParamType(e)?e:new kt(Di,{name:e.name||null,type:Ji(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(kt.fromObject):null})}static fromString(e,r){function n(i){return kt.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return n($x(e,!!r))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function el(t,e){return Wx(t).map(r=>kt.fromString(r,e))}class Nn{constructor(e,r){e!==Di&&Ee.throwError("use a static from method",T.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),pa(this,r),this._isFragment=!0,Object.freeze(this)}static from(e){return Nn.isFragment(e)?e:typeof e=="string"?Nn.fromString(e):Nn.fromObject(e)}static fromObject(e){if(Nn.isFragment(e))return e;switch(e.type){case"function":return sn.fromObject(e);case"event":return _n.fromObject(e);case"constructor":return on.fromObject(e);case"error":return ei.fromObject(e);case"fallback":case"receive":return null}return Ee.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?_n.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?sn.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?on.fromString(e.trim()):e.split(" ")[0]==="error"?ei.fromString(e.substring(5).trim()):Ee.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class _n extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",e!==Se.sighash&&this.anonymous&&(r+="anonymous "),r.trim()}static from(e){return typeof e=="string"?_n.fromString(e):_n.fromObject(e)}static fromObject(e){if(_n.isEventFragment(e))return e;e.type!=="event"&&Ee.throwArgumentError("invalid event object","value",e);const r={name:tl(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(kt.fromObject):[],type:"event"};return new _n(Di,r)}static fromString(e){let r=e.match(rl);r||Ee.throwArgumentError("invalid event string","value",e);let n=!1;return r[3].split(" ").forEach(i=>{switch(i.trim()){case"anonymous":n=!0;break;case"":break;default:Ee.warn("unknown modifier: "+i)}}),_n.fromObject({name:r[1].trim(),anonymous:n,inputs:el(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function sy(t,e){e.gas=null;let r=t.split("@");return r.length!==1?(r.length>2&&Ee.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||Ee.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=V.from(r[1]),r[0]):t}function ly(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach(r=>{switch(r.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+r)}})}function ay(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return t.stateMutability!=null?(e.stateMutability=t.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",t.constant!=null&&!!t.constant!==e.constant&&Ee.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable=e.stateMutability==="payable",t.payable!=null&&!!t.payable!==e.payable&&Ee.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):t.payable!=null?(e.payable=!!t.payable,t.constant==null&&!e.payable&&t.type!=="constructor"&&Ee.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Ee.throwArgumentError("cannot have constant payable function","value",t)):t.constant!=null?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):t.type!=="constructor"&&Ee.throwArgumentError("unable to determine stateMutability","value",t),e}class on extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});e===Se.sighash&&Ee.throwError("cannot format a constructor for sighash",T.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let r="constructor("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "),r.trim()}static from(e){return typeof e=="string"?on.fromString(e):on.fromObject(e)}static fromObject(e){if(on.isConstructorFragment(e))return e;e.type!=="constructor"&&Ee.throwArgumentError("invalid constructor object","value",e);let r=ay(e);r.constant&&Ee.throwArgumentError("constructor cannot be constant","value",e);const n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(kt.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?V.from(e.gas):null};return new on(Di,n)}static fromString(e){let r={type:"constructor"};e=sy(e,r);let n=e.match(rl);return(!n||n[1].trim()!=="constructor")&&Ee.throwArgumentError("invalid constructor string","value",e),r.inputs=el(n[2].trim(),!1),ly(n[3].trim(),r),on.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class sn extends on{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e))),outputs:this.outputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",e!==Se.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "):this.constant&&(r+="view "),this.outputs&&this.outputs.length&&(r+="returns ("+this.outputs.map(n=>n.format(e)).join(", ")+") "),this.gas!=null&&(r+="@"+this.gas.toString()+" ")),r.trim()}static from(e){return typeof e=="string"?sn.fromString(e):sn.fromObject(e)}static fromObject(e){if(sn.isFunctionFragment(e))return e;e.type!=="function"&&Ee.throwArgumentError("invalid function object","value",e);let r=ay(e);const n={type:e.type,name:tl(e.name),constant:r.constant,inputs:e.inputs?e.inputs.map(kt.fromObject):[],outputs:e.outputs?e.outputs.map(kt.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?V.from(e.gas):null};return new sn(Di,n)}static fromString(e){let r={type:"function"};e=sy(e,r);let n=e.split(" returns ");n.length>2&&Ee.throwArgumentError("invalid function string","value",e);let i=n[0].match(rl);if(i||Ee.throwArgumentError("invalid function signature","value",e),r.name=i[1].trim(),r.name&&tl(r.name),r.inputs=el(i[2],!1),ly(i[3].trim(),r),n.length>1){let o=n[1].match(rl);(o[1].trim()!=""||o[3].trim()!="")&&Ee.throwArgumentError("unexpected tokens","value",e),r.outputs=el(o[2],!1)}else r.outputs=[];return sn.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function pp(t){const e=t.format();return(e==="Error(string)"||e==="Panic(uint256)")&&Ee.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class ei extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",r.trim()}static from(e){return typeof e=="string"?ei.fromString(e):ei.fromObject(e)}static fromObject(e){if(ei.isErrorFragment(e))return e;e.type!=="error"&&Ee.throwArgumentError("invalid error object","value",e);const r={type:e.type,name:tl(e.name),inputs:e.inputs?e.inputs.map(kt.fromObject):[]};return pp(new ei(Di,r))}static fromString(e){let r={type:"error"},n=e.match(rl);return n||Ee.throwArgumentError("invalid error signature","value",e),r.name=n[1].trim(),r.name&&tl(r.name),r.inputs=el(n[2],!1),pp(ei.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function Ji(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const qx=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function tl(t){return(!t||!t.match(qx))&&Ee.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const rl=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function Wx(t){t=t.trim();let e=[],r="",n=0;for(let i=0;ithis.wordSize&&_h.throwError("value out-of-bounds",T.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=Ut([this._padding.slice(r.length%this.wordSize),r])),r}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,r=>{this._data[e]=this._getValue(r)}}}class Ya{constructor(e,r,n,i){z(this,"_data",se(e)),z(this,"wordSize",r||32),z(this,"_coerceFunc",n),z(this,"allowLoose",i),this._offset=0}get data(){return re(this._data)}get consumed(){return this._offset}static coerce(e,r){let n=e.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(r=r.toNumber()),r}coerce(e,r){return this._coerceFunc?this._coerceFunc(e,r):Ya.coerce(e,r)}_peekBytes(e,r,n){let i=Math.ceil(r/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&n&&this._offset+r<=this._data.length?i=r:_h.throwError("data out-of-bounds",T.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new Ya(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,r){let n=this._peekBytes(0,e,!!r);return this._offset+=n.length,n.slice(0,e)}readValue(){return V.from(this.readBytes(this.wordSize))}}var uy={exports:{}};/** + */const bx="startTransition",rp=xw[bx];function _x(t){let{basename:e,children:r,future:n,window:i}=t,o=L.useRef();o.current==null&&(o.current=IE({window:i,v5Compat:!0}));let s=o.current,[l,a]=L.useState({action:s.action,location:s.location}),{v7_startTransition:u}=n||{},c=L.useCallback(d=>{u&&rp?rp(()=>a(d)):a(d)},[a,u]);return L.useLayoutEffect(()=>s.listen(c),[s,c]),L.createElement(xx,{basename:e,children:r,location:l.location,navigationType:l.action,navigator:s,future:n})}var np;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(np||(np={}));var ip;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(ip||(ip={}));var Ah={exports:{}};const Sx={},kx=Object.freeze(Object.defineProperty({__proto__:null,default:Sx},Symbol.toStringTag,{value:"Module"})),Nx=Uo(kx);Ah.exports;(function(t){(function(e,r){function n(C,f){if(!C)throw new Error(f||"Assertion failed")}function i(C,f){C.super_=f;var m=function(){};m.prototype=f.prototype,C.prototype=new m,C.prototype.constructor=C}function o(C,f,m){if(o.isBN(C))return C;this.negative=0,this.words=null,this.length=0,this.red=null,C!==null&&((f==="le"||f==="be")&&(m=f,f=10),this._init(C||0,f||10,m||"be"))}typeof e=="object"?e.exports=o:r.BN=o,o.BN=o,o.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=Nx.Buffer}catch{}o.isBN=function(f){return f instanceof o?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===o.wordSize&&Array.isArray(f.words)},o.max=function(f,m){return f.cmp(m)>0?f:m},o.min=function(f,m){return f.cmp(m)<0?f:m},o.prototype._init=function(f,m,A){if(typeof f=="number")return this._initNumber(f,m,A);if(typeof f=="object")return this._initArray(f,m,A);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),f=f.toString().replace(/\s+/g,"");var N=0;f[0]==="-"&&(N++,this.negative=1),N=0;N-=3)M=f[N]|f[N-1]<<8|f[N-2]<<16,this.words[b]|=M<>>26-R&67108863,R+=24,R>=26&&(R-=26,b++);else if(A==="le")for(N=0,b=0;N>>26-R&67108863,R+=24,R>=26&&(R-=26,b++);return this._strip()};function l(C,f){var m=C.charCodeAt(f);if(m>=48&&m<=57)return m-48;if(m>=65&&m<=70)return m-55;if(m>=97&&m<=102)return m-87;n(!1,"Invalid character in "+C)}function a(C,f,m){var A=l(C,m);return m-1>=f&&(A|=l(C,m-1)<<4),A}o.prototype._parseHex=function(f,m,A){this.length=Math.ceil((f.length-m)/6),this.words=new Array(this.length);for(var N=0;N=m;N-=2)R=a(f,m,N)<=18?(b-=18,M+=1,this.words[M]|=R>>>26):b+=8;else{var S=f.length-m;for(N=S%2===0?m+1:m;N=18?(b-=18,M+=1,this.words[M]|=R>>>26):b+=8}this._strip()};function u(C,f,m,A){for(var N=0,b=0,M=Math.min(C.length,m),R=f;R=49?b=S-49+10:S>=17?b=S-17+10:b=S,n(S>=0&&b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch{o.prototype.inspect=d}else o.prototype.inspect=d;function d(){return(this.red?""}var p=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],v=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],g=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(f,m){f=f||10,m=m|0||1;var A;if(f===16||f==="hex"){A="";for(var N=0,b=0,M=0;M>>24-N&16777215,N+=2,N>=26&&(N-=26,M--),b!==0||M!==this.length-1?A=p[6-S.length]+S+A:A=S+A}for(b!==0&&(A=b.toString(16)+A);A.length%m!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}if(f===(f|0)&&f>=2&&f<=36){var h=v[f],P=g[f];A="";var te=this.clone();for(te.negative=0;!te.isZero();){var y=te.modrn(P).toString(f);te=te.idivn(P),te.isZero()?A=y+A:A=p[h-y.length]+y+A}for(this.isZero()&&(A="0"+A);A.length%m!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(f,m){return this.toArrayLike(s,f,m)}),o.prototype.toArray=function(f,m){return this.toArrayLike(Array,f,m)};var x=function(f,m){return f.allocUnsafe?f.allocUnsafe(m):new f(m)};o.prototype.toArrayLike=function(f,m,A){this._strip();var N=this.byteLength(),b=A||Math.max(1,N);n(N<=b,"byte array longer than desired length"),n(b>0,"Requested array length <= 0");var M=x(f,b),R=m==="le"?"LE":"BE";return this["_toArrayLike"+R](M,N),M},o.prototype._toArrayLikeLE=function(f,m){for(var A=0,N=0,b=0,M=0;b>8&255),A>16&255),M===6?(A>24&255),N=0,M=0):(N=R>>>24,M+=2)}if(A=0&&(f[A--]=R>>8&255),A>=0&&(f[A--]=R>>16&255),M===6?(A>=0&&(f[A--]=R>>24&255),N=0,M=0):(N=R>>>24,M+=2)}if(A>=0)for(f[A--]=N;A>=0;)f[A--]=0},Math.clz32?o.prototype._countBits=function(f){return 32-Math.clz32(f)}:o.prototype._countBits=function(f){var m=f,A=0;return m>=4096&&(A+=13,m>>>=13),m>=64&&(A+=7,m>>>=7),m>=8&&(A+=4,m>>>=4),m>=2&&(A+=2,m>>>=2),A+m},o.prototype._zeroBits=function(f){if(f===0)return 26;var m=f,A=0;return m&8191||(A+=13,m>>>=13),m&127||(A+=7,m>>>=7),m&15||(A+=4,m>>>=4),m&3||(A+=2,m>>>=2),m&1||A++,A},o.prototype.bitLength=function(){var f=this.words[this.length-1],m=this._countBits(f);return(this.length-1)*26+m};function k(C){for(var f=new Array(C.bitLength()),m=0;m>>N&1}return f}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,m=0;mf.length?this.clone().ior(f):f.clone().ior(this)},o.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},o.prototype.iuand=function(f){var m;this.length>f.length?m=f:m=this;for(var A=0;Af.length?this.clone().iand(f):f.clone().iand(this)},o.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},o.prototype.iuxor=function(f){var m,A;this.length>f.length?(m=this,A=f):(m=f,A=this);for(var N=0;Nf.length?this.clone().ixor(f):f.clone().ixor(this)},o.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},o.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var m=Math.ceil(f/26)|0,A=f%26;this._expand(m),A>0&&m--;for(var N=0;N0&&(this.words[N]=~this.words[N]&67108863>>26-A),this._strip()},o.prototype.notn=function(f){return this.clone().inotn(f)},o.prototype.setn=function(f,m){n(typeof f=="number"&&f>=0);var A=f/26|0,N=f%26;return this._expand(A+1),m?this.words[A]=this.words[A]|1<f.length?(A=this,N=f):(A=f,N=this);for(var b=0,M=0;M>>26;for(;b!==0&&M>>26;if(this.length=A.length,b!==0)this.words[this.length]=b,this.length++;else if(A!==this)for(;Mf.length?this.clone().iadd(f):f.clone().iadd(this)},o.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var m=this.iadd(f);return f.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var A=this.cmp(f);if(A===0)return this.negative=0,this.length=1,this.words[0]=0,this;var N,b;A>0?(N=this,b=f):(N=f,b=this);for(var M=0,R=0;R>26,this.words[R]=m&67108863;for(;M!==0&&R>26,this.words[R]=m&67108863;if(M===0&&R>>26,te=S&67108863,y=Math.min(h,f.length-1),D=Math.max(0,h-C.length+1);D<=y;D++){var U=h-D|0;N=C.words[U]|0,b=f.words[D]|0,M=N*b+te,P+=M/67108864|0,te=M&67108863}m.words[h]=te|0,S=P|0}return S!==0?m.words[h]=S|0:m.length--,m._strip()}var w=function(f,m,A){var N=f.words,b=m.words,M=A.words,R=0,S,h,P,te=N[0]|0,y=te&8191,D=te>>>13,U=N[1]|0,F=U&8191,W=U>>>13,oe=N[2]|0,Y=oe&8191,K=oe>>>13,Je=N[3]|0,Q=Je&8191,le=Je>>>13,Qr=N[4]|0,Te=Qr&8191,Ne=Qr>>>13,Jr=N[5]|0,Pe=Jr&8191,ce=Jr>>>13,wr=N[6]|0,fe=wr&8191,Oe=wr>>>13,Yr=N[7]|0,me=Yr&8191,ze=Yr>>>13,gn=N[8]|0,$e=gn&8191,He=gn>>>13,Ht=N[9]|0,Le=Ht&8191,qe=Ht>>>13,Rr=b[0]|0,Ce=Rr&8191,We=Rr>>>13,vn=b[1]|0,Be=vn&8191,Ge=vn>>>13,yn=b[2]|0,De=yn&8191,ne=yn>>>13,ot=b[3]|0,ge=ot&8191,de=ot>>>13,rt=b[4]|0,be=rt&8191,_e=rt>>>13,Ct=b[5]|0,Me=Ct&8191,je=Ct>>>13,Kt=b[6]|0,Ve=Kt&8191,Ke=Kt>>>13,Qt=b[7]|0,Ie=Qt&8191,Ue=Qt>>>13,Er=b[8]|0,ke=Er&8191,Ye=Er>>>13,Ai=b[9]|0,Xe=Ai&8191,Ze=Ai>>>13;A.negative=f.negative^m.negative,A.length=19,S=Math.imul(y,Ce),h=Math.imul(y,We),h=h+Math.imul(D,Ce)|0,P=Math.imul(D,We);var $n=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+($n>>>26)|0,$n&=67108863,S=Math.imul(F,Ce),h=Math.imul(F,We),h=h+Math.imul(W,Ce)|0,P=Math.imul(W,We),S=S+Math.imul(y,Be)|0,h=h+Math.imul(y,Ge)|0,h=h+Math.imul(D,Be)|0,P=P+Math.imul(D,Ge)|0;var Hn=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Hn>>>26)|0,Hn&=67108863,S=Math.imul(Y,Ce),h=Math.imul(Y,We),h=h+Math.imul(K,Ce)|0,P=Math.imul(K,We),S=S+Math.imul(F,Be)|0,h=h+Math.imul(F,Ge)|0,h=h+Math.imul(W,Be)|0,P=P+Math.imul(W,Ge)|0,S=S+Math.imul(y,De)|0,h=h+Math.imul(y,ne)|0,h=h+Math.imul(D,De)|0,P=P+Math.imul(D,ne)|0;var qn=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(qn>>>26)|0,qn&=67108863,S=Math.imul(Q,Ce),h=Math.imul(Q,We),h=h+Math.imul(le,Ce)|0,P=Math.imul(le,We),S=S+Math.imul(Y,Be)|0,h=h+Math.imul(Y,Ge)|0,h=h+Math.imul(K,Be)|0,P=P+Math.imul(K,Ge)|0,S=S+Math.imul(F,De)|0,h=h+Math.imul(F,ne)|0,h=h+Math.imul(W,De)|0,P=P+Math.imul(W,ne)|0,S=S+Math.imul(y,ge)|0,h=h+Math.imul(y,de)|0,h=h+Math.imul(D,ge)|0,P=P+Math.imul(D,de)|0;var Wn=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,S=Math.imul(Te,Ce),h=Math.imul(Te,We),h=h+Math.imul(Ne,Ce)|0,P=Math.imul(Ne,We),S=S+Math.imul(Q,Be)|0,h=h+Math.imul(Q,Ge)|0,h=h+Math.imul(le,Be)|0,P=P+Math.imul(le,Ge)|0,S=S+Math.imul(Y,De)|0,h=h+Math.imul(Y,ne)|0,h=h+Math.imul(K,De)|0,P=P+Math.imul(K,ne)|0,S=S+Math.imul(F,ge)|0,h=h+Math.imul(F,de)|0,h=h+Math.imul(W,ge)|0,P=P+Math.imul(W,de)|0,S=S+Math.imul(y,be)|0,h=h+Math.imul(y,_e)|0,h=h+Math.imul(D,be)|0,P=P+Math.imul(D,_e)|0;var Gn=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Gn>>>26)|0,Gn&=67108863,S=Math.imul(Pe,Ce),h=Math.imul(Pe,We),h=h+Math.imul(ce,Ce)|0,P=Math.imul(ce,We),S=S+Math.imul(Te,Be)|0,h=h+Math.imul(Te,Ge)|0,h=h+Math.imul(Ne,Be)|0,P=P+Math.imul(Ne,Ge)|0,S=S+Math.imul(Q,De)|0,h=h+Math.imul(Q,ne)|0,h=h+Math.imul(le,De)|0,P=P+Math.imul(le,ne)|0,S=S+Math.imul(Y,ge)|0,h=h+Math.imul(Y,de)|0,h=h+Math.imul(K,ge)|0,P=P+Math.imul(K,de)|0,S=S+Math.imul(F,be)|0,h=h+Math.imul(F,_e)|0,h=h+Math.imul(W,be)|0,P=P+Math.imul(W,_e)|0,S=S+Math.imul(y,Me)|0,h=h+Math.imul(y,je)|0,h=h+Math.imul(D,Me)|0,P=P+Math.imul(D,je)|0;var Yu=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Yu>>>26)|0,Yu&=67108863,S=Math.imul(fe,Ce),h=Math.imul(fe,We),h=h+Math.imul(Oe,Ce)|0,P=Math.imul(Oe,We),S=S+Math.imul(Pe,Be)|0,h=h+Math.imul(Pe,Ge)|0,h=h+Math.imul(ce,Be)|0,P=P+Math.imul(ce,Ge)|0,S=S+Math.imul(Te,De)|0,h=h+Math.imul(Te,ne)|0,h=h+Math.imul(Ne,De)|0,P=P+Math.imul(Ne,ne)|0,S=S+Math.imul(Q,ge)|0,h=h+Math.imul(Q,de)|0,h=h+Math.imul(le,ge)|0,P=P+Math.imul(le,de)|0,S=S+Math.imul(Y,be)|0,h=h+Math.imul(Y,_e)|0,h=h+Math.imul(K,be)|0,P=P+Math.imul(K,_e)|0,S=S+Math.imul(F,Me)|0,h=h+Math.imul(F,je)|0,h=h+Math.imul(W,Me)|0,P=P+Math.imul(W,je)|0,S=S+Math.imul(y,Ve)|0,h=h+Math.imul(y,Ke)|0,h=h+Math.imul(D,Ve)|0,P=P+Math.imul(D,Ke)|0;var Xu=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,S=Math.imul(me,Ce),h=Math.imul(me,We),h=h+Math.imul(ze,Ce)|0,P=Math.imul(ze,We),S=S+Math.imul(fe,Be)|0,h=h+Math.imul(fe,Ge)|0,h=h+Math.imul(Oe,Be)|0,P=P+Math.imul(Oe,Ge)|0,S=S+Math.imul(Pe,De)|0,h=h+Math.imul(Pe,ne)|0,h=h+Math.imul(ce,De)|0,P=P+Math.imul(ce,ne)|0,S=S+Math.imul(Te,ge)|0,h=h+Math.imul(Te,de)|0,h=h+Math.imul(Ne,ge)|0,P=P+Math.imul(Ne,de)|0,S=S+Math.imul(Q,be)|0,h=h+Math.imul(Q,_e)|0,h=h+Math.imul(le,be)|0,P=P+Math.imul(le,_e)|0,S=S+Math.imul(Y,Me)|0,h=h+Math.imul(Y,je)|0,h=h+Math.imul(K,Me)|0,P=P+Math.imul(K,je)|0,S=S+Math.imul(F,Ve)|0,h=h+Math.imul(F,Ke)|0,h=h+Math.imul(W,Ve)|0,P=P+Math.imul(W,Ke)|0,S=S+Math.imul(y,Ie)|0,h=h+Math.imul(y,Ue)|0,h=h+Math.imul(D,Ie)|0,P=P+Math.imul(D,Ue)|0;var Zu=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Zu>>>26)|0,Zu&=67108863,S=Math.imul($e,Ce),h=Math.imul($e,We),h=h+Math.imul(He,Ce)|0,P=Math.imul(He,We),S=S+Math.imul(me,Be)|0,h=h+Math.imul(me,Ge)|0,h=h+Math.imul(ze,Be)|0,P=P+Math.imul(ze,Ge)|0,S=S+Math.imul(fe,De)|0,h=h+Math.imul(fe,ne)|0,h=h+Math.imul(Oe,De)|0,P=P+Math.imul(Oe,ne)|0,S=S+Math.imul(Pe,ge)|0,h=h+Math.imul(Pe,de)|0,h=h+Math.imul(ce,ge)|0,P=P+Math.imul(ce,de)|0,S=S+Math.imul(Te,be)|0,h=h+Math.imul(Te,_e)|0,h=h+Math.imul(Ne,be)|0,P=P+Math.imul(Ne,_e)|0,S=S+Math.imul(Q,Me)|0,h=h+Math.imul(Q,je)|0,h=h+Math.imul(le,Me)|0,P=P+Math.imul(le,je)|0,S=S+Math.imul(Y,Ve)|0,h=h+Math.imul(Y,Ke)|0,h=h+Math.imul(K,Ve)|0,P=P+Math.imul(K,Ke)|0,S=S+Math.imul(F,Ie)|0,h=h+Math.imul(F,Ue)|0,h=h+Math.imul(W,Ie)|0,P=P+Math.imul(W,Ue)|0,S=S+Math.imul(y,ke)|0,h=h+Math.imul(y,Ye)|0,h=h+Math.imul(D,ke)|0,P=P+Math.imul(D,Ye)|0;var ec=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ec>>>26)|0,ec&=67108863,S=Math.imul(Le,Ce),h=Math.imul(Le,We),h=h+Math.imul(qe,Ce)|0,P=Math.imul(qe,We),S=S+Math.imul($e,Be)|0,h=h+Math.imul($e,Ge)|0,h=h+Math.imul(He,Be)|0,P=P+Math.imul(He,Ge)|0,S=S+Math.imul(me,De)|0,h=h+Math.imul(me,ne)|0,h=h+Math.imul(ze,De)|0,P=P+Math.imul(ze,ne)|0,S=S+Math.imul(fe,ge)|0,h=h+Math.imul(fe,de)|0,h=h+Math.imul(Oe,ge)|0,P=P+Math.imul(Oe,de)|0,S=S+Math.imul(Pe,be)|0,h=h+Math.imul(Pe,_e)|0,h=h+Math.imul(ce,be)|0,P=P+Math.imul(ce,_e)|0,S=S+Math.imul(Te,Me)|0,h=h+Math.imul(Te,je)|0,h=h+Math.imul(Ne,Me)|0,P=P+Math.imul(Ne,je)|0,S=S+Math.imul(Q,Ve)|0,h=h+Math.imul(Q,Ke)|0,h=h+Math.imul(le,Ve)|0,P=P+Math.imul(le,Ke)|0,S=S+Math.imul(Y,Ie)|0,h=h+Math.imul(Y,Ue)|0,h=h+Math.imul(K,Ie)|0,P=P+Math.imul(K,Ue)|0,S=S+Math.imul(F,ke)|0,h=h+Math.imul(F,Ye)|0,h=h+Math.imul(W,ke)|0,P=P+Math.imul(W,Ye)|0,S=S+Math.imul(y,Xe)|0,h=h+Math.imul(y,Ze)|0,h=h+Math.imul(D,Xe)|0,P=P+Math.imul(D,Ze)|0;var tc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(tc>>>26)|0,tc&=67108863,S=Math.imul(Le,Be),h=Math.imul(Le,Ge),h=h+Math.imul(qe,Be)|0,P=Math.imul(qe,Ge),S=S+Math.imul($e,De)|0,h=h+Math.imul($e,ne)|0,h=h+Math.imul(He,De)|0,P=P+Math.imul(He,ne)|0,S=S+Math.imul(me,ge)|0,h=h+Math.imul(me,de)|0,h=h+Math.imul(ze,ge)|0,P=P+Math.imul(ze,de)|0,S=S+Math.imul(fe,be)|0,h=h+Math.imul(fe,_e)|0,h=h+Math.imul(Oe,be)|0,P=P+Math.imul(Oe,_e)|0,S=S+Math.imul(Pe,Me)|0,h=h+Math.imul(Pe,je)|0,h=h+Math.imul(ce,Me)|0,P=P+Math.imul(ce,je)|0,S=S+Math.imul(Te,Ve)|0,h=h+Math.imul(Te,Ke)|0,h=h+Math.imul(Ne,Ve)|0,P=P+Math.imul(Ne,Ke)|0,S=S+Math.imul(Q,Ie)|0,h=h+Math.imul(Q,Ue)|0,h=h+Math.imul(le,Ie)|0,P=P+Math.imul(le,Ue)|0,S=S+Math.imul(Y,ke)|0,h=h+Math.imul(Y,Ye)|0,h=h+Math.imul(K,ke)|0,P=P+Math.imul(K,Ye)|0,S=S+Math.imul(F,Xe)|0,h=h+Math.imul(F,Ze)|0,h=h+Math.imul(W,Xe)|0,P=P+Math.imul(W,Ze)|0;var rc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(rc>>>26)|0,rc&=67108863,S=Math.imul(Le,De),h=Math.imul(Le,ne),h=h+Math.imul(qe,De)|0,P=Math.imul(qe,ne),S=S+Math.imul($e,ge)|0,h=h+Math.imul($e,de)|0,h=h+Math.imul(He,ge)|0,P=P+Math.imul(He,de)|0,S=S+Math.imul(me,be)|0,h=h+Math.imul(me,_e)|0,h=h+Math.imul(ze,be)|0,P=P+Math.imul(ze,_e)|0,S=S+Math.imul(fe,Me)|0,h=h+Math.imul(fe,je)|0,h=h+Math.imul(Oe,Me)|0,P=P+Math.imul(Oe,je)|0,S=S+Math.imul(Pe,Ve)|0,h=h+Math.imul(Pe,Ke)|0,h=h+Math.imul(ce,Ve)|0,P=P+Math.imul(ce,Ke)|0,S=S+Math.imul(Te,Ie)|0,h=h+Math.imul(Te,Ue)|0,h=h+Math.imul(Ne,Ie)|0,P=P+Math.imul(Ne,Ue)|0,S=S+Math.imul(Q,ke)|0,h=h+Math.imul(Q,Ye)|0,h=h+Math.imul(le,ke)|0,P=P+Math.imul(le,Ye)|0,S=S+Math.imul(Y,Xe)|0,h=h+Math.imul(Y,Ze)|0,h=h+Math.imul(K,Xe)|0,P=P+Math.imul(K,Ze)|0;var nc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(nc>>>26)|0,nc&=67108863,S=Math.imul(Le,ge),h=Math.imul(Le,de),h=h+Math.imul(qe,ge)|0,P=Math.imul(qe,de),S=S+Math.imul($e,be)|0,h=h+Math.imul($e,_e)|0,h=h+Math.imul(He,be)|0,P=P+Math.imul(He,_e)|0,S=S+Math.imul(me,Me)|0,h=h+Math.imul(me,je)|0,h=h+Math.imul(ze,Me)|0,P=P+Math.imul(ze,je)|0,S=S+Math.imul(fe,Ve)|0,h=h+Math.imul(fe,Ke)|0,h=h+Math.imul(Oe,Ve)|0,P=P+Math.imul(Oe,Ke)|0,S=S+Math.imul(Pe,Ie)|0,h=h+Math.imul(Pe,Ue)|0,h=h+Math.imul(ce,Ie)|0,P=P+Math.imul(ce,Ue)|0,S=S+Math.imul(Te,ke)|0,h=h+Math.imul(Te,Ye)|0,h=h+Math.imul(Ne,ke)|0,P=P+Math.imul(Ne,Ye)|0,S=S+Math.imul(Q,Xe)|0,h=h+Math.imul(Q,Ze)|0,h=h+Math.imul(le,Xe)|0,P=P+Math.imul(le,Ze)|0;var ic=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ic>>>26)|0,ic&=67108863,S=Math.imul(Le,be),h=Math.imul(Le,_e),h=h+Math.imul(qe,be)|0,P=Math.imul(qe,_e),S=S+Math.imul($e,Me)|0,h=h+Math.imul($e,je)|0,h=h+Math.imul(He,Me)|0,P=P+Math.imul(He,je)|0,S=S+Math.imul(me,Ve)|0,h=h+Math.imul(me,Ke)|0,h=h+Math.imul(ze,Ve)|0,P=P+Math.imul(ze,Ke)|0,S=S+Math.imul(fe,Ie)|0,h=h+Math.imul(fe,Ue)|0,h=h+Math.imul(Oe,Ie)|0,P=P+Math.imul(Oe,Ue)|0,S=S+Math.imul(Pe,ke)|0,h=h+Math.imul(Pe,Ye)|0,h=h+Math.imul(ce,ke)|0,P=P+Math.imul(ce,Ye)|0,S=S+Math.imul(Te,Xe)|0,h=h+Math.imul(Te,Ze)|0,h=h+Math.imul(Ne,Xe)|0,P=P+Math.imul(Ne,Ze)|0;var oc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(oc>>>26)|0,oc&=67108863,S=Math.imul(Le,Me),h=Math.imul(Le,je),h=h+Math.imul(qe,Me)|0,P=Math.imul(qe,je),S=S+Math.imul($e,Ve)|0,h=h+Math.imul($e,Ke)|0,h=h+Math.imul(He,Ve)|0,P=P+Math.imul(He,Ke)|0,S=S+Math.imul(me,Ie)|0,h=h+Math.imul(me,Ue)|0,h=h+Math.imul(ze,Ie)|0,P=P+Math.imul(ze,Ue)|0,S=S+Math.imul(fe,ke)|0,h=h+Math.imul(fe,Ye)|0,h=h+Math.imul(Oe,ke)|0,P=P+Math.imul(Oe,Ye)|0,S=S+Math.imul(Pe,Xe)|0,h=h+Math.imul(Pe,Ze)|0,h=h+Math.imul(ce,Xe)|0,P=P+Math.imul(ce,Ze)|0;var sc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(sc>>>26)|0,sc&=67108863,S=Math.imul(Le,Ve),h=Math.imul(Le,Ke),h=h+Math.imul(qe,Ve)|0,P=Math.imul(qe,Ke),S=S+Math.imul($e,Ie)|0,h=h+Math.imul($e,Ue)|0,h=h+Math.imul(He,Ie)|0,P=P+Math.imul(He,Ue)|0,S=S+Math.imul(me,ke)|0,h=h+Math.imul(me,Ye)|0,h=h+Math.imul(ze,ke)|0,P=P+Math.imul(ze,Ye)|0,S=S+Math.imul(fe,Xe)|0,h=h+Math.imul(fe,Ze)|0,h=h+Math.imul(Oe,Xe)|0,P=P+Math.imul(Oe,Ze)|0;var lc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(lc>>>26)|0,lc&=67108863,S=Math.imul(Le,Ie),h=Math.imul(Le,Ue),h=h+Math.imul(qe,Ie)|0,P=Math.imul(qe,Ue),S=S+Math.imul($e,ke)|0,h=h+Math.imul($e,Ye)|0,h=h+Math.imul(He,ke)|0,P=P+Math.imul(He,Ye)|0,S=S+Math.imul(me,Xe)|0,h=h+Math.imul(me,Ze)|0,h=h+Math.imul(ze,Xe)|0,P=P+Math.imul(ze,Ze)|0;var ac=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ac>>>26)|0,ac&=67108863,S=Math.imul(Le,ke),h=Math.imul(Le,Ye),h=h+Math.imul(qe,ke)|0,P=Math.imul(qe,Ye),S=S+Math.imul($e,Xe)|0,h=h+Math.imul($e,Ze)|0,h=h+Math.imul(He,Xe)|0,P=P+Math.imul(He,Ze)|0;var uc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(uc>>>26)|0,uc&=67108863,S=Math.imul(Le,Xe),h=Math.imul(Le,Ze),h=h+Math.imul(qe,Xe)|0,P=Math.imul(qe,Ze);var cc=(R+S|0)+((h&8191)<<13)|0;return R=(P+(h>>>13)|0)+(cc>>>26)|0,cc&=67108863,M[0]=$n,M[1]=Hn,M[2]=qn,M[3]=Wn,M[4]=Gn,M[5]=Yu,M[6]=Xu,M[7]=Zu,M[8]=ec,M[9]=tc,M[10]=rc,M[11]=nc,M[12]=ic,M[13]=oc,M[14]=sc,M[15]=lc,M[16]=ac,M[17]=uc,M[18]=cc,R!==0&&(M[19]=R,A.length++),A};Math.imul||(w=E);function _(C,f,m){m.negative=f.negative^C.negative,m.length=C.length+f.length;for(var A=0,N=0,b=0;b>>26)|0,N+=M>>>26,M&=67108863}m.words[b]=R,A=M,M=N}return A!==0?m.words[b]=A:m.length--,m._strip()}function O(C,f,m){return _(C,f,m)}o.prototype.mulTo=function(f,m){var A,N=this.length+f.length;return this.length===10&&f.length===10?A=w(this,f,m):N<63?A=E(this,f,m):N<1024?A=_(this,f,m):A=O(this,f,m),A},o.prototype.mul=function(f){var m=new o(null);return m.words=new Array(this.length+f.length),this.mulTo(f,m)},o.prototype.mulf=function(f){var m=new o(null);return m.words=new Array(this.length+f.length),O(this,f,m)},o.prototype.imul=function(f){return this.clone().mulTo(f,this)},o.prototype.imuln=function(f){var m=f<0;m&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var A=0,N=0;N>=26,A+=b/67108864|0,A+=M>>>26,this.words[N]=M&67108863}return A!==0&&(this.words[N]=A,this.length++),m?this.ineg():this},o.prototype.muln=function(f){return this.clone().imuln(f)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(f){var m=k(f);if(m.length===0)return new o(1);for(var A=this,N=0;N=0);var m=f%26,A=(f-m)/26,N=67108863>>>26-m<<26-m,b;if(m!==0){var M=0;for(b=0;b>>26-m}M&&(this.words[b]=M,this.length++)}if(A!==0){for(b=this.length-1;b>=0;b--)this.words[b+A]=this.words[b];for(b=0;b=0);var N;m?N=(m-m%26)/26:N=0;var b=f%26,M=Math.min((f-b)/26,this.length),R=67108863^67108863>>>b<M)for(this.length-=M,h=0;h=0&&(P!==0||h>=N);h--){var te=this.words[h]|0;this.words[h]=P<<26-b|te>>>b,P=te&R}return S&&P!==0&&(S.words[S.length++]=P),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(f,m,A){return n(this.negative===0),this.iushrn(f,m,A)},o.prototype.shln=function(f){return this.clone().ishln(f)},o.prototype.ushln=function(f){return this.clone().iushln(f)},o.prototype.shrn=function(f){return this.clone().ishrn(f)},o.prototype.ushrn=function(f){return this.clone().iushrn(f)},o.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var m=f%26,A=(f-m)/26,N=1<=0);var m=f%26,A=(f-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=A)return this;if(m!==0&&A++,this.length=Math.min(A,this.length),m!==0){var N=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},o.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(S/67108864|0),this.words[b+A]=M&67108863}for(;b>26,this.words[b+A]=M&67108863;if(R===0)return this._strip();for(n(R===-1),R=0,b=0;b>26,this.words[b]=M&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(f,m){var A=this.length-f.length,N=this.clone(),b=f,M=b.words[b.length-1]|0,R=this._countBits(M);A=26-R,A!==0&&(b=b.ushln(A),N.iushln(A),M=b.words[b.length-1]|0);var S=N.length-b.length,h;if(m!=="mod"){h=new o(null),h.length=S+1,h.words=new Array(h.length);for(var P=0;P=0;y--){var D=(N.words[b.length+y]|0)*67108864+(N.words[b.length+y-1]|0);for(D=Math.min(D/M|0,67108863),N._ishlnsubmul(b,D,y);N.negative!==0;)D--,N.negative=0,N._ishlnsubmul(b,1,y),N.isZero()||(N.negative^=1);h&&(h.words[y]=D)}return h&&h._strip(),N._strip(),m!=="div"&&A!==0&&N.iushrn(A),{div:h||null,mod:N}},o.prototype.divmod=function(f,m,A){if(n(!f.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var N,b,M;return this.negative!==0&&f.negative===0?(M=this.neg().divmod(f,m),m!=="mod"&&(N=M.div.neg()),m!=="div"&&(b=M.mod.neg(),A&&b.negative!==0&&b.iadd(f)),{div:N,mod:b}):this.negative===0&&f.negative!==0?(M=this.divmod(f.neg(),m),m!=="mod"&&(N=M.div.neg()),{div:N,mod:M.mod}):this.negative&f.negative?(M=this.neg().divmod(f.neg(),m),m!=="div"&&(b=M.mod.neg(),A&&b.negative!==0&&b.isub(f)),{div:M.div,mod:b}):f.length>this.length||this.cmp(f)<0?{div:new o(0),mod:this}:f.length===1?m==="div"?{div:this.divn(f.words[0]),mod:null}:m==="mod"?{div:null,mod:new o(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new o(this.modrn(f.words[0]))}:this._wordDiv(f,m)},o.prototype.div=function(f){return this.divmod(f,"div",!1).div},o.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},o.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},o.prototype.divRound=function(f){var m=this.divmod(f);if(m.mod.isZero())return m.div;var A=m.div.negative!==0?m.mod.isub(f):m.mod,N=f.ushrn(1),b=f.andln(1),M=A.cmp(N);return M<0||b===1&&M===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},o.prototype.modrn=function(f){var m=f<0;m&&(f=-f),n(f<=67108863);for(var A=(1<<26)%f,N=0,b=this.length-1;b>=0;b--)N=(A*N+(this.words[b]|0))%f;return m?-N:N},o.prototype.modn=function(f){return this.modrn(f)},o.prototype.idivn=function(f){var m=f<0;m&&(f=-f),n(f<=67108863);for(var A=0,N=this.length-1;N>=0;N--){var b=(this.words[N]|0)+A*67108864;this.words[N]=b/f|0,A=b%f}return this._strip(),m?this.ineg():this},o.prototype.divn=function(f){return this.clone().idivn(f)},o.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var m=this,A=f.clone();m.negative!==0?m=m.umod(f):m=m.clone();for(var N=new o(1),b=new o(0),M=new o(0),R=new o(1),S=0;m.isEven()&&A.isEven();)m.iushrn(1),A.iushrn(1),++S;for(var h=A.clone(),P=m.clone();!m.isZero();){for(var te=0,y=1;!(m.words[0]&y)&&te<26;++te,y<<=1);if(te>0)for(m.iushrn(te);te-- >0;)(N.isOdd()||b.isOdd())&&(N.iadd(h),b.isub(P)),N.iushrn(1),b.iushrn(1);for(var D=0,U=1;!(A.words[0]&U)&&D<26;++D,U<<=1);if(D>0)for(A.iushrn(D);D-- >0;)(M.isOdd()||R.isOdd())&&(M.iadd(h),R.isub(P)),M.iushrn(1),R.iushrn(1);m.cmp(A)>=0?(m.isub(A),N.isub(M),b.isub(R)):(A.isub(m),M.isub(N),R.isub(b))}return{a:M,b:R,gcd:A.iushln(S)}},o.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var m=this,A=f.clone();m.negative!==0?m=m.umod(f):m=m.clone();for(var N=new o(1),b=new o(0),M=A.clone();m.cmpn(1)>0&&A.cmpn(1)>0;){for(var R=0,S=1;!(m.words[0]&S)&&R<26;++R,S<<=1);if(R>0)for(m.iushrn(R);R-- >0;)N.isOdd()&&N.iadd(M),N.iushrn(1);for(var h=0,P=1;!(A.words[0]&P)&&h<26;++h,P<<=1);if(h>0)for(A.iushrn(h);h-- >0;)b.isOdd()&&b.iadd(M),b.iushrn(1);m.cmp(A)>=0?(m.isub(A),N.isub(b)):(A.isub(m),b.isub(N))}var te;return m.cmpn(1)===0?te=N:te=b,te.cmpn(0)<0&&te.iadd(f),te},o.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var m=this.clone(),A=f.clone();m.negative=0,A.negative=0;for(var N=0;m.isEven()&&A.isEven();N++)m.iushrn(1),A.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;A.isEven();)A.iushrn(1);var b=m.cmp(A);if(b<0){var M=m;m=A,A=M}else if(b===0||A.cmpn(1)===0)break;m.isub(A)}while(!0);return A.iushln(N)},o.prototype.invm=function(f){return this.egcd(f).a.umod(f)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(f){return this.words[0]&f},o.prototype.bincn=function(f){n(typeof f=="number");var m=f%26,A=(f-m)/26,N=1<>>26,R&=67108863,this.words[M]=R}return b!==0&&(this.words[M]=b,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(f){var m=f<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this._strip();var A;if(this.length>1)A=1;else{m&&(f=-f),n(f<=67108863,"Number is too big");var N=this.words[0]|0;A=N===f?0:Nf.length)return 1;if(this.length=0;A--){var N=this.words[A]|0,b=f.words[A]|0;if(N!==b){Nb&&(m=1);break}}return m},o.prototype.gtn=function(f){return this.cmpn(f)===1},o.prototype.gt=function(f){return this.cmp(f)===1},o.prototype.gten=function(f){return this.cmpn(f)>=0},o.prototype.gte=function(f){return this.cmp(f)>=0},o.prototype.ltn=function(f){return this.cmpn(f)===-1},o.prototype.lt=function(f){return this.cmp(f)===-1},o.prototype.lten=function(f){return this.cmpn(f)<=0},o.prototype.lte=function(f){return this.cmp(f)<=0},o.prototype.eqn=function(f){return this.cmpn(f)===0},o.prototype.eq=function(f){return this.cmp(f)===0},o.red=function(f){return new G(f)},o.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(f){return this.red=f,this},o.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},o.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},o.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},o.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},o.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},o.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},o.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},o.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var B={k256:null,p224:null,p192:null,p25519:null};function j(C,f){this.name=C,this.p=new o(f,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}j.prototype._tmp=function(){var f=new o(null);return f.words=new Array(Math.ceil(this.n/13)),f},j.prototype.ireduce=function(f){var m=f,A;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),A=m.bitLength();while(A>this.n);var N=A0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},j.prototype.split=function(f,m){f.iushrn(this.n,0,m)},j.prototype.imulK=function(f){return f.imul(this.k)};function $(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i($,j),$.prototype.split=function(f,m){for(var A=4194303,N=Math.min(f.length,9),b=0;b>>22,M=R}M>>>=22,f.words[b-10]=M,M===0&&f.length>10?f.length-=10:f.length-=9},$.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var m=0,A=0;A>>=26,f.words[A]=b,m=N}return m!==0&&(f.words[f.length++]=m),f},o._prime=function(f){if(B[f])return B[f];var m;if(f==="k256")m=new $;else if(f==="p224")m=new H;else if(f==="p192")m=new ie;else if(f==="p25519")m=new X;else throw new Error("Unknown prime "+f);return B[f]=m,m};function G(C){if(typeof C=="string"){var f=o._prime(C);this.m=f.p,this.prime=f}else n(C.gtn(1),"modulus must be greater than 1"),this.m=C,this.prime=null}G.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},G.prototype._verify2=function(f,m){n((f.negative|m.negative)===0,"red works only with positives"),n(f.red&&f.red===m.red,"red works only with red numbers")},G.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(c(f,f.umod(this.m)._forceRed(this)),f)},G.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},G.prototype.add=function(f,m){this._verify2(f,m);var A=f.add(m);return A.cmp(this.m)>=0&&A.isub(this.m),A._forceRed(this)},G.prototype.iadd=function(f,m){this._verify2(f,m);var A=f.iadd(m);return A.cmp(this.m)>=0&&A.isub(this.m),A},G.prototype.sub=function(f,m){this._verify2(f,m);var A=f.sub(m);return A.cmpn(0)<0&&A.iadd(this.m),A._forceRed(this)},G.prototype.isub=function(f,m){this._verify2(f,m);var A=f.isub(m);return A.cmpn(0)<0&&A.iadd(this.m),A},G.prototype.shl=function(f,m){return this._verify1(f),this.imod(f.ushln(m))},G.prototype.imul=function(f,m){return this._verify2(f,m),this.imod(f.imul(m))},G.prototype.mul=function(f,m){return this._verify2(f,m),this.imod(f.mul(m))},G.prototype.isqr=function(f){return this.imul(f,f.clone())},G.prototype.sqr=function(f){return this.mul(f,f)},G.prototype.sqrt=function(f){if(f.isZero())return f.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var A=this.m.add(new o(1)).iushrn(2);return this.pow(f,A)}for(var N=this.m.subn(1),b=0;!N.isZero()&&N.andln(1)===0;)b++,N.iushrn(1);n(!N.isZero());var M=new o(1).toRed(this),R=M.redNeg(),S=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);this.pow(h,S).cmp(R)!==0;)h.redIAdd(R);for(var P=this.pow(h,N),te=this.pow(f,N.addn(1).iushrn(1)),y=this.pow(f,N),D=b;y.cmp(M)!==0;){for(var U=y,F=0;U.cmp(M)!==0;F++)U=U.redSqr();n(F=0;b--){for(var P=m.words[b],te=h-1;te>=0;te--){var y=P>>te&1;if(M!==N[0]&&(M=this.sqr(M)),y===0&&R===0){S=0;continue}R<<=1,R|=y,S++,!(S!==A&&(b!==0||te!==0))&&(M=this.mul(M,N[R]),S=0,R=0)}h=26}return M},G.prototype.convertTo=function(f){var m=f.umod(this.m);return m===f?m.clone():m},G.prototype.convertFrom=function(f){var m=f.clone();return m.red=null,m},o.mont=function(f){return new J(f)};function J(C){G.call(this,C),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(J,G),J.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},J.prototype.convertFrom=function(f){var m=this.imod(f.mul(this.rinv));return m.red=null,m},J.prototype.imul=function(f,m){if(f.isZero()||m.isZero())return f.words[0]=0,f.length=1,f;var A=f.imul(m),N=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=A.isub(N).iushrn(this.shift),M=b;return b.cmp(this.m)>=0?M=b.isub(this.m):b.cmpn(0)<0&&(M=b.iadd(this.m)),M._forceRed(this)},J.prototype.mul=function(f,m){if(f.isZero()||m.isZero())return new o(0)._forceRed(this);var A=f.mul(m),N=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=A.isub(N).iushrn(this.shift),M=b;return b.cmp(this.m)>=0?M=b.isub(this.m):b.cmpn(0)<0&&(M=b.iadd(this.m)),M._forceRed(this)},J.prototype.invm=function(f){var m=this.imod(f._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,Fe)})(Ah);var Px=Ah.exports;const ue=jo(Px),Cx="logger/5.7.0";let op=!1,sp=!1;const da={debug:1,default:2,info:2,warning:3,error:4,off:5};let lp=da.default,jc=null;function Mx(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const ap=Mx();var od;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(od||(od={}));var Ur;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(Ur||(Ur={}));const up="0123456789abcdef";class T{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();da[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(lp>da[n])&&console.log.apply(console,r)}debug(...e){this._log(T.levels.DEBUG,e)}info(...e){this._log(T.levels.INFO,e)}warn(...e){this._log(T.levels.WARNING,e)}makeError(e,r,n){if(sp)return this.makeError("censored error",r,{});r||(r=T.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(a=>{const u=n[a];try{if(u instanceof Uint8Array){let c="";for(let d=0;d>4],c+=up[u[d]&15];i.push(a+"=Uint8Array(0x"+c+")")}else i.push(a+"="+JSON.stringify(u))}catch{i.push(a+"="+JSON.stringify(n[a].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const o=e;let s="";switch(r){case Ur.NUMERIC_FAULT:{s="NUMERIC_FAULT";const a=e;switch(a){case"overflow":case"underflow":case"division-by-zero":s+="-"+a;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result";break}break}case Ur.CALL_EXCEPTION:case Ur.INSUFFICIENT_FUNDS:case Ur.MISSING_NEW:case Ur.NONCE_EXPIRED:case Ur.REPLACEMENT_UNDERPRICED:case Ur.TRANSACTION_REPLACED:case Ur.UNPREDICTABLE_GAS_LIMIT:s=r;break}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const l=new Error(e);return l.reason=o,l.code=r,Object.keys(n).forEach(function(a){l[a]=n[a]}),l}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,T.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){ap&&this.throwError("platform missing String.prototype.normalize",T.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ap})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,T.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,T.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,T.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",T.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",T.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",T.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return jc||(jc=new T(Cx)),jc}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",T.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),op){if(!e)return;this.globalLogger().throwError("error censorship permanent",T.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}sp=!!e,op=!!r}static setLogLevel(e){const r=da[e.toLowerCase()];if(r==null){T.globalLogger().warn("invalid log level - "+e);return}lp=r}static from(e){return new T(e)}}T.errors=Ur;T.levels=od;const Ix="bytes/5.7.0",dt=new T(Ix);function iy(t){return!!t.toHexString}function Ao(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Ao(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function bh(t){return pe(t)&&!(t.length%2)||Ru(t)}function cp(t){return typeof t=="number"&&t==t&&t%1===0}function Ru(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!cp(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function se(t,e){if(e||(e={}),typeof t=="number"){dt.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Ao(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),iy(t)&&(t=t.toHexString()),pe(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":dt.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ise(i)),r=e.reduce((i,o)=>i+o.length,0),n=new Uint8Array(r);return e.reduce((i,o)=>(n.set(o,i),i+o.length),0),Ao(n)}function Ro(t){let e=se(t);if(e.length===0)return e;let r=0;for(;re&&dt.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),Ao(r)}function pe(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const Uc="0123456789abcdef";function re(t,e){if(e||(e={}),typeof t=="number"){dt.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=Uc[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),iy(t))return t.toHexString();if(pe(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":dt.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Ru(t)){let r="0x";for(let n=0;n>4]+Uc[i&15]}return r}return dt.throwArgumentError("invalid hexlify value","value",t)}function On(t){if(typeof t!="string")t=re(t);else if(!pe(t)||t.length%2)return null;return(t.length-2)/2}function It(t,e,r){return typeof t!="string"?t=re(t):(!pe(t)||t.length%2)&&dt.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Xt(t){let e="0x";return t.forEach(r=>{e+=re(r).substring(2)}),e}function Tu(t){const e=Rx(re(t,{hexPad:"left"}));return e==="0x"?"0x0":e}function Rx(t){typeof t!="string"&&(t=re(t)),pe(t)||dt.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e2*e+2&&dt.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Ou(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(bh(t)){let r=se(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=re(r.slice(0,32)),e.s=re(r.slice(32,64))):r.length===65?(e.r=re(r.slice(0,32)),e.s=re(r.slice(32,64)),e.v=r[64]):dt.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:dt.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=re(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=ha(se(e._vs),32);e._vs=re(i);const o=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=o:e.recoveryParam!==o&&dt.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const s=re(i);e.s==null?e.s=s:e.s!==s&&dt.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?dt.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&dt.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!pe(e.r)?dt.throwArgumentError("signature missing or invalid r","signature",t):e.r=pt(e.r,32),e.s==null||!pe(e.s)?dt.throwArgumentError("signature missing or invalid s","signature",t):e.s=pt(e.s,32);const r=se(e.s);r[0]>=128&&dt.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=re(r);e._vs&&(pe(e._vs)||dt.throwArgumentError("signature invalid _vs","signature",t),e._vs=pt(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&dt.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const Tx="bignumber/5.7.0";var Xs=ue.BN;const En=new T(Tx),Fc={},fp=9007199254740991;let dp=!1;class V{constructor(e,r){e!==Fc&&En.throwError("cannot call constructor directly; use BigNumber.from",T.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Jt(ve(this).fromTwos(e))}toTwos(e){return Jt(ve(this).toTwos(e))}abs(){return this._hex[0]==="-"?V.from(this._hex.substring(1)):this}add(e){return Jt(ve(this).add(ve(e)))}sub(e){return Jt(ve(this).sub(ve(e)))}div(e){return V.from(e).isZero()&&xr("division-by-zero","div"),Jt(ve(this).div(ve(e)))}mul(e){return Jt(ve(this).mul(ve(e)))}mod(e){const r=ve(e);return r.isNeg()&&xr("division-by-zero","mod"),Jt(ve(this).umod(r))}pow(e){const r=ve(e);return r.isNeg()&&xr("negative-power","pow"),Jt(ve(this).pow(r))}and(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","and"),Jt(ve(this).and(r))}or(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","or"),Jt(ve(this).or(r))}xor(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","xor"),Jt(ve(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&xr("negative-width","mask"),Jt(ve(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&xr("negative-width","shl"),Jt(ve(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&xr("negative-width","shr"),Jt(ve(this).shrn(e))}eq(e){return ve(this).eq(ve(e))}lt(e){return ve(this).lt(ve(e))}lte(e){return ve(this).lte(ve(e))}gt(e){return ve(this).gt(ve(e))}gte(e){return ve(this).gte(ve(e))}isNegative(){return this._hex[0]==="-"}isZero(){return ve(this).isZero()}toNumber(){try{return ve(this).toNumber()}catch{xr("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return En.throwError("this platform does not support BigInt",T.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?dp||(dp=!0,En.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?En.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",T.errors.UNEXPECTED_ARGUMENT,{}):En.throwError("BigNumber.toString does not accept parameters",T.errors.UNEXPECTED_ARGUMENT,{})),ve(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof V)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new V(Fc,Zs(e)):e.match(/^-?[0-9]+$/)?new V(Fc,Zs(new Xs(e))):En.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&xr("underflow","BigNumber.from",e),(e>=fp||e<=-fp)&&xr("overflow","BigNumber.from",e),V.from(String(e));const r=e;if(typeof r=="bigint")return V.from(r.toString());if(Ru(r))return V.from(re(r));if(r)if(r.toHexString){const n=r.toHexString();if(typeof n=="string")return V.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(pe(n)||n[0]==="-"&&pe(n.substring(1))))return V.from(n)}return En.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function Zs(t){if(typeof t!="string")return Zs(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&En.throwArgumentError("invalid hex","value",t),t=Zs(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function Jt(t){return V.from(Zs(t))}function ve(t){const e=V.from(t).toHexString();return e[0]==="-"?new Xs("-"+e.substring(3),16):new Xs(e.substring(2),16)}function xr(t,e,r){const n={fault:t,operation:e};return r!=null&&(n.value=r),En.throwError(t,T.errors.NUMERIC_FAULT,n)}function Ox(t){return new Xs(t,36).toString(16)}function Lx(t){return new Xs(t,16).toString(36)}const Bx="properties/5.7.0";var Dx=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Ja=new T(Bx);function z(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function fr(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||typeof t.prototype!="object")break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function yt(t){return Dx(this,void 0,void 0,function*(){const e=Object.keys(t).map(n=>{const i=t[n];return Promise.resolve(i).then(o=>({key:n,value:o}))});return(yield Promise.all(e)).reduce((n,i)=>(n[i.key]=i.value,n),{})})}function jx(t,e){(!t||typeof t!="object")&&Ja.throwArgumentError("invalid object","object",t),Object.keys(t).forEach(r=>{e[r]||Ja.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)})}function it(t){const e={};for(const r in t)e[r]=t[r];return e}const Ux={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function oy(t){if(t==null||Ux[typeof t])return!0;if(Array.isArray(t)||typeof t=="object"){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;rnr(e)));if(typeof t=="object"){const e={};for(const r in t){const n=t[r];n!==void 0&&z(e,r,nr(n))}return e}return Ja.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function nr(t){return Fx(t)}class vl{constructor(e){for(const r in e)this[r]=nr(e[r])}}const yl="abi/5.7.0",Ee=new T(yl),Di={};let hp={calldata:!0,memory:!0,storage:!0},zx={calldata:!0,memory:!0};function zl(t,e){if(t==="bytes"||t==="string"){if(hp[e])return!0}else if(t==="address"){if(e==="payable")return!0}else if((t.indexOf("[")>=0||t==="tuple")&&zx[e])return!0;return(hp[e]||e==="payable")&&Ee.throwArgumentError("invalid modifier","name",e),!1}function $x(t,e){let r=t;function n(l){Ee.throwArgumentError(`unexpected character at position ${l}`,"param",t)}t=t.replace(/\s/g," ");function i(l){let a={type:"",name:"",parent:l,state:{allowType:!0}};return e&&(a.indexed=!1),a}let o={type:"",name:"",state:{allowType:!0}},s=o;for(let l=0;lJSON.parse(i.format(e)))),JSON.stringify(n)}let r="";return this.baseType==="array"?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==Se.sighash&&(r+=this.type),r+="("+this.components.map(n=>n.format(e)).join(e===Se.full?", ":",")+")"):r+=this.type,e!==Se.sighash&&(this.indexed===!0&&(r+=" indexed"),e===Se.full&&this.name&&(r+=" "+this.name)),r}static from(e,r){return typeof e=="string"?kt.fromString(e,r):kt.fromObject(e)}static fromObject(e){return kt.isParamType(e)?e:new kt(Di,{name:e.name||null,type:Ji(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(kt.fromObject):null})}static fromString(e,r){function n(i){return kt.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return n($x(e,!!r))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function el(t,e){return Wx(t).map(r=>kt.fromString(r,e))}class Nn{constructor(e,r){e!==Di&&Ee.throwError("use a static from method",T.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),pa(this,r),this._isFragment=!0,Object.freeze(this)}static from(e){return Nn.isFragment(e)?e:typeof e=="string"?Nn.fromString(e):Nn.fromObject(e)}static fromObject(e){if(Nn.isFragment(e))return e;switch(e.type){case"function":return sn.fromObject(e);case"event":return _n.fromObject(e);case"constructor":return on.fromObject(e);case"error":return ei.fromObject(e);case"fallback":case"receive":return null}return Ee.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?_n.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?sn.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?on.fromString(e.trim()):e.split(" ")[0]==="error"?ei.fromString(e.substring(5).trim()):Ee.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class _n extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",e!==Se.sighash&&this.anonymous&&(r+="anonymous "),r.trim()}static from(e){return typeof e=="string"?_n.fromString(e):_n.fromObject(e)}static fromObject(e){if(_n.isEventFragment(e))return e;e.type!=="event"&&Ee.throwArgumentError("invalid event object","value",e);const r={name:tl(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(kt.fromObject):[],type:"event"};return new _n(Di,r)}static fromString(e){let r=e.match(rl);r||Ee.throwArgumentError("invalid event string","value",e);let n=!1;return r[3].split(" ").forEach(i=>{switch(i.trim()){case"anonymous":n=!0;break;case"":break;default:Ee.warn("unknown modifier: "+i)}}),_n.fromObject({name:r[1].trim(),anonymous:n,inputs:el(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function sy(t,e){e.gas=null;let r=t.split("@");return r.length!==1?(r.length>2&&Ee.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||Ee.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=V.from(r[1]),r[0]):t}function ly(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach(r=>{switch(r.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+r)}})}function ay(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return t.stateMutability!=null?(e.stateMutability=t.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",t.constant!=null&&!!t.constant!==e.constant&&Ee.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable=e.stateMutability==="payable",t.payable!=null&&!!t.payable!==e.payable&&Ee.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):t.payable!=null?(e.payable=!!t.payable,t.constant==null&&!e.payable&&t.type!=="constructor"&&Ee.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Ee.throwArgumentError("cannot have constant payable function","value",t)):t.constant!=null?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):t.type!=="constructor"&&Ee.throwArgumentError("unable to determine stateMutability","value",t),e}class on extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});e===Se.sighash&&Ee.throwError("cannot format a constructor for sighash",T.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let r="constructor("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "),r.trim()}static from(e){return typeof e=="string"?on.fromString(e):on.fromObject(e)}static fromObject(e){if(on.isConstructorFragment(e))return e;e.type!=="constructor"&&Ee.throwArgumentError("invalid constructor object","value",e);let r=ay(e);r.constant&&Ee.throwArgumentError("constructor cannot be constant","value",e);const n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(kt.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?V.from(e.gas):null};return new on(Di,n)}static fromString(e){let r={type:"constructor"};e=sy(e,r);let n=e.match(rl);return(!n||n[1].trim()!=="constructor")&&Ee.throwArgumentError("invalid constructor string","value",e),r.inputs=el(n[2].trim(),!1),ly(n[3].trim(),r),on.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class sn extends on{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e))),outputs:this.outputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",e!==Se.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "):this.constant&&(r+="view "),this.outputs&&this.outputs.length&&(r+="returns ("+this.outputs.map(n=>n.format(e)).join(", ")+") "),this.gas!=null&&(r+="@"+this.gas.toString()+" ")),r.trim()}static from(e){return typeof e=="string"?sn.fromString(e):sn.fromObject(e)}static fromObject(e){if(sn.isFunctionFragment(e))return e;e.type!=="function"&&Ee.throwArgumentError("invalid function object","value",e);let r=ay(e);const n={type:e.type,name:tl(e.name),constant:r.constant,inputs:e.inputs?e.inputs.map(kt.fromObject):[],outputs:e.outputs?e.outputs.map(kt.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?V.from(e.gas):null};return new sn(Di,n)}static fromString(e){let r={type:"function"};e=sy(e,r);let n=e.split(" returns ");n.length>2&&Ee.throwArgumentError("invalid function string","value",e);let i=n[0].match(rl);if(i||Ee.throwArgumentError("invalid function signature","value",e),r.name=i[1].trim(),r.name&&tl(r.name),r.inputs=el(i[2],!1),ly(i[3].trim(),r),n.length>1){let o=n[1].match(rl);(o[1].trim()!=""||o[3].trim()!="")&&Ee.throwArgumentError("unexpected tokens","value",e),r.outputs=el(o[2],!1)}else r.outputs=[];return sn.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function pp(t){const e=t.format();return(e==="Error(string)"||e==="Panic(uint256)")&&Ee.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class ei extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",r.trim()}static from(e){return typeof e=="string"?ei.fromString(e):ei.fromObject(e)}static fromObject(e){if(ei.isErrorFragment(e))return e;e.type!=="error"&&Ee.throwArgumentError("invalid error object","value",e);const r={type:e.type,name:tl(e.name),inputs:e.inputs?e.inputs.map(kt.fromObject):[]};return pp(new ei(Di,r))}static fromString(e){let r={type:"error"},n=e.match(rl);return n||Ee.throwArgumentError("invalid error signature","value",e),r.name=n[1].trim(),r.name&&tl(r.name),r.inputs=el(n[2],!1),pp(ei.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function Ji(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const qx=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function tl(t){return(!t||!t.match(qx))&&Ee.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const rl=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function Wx(t){t=t.trim();let e=[],r="",n=0;for(let i=0;ithis.wordSize&&_h.throwError("value out-of-bounds",T.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=Ut([this._padding.slice(r.length%this.wordSize),r])),r}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,r=>{this._data[e]=this._getValue(r)}}}class Ya{constructor(e,r,n,i){z(this,"_data",se(e)),z(this,"wordSize",r||32),z(this,"_coerceFunc",n),z(this,"allowLoose",i),this._offset=0}get data(){return re(this._data)}get consumed(){return this._offset}static coerce(e,r){let n=e.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(r=r.toNumber()),r}coerce(e,r){return this._coerceFunc?this._coerceFunc(e,r):Ya.coerce(e,r)}_peekBytes(e,r,n){let i=Math.ceil(r/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&n&&this._offset+r<=this._data.length?i=r:_h.throwError("data out-of-bounds",T.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new Ya(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,r){let n=this._peekBytes(0,e,!!r);return this._offset+=n.length,n.slice(0,e)}readValue(){return V.from(this.readBytes(this.wordSize))}}var uy={exports:{}};/** * [js-sha3]{@link https://github.com/emn178/js-sha3} * * @version 0.8.0 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT - */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&typeof self=="object",s=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;s?i=Fe:o&&(i=self);var l=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,a=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),c=[31,7936,2031616,520093696],d=[4,1024,262144,67108864],m=[1,256,65536,16777216],v=[6,1536,393216,100663296],p=[0,8,16,24],x=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],k=[224,256,384,512],E=[128,256],w=["hex","buffer","arrayBuffer","array","digest"],_={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(y){return Object.prototype.toString.call(y)==="[object Array]"}),a&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(y){return typeof y=="object"&&y.buffer&&y.buffer.constructor===ArrayBuffer});for(var O=function(y,D,U){return function(F){return new h(y,D,y).update(F)[U]()}},B=function(y,D,U){return function(F,W){return new h(y,D,W).update(F)[U]()}},j=function(y,D,U){return function(F,W,oe,Y){return f["cshake"+y].update(F,W,oe,Y)[U]()}},$=function(y,D,U){return function(F,W,oe,Y){return f["kmac"+y].update(F,W,oe,Y)[U]()}},H=function(y,D,U,F){for(var W=0;W>5,this.byteCount=this.blockCount<<2,this.outputBlocks=U>>5,this.extraBytes=(U&31)>>3;for(var F=0;F<50;++F)this.s[F]=0}h.prototype.update=function(y){if(this.finalized)throw new Error(r);var D,U=typeof y;if(U!=="string"){if(U==="object"){if(y===null)throw new Error(e);if(a&&y.constructor===ArrayBuffer)y=new Uint8Array(y);else if(!Array.isArray(y)&&(!a||!ArrayBuffer.isView(y)))throw new Error(e)}else throw new Error(e);D=!0}for(var F=this.blocks,W=this.byteCount,oe=y.length,Y=this.blockCount,K=0,Je=this.s,Q,le;K>2]|=y[K]<>2]|=le<>2]|=(192|le>>6)<>2]|=(128|le&63)<=57344?(F[Q>>2]|=(224|le>>12)<>2]|=(128|le>>6&63)<>2]|=(128|le&63)<>2]|=(240|le>>18)<>2]|=(128|le>>12&63)<>2]|=(128|le>>6&63)<>2]|=(128|le&63)<=W){for(this.start=Q-W,this.block=F[Y],Q=0;Q>8,U=y&255;U>0;)W.unshift(U),y=y>>8,U=y&255,++F;return D?W.push(F):W.unshift(F),this.update(W),W.length},h.prototype.encodeString=function(y){var D,U=typeof y;if(U!=="string"){if(U==="object"){if(y===null)throw new Error(e);if(a&&y.constructor===ArrayBuffer)y=new Uint8Array(y);else if(!Array.isArray(y)&&(!a||!ArrayBuffer.isView(y)))throw new Error(e)}else throw new Error(e);D=!0}var F=0,W=y.length;if(D)F=W;else for(var oe=0;oe=57344?F+=3:(Y=65536+((Y&1023)<<10|y.charCodeAt(++oe)&1023),F+=4)}return F+=this.encode(F*8),this.update(y),F},h.prototype.bytepad=function(y,D){for(var U=this.encode(D),F=0;F>2]|=this.padding[D&3],this.lastByteIndex===this.byteCount)for(y[0]=y[U],D=1;D>4&15]+u[K&15]+u[K>>12&15]+u[K>>8&15]+u[K>>20&15]+u[K>>16&15]+u[K>>28&15]+u[K>>24&15];oe%y===0&&(te(D),W=0)}return F&&(K=D[W],Y+=u[K>>4&15]+u[K&15],F>1&&(Y+=u[K>>12&15]+u[K>>8&15]),F>2&&(Y+=u[K>>20&15]+u[K>>16&15])),Y},h.prototype.arrayBuffer=function(){this.finalize();var y=this.blockCount,D=this.s,U=this.outputBlocks,F=this.extraBytes,W=0,oe=0,Y=this.outputBits>>3,K;F?K=new ArrayBuffer(U+1<<2):K=new ArrayBuffer(Y);for(var Je=new Uint32Array(K);oe>8&255,Y[K+2]=Je>>16&255,Y[K+3]=Je>>24&255;oe%y===0&&te(D)}return F&&(K=oe<<2,Je=D[W],Y[K]=Je&255,F>1&&(Y[K+1]=Je>>8&255),F>2&&(Y[K+2]=Je>>16&255)),Y};function P(y,D,U){h.call(this,y,D,U)}P.prototype=new h,P.prototype.finalize=function(){return this.encode(this.outputBits,!0),h.prototype.finalize.call(this)};var te=function(y){var D,U,F,W,oe,Y,K,Je,Q,le,Qr,Te,Ne,Jr,Pe,ce,wr,fe,Oe,Yr,me,ze,gn,$e,He,Ht,Le,qe,Rr,Ce,We,vn,Be,Ge,yn,De,ne,ot,ge,de,rt,be,_e,Ct,Me,je,Kt,Ve,Ke,Qt,Ie,Ue,Er,ke,Ye,Ai,Xe,Ze,$n,Hn,qn,Wn,Gn;for(F=0;F<48;F+=2)W=y[0]^y[10]^y[20]^y[30]^y[40],oe=y[1]^y[11]^y[21]^y[31]^y[41],Y=y[2]^y[12]^y[22]^y[32]^y[42],K=y[3]^y[13]^y[23]^y[33]^y[43],Je=y[4]^y[14]^y[24]^y[34]^y[44],Q=y[5]^y[15]^y[25]^y[35]^y[45],le=y[6]^y[16]^y[26]^y[36]^y[46],Qr=y[7]^y[17]^y[27]^y[37]^y[47],Te=y[8]^y[18]^y[28]^y[38]^y[48],Ne=y[9]^y[19]^y[29]^y[39]^y[49],D=Te^(Y<<1|K>>>31),U=Ne^(K<<1|Y>>>31),y[0]^=D,y[1]^=U,y[10]^=D,y[11]^=U,y[20]^=D,y[21]^=U,y[30]^=D,y[31]^=U,y[40]^=D,y[41]^=U,D=W^(Je<<1|Q>>>31),U=oe^(Q<<1|Je>>>31),y[2]^=D,y[3]^=U,y[12]^=D,y[13]^=U,y[22]^=D,y[23]^=U,y[32]^=D,y[33]^=U,y[42]^=D,y[43]^=U,D=Y^(le<<1|Qr>>>31),U=K^(Qr<<1|le>>>31),y[4]^=D,y[5]^=U,y[14]^=D,y[15]^=U,y[24]^=D,y[25]^=U,y[34]^=D,y[35]^=U,y[44]^=D,y[45]^=U,D=Je^(Te<<1|Ne>>>31),U=Q^(Ne<<1|Te>>>31),y[6]^=D,y[7]^=U,y[16]^=D,y[17]^=U,y[26]^=D,y[27]^=U,y[36]^=D,y[37]^=U,y[46]^=D,y[47]^=U,D=le^(W<<1|oe>>>31),U=Qr^(oe<<1|W>>>31),y[8]^=D,y[9]^=U,y[18]^=D,y[19]^=U,y[28]^=D,y[29]^=U,y[38]^=D,y[39]^=U,y[48]^=D,y[49]^=U,Jr=y[0],Pe=y[1],je=y[11]<<4|y[10]>>>28,Kt=y[10]<<4|y[11]>>>28,qe=y[20]<<3|y[21]>>>29,Rr=y[21]<<3|y[20]>>>29,Hn=y[31]<<9|y[30]>>>23,qn=y[30]<<9|y[31]>>>23,be=y[40]<<18|y[41]>>>14,_e=y[41]<<18|y[40]>>>14,Ge=y[2]<<1|y[3]>>>31,yn=y[3]<<1|y[2]>>>31,ce=y[13]<<12|y[12]>>>20,wr=y[12]<<12|y[13]>>>20,Ve=y[22]<<10|y[23]>>>22,Ke=y[23]<<10|y[22]>>>22,Ce=y[33]<<13|y[32]>>>19,We=y[32]<<13|y[33]>>>19,Wn=y[42]<<2|y[43]>>>30,Gn=y[43]<<2|y[42]>>>30,ke=y[5]<<30|y[4]>>>2,Ye=y[4]<<30|y[5]>>>2,De=y[14]<<6|y[15]>>>26,ne=y[15]<<6|y[14]>>>26,fe=y[25]<<11|y[24]>>>21,Oe=y[24]<<11|y[25]>>>21,Qt=y[34]<<15|y[35]>>>17,Ie=y[35]<<15|y[34]>>>17,vn=y[45]<<29|y[44]>>>3,Be=y[44]<<29|y[45]>>>3,$e=y[6]<<28|y[7]>>>4,He=y[7]<<28|y[6]>>>4,Ai=y[17]<<23|y[16]>>>9,Xe=y[16]<<23|y[17]>>>9,ot=y[26]<<25|y[27]>>>7,ge=y[27]<<25|y[26]>>>7,Yr=y[36]<<21|y[37]>>>11,me=y[37]<<21|y[36]>>>11,Ue=y[47]<<24|y[46]>>>8,Er=y[46]<<24|y[47]>>>8,Ct=y[8]<<27|y[9]>>>5,Me=y[9]<<27|y[8]>>>5,Ht=y[18]<<20|y[19]>>>12,Le=y[19]<<20|y[18]>>>12,Ze=y[29]<<7|y[28]>>>25,$n=y[28]<<7|y[29]>>>25,de=y[38]<<8|y[39]>>>24,rt=y[39]<<8|y[38]>>>24,ze=y[48]<<14|y[49]>>>18,gn=y[49]<<14|y[48]>>>18,y[0]=Jr^~ce&fe,y[1]=Pe^~wr&Oe,y[10]=$e^~Ht&qe,y[11]=He^~Le&Rr,y[20]=Ge^~De&ot,y[21]=yn^~ne&ge,y[30]=Ct^~je&Ve,y[31]=Me^~Kt&Ke,y[40]=ke^~Ai&Ze,y[41]=Ye^~Xe&$n,y[2]=ce^~fe&Yr,y[3]=wr^~Oe&me,y[12]=Ht^~qe&Ce,y[13]=Le^~Rr&We,y[22]=De^~ot&de,y[23]=ne^~ge&rt,y[32]=je^~Ve&Qt,y[33]=Kt^~Ke&Ie,y[42]=Ai^~Ze&Hn,y[43]=Xe^~$n&qn,y[4]=fe^~Yr&ze,y[5]=Oe^~me&gn,y[14]=qe^~Ce&vn,y[15]=Rr^~We&Be,y[24]=ot^~de&be,y[25]=ge^~rt&_e,y[34]=Ve^~Qt&Ue,y[35]=Ke^~Ie&Er,y[44]=Ze^~Hn&Wn,y[45]=$n^~qn&Gn,y[6]=Yr^~ze&Jr,y[7]=me^~gn&Pe,y[16]=Ce^~vn&$e,y[17]=We^~Be&He,y[26]=de^~be&Ge,y[27]=rt^~_e&yn,y[36]=Qt^~Ue&Ct,y[37]=Ie^~Er&Me,y[46]=Hn^~Wn&ke,y[47]=qn^~Gn&Ye,y[8]=ze^~Jr&ce,y[9]=gn^~Pe&wr,y[18]=vn^~$e&Ht,y[19]=Be^~He&Le,y[28]=be^~Ge&De,y[29]=_e^~yn&ne,y[38]=Ue^~Ct&je,y[39]=Er^~Me&Kt,y[48]=Wn^~ke&Ai,y[49]=Gn^~Ye&Xe,y[0]^=x[F],y[1]^=x[F+1]};if(l)t.exports=f;else for(A=0;A>=8;return e}function gp(t,e,r){let n=0;for(let i=0;ie+1+n&&tn.throwError("child data too short",T.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function fy(t,e){if(t.length===0&&tn.throwError("data too short",T.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&tn.throwError("data short segment too short",T.errors.BUFFER_OVERRUN,{});const n=gp(t,e+1,r);return e+1+r+n>t.length&&tn.throwError("data long segment too short",T.errors.BUFFER_OVERRUN,{}),vp(t,e,e+1+r,r+n)}else if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{}),vp(t,e,e+1,r)}else if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{});const n=gp(t,e+1,r);e+1+r+n>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{});const i=re(t.slice(e+1+r,e+1+r+n));return{consumed:1+r+n,result:i}}else if(t[e]>=128){const r=t[e]-128;e+1+r>t.length&&tn.throwError("data too short",T.errors.BUFFER_OVERRUN,{});const n=re(t.slice(e+1,e+1+r));return{consumed:1+r,result:n}}return{consumed:1,result:re(t[e])}}function Sh(t){const e=se(t),r=fy(e,0);return r.consumed!==e.length&&tn.throwArgumentError("invalid rlp data","data",t),r.result}const Jx="address/5.7.0",oi=new T(Jx);function yp(t){pe(t,20)||oi.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=se(ut(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const Yx=9007199254740991;function Xx(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const kh={};for(let t=0;t<10;t++)kh[String(t)]=String(t);for(let t=0;t<26;t++)kh[String.fromCharCode(65+t)]=String(10+t);const wp=Math.floor(Xx(Yx));function dy(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>kh[n]).join("");for(;e.length>=wp;){let n=e.substring(0,wp);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function mt(t){let e=null;if(typeof t!="string"&&oi.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=yp(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&oi.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==dy(t)&&oi.throwArgumentError("bad icap checksum","address",t),e=Ox(t.substring(4));e.length<40;)e="0"+e;e=yp("0x"+e)}else oi.throwArgumentError("invalid address","address",t);return e}function Zx(t){try{return mt(t),!0}catch{}return!1}function eA(t){let e=Lx(mt(t).substring(2)).toUpperCase();for(;e.length<30;)e="0"+e;return"XE"+dy("XE00"+e)+e}function Nh(t){let e=null;try{e=mt(t.from)}catch{oi.throwArgumentError("missing from address","transaction",t)}const r=Ro(se(V.from(t.nonce).toHexString()));return mt(It(ut(Lu([e,r])),12))}function tA(t,e,r){return On(e)!==32&&oi.throwArgumentError("salt must be 32 bytes","salt",e),On(r)!==32&&oi.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),mt(It(ut(Ut(["0xff",mt(t),e,r])),12))}const rA=Object.freeze(Object.defineProperty({__proto__:null,getAddress:mt,getContractAddress:Nh,getCreate2Address:tA,getIcapAddress:eA,isAddress:Zx},Symbol.toStringTag,{value:"Module"}));class nA extends jn{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){try{r=mt(r)}catch(n){this._throwError(n.message,r)}return e.writeValue(r)}decode(e){return mt(pt(e.readValue().toHexString(),20))}}class iA extends jn{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,r){return this.coder.encode(e,r)}decode(e){return this.coder.decode(e)}}const co=new T(yl);function hy(t,e,r){let n=null;if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let a={};n=e.map(u=>{const c=u.localName;return c||co.throwError("cannot encode object for signature with missing names",T.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),a[c]&&co.throwError("cannot encode object for signature with duplicate names",T.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),a[c]=!0,r[c]})}else co.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&co.throwArgumentError("types/value length mismatch","tuple",r);let i=new sd(t.wordSize),o=new sd(t.wordSize),s=[];e.forEach((a,u)=>{let c=n[u];if(a.dynamic){let d=o.length;a.encode(o,c);let m=i.writeUpdatableValue();s.push(v=>{m(v+d)})}else a.encode(i,c)}),s.forEach(a=>{a(i.length)});let l=t.appendWriter(i);return l+=t.appendWriter(o),l}function py(t,e){let r=[],n=t.subReader(0);e.forEach(o=>{let s=null;if(o.dynamic){let l=t.readValue(),a=n.subReader(l.toNumber());try{s=o.decode(a)}catch(u){if(u.code===T.errors.BUFFER_OVERRUN)throw u;s=u,s.baseType=o.name,s.name=o.localName,s.type=o.type}}else try{s=o.decode(t)}catch(l){if(l.code===T.errors.BUFFER_OVERRUN)throw l;s=l,s.baseType=o.name,s.name=o.localName,s.type=o.type}s!=null&&r.push(s)});const i=e.reduce((o,s)=>{const l=s.localName;return l&&(o[l]||(o[l]=0),o[l]++),o},{});e.forEach((o,s)=>{let l=o.localName;if(!l||i[l]!==1||(l==="length"&&(l="_length"),r[l]!=null))return;const a=r[s];a instanceof Error?Object.defineProperty(r,l,{enumerable:!0,get:()=>{throw a}}):r[l]=a});for(let o=0;o{throw s}})}return Object.freeze(r)}class oA extends jn{constructor(e,r,n){const i=e.type+"["+(r>=0?r:"")+"]",o=r===-1||e.dynamic;super("array",i,n,o),this.coder=e,this.length=r}defaultValue(){const e=this.coder.defaultValue(),r=[];for(let n=0;ne._data.length&&co.throwError("insufficient data length",T.errors.BUFFER_OVERRUN,{length:e._data.length,count:r}));let n=[];for(let i=0;i>6===2;s++)o++;return o}return t===ar.OVERRUN?r.length-e-1:0}function yA(t,e,r,n,i){return t===ar.OVERLONG?(n.push(i),0):(n.push(65533),yy(t,e,r))}const wA=Object.freeze({error:vA,ignore:yy,replace:yA});function wy(t,e){e==null&&(e=wA.error),t=se(t);const r=[];let n=0;for(;n>7)){r.push(i);continue}let o=null,s=null;if((i&224)===192)o=1,s=127;else if((i&240)===224)o=2,s=2047;else if((i&248)===240)o=3,s=65535;else{(i&192)===128?n+=e(ar.UNEXPECTED_CONTINUE,n-1,t,r):n+=e(ar.BAD_PREFIX,n-1,t,r);continue}if(n-1+o>=t.length){n+=e(ar.OVERRUN,n-1,t,r);continue}let l=i&(1<<8-o-1)-1;for(let a=0;a1114111){n+=e(ar.OUT_OF_RANGE,n-1-o,t,r,l);continue}if(l>=55296&&l<=57343){n+=e(ar.UTF16_SURROGATE,n-1-o,t,r,l);continue}if(l<=s){n+=e(ar.OVERLONG,n-1-o,t,r,l);continue}r.push(l)}}return r}function mr(t,e=nl.current){e!=nl.current&&(vy.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const o=t.charCodeAt(n);if(n>=t.length||(o&64512)!==56320)throw new Error("invalid utf-8 string");const s=65536+((i&1023)<<10)+(o&1023);r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return se(r)}function EA(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function wl(t,e){return EA(wy(t,e))}function xA(t,e=nl.current){return wy(mr(t,e))}class AA extends my{constructor(e){super("string",e)}defaultValue(){return""}encode(e,r){return super.encode(e,mr(r))}decode(e){return wl(super.decode(e))}}class $l extends jn{constructor(e,r){let n=!1;const i=[];e.forEach(s=>{s.dynamic&&(n=!0),i.push(s.type)});const o="tuple("+i.join(",")+")";super("tuple",o,r,n),this.coders=e}defaultValue(){const e=[];this.coders.forEach(n=>{e.push(n.defaultValue())});const r=this.coders.reduce((n,i)=>{const o=i.localName;return o&&(n[o]||(n[o]=0),n[o]++),n},{});return this.coders.forEach((n,i)=>{let o=n.localName;!o||r[o]!==1||(o==="length"&&(o="_length"),e[o]==null&&(e[o]=e[i]))}),Object.freeze(e)}encode(e,r){return hy(e,this.coders,r)}decode(e){return e.coerce(this.name,py(e,this.coders))}}const Hl=new T(yl),bA=new RegExp(/^bytes([0-9]*)$/),_A=new RegExp(/^(u?int)([0-9]*)$/);class SA{constructor(e){z(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new nA(e.name);case"bool":return new sA(e.name);case"string":return new AA(e.name);case"bytes":return new lA(e.name);case"array":return new oA(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new $l((e.components||[]).map(n=>this._getCoder(n)),e.name);case"":return new uA(e.name)}let r=e.type.match(_A);if(r){let n=parseInt(r[2]||"256");return(n===0||n>256||n%8!==0)&&Hl.throwArgumentError("invalid "+r[1]+" bit length","param",e),new mA(n/8,r[1]==="int",e.name)}if(r=e.type.match(bA),r){let n=parseInt(r[1]);return(n===0||n>32)&&Hl.throwArgumentError("invalid bytes length","param",e),new aA(n,e.name)}return Hl.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,r){return new Ya(e,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new sd(this._getWordSize())}getDefaultValue(e){const r=e.map(i=>this._getCoder(kt.from(i)));return new $l(r,"_").defaultValue()}encode(e,r){e.length!==r.length&&Hl.throwError("types/values length mismatch",T.errors.INVALID_ARGUMENT,{count:{types:e.length,values:r.length},value:{types:e,values:r}});const n=e.map(s=>this._getCoder(kt.from(s))),i=new $l(n,"_"),o=this._getWriter();return i.encode(o,r),o.data}decode(e,r,n){const i=e.map(s=>this._getCoder(kt.from(s)));return new $l(i,"_").decode(this._getReader(se(r),n))}}const kA=new SA;function fo(t){return ut(mr(t))}const Ey="hash/5.7.0";function xy(t){t=atob(t);const e=[];for(let r=0;r0&&Array.isArray(l)?i(l,s-1):r.push(l)})};return i(t,e),r}function NA(t){const e={};for(let r=0;r>--a&1}const d=31,m=Math.pow(2,d),v=m>>>1,p=v>>1,x=m-1;let k=0;for(let B=0;B1;){let X=j+$>>>1;B>>1|c(),H=H<<1^v,ie=(ie^v)<<1|v|1;w=H,_=1+ie-H}let O=n-4;return E.map(B=>{switch(B-O){case 3:return O+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return O+256+(t[l++]<<8|t[l++]);case 1:return O+t[l++];default:return B-1}})}function CA(t){let e=0;return()=>t[e++]}function MA(t){return CA(PA(t))}function IA(t){return t&1?~t>>1:t>>1}function RA(t,e){let r=Array(t);for(let n=0;ne[s]):r}function OA(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(BA(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(DA(r,t))}return NA(by(e))}function LA(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function _y(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;in[s].push(o));return n}function BA(t,e){let r=1+e(),n=e(),i=LA(e),o=_y(i.length,1+t,e);return by(o.map((s,l)=>{const a=s[0],u=s.slice(1);return Array(i[l]).fill(void 0).map((c,d)=>{let m=d*n;return[a+d*r,u.map(v=>v+m)]})}))}function DA(t,e){let r=1+e();return _y(r,1+t,e).map(i=>[i[0],i.slice(1)])}function jA(t){let e=Xa(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let u=Xa(t,e);if(u.length==0)break;n.push({set:new Set(u),node:r()})}n.sort((u,c)=>c.set.size-u.set.size);let i=t(),o=i%3;i=i/3|0;let s=!!(i&1);i>>=1;let l=i==1,a=i==2;return{branches:n,valid:o,fe0f:s,save:l,check:a}}}function UA(){return MA(xy("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const Bu=UA(),FA=new Set(Xa(Bu)),zA=new Set(Xa(Bu)),$A=OA(Bu),HA=jA(Bu),xp=45,Ap=95;function Sy(t){return xA(t)}function qA(t){return t.filter(e=>e!=65039)}function ky(t){for(let e of t.split(".")){let r=Sy(e);try{for(let n=r.lastIndexOf(Ap)-1;n>=0;n--)if(r[n]!==Ap)throw new Error("underscore only allowed at start");if(r.length>=4&&r.every(n=>n<128)&&r[2]===xp&&r[3]===xp)throw new Error("invalid label extension")}catch(n){throw new Error(`Invalid label "${e}": ${n.message}`)}}return t}function WA(t){return ky(GA(t,qA))}function GA(t,e){let r=Sy(t).reverse(),n=[];for(;r.length;){let i=KA(r);if(i){n.push(...e(i));continue}let o=r.pop();if(FA.has(o)){n.push(o);continue}if(zA.has(o))continue;let s=$A[o];if(s){n.push(...s);continue}throw new Error(`Disallowed codepoint: 0x${o.toString(16).toUpperCase()}`)}return ky(VA(String.fromCodePoint(...n)))}function VA(t){return t.normalize("NFC")}function KA(t,e){var r;let n=HA,i,o,s=[],l=t.length;for(e&&(e.length=0);l;){let a=t[--l];if(n=(r=n.branches.find(u=>u.set.has(a)))===null||r===void 0?void 0:r.node,!n)break;if(n.save)o=a;else if(n.check&&a===o)break;s.push(a),n.fe0f&&(s.push(65039),l>0&&t[l-1]==65039&&l--),n.valid&&(i=s.slice(),n.valid==2&&i.splice(1,1),e&&e.push(...t.slice(l).reverse()),t.length=l)}return i}const QA=new T(Ey),Ny=new Uint8Array(32);Ny.fill(0);function bp(t){if(t.length===0)throw new Error("invalid ENS name; empty component");return t}function Py(t){const e=mr(WA(t)),r=[];if(t.length===0)return r;let n=0;for(let i=0;i=e.length)throw new Error("invalid ENS name; empty component");return r.push(bp(e.slice(n))),r}function ma(t){typeof t!="string"&&QA.throwArgumentError("invalid ENS name; not a string","name",t);let e=Ny;const r=Py(t);for(;r.length;)e=ut(Ut([e,ut(r.pop())]));return re(e)}function JA(t){return re(Ut(Py(t).map(e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const r=new Uint8Array(e.length+1);return r.set(e,1),r[0]=r.length-1,r})))+"00"}var YA=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const lt=new T(Ey),Cy=new Uint8Array(32);Cy.fill(0);const XA=V.from(-1),My=V.from(0),Iy=V.from(1),ZA=V.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function eb(t){const e=se(t),r=e.length%32;return r?Xt([e,Cy.slice(r)]):re(e)}const tb=pt(Iy.toHexString(),32),rb=pt(My.toHexString(),32),_p={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},zc=["name","version","chainId","verifyingContract","salt"];function Sp(t){return function(e){return typeof e!="string"&<.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const nb={name:Sp("name"),version:Sp("version"),chainId:function(t){try{return V.from(t).toString()}catch{}return lt.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return mt(t).toLowerCase()}catch{}return lt.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=se(t);if(e.length!==32)throw new Error("bad length");return re(e)}catch{}return lt.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function $c(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=e[1]==="",n=parseInt(e[2]||"256");(n%8!==0||n>256||e[2]&&e[2]!==String(n))&<.throwArgumentError("invalid numeric width","type",t);const i=ZA.mask(r?n-1:n),o=r?i.add(Iy).mul(XA):My;return function(s){const l=V.from(s);return(l.lt(o)||l.gt(i))&<.throwArgumentError(`value out-of-bounds for ${t}`,"value",s),pt(l.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(r===0||r>32||e[1]!==String(r))&<.throwArgumentError("invalid bytes width","type",t),function(n){return se(n).length!==r&<.throwArgumentError(`invalid length for ${t}`,"value",n),eb(n)}}}switch(t){case"address":return function(e){return pt(mt(e),32)};case"bool":return function(e){return e?tb:rb};case"bytes":return function(e){return ut(e)};case"string":return function(e){return fo(e)}}return null}function kp(t,e){return`${t}(${e.map(({name:r,type:n})=>n+" "+r).join(",")})`}class sr{constructor(e){z(this,"types",Object.freeze(nr(e))),z(this,"_encoderCache",{}),z(this,"_types",{});const r={},n={},i={};Object.keys(e).forEach(l=>{r[l]={},n[l]=[],i[l]={}});for(const l in e){const a={};e[l].forEach(u=>{a[u.name]&<.throwArgumentError(`duplicate variable name ${JSON.stringify(u.name)} in ${JSON.stringify(l)}`,"types",e),a[u.name]=!0;const c=u.type.match(/^([^\x5b]*)(\x5b|$)/)[1];c===l&<.throwArgumentError(`circular type reference to ${JSON.stringify(c)}`,"types",e),!$c(c)&&(n[c]||lt.throwArgumentError(`unknown type ${JSON.stringify(c)}`,"types",e),n[c].push(l),r[l][c]=!0)})}const o=Object.keys(n).filter(l=>n[l].length===0);o.length===0?lt.throwArgumentError("missing primary type","types",e):o.length>1&<.throwArgumentError(`ambiguous primary types or unused types: ${o.map(l=>JSON.stringify(l)).join(", ")}`,"types",e),z(this,"primaryType",o[0]);function s(l,a){a[l]&<.throwArgumentError(`circular type reference to ${JSON.stringify(l)}`,"types",e),a[l]=!0,Object.keys(r[l]).forEach(u=>{n[u]&&(s(u,a),Object.keys(a).forEach(c=>{i[c][u]=!0}))}),delete a[l]}s(this.primaryType,{});for(const l in i){const a=Object.keys(i[l]);a.sort(),this._types[l]=kp(l,e[l])+a.map(u=>kp(u,e[u])).join("")}}getEncoder(e){let r=this._encoderCache[e];return r||(r=this._encoderCache[e]=this._getEncoder(e)),r}_getEncoder(e){{const i=$c(e);if(i)return i}const r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const i=r[1],o=this.getEncoder(i),s=parseInt(r[3]);return l=>{s>=0&&l.length!==s&<.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",l);let a=l.map(o);return this._types[i]&&(a=a.map(ut)),ut(Xt(a))}}const n=this.types[e];if(n){const i=fo(this._types[e]);return o=>{const s=n.map(({name:l,type:a})=>{const u=this.getEncoder(a)(o[l]);return this._types[a]?ut(u):u});return s.unshift(i),Xt(s)}}return lt.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const r=this._types[e];return r||lt.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return ut(this.encodeData(e,r))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,r,n){if($c(e))return n(e,r);const i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const s=i[1],l=parseInt(i[3]);return l>=0&&r.length!==l&<.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map(a=>this._visit(s,a,n))}const o=this.types[e];return o?o.reduce((s,{name:l,type:a})=>(s[l]=this._visit(a,r[l],n),s),{}):lt.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new sr(e)}static getPrimaryType(e){return sr.from(e).primaryType}static hashStruct(e,r,n){return sr.from(r).hashStruct(e,n)}static hashDomain(e){const r=[];for(const n in e){const i=_p[n];i||lt.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),r.push({name:n,type:i})}return r.sort((n,i)=>zc.indexOf(n.name)-zc.indexOf(i.name)),sr.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,n){return Xt(["0x1901",sr.hashDomain(e),sr.from(r).hash(n)])}static hash(e,r,n){return ut(sr.encode(e,r,n))}static resolveNames(e,r,n,i){return YA(this,void 0,void 0,function*(){e=it(e);const o={};e.verifyingContract&&!pe(e.verifyingContract,20)&&(o[e.verifyingContract]="0x");const s=sr.from(r);s.visit(n,(l,a)=>(l==="address"&&!pe(a,20)&&(o[a]="0x"),a));for(const l in o)o[l]=yield i(l);return e.verifyingContract&&o[e.verifyingContract]&&(e.verifyingContract=o[e.verifyingContract]),n=s.visit(n,(l,a)=>l==="address"&&o[a]?o[a]:a),{domain:e,value:n}})}static getPayload(e,r,n){sr.hashDomain(e);const i={},o=[];zc.forEach(a=>{const u=e[a];u!=null&&(i[a]=nb[a](u),o.push({name:a,type:_p[a]}))});const s=sr.from(r),l=it(r);return l.EIP712Domain?lt.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):l.EIP712Domain=o,s.encode(n),{types:l,domain:i,primaryType:s.primaryType,message:s.visit(n,(a,u)=>{if(a.match(/^bytes(\d*)/))return re(se(u));if(a.match(/^u?int/))return V.from(u).toString();switch(a){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return typeof u!="string"&<.throwArgumentError("invalid string","value",u),u}return lt.throwArgumentError("unsupported type","type",a)})}}}const st=new T(yl);class ib extends vl{}class ob extends vl{}class sb extends vl{}class ld extends vl{static isIndexed(e){return!!(e&&e._isIndexed)}}const lb={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Np(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class ad{constructor(e){let r=[];typeof e=="string"?r=JSON.parse(e):r=e,z(this,"fragments",r.map(n=>Nn.from(n)).filter(n=>n!=null)),z(this,"_abiCoder",fr(new.target,"getAbiCoder")()),z(this,"functions",{}),z(this,"errors",{}),z(this,"events",{}),z(this,"structs",{}),this.fragments.forEach(n=>{let i=null;switch(n.type){case"constructor":if(this.deploy){st.warn("duplicate definition - constructor");return}z(this,"deploy",n);return;case"function":i=this.functions;break;case"event":i=this.events;break;case"error":i=this.errors;break;default:return}let o=n.format();if(i[o]){st.warn("duplicate definition - "+o);return}i[o]=n}),this.deploy||z(this,"deploy",on.from({payable:!1,type:"constructor"})),z(this,"_isInterface",!0)}format(e){e||(e=Se.full),e===Se.sighash&&st.throwArgumentError("interface does not support formatting sighash","format",e);const r=this.fragments.map(n=>n.format(e));return e===Se.json?JSON.stringify(r.map(n=>JSON.parse(n))):r}static getAbiCoder(){return kA}static getAddress(e){return mt(e)}static getSighash(e){return It(fo(e.format()),0,4)}static getEventTopic(e){return fo(e.format())}getFunction(e){if(pe(e)){for(const n in this.functions)if(e===this.getSighash(n))return this.functions[n];st.throwArgumentError("no matching function","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.functions).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching function","name",n):i.length>1&&st.throwArgumentError("multiple matching functions","name",n),this.functions[i[0]]}const r=this.functions[sn.fromString(e).format()];return r||st.throwArgumentError("no matching function","signature",e),r}getEvent(e){if(pe(e)){const n=e.toLowerCase();for(const i in this.events)if(n===this.getEventTopic(i))return this.events[i];st.throwArgumentError("no matching event","topichash",n)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.events).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching event","name",n):i.length>1&&st.throwArgumentError("multiple matching events","name",n),this.events[i[0]]}const r=this.events[_n.fromString(e).format()];return r||st.throwArgumentError("no matching event","signature",e),r}getError(e){if(pe(e)){const n=fr(this.constructor,"getSighash");for(const i in this.errors){const o=this.errors[i];if(e===n(o))return this.errors[i]}st.throwArgumentError("no matching error","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.errors).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching error","name",n):i.length>1&&st.throwArgumentError("multiple matching errors","name",n),this.errors[i[0]]}const r=this.errors[sn.fromString(e).format()];return r||st.throwArgumentError("no matching error","signature",e),r}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e)}catch(r){try{e=this.getError(e)}catch{throw r}}return fr(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),fr(this.constructor,"getEventTopic")(e)}_decodeParams(e,r){return this._abiCoder.decode(e,r)}_encodeParams(e,r){return this._abiCoder.encode(e,r)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,r){typeof e=="string"&&(e=this.getError(e));const n=se(r);return re(n.slice(0,4))!==this.getSighash(e)&&st.throwArgumentError(`data signature does not match error ${e.name}.`,"data",re(n)),this._decodeParams(e.inputs,n.slice(4))}encodeErrorResult(e,r){return typeof e=="string"&&(e=this.getError(e)),re(Ut([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionData(e,r){typeof e=="string"&&(e=this.getFunction(e));const n=se(r);return re(n.slice(0,4))!==this.getSighash(e)&&st.throwArgumentError(`data signature does not match function ${e.name}.`,"data",re(n)),this._decodeParams(e.inputs,n.slice(4))}encodeFunctionData(e,r){return typeof e=="string"&&(e=this.getFunction(e)),re(Ut([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionResult(e,r){typeof e=="string"&&(e=this.getFunction(e));let n=se(r),i=null,o="",s=null,l=null,a=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,n)}catch{}break;case 4:{const u=re(n.slice(0,4)),c=lb[u];if(c)s=this._abiCoder.decode(c.inputs,n.slice(4)),l=c.name,a=c.signature,c.reason&&(i=s[0]),l==="Error"?o=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(s[0])}`:l==="Panic"&&(o=`; VM Exception while processing transaction: reverted with panic code ${s[0]}`);else try{const d=this.getError(u);s=this._abiCoder.decode(d.inputs,n.slice(4)),l=d.name,a=d.format()}catch{}break}}return st.throwError("call revert exception"+o,T.errors.CALL_EXCEPTION,{method:e.format(),data:re(r),errorArgs:s,errorName:l,errorSignature:a,reason:i})}encodeFunctionResult(e,r){return typeof e=="string"&&(e=this.getFunction(e)),re(this._abiCoder.encode(e.outputs,r||[]))}encodeFilterTopics(e,r){typeof e=="string"&&(e=this.getEvent(e)),r.length>e.inputs.length&&st.throwError("too many arguments for "+e.format(),T.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:r});let n=[];e.anonymous||n.push(this.getEventTopic(e));const i=(o,s)=>o.type==="string"?fo(s):o.type==="bytes"?ut(re(s)):(o.type==="bool"&&typeof s=="boolean"&&(s=s?"0x01":"0x00"),o.type.match(/^u?int/)&&(s=V.from(s).toHexString()),o.type==="address"&&this._abiCoder.encode(["address"],[s]),pt(re(s),32));for(r.forEach((o,s)=>{let l=e.inputs[s];if(!l.indexed){o!=null&&st.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+l.name,o);return}o==null?n.push(null):l.baseType==="array"||l.baseType==="tuple"?st.throwArgumentError("filtering with tuples or arrays not supported","contract."+l.name,o):Array.isArray(o)?n.push(o.map(a=>i(l,a))):n.push(i(l,o))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,r){typeof e=="string"&&(e=this.getEvent(e));const n=[],i=[],o=[];return e.anonymous||n.push(this.getEventTopic(e)),r.length!==e.inputs.length&&st.throwArgumentError("event arguments/values mismatch","values",r),e.inputs.forEach((s,l)=>{const a=r[l];if(s.indexed)if(s.type==="string")n.push(fo(a));else if(s.type==="bytes")n.push(ut(a));else{if(s.baseType==="tuple"||s.baseType==="array")throw new Error("not implemented");n.push(this._abiCoder.encode([s.type],[a]))}else i.push(s),o.push(a)}),{data:this._abiCoder.encode(i,o),topics:n}}decodeEventLog(e,r,n){if(typeof e=="string"&&(e=this.getEvent(e)),n!=null&&!e.anonymous){let m=this.getEventTopic(e);(!pe(n[0],32)||n[0].toLowerCase()!==m)&&st.throwError("fragment/topic mismatch",T.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:m,value:n[0]}),n=n.slice(1)}let i=[],o=[],s=[];e.inputs.forEach((m,v)=>{m.indexed?m.type==="string"||m.type==="bytes"||m.baseType==="tuple"||m.baseType==="array"?(i.push(kt.fromObject({type:"bytes32",name:m.name})),s.push(!0)):(i.push(m),s.push(!1)):(o.push(m),s.push(!1))});let l=n!=null?this._abiCoder.decode(i,Ut(n)):null,a=this._abiCoder.decode(o,r,!0),u=[],c=0,d=0;e.inputs.forEach((m,v)=>{if(m.indexed)if(l==null)u[v]=new ld({_isIndexed:!0,hash:null});else if(s[v])u[v]=new ld({_isIndexed:!0,hash:l[d++]});else try{u[v]=l[d++]}catch(p){u[v]=p}else try{u[v]=a[c++]}catch(p){u[v]=p}if(m.name&&u[m.name]==null){const p=u[v];p instanceof Error?Object.defineProperty(u,m.name,{enumerable:!0,get:()=>{throw Np(`property ${JSON.stringify(m.name)}`,p)}}):u[m.name]=p}});for(let m=0;m{throw Np(`index ${m}`,v)}})}return Object.freeze(u)}parseTransaction(e){let r=this.getFunction(e.data.substring(0,10).toLowerCase());return r?new ob({args:this._abiCoder.decode(r.inputs,"0x"+e.data.substring(10)),functionFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r),value:V.from(e.value||"0")}):null}parseLog(e){let r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new ib({eventFragment:r,name:r.name,signature:r.format(),topic:this.getEventTopic(r),args:this.decodeEventLog(r,e.data,e.topics)})}parseError(e){const r=re(e);let n=this.getError(r.substring(0,10).toLowerCase());return n?new sb({args:this._abiCoder.decode(n.inputs,"0x"+r.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(e){return!!(e&&e._isInterface)}}const ab="abstract-provider/5.7.0";var ub=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const cb=new T(ab);class fb extends vl{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class qo{constructor(){cb.checkAbstract(new.target,qo),z(this,"_isProvider",!0)}getFeeData(){return ub(this,void 0,void 0,function*(){const{block:e,gasPrice:r}=yield yt({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(s=>null)});let n=null,i=null,o=null;return e&&e.baseFeePerGas&&(n=e.baseFeePerGas,o=V.from("1500000000"),i=e.baseFeePerGas.mul(2).add(o)),{lastBaseFeePerGas:n,maxFeePerGas:i,maxPriorityFeePerGas:o,gasPrice:r}})}addListener(e,r){return this.on(e,r)}removeListener(e,r){return this.off(e,r)}static isProvider(e){return!!(e&&e._isProvider)}}const db="abstract-signer/5.7.0";var Or=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Ar=new T(db),hb=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],pb=[T.errors.INSUFFICIENT_FUNDS,T.errors.NONCE_EXPIRED,T.errors.REPLACEMENT_UNDERPRICED];class El{constructor(){Ar.checkAbstract(new.target,El),z(this,"_isSigner",!0)}getBalance(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return Or(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const r=yield yt(this.checkTransaction(e));return yield this.provider.estimateGas(r)})}call(e,r){return Or(this,void 0,void 0,function*(){this._checkProvider("call");const n=yield yt(this.checkTransaction(e));return yield this.provider.call(n,r)})}sendTransaction(e){return Or(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const r=yield this.populateTransaction(e),n=yield this.signTransaction(r);return yield this.provider.sendTransaction(n)})}getChainId(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const n in e)hb.indexOf(n)===-1&&Ar.throwArgumentError("invalid transaction key: "+n,"transaction",e);const r=it(e);return r.from==null?r.from=this.getAddress():r.from=Promise.all([Promise.resolve(r.from),this.getAddress()]).then(n=>(n[0].toLowerCase()!==n[1].toLowerCase()&&Ar.throwArgumentError("from address mismatch","transaction",e),n[0])),r}populateTransaction(e){return Or(this,void 0,void 0,function*(){const r=yield yt(this.checkTransaction(e));r.to!=null&&(r.to=Promise.resolve(r.to).then(i=>Or(this,void 0,void 0,function*(){if(i==null)return null;const o=yield this.resolveName(i);return o==null&&Ar.throwArgumentError("provided ENS name resolves to null","tx.to",i),o})),r.to.catch(i=>{}));const n=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||n)?Ar.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(r.type===0||r.type===1)&&n&&Ar.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1)r.gasPrice==null&&(r.gasPrice=this.getGasPrice());else{const i=yield this.getFeeData();if(r.type==null)if(i.maxFeePerGas!=null&&i.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){const o=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=o,r.maxPriorityFeePerGas=o}else r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas);else i.gasPrice!=null?(n&&Ar.throwError("network does not support EIP-1559",T.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=i.gasPrice),r.type=0):Ar.throwError("failed to get consistent fee data",T.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else r.type===2&&(r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas))}return r.nonce==null&&(r.nonce=this.getTransactionCount("pending")),r.gasLimit==null&&(r.gasLimit=this.estimateGas(r).catch(i=>{if(pb.indexOf(i.code)>=0)throw i;return Ar.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:i,tx:r})})),r.chainId==null?r.chainId=this.getChainId():r.chainId=Promise.all([Promise.resolve(r.chainId),this.getChainId()]).then(i=>(i[1]!==0&&i[0]!==i[1]&&Ar.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield yt(r)})}_checkProvider(e){this.provider||Ar.throwError("missing provider",T.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class Ph extends El{constructor(e,r){super(),z(this,"address",e),z(this,"provider",r||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,r){return Promise.resolve().then(()=>{Ar.throwError(e,T.errors.UNSUPPORTED_OPERATION,{operation:r})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,r,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new Ph(this.address,e)}}var Ry={},we={},xl=Ty;function Ty(t,e){if(!t)throw new Error(e||"Assertion failed")}Ty.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var ud={exports:{}};typeof Object.create=="function"?ud.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ud.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var mb=ud.exports,gb=xl,vb=mb;we.inherits=vb;function yb(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function wb(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=o&63|128):yb(t,i)?(o=65536+((o&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=o&63|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=o&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}we.htonl=Oy;function xb(t,e){for(var r="",n=0;n>>0}return o}we.join32=Ab;function bb(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=o&255):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=o&255)}return r}we.split32=bb;function _b(t,e){return t>>>e|t<<32-e}we.rotr32=_b;function Sb(t,e){return t<>>32-e}we.rotl32=Sb;function kb(t,e){return t+e>>>0}we.sum32=kb;function Nb(t,e,r){return t+e+r>>>0}we.sum32_3=Nb;function Pb(t,e,r,n){return t+e+r+n>>>0}we.sum32_4=Pb;function Cb(t,e,r,n,i){return t+e+r+n+i>>>0}we.sum32_5=Cb;function Mb(t,e,r,n){var i=t[e],o=t[e+1],s=n+o>>>0,l=(s>>0,t[e+1]=s}we.sum64=Mb;function Ib(t,e,r,n){var i=e+n>>>0,o=(i>>0}we.sum64_hi=Ib;function Rb(t,e,r,n){var i=e+n;return i>>>0}we.sum64_lo=Rb;function Tb(t,e,r,n,i,o,s,l){var a=0,u=e;u=u+n>>>0,a+=u>>0,a+=u>>0,a+=u>>0}we.sum64_4_hi=Tb;function Ob(t,e,r,n,i,o,s,l){var a=e+n+o+l;return a>>>0}we.sum64_4_lo=Ob;function Lb(t,e,r,n,i,o,s,l,a,u){var c=0,d=e;d=d+n>>>0,c+=d>>0,c+=d>>0,c+=d>>0,c+=d>>0}we.sum64_5_hi=Lb;function Bb(t,e,r,n,i,o,s,l,a,u){var c=e+n+o+l+u;return c>>>0}we.sum64_5_lo=Bb;function Db(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}we.rotr64_hi=Db;function jb(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}we.rotr64_lo=jb;function Ub(t,e,r){return t>>>r}we.shr64_hi=Ub;function Fb(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}we.shr64_lo=Fb;var Wo={},Pp=we,zb=xl;function Du(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Wo.BlockHash=Du;Du.prototype.update=function(e,r){if(e=Pp.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Pp.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[o++]=e>>>16&255,i[o++]=e>>>8&255,i[o++]=e&255}else for(i[o++]=e&255,i[o++]=e>>>8&255,i[o++]=e>>>16&255,i[o++]=e>>>24&255,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,s=8;s>>3}mn.g0_256=Gb;function Vb(t){return un(t,17)^un(t,19)^t>>>10}mn.g1_256=Vb;var To=we,Kb=Wo,Qb=mn,Hc=To.rotl32,is=To.sum32,Jb=To.sum32_5,Yb=Qb.ft_1,Fy=Kb.BlockHash,Xb=[1518500249,1859775393,2400959708,3395469782];function dn(){if(!(this instanceof dn))return new dn;Fy.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}To.inherits(dn,Fy);var Zb=dn;dn.blockSize=512;dn.outSize=160;dn.hmacStrength=80;dn.padLength=64;dn.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),F_(e.length<=this.blockSize);for(var r=e.length;r>8,m=c&255;d?a.push(d,m):a.push(m)}return a}r.toArray=n;function i(s){return s.length===1?"0"+s:s}r.zero2=i;function o(s){for(var l="",a=0;a(m>>1)-1?x=(m>>1)-k:x=k,v.isubn(x)):x=0,d[p]=x,v.iushrn(1)}return d}r.getNAF=n;function i(a,u){var c=[[],[]];a=a.clone(),u=u.clone();for(var d=0,m=0,v;a.cmpn(-d)>0||u.cmpn(-m)>0;){var p=a.andln(3)+d&3,x=u.andln(3)+m&3;p===3&&(p=-1),x===3&&(x=-1);var k;p&1?(v=a.andln(7)+d&7,(v===3||v===5)&&x===2?k=-p:k=p):k=0,c[0].push(k);var E;x&1?(v=u.andln(7)+m&7,(v===3||v===5)&&p===2?E=-x:E=x):E=0,c[1].push(E),2*d===k+1&&(d=1-d),2*m===E+1&&(m=1-m),a.iushrn(1),u.iushrn(1)}return c}r.getJSF=i;function o(a,u,c){var d="_"+u;a.prototype[u]=function(){return this[d]!==void 0?this[d]:this[d]=c.call(this)}}r.cachedProperty=o;function s(a){return typeof a=="string"?r.toArray(a,"hex"):a}r.parseBytes=s;function l(a){return new ue(a,"hex","le")}r.intFromLE=l}),Za=yr.getNAF,H_=yr.getJSF,eu=yr.assert;function xi(t,e){this.type=t,this.p=new ue(e.p,16),this.red=e.prime?ue.red(e.prime):ue.mont(this.p),this.zero=new ue(0).toRed(this.red),this.one=new ue(1).toRed(this.red),this.two=new ue(2).toRed(this.red),this.n=e.n&&new ue(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Hi=xi;xi.prototype.point=function(){throw new Error("Not implemented")};xi.prototype.validate=function(){throw new Error("Not implemented")};xi.prototype._fixedNafMul=function(e,r){eu(e.precomputed);var n=e._getDoubles(),i=Za(r,1,this._bitLength),o=(1<=l;u--)a=(a<<1)+i[u];s.push(a)}for(var c=this.jpoint(null,null,null),d=this.jpoint(null,null,null),m=o;m>0;m--){for(l=0;l=0;a--){for(var u=0;a>=0&&s[a]===0;a--)u++;if(a>=0&&u++,l=l.dblp(u),a<0)break;var c=s[a];eu(c!==0),e.type==="affine"?c>0?l=l.mixedAdd(o[c-1>>1]):l=l.mixedAdd(o[-c-1>>1].neg()):c>0?l=l.add(o[c-1>>1]):l=l.add(o[-c-1>>1].neg())}return e.type==="affine"?l.toP():l};xi.prototype._wnafMulAdd=function(e,r,n,i,o){var s=this._wnafT1,l=this._wnafT2,a=this._wnafT3,u=0,c,d,m;for(c=0;c=1;c-=2){var p=c-1,x=c;if(s[p]!==1||s[x]!==1){a[p]=Za(n[p],s[p],this._bitLength),a[x]=Za(n[x],s[x],this._bitLength),u=Math.max(a[p].length,u),u=Math.max(a[x].length,u);continue}var k=[r[p],null,null,r[x]];r[p].y.cmp(r[x].y)===0?(k[1]=r[p].add(r[x]),k[2]=r[p].toJ().mixedAdd(r[x].neg())):r[p].y.cmp(r[x].y.redNeg())===0?(k[1]=r[p].toJ().mixedAdd(r[x]),k[2]=r[p].add(r[x].neg())):(k[1]=r[p].toJ().mixedAdd(r[x]),k[2]=r[p].toJ().mixedAdd(r[x].neg()));var E=[-3,-1,-5,-7,0,7,5,1,3],w=H_(n[p],n[x]);for(u=Math.max(w[0].length,u),a[p]=new Array(u),a[x]=new Array(u),d=0;d=0;c--){for(var $=0;c>=0;){var H=!0;for(d=0;d=0&&$++,B=B.dblp($),c<0)break;for(d=0;d0?m=l[d][ie-1>>1]:ie<0&&(m=l[d][-ie-1>>1].neg()),m.type==="affine"?B=B.mixedAdd(m):B=B.add(m))}}for(c=0;c=Math.ceil((e.bitLength()+1)/r.step):!1};Mr.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,o=0;o=0&&(v=u,p=c),d.negative&&(d=d.neg(),m=m.neg()),v.negative&&(v=v.neg(),p=p.neg()),[{a:d,b:m},{a:v,b:p}]};Ir.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],o=i.b.mul(e).divRound(this.n),s=n.b.neg().mul(e).divRound(this.n),l=o.mul(n.a),a=s.mul(i.a),u=o.mul(n.b),c=s.mul(i.b),d=e.sub(l).sub(a),m=u.add(c).neg();return{k1:d,k2:m}};Ir.prototype.pointFromX=function(e,r){e=new ue(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var o=i.fromRed().isOdd();return(r&&!o||!r&&o)&&(i=i.redNeg()),this.point(e,i)};Ir.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),o=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(o).cmpn(0)===0};Ir.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,o=this._endoWnafT2,s=0;s":""};Pt.prototype.isInfinity=function(){return this.inf};Pt.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};Pt.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),s=o.redSqr().redISub(this.x.redAdd(this.x)),l=o.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,l)};Pt.prototype.getX=function(){return this.x.fromRed()};Pt.prototype.getY=function(){return this.y.fromRed()};Pt.prototype.mul=function(e){return e=new ue(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Pt.prototype.mulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o):this.curve._wnafMulAdd(1,i,o,2)};Pt.prototype.jmulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o,!0):this.curve._wnafMulAdd(1,i,o,2,!0)};Pt.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Pt.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(o){return o.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};Pt.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Ot(t,e,r,n){Hi.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new ue(0)):(this.x=new ue(e,16),this.y=new ue(r,16),this.z=new ue(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Mh(Ot,Hi.BasePoint);Ir.prototype.jpoint=function(e,r,n){return new Ot(this,e,r,n)};Ot.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};Ot.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Ot.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),o=e.x.redMul(n),s=this.y.redMul(r.redMul(e.z)),l=e.y.redMul(n.redMul(this.z)),a=i.redSub(o),u=s.redSub(l);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),d=c.redMul(a),m=i.redMul(c),v=u.redSqr().redIAdd(d).redISub(m).redISub(m),p=u.redMul(m.redISub(v)).redISub(s.redMul(d)),x=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(v,p,x)};Ot.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),o=this.y,s=e.y.redMul(r).redMul(this.z),l=n.redSub(i),a=o.redSub(s);if(l.cmpn(0)===0)return a.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=l.redSqr(),c=u.redMul(l),d=n.redMul(u),m=a.redSqr().redIAdd(c).redISub(d).redISub(d),v=a.redMul(d.redISub(m)).redISub(o.redMul(c)),p=this.z.redMul(l);return this.curve.jpoint(m,v,p)};Ot.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(o),this.x.cmp(n)===0)return!0}};Ot.prototype.inspect=function(){return this.isInfinity()?"":""};Ot.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var ga=Ko(function(t,e){var r=e;r.base=Hi,r.short=W_,r.mont=null,r.edwards=null}),va=Ko(function(t,e){var r=e,n=yr.assert;function i(l){l.type==="short"?this.curve=new ga.short(l):l.type==="edwards"?this.curve=new ga.edwards(l):this.curve=new ga.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function o(l,a){Object.defineProperty(r,l,{configurable:!0,enumerable:!0,get:function(){var u=new i(a);return Object.defineProperty(r,l,{configurable:!0,enumerable:!0,value:u}),u}})}o("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:en.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:en.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:en.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:en.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),o("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:en.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:en.sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:en.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var s;try{s=null.crash()}catch{s=void 0}o("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:en.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",s]})});function gi(t){if(!(this instanceof gi))return new gi(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Hr.toArray(t.entropy,t.entropyEnc||"hex"),r=Hr.toArray(t.nonce,t.nonceEnc||"hex"),n=Hr.toArray(t.pers,t.persEnc||"hex");Ch(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Xy=gi;gi.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};gi.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Hr.toArray(n,i||"hex"),this._update(n));for(var o=[];o.length"};var G_=yr.assert;function ju(t,e){if(t instanceof ju)return t;this._importDER(t,e)||(G_(t.r&&t.s,"Signature without r or s"),this.r=new ue(t.r,16),this.s=new ue(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Uu=ju;function V_(){this.place=0}function Gc(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,o=0,s=e.place;o>>=0;return i<=127?!1:(e.place=s,i)}function Rp(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}ju.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=Rp(r),n=Rp(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Vc(i,r.length),i=i.concat(r),i.push(2),Vc(i,n.length);var o=i.concat(n),s=[48];return Vc(s,o.length),s=s.concat(o),yr.encode(s,e)};var K_=function(){throw new Error("unsupported")},Zy=yr.assert;function Cr(t){if(!(this instanceof Cr))return new Cr(t);typeof t=="string"&&(Zy(Object.prototype.hasOwnProperty.call(va,t),"Unknown curve "+t),t=va[t]),t instanceof va.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Q_=Cr;Cr.prototype.keyPair=function(e){return new Ih(this,e)};Cr.prototype.keyFromPrivate=function(e,r){return Ih.fromPrivate(this,e,r)};Cr.prototype.keyFromPublic=function(e,r){return Ih.fromPublic(this,e,r)};Cr.prototype.genKeyPair=function(e){e||(e={});for(var r=new Xy({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||K_(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new ue(2));;){var o=new ue(r.generate(n));if(!(o.cmp(i)>0))return o.iaddn(1),this.keyFromPrivate(o)}};Cr.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};Cr.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new ue(e,16));for(var o=this.n.byteLength(),s=r.getPrivate().toArray("be",o),l=e.toArray("be",o),a=new Xy({hash:this.hash,entropy:s,nonce:l,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new ue(1)),c=0;;c++){var d=i.k?i.k(c):new ue(a.generate(this.n.byteLength()));if(d=this._truncateToN(d,!0),!(d.cmpn(1)<=0||d.cmp(u)>=0)){var m=this.g.mul(d);if(!m.isInfinity()){var v=m.getX(),p=v.umod(this.n);if(p.cmpn(0)!==0){var x=d.invm(this.n).mul(p.mul(r.getPrivate()).iadd(e));if(x=x.umod(this.n),x.cmpn(0)!==0){var k=(m.getY().isOdd()?1:0)|(v.cmp(p)!==0?2:0);return i.canonical&&x.cmp(this.nh)>0&&(x=this.n.sub(x),k^=1),new Uu({r:p,s:x,recoveryParam:k})}}}}}};Cr.prototype.verify=function(e,r,n,i){e=this._truncateToN(new ue(e,16)),n=this.keyFromPublic(n,i),r=new Uu(r,"hex");var o=r.r,s=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var l=s.invm(this.n),a=l.mul(e).umod(this.n),u=l.mul(o).umod(this.n),c;return this.curve._maxwellTrick?(c=this.g.jmulAdd(a,n.getPublic(),u),c.isInfinity()?!1:c.eqXToP(o)):(c=this.g.mulAdd(a,n.getPublic(),u),c.isInfinity()?!1:c.getX().umod(this.n).cmp(o)===0)};Cr.prototype.recoverPubKey=function(t,e,r,n){Zy((3&r)===r,"The recovery param is more than two bits"),e=new Uu(e,n);var i=this.n,o=new ue(t),s=e.r,l=e.s,a=r&1,u=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?s=this.curve.pointFromX(s.add(this.curve.n),a):s=this.curve.pointFromX(s,a);var c=e.r.invm(i),d=i.sub(o).mul(c).umod(i),m=l.mul(c).umod(i);return this.g.mulAdd(d,s,m)};Cr.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Uu(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch{continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var J_=Ko(function(t,e){var r=e;r.version="6.5.4",r.utils=yr,r.rand=function(){throw new Error("unsupported")},r.curve=ga,r.curves=va,r.ec=Q_,r.eddsa=null}),Y_=J_.ec;const X_="signing-key/5.7.0",hd=new T(X_);let Kc=null;function rn(){return Kc||(Kc=new Y_("secp256k1")),Kc}class Z_{constructor(e){z(this,"curve","secp256k1"),z(this,"privateKey",re(e)),On(this.privateKey)!==32&&hd.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=rn().keyFromPrivate(se(this.privateKey));z(this,"publicKey","0x"+r.getPublic(!1,"hex")),z(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),z(this,"_isSigningKey",!0)}_addPoint(e){const r=rn().keyFromPublic(se(this.publicKey)),n=rn().keyFromPublic(se(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=rn().keyFromPrivate(se(this.privateKey)),n=se(e);n.length!==32&&hd.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Ou({recoveryParam:i.recoveryParam,r:pt("0x"+i.r.toString(16),32),s:pt("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=rn().keyFromPrivate(se(this.privateKey)),n=rn().keyFromPublic(se(e1(e)));return pt("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function e3(t,e){const r=Ou(e),n={r:se(r.r),s:se(r.s)};return"0x"+rn().recoverPubKey(se(t),n,r.recoveryParam).encode("hex",!1)}function e1(t,e){const r=se(t);if(r.length===32){const n=new Z_(r);return e?"0x"+rn().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return e?re(r):"0x"+rn().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+rn().keyFromPublic(r).getPublic(!0,"hex"):re(r)}return hd.throwArgumentError("invalid public or private key","key","[REDACTED]")}const t3="transactions/5.7.0",Un=new T(t3);var Tp;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(Tp||(Tp={}));function Rh(t){return t==="0x"?null:mt(t)}function jt(t){return t==="0x"?gy:V.from(t)}function r3(t){const e=e1(t);return mt(It(ut(It(e,1)),12))}function t1(t,e){return r3(e3(se(t),e))}function ur(t,e){const r=Ro(V.from(t).toHexString());return r.length>32&&Un.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function Qc(t,e){return{address:mt(t),storageKeys:(e||[]).map((r,n)=>(On(r)!==32&&Un.throwArgumentError("invalid access list storageKey",`accessList[${t}:${n}]`,r),r.toLowerCase()))}}function qi(t){if(Array.isArray(t))return t.map((r,n)=>Array.isArray(r)?(r.length>2&&Un.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${n}]`,r),Qc(r[0],r[1])):Qc(r.address,r.storageKeys));const e=Object.keys(t).map(r=>{const n=t[r].reduce((i,o)=>(i[o]=!0,i),{});return Qc(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function r1(t){return qi(t).map(e=>[e.address,e.storageKeys])}function n3(t,e){if(t.gasPrice!=null){const n=V.from(t.gasPrice),i=V.from(t.maxFeePerGas||0);n.eq(i)||Un.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:n,maxFeePerGas:i})}const r=[ur(t.chainId||0,"chainId"),ur(t.nonce||0,"nonce"),ur(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ur(t.maxFeePerGas||0,"maxFeePerGas"),ur(t.gasLimit||0,"gasLimit"),t.to!=null?mt(t.to):"0x",ur(t.value||0,"value"),t.data||"0x",r1(t.accessList||[])];if(e){const n=Ou(e);r.push(ur(n.recoveryParam,"recoveryParam")),r.push(Ro(n.r)),r.push(Ro(n.s))}return Xt(["0x02",Lu(r)])}function i3(t,e){const r=[ur(t.chainId||0,"chainId"),ur(t.nonce||0,"nonce"),ur(t.gasPrice||0,"gasPrice"),ur(t.gasLimit||0,"gasLimit"),t.to!=null?mt(t.to):"0x",ur(t.value||0,"value"),t.data||"0x",r1(t.accessList||[])];if(e){const n=Ou(e);r.push(ur(n.recoveryParam,"recoveryParam")),r.push(Ro(n.r)),r.push(Ro(n.s))}return Xt(["0x01",Lu(r)])}function n1(t,e,r){try{const n=jt(e[0]).toNumber();if(n!==0&&n!==1)throw new Error("bad recid");t.v=n}catch{Un.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=pt(e[1],32),t.s=pt(e[2],32);try{const n=ut(r(t));t.from=t1(n,{r:t.r,s:t.s,recoveryParam:t.v})}catch{}}function o3(t){const e=Sh(t.slice(1));e.length!==9&&e.length!==12&&Un.throwArgumentError("invalid component count for transaction type: 2","payload",re(t));const r=jt(e[2]),n=jt(e[3]),i={type:2,chainId:jt(e[0]).toNumber(),nonce:jt(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:jt(e[4]),to:Rh(e[5]),value:jt(e[6]),data:e[7],accessList:qi(e[8])};return e.length===9||(i.hash=ut(t),n1(i,e.slice(9),n3)),i}function s3(t){const e=Sh(t.slice(1));e.length!==8&&e.length!==11&&Un.throwArgumentError("invalid component count for transaction type: 1","payload",re(t));const r={type:1,chainId:jt(e[0]).toNumber(),nonce:jt(e[1]).toNumber(),gasPrice:jt(e[2]),gasLimit:jt(e[3]),to:Rh(e[4]),value:jt(e[5]),data:e[6],accessList:qi(e[7])};return e.length===8||(r.hash=ut(t),n1(r,e.slice(8),i3)),r}function l3(t){const e=Sh(t);e.length!==9&&e.length!==6&&Un.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:jt(e[0]).toNumber(),gasPrice:jt(e[1]),gasLimit:jt(e[2]),to:Rh(e[3]),value:jt(e[4]),data:e[5],chainId:0};if(e.length===6)return r;try{r.v=V.from(e[6]).toNumber()}catch{return r}if(r.r=pt(e[7],32),r.s=pt(e[8],32),V.from(r.r).isZero()&&V.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=e.slice(0,6);r.chainId!==0&&(i.push(re(r.chainId)),i.push("0x"),i.push("0x"),n-=r.chainId*2+8);const o=ut(Lu(i));try{r.from=t1(o,{r:re(r.r),s:re(r.s),recoveryParam:n})}catch{}r.hash=ut(t)}return r.type=null,r}function a3(t){const e=se(t);if(e[0]>127)return l3(e);switch(e[0]){case 1:return s3(e);case 2:return o3(e)}return Un.throwError(`unsupported transaction type: ${e[0]}`,T.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const u3="contracts/5.7.0";var Ui=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const gt=new T(u3);function tu(t,e){return Ui(this,void 0,void 0,function*(){const r=yield e;typeof r!="string"&>.throwArgumentError("invalid address or ENS name","name",r);try{return mt(r)}catch{}t||gt.throwError("a provider or signer is needed to resolve ENS names",T.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield t.resolveName(r);return n==null&>.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n})}function ya(t,e,r){return Ui(this,void 0,void 0,function*(){return Array.isArray(r)?yield Promise.all(r.map((n,i)=>ya(t,Array.isArray(e)?e[i]:e[n.name],n))):r.type==="address"?yield tu(t,e):r.type==="tuple"?yield ya(t,e,r.components):r.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(n=>ya(t,n,r.arrayChildren))):Promise.reject(gt.makeError("invalid value for array",T.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function Fu(t,e,r){return Ui(this,void 0,void 0,function*(){let n={};r.length===e.inputs.length+1&&typeof r[r.length-1]=="object"&&(n=it(r.pop())),gt.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?n.from?n.from=yt({override:tu(t.signer,n.from),signer:t.signer.getAddress()}).then(u=>Ui(this,void 0,void 0,function*(){return mt(u.signer)!==u.override&>.throwError("Contract with a Signer cannot override from",T.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),u.override})):n.from=t.signer.getAddress():n.from&&(n.from=tu(t.provider,n.from));const i=yield yt({args:ya(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:yt(n)||{}}),o=t.interface.encodeFunctionData(e,i.args),s={data:o,to:i.address},l=i.overrides;if(l.nonce!=null&&(s.nonce=V.from(l.nonce).toNumber()),l.gasLimit!=null&&(s.gasLimit=V.from(l.gasLimit)),l.gasPrice!=null&&(s.gasPrice=V.from(l.gasPrice)),l.maxFeePerGas!=null&&(s.maxFeePerGas=V.from(l.maxFeePerGas)),l.maxPriorityFeePerGas!=null&&(s.maxPriorityFeePerGas=V.from(l.maxPriorityFeePerGas)),l.from!=null&&(s.from=l.from),l.type!=null&&(s.type=l.type),l.accessList!=null&&(s.accessList=qi(l.accessList)),s.gasLimit==null&&e.gas!=null){let u=21e3;const c=se(o);for(let d=0;dn[u]!=null);return a.length&>.throwError(`cannot override ${a.map(u=>JSON.stringify(u)).join(",")}`,T.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:a}),s})}function c3(t,e){return function(...r){return Fu(t,e,r)}}function f3(t,e){const r=t.signer||t.provider;return function(...n){return Ui(this,void 0,void 0,function*(){r||gt.throwError("estimate require a provider or signer",T.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield Fu(t,e,n);return yield r.estimateGas(i)})}}function d3(t,e){const r=e.wait.bind(e);e.wait=n=>r(n).then(i=>(i.events=i.logs.map(o=>{let s=nr(o),l=null;try{l=t.interface.parseLog(o)}catch{}return l&&(s.args=l.args,s.decode=(a,u)=>t.interface.decodeEventLog(l.eventFragment,a,u),s.event=l.name,s.eventSignature=l.signature),s.removeListener=()=>t.provider,s.getBlock=()=>t.provider.getBlock(i.blockHash),s.getTransaction=()=>t.provider.getTransaction(i.transactionHash),s.getTransactionReceipt=()=>Promise.resolve(i),s}),i))}function i1(t,e,r){const n=t.signer||t.provider;return function(...i){return Ui(this,void 0,void 0,function*(){let o;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const a=it(i.pop());a.blockTag!=null&&(o=yield a.blockTag),delete a.blockTag,i.push(a)}t.deployTransaction!=null&&(yield t._deployed(o));const s=yield Fu(t,e,i),l=yield n.call(s,o);try{let a=t.interface.decodeFunctionResult(e,l);return r&&e.outputs.length===1&&(a=a[0]),a}catch(a){throw a.code===T.errors.CALL_EXCEPTION&&(a.address=t.address,a.args=i,a.transaction=s),a}})}}function h3(t,e){return function(...r){return Ui(this,void 0,void 0,function*(){t.signer||gt.throwError("sending a transaction requires a signer",T.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),t.deployTransaction!=null&&(yield t._deployed());const n=yield Fu(t,e,r),i=yield t.signer.sendTransaction(n);return d3(t,i),i})}}function Op(t,e,r){return e.constant?i1(t,e,r):h3(t,e)}function o1(t){return t.address&&(t.topics==null||t.topics.length===0)?"*":(t.address||"*")+"@"+(t.topics?t.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):"")}class il{constructor(e,r){z(this,"tag",e),z(this,"filter",r),this._listeners=[]}addListener(e,r){this._listeners.push({listener:e,once:r})}removeListener(e){let r=!1;this._listeners=this._listeners.filter(n=>r||n.listener!==e?!0:(r=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){const r=this.listenerCount();return this._listeners=this._listeners.filter(n=>{const i=e.slice();return setTimeout(()=>{n.listener.apply(this,i)},0),!n.once}),r}prepareEvent(e){}getEmit(e){return[e]}}class p3 extends il{constructor(){super("error",null)}}class Lp extends il{constructor(e,r,n,i){const o={address:e};let s=r.getEventTopic(n);i?(s!==i[0]&>.throwArgumentError("topic mismatch","topics",i),o.topics=i.slice()):o.topics=[s],super(o1(o),o),z(this,"address",e),z(this,"interface",r),z(this,"fragment",n)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(r,n)=>this.interface.decodeEventLog(this.fragment,r,n);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(r){e.args=null,e.decodeError=r}}getEmit(e){const r=Gx(e.args);if(r.length)throw r[0].error;const n=(e.args||[]).slice();return n.push(e),n}}class Bp extends il{constructor(e,r){super("*",{address:e}),z(this,"address",e),z(this,"interface",r)}prepareEvent(e){super.prepareEvent(e);try{const r=this.interface.parseLog(e);e.event=r.name,e.eventSignature=r.signature,e.decode=(n,i)=>this.interface.decodeEventLog(r.eventFragment,n,i),e.args=r.args}catch{}}}class m3{constructor(e,r,n){z(this,"interface",fr(new.target,"getInterface")(r)),n==null?(z(this,"provider",null),z(this,"signer",null)):El.isSigner(n)?(z(this,"provider",n.provider||null),z(this,"signer",n)):qo.isProvider(n)?(z(this,"provider",n),z(this,"signer",null)):gt.throwArgumentError("invalid signer or provider","signerOrProvider",n),z(this,"callStatic",{}),z(this,"estimateGas",{}),z(this,"functions",{}),z(this,"populateTransaction",{}),z(this,"filters",{});{const s={};Object.keys(this.interface.events).forEach(l=>{const a=this.interface.events[l];z(this.filters,l,(...u)=>({address:this.address,topics:this.interface.encodeFilterTopics(a,u)})),s[a.name]||(s[a.name]=[]),s[a.name].push(l)}),Object.keys(s).forEach(l=>{const a=s[l];a.length===1?z(this.filters,l,this.filters[a[0]]):gt.warn(`Duplicate definition of ${l} (${a.join(", ")})`)})}if(z(this,"_runningEvents",{}),z(this,"_wrappedEmits",{}),e==null&>.throwArgumentError("invalid contract address or ENS name","addressOrName",e),z(this,"address",e),this.provider)z(this,"resolvedAddress",tu(this.provider,e));else try{z(this,"resolvedAddress",Promise.resolve(mt(e)))}catch{gt.throwError("provider is required to use ENS name as contract address",T.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(s=>{});const i={},o={};Object.keys(this.interface.functions).forEach(s=>{const l=this.interface.functions[s];if(o[s]){gt.warn(`Duplicate ABI entry for ${JSON.stringify(s)}`);return}o[s]=!0;{const a=l.name;i[`%${a}`]||(i[`%${a}`]=[]),i[`%${a}`].push(s)}this[s]==null&&z(this,s,Op(this,l,!0)),this.functions[s]==null&&z(this.functions,s,Op(this,l,!1)),this.callStatic[s]==null&&z(this.callStatic,s,i1(this,l,!0)),this.populateTransaction[s]==null&&z(this.populateTransaction,s,c3(this,l)),this.estimateGas[s]==null&&z(this.estimateGas,s,f3(this,l))}),Object.keys(i).forEach(s=>{const l=i[s];if(l.length>1)return;s=s.substring(1);const a=l[0];try{this[s]==null&&z(this,s,this[a])}catch{}this.functions[s]==null&&z(this.functions,s,this.functions[a]),this.callStatic[s]==null&&z(this.callStatic,s,this.callStatic[a]),this.populateTransaction[s]==null&&z(this.populateTransaction,s,this.populateTransaction[a]),this.estimateGas[s]==null&&z(this.estimateGas,s,this.estimateGas[a])})}static getContractAddress(e){return Nh(e)}static getInterface(e){return ad.isInterface(e)?e:new ad(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(r=>(r==="0x"&>.throwError("contract not deployed",T.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||gt.throwError("sending a transactions require a signer",T.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const r=it(e||{});return["from","to"].forEach(function(n){r[n]!=null&>.throwError("cannot override "+n,T.errors.UNSUPPORTED_OPERATION,{operation:n})}),r.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(r))}connect(e){typeof e=="string"&&(e=new Ph(e,this.provider));const r=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&z(r,"deployTransaction",this.deployTransaction),r}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return ld.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if(typeof e=="string"){if(e==="error")return this._normalizeRunningEvent(new p3);if(e==="event")return this._normalizeRunningEvent(new il("event",null));if(e==="*")return this._normalizeRunningEvent(new Bp(this.address,this.interface));const r=this.interface.getEvent(e);return this._normalizeRunningEvent(new Lp(this.address,this.interface,r))}if(e.topics&&e.topics.length>0){try{const n=e.topics[0];if(typeof n!="string")throw new Error("invalid topic");const i=this.interface.getEvent(n);return this._normalizeRunningEvent(new Lp(this.address,this.interface,i,e.topics))}catch{}const r={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new il(o1(r),r))}return this._normalizeRunningEvent(new Bp(this.address,this.interface))}_checkRunningEvents(e){if(e.listenerCount()===0){delete this._runningEvents[e.tag];const r=this._wrappedEmits[e.tag];r&&e.filter&&(this.provider.off(e.filter,r),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,r,n){const i=nr(r);return i.removeListener=()=>{n&&(e.removeListener(n),this._checkRunningEvents(e))},i.getBlock=()=>this.provider.getBlock(r.blockHash),i.getTransaction=()=>this.provider.getTransaction(r.transactionHash),i.getTransactionReceipt=()=>this.provider.getTransactionReceipt(r.transactionHash),e.prepareEvent(i),i}_addEventListener(e,r,n){if(this.provider||gt.throwError("events require a provider or a signer with a provider",T.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(r,n),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const i=o=>{let s=this._wrapEvent(e,o,r);if(s.decodeError==null)try{const l=e.getEmit(s);this.emit(e.filter,...l)}catch(l){s.decodeError=l.error}e.filter!=null&&this.emit("event",s),s.decodeError!=null&&this.emit("error",s.decodeError,s)};this._wrappedEmits[e.tag]=i,e.filter!=null&&this.provider.on(e.filter,i)}}queryFilter(e,r,n){const i=this._getRunningEvent(e),o=it(i.filter);return typeof r=="string"&&pe(r,32)?(n!=null&>.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),o.blockHash=r):(o.fromBlock=r??0,o.toBlock=n??"latest"),this.provider.getLogs(o).then(s=>s.map(l=>this._wrapEvent(i,l,null)))}on(e,r){return this._addEventListener(this._getRunningEvent(e),r,!1),this}once(e,r){return this._addEventListener(this._getRunningEvent(e),r,!0),this}emit(e,...r){if(!this.provider)return!1;const n=this._getRunningEvent(e),i=n.run(r)>0;return this._checkRunningEvents(n),i}listenerCount(e){return this.provider?e==null?Object.keys(this._runningEvents).reduce((r,n)=>r+this._runningEvents[n].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(e==null){const r=[];for(let n in this._runningEvents)this._runningEvents[n].listeners().forEach(i=>{r.push(i)});return r}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(e==null){for(const n in this._runningEvents){const i=this._runningEvents[n];i.removeAllListeners(),this._checkRunningEvents(i)}return this}const r=this._getRunningEvent(e);return r.removeAllListeners(),this._checkRunningEvents(r),this}off(e,r){if(!this.provider)return this;const n=this._getRunningEvent(e);return n.removeListener(r),this._checkRunningEvents(n),this}removeListener(e,r){return this.off(e,r)}}class g3 extends m3{}class s1{constructor(e){z(this,"alphabet",e),z(this,"base",e.length),z(this,"_alphabetMap",{}),z(this,"_leader",e.charAt(0));for(let r=0;r0;)n.push(s%this.base),s=s/this.base|0}let i="";for(let o=0;r[o]===0&&o=0;--o)i+=this.alphabet[n[o]];return i}decode(e){if(typeof e!="string")throw new TypeError("Expected String");let r=[];if(e.length===0)return new Uint8Array(r);r.push(0);for(let n=0;n>=8;for(;o>0;)r.push(o&255),o>>=8}for(let n=0;e[n]===this._leader&&n0;e--){const r=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[r],t[r]=n}return t}const y3="networks/5.7.1",jp=new T(y3);function w3(t){return t&&typeof t.renetwork=="function"}function bn(t){const e=function(r,n){n==null&&(n={});const i=[];if(r.InfuraProvider&&n.infura!=="-")try{i.push(new r.InfuraProvider(t,n.infura))}catch{}if(r.EtherscanProvider&&n.etherscan!=="-")try{i.push(new r.EtherscanProvider(t,n.etherscan))}catch{}if(r.AlchemyProvider&&n.alchemy!=="-")try{i.push(new r.AlchemyProvider(t,n.alchemy))}catch{}if(r.PocketProvider&&n.pocket!=="-"){const o=["goerli","ropsten","rinkeby","sepolia"];try{const s=new r.PocketProvider(t,n.pocket);s.network&&o.indexOf(s.network.name)===-1&&i.push(s)}catch{}}if(r.CloudflareProvider&&n.cloudflare!=="-")try{i.push(new r.CloudflareProvider(t))}catch{}if(r.AnkrProvider&&n.ankr!=="-")try{const o=["ropsten"],s=new r.AnkrProvider(t,n.ankr);s.network&&o.indexOf(s.network.name)===-1&&i.push(s)}catch{}if(i.length===0)return null;if(r.FallbackProvider){let o=1;return n.quorum!=null?o=n.quorum:t==="homestead"&&(o=2),new r.FallbackProvider(i,o)}return i[0]};return e.renetwork=function(r){return bn(r)},e}function ru(t,e){const r=function(n,i){return n.JsonRpcProvider?new n.JsonRpcProvider(t,e):null};return r.renetwork=function(n){return ru(t,n)},r}const Up={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:bn("homestead")},Fp={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:bn("ropsten")},zp={chainId:63,name:"classicMordor",_defaultProvider:ru("https://www.ethercluster.com/mordor","classicMordor")},Wl={unspecified:{chainId:0,name:"unspecified"},homestead:Up,mainnet:Up,morden:{chainId:2,name:"morden"},ropsten:Fp,testnet:Fp,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:bn("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:bn("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:bn("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:bn("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:ru("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:zp,classicTestnet:zp,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:ru("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:bn("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:bn("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function Th(t){if(t==null)return null;if(typeof t=="number"){for(const n in Wl){const i=Wl[n];if(i.chainId===t)return{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress||null,_defaultProvider:i._defaultProvider||null}}return{chainId:t,name:"unknown"}}if(typeof t=="string"){const n=Wl[t];return n==null?null:{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress,_defaultProvider:n._defaultProvider||null}}const e=Wl[t.name];if(!e)return typeof t.chainId!="number"&&jp.throwArgumentError("invalid network chainId","network",t),t;t.chainId!==0&&t.chainId!==e.chainId&&jp.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;return r==null&&e._defaultProvider&&(w3(e._defaultProvider)?r=e._defaultProvider.renetwork(t):r=e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}const E3="web/5.7.1";var x3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};function A3(t,e){return x3(this,void 0,void 0,function*(){e==null&&(e={});const r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};if(e.skipFetchSetup!==!0&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),e.fetchOptions!=null){const s=e.fetchOptions;s.mode&&(r.mode=s.mode),s.cache&&(r.cache=s.cache),s.credentials&&(r.credentials=s.credentials),s.redirect&&(r.redirect=s.redirect),s.referrer&&(r.referrer=s.referrer)}const n=yield fetch(t,r),i=yield n.arrayBuffer(),o={};return n.headers.forEach?n.headers.forEach((s,l)=>{o[l.toLowerCase()]=s}):n.headers.keys().forEach(s=>{o[s.toLowerCase()]=n.headers.get(s)}),{headers:o,statusCode:n.status,statusMessage:n.statusText,body:se(new Uint8Array(i))}})}var b3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Br=new T(E3);function $p(t){return new Promise(e=>{setTimeout(e,t)})}function Qn(t,e){if(t==null)return null;if(typeof t=="string")return t;if(bh(t)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return wl(t)}catch{}return re(t)}return t}function _3(t){return mr(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function S3(t,e,r){const n=typeof t=="object"&&t.throttleLimit!=null?t.throttleLimit:12;Br.assertArgument(n>0&&n%1===0,"invalid connection throttle limit","connection.throttleLimit",n);const i=typeof t=="object"?t.throttleCallback:null,o=typeof t=="object"&&typeof t.throttleSlotInterval=="number"?t.throttleSlotInterval:100;Br.assertArgument(o>0&&o%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const s=typeof t=="object"?!!t.errorPassThrough:!1,l={};let a=null;const u={method:"GET"};let c=!1,d=2*60*1e3;if(typeof t=="string")a=t;else if(typeof t=="object"){if((t==null||t.url==null)&&Br.throwArgumentError("missing URL","connection.url",t),a=t.url,typeof t.timeout=="number"&&t.timeout>0&&(d=t.timeout),t.headers)for(const E in t.headers)l[E.toLowerCase()]={key:E,value:String(t.headers[E])},["if-none-match","if-modified-since"].indexOf(E.toLowerCase())>=0&&(c=!0);if(u.allowGzip=!!t.allowGzip,t.user!=null&&t.password!=null){a.substring(0,6)!=="https:"&&t.allowInsecureAuthentication!==!0&&Br.throwError("basic authentication requires a secure https url",T.errors.INVALID_ARGUMENT,{argument:"url",url:a,user:t.user,password:"[REDACTED]"});const E=t.user+":"+t.password;l.authorization={key:"Authorization",value:"Basic "+Ay(mr(E))}}t.skipFetchSetup!=null&&(u.skipFetchSetup=!!t.skipFetchSetup),t.fetchOptions!=null&&(u.fetchOptions=it(t.fetchOptions))}const m=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),v=a?a.match(m):null;if(v)try{const E={statusCode:200,statusMessage:"OK",headers:{"content-type":v[1]||"text/plain"},body:v[2]?xy(v[3]):_3(v[3])};let w=E.body;return r&&(w=r(E.body,E)),Promise.resolve(w)}catch(E){Br.throwError("processing response error",T.errors.SERVER_ERROR,{body:Qn(v[1],v[2]),error:E,requestBody:null,requestMethod:"GET",url:a})}e&&(u.method="POST",u.body=e,l["content-type"]==null&&(l["content-type"]={key:"Content-Type",value:"application/octet-stream"}),l["content-length"]==null&&(l["content-length"]={key:"Content-Length",value:String(e.length)}));const p={};Object.keys(l).forEach(E=>{const w=l[E];p[w.key]=w.value}),u.headers=p;const x=function(){let E=null;return{promise:new Promise(function(O,B){d&&(E=setTimeout(()=>{E!=null&&(E=null,B(Br.makeError("timeout",T.errors.TIMEOUT,{requestBody:Qn(u.body,p["content-type"]),requestMethod:u.method,timeout:d,url:a})))},d))}),cancel:function(){E!=null&&(clearTimeout(E),E=null)}}}(),k=function(){return b3(this,void 0,void 0,function*(){for(let E=0;E=300)&&(x.cancel(),Br.throwError("bad response",T.errors.SERVER_ERROR,{status:w.statusCode,headers:w.headers,body:Qn(_,w.headers?w.headers["content-type"]:null),requestBody:Qn(u.body,p["content-type"]),requestMethod:u.method,url:a})),r)try{const O=yield r(_,w);return x.cancel(),O}catch(O){if(O.throttleRetry&&E{let l=null;if(o!=null)try{l=JSON.parse(wl(o))}catch(a){Br.throwError("invalid JSON",T.errors.SERVER_ERROR,{body:o,error:a})}return r&&(l=r(l,s)),l},i=null;if(e!=null){i=mr(e);const o=typeof t=="string"?{url:t}:it(t);o.headers?Object.keys(o.headers).filter(l=>l.toLowerCase()==="content-type").length!==0||(o.headers=it(o.headers),o.headers["content-type"]="application/json"):o.headers={"content-type":"application/json"},t=o}return S3(t,i,n)}function ho(t,e){return e||(e={}),e=it(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(r,n){let i=null,o=!1;const s=()=>o?!1:(o=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout(()=>{s()&&n(new Error("timeout"))},e.timeout));const l=e.retryLimit;let a=0;function u(){return t().then(function(c){if(c!==void 0)s()&&r(c);else if(e.oncePoll)e.oncePoll.once("poll",u);else if(e.onceBlock)e.onceBlock.once("block",u);else if(!o){if(a++,a>l){s()&&n(new Error("retry limit reached"));return}let d=e.interval*parseInt(String(Math.random()*Math.pow(2,a)));de.ceiling&&(d=e.ceiling),setTimeout(u,d)}return null},function(c){s()&&n(c)})}u()})}var nu="qpzry9x8gf2tvdw0s3jn54khce6mua7l",md={};for(var Gl=0;Gl>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function l1(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=bo(e)^n>>5}for(e=bo(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=l1(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",o=0;o>5)throw new Error("Non 5-bit word");n=bo(n)^s,i+=nu.charAt(s)}for(o=0;o<6;++o)n=bo(n);for(n^=1,o=0;o<6;++o){var l=n>>(5-o)*5&31;i+=nu.charAt(l)}return i}function a1(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var o=t.slice(0,i),s=t.slice(i+1);if(s.length<6)return"Data too short";var l=l1(o);if(typeof l=="string")return l;for(var a=[],u=0;u=s.length)&&a.push(d)}return l!==1?"Invalid checksum for "+t:{prefix:o,words:a}}function N3(){var t=a1.apply(null,arguments);if(typeof t=="object")return t}function P3(t){var e=a1.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function zu(t,e,r,n){for(var i=0,o=0,s=(1<=r;)o-=r,l.push(i>>o&s);if(n)o>0&&l.push(i<=e)return"Excess padding";if(i<this.data(d,!0);return e.transaction={hash:s,type:u,accessList:ee.allowNull(this.accessList.bind(this),null),blockHash:ee.allowNull(s,null),blockNumber:ee.allowNull(a,null),transactionIndex:ee.allowNull(a,null),confirmations:ee.allowNull(a,null),from:r,gasPrice:ee.allowNull(n),maxPriorityFeePerGas:ee.allowNull(n),maxFeePerGas:ee.allowNull(n),gasLimit:n,to:ee.allowNull(r,null),value:n,nonce:a,data:o,r:ee.allowNull(this.uint256),s:ee.allowNull(this.uint256),v:ee.allowNull(a),creates:ee.allowNull(r,null),raw:ee.allowNull(o)},e.transactionRequest={from:ee.allowNull(r),nonce:ee.allowNull(a),gasLimit:ee.allowNull(n),gasPrice:ee.allowNull(n),maxPriorityFeePerGas:ee.allowNull(n),maxFeePerGas:ee.allowNull(n),to:ee.allowNull(r),value:ee.allowNull(n),data:ee.allowNull(c),type:ee.allowNull(a),accessList:ee.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:s,address:r,topics:ee.arrayOf(s),data:o,logIndex:a,blockHash:s},e.receipt={to:ee.allowNull(this.address,null),from:ee.allowNull(this.address,null),contractAddress:ee.allowNull(r,null),transactionIndex:a,root:ee.allowNull(l),gasUsed:n,logsBloom:ee.allowNull(o),blockHash:s,transactionHash:s,logs:ee.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:ee.allowNull(a,null),cumulativeGasUsed:n,effectiveGasPrice:ee.allowNull(n),status:ee.allowNull(a),type:u},e.block={hash:ee.allowNull(s),parentHash:s,number:a,timestamp:a,nonce:ee.allowNull(l),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:ee.allowNull(r),extraData:o,transactions:ee.allowNull(ee.arrayOf(s)),baseFeePerGas:ee.allowNull(n)},e.blockWithTransactions=it(e.block),e.blockWithTransactions.transactions=ee.allowNull(ee.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:ee.allowNull(i,void 0),toBlock:ee.allowNull(i,void 0),blockHash:ee.allowNull(s,void 0),address:ee.allowNull(r,void 0),topics:ee.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:ee.allowNull(a),blockHash:ee.allowNull(s),transactionIndex:a,removed:ee.allowNull(this.boolean.bind(this)),address:r,data:ee.allowFalsish(o,"0x"),topics:ee.arrayOf(s),transactionHash:s,logIndex:a},e}accessList(e){return qi(e||[])}number(e){return e==="0x"?0:V.from(e).toNumber()}type(e){return e==="0x"||e==null?0:V.from(e).toNumber()}bigNumber(e){return V.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,r){return typeof e=="string"&&(!r&&e.substring(0,2)!=="0x"&&(e="0x"+e),pe(e))?e.toLowerCase():ss.throwArgumentError("invalid hash","value",e)}data(e,r){const n=this.hex(e,r);if(n.length%2!==0)throw new Error("invalid data; odd-length - "+e);return n}address(e){return mt(e)}callAddress(e){if(!pe(e,32))return null;const r=mt(It(e,12));return r===cA?null:r}contractAddress(e){return Nh(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||pe(e))return Tu(e);throw new Error("invalid blockTag")}hash(e,r){const n=this.hex(e,r);return On(n)!==32?ss.throwArgumentError("invalid hash","value",e):n}difficulty(e){if(e==null)return null;const r=V.from(e);try{return r.toNumber()}catch{}return null}uint256(e){if(!pe(e))throw new Error("invalid uint256");return pt(e,32)}_block(e,r){e.author!=null&&e.miner==null&&(e.miner=e.author);const n=e._difficulty!=null?e._difficulty:e.difficulty,i=ee.check(r,e);return i._difficulty=n==null?null:V.from(n),i}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return ee.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&V.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);const r=ee.check(this.formats.transaction,e);if(e.chainId!=null){let n=e.chainId;pe(n)&&(n=V.from(n).toNumber()),r.chainId=n}else{let n=e.networkId;n==null&&r.v==null&&(n=e.chainId),pe(n)&&(n=V.from(n).toNumber()),typeof n!="number"&&r.v!=null&&(n=(r.v-35)/2,n<0&&(n=0),n=parseInt(n)),typeof n!="number"&&(n=0),r.chainId=n}return r.blockHash&&r.blockHash.replace(/0/g,"")==="x"&&(r.blockHash=null),r}transaction(e){return a3(e)}receiptLog(e){return ee.check(this.formats.receiptLog,e)}receipt(e){const r=ee.check(this.formats.receipt,e);if(r.root!=null)if(r.root.length<=4){const n=V.from(r.root).toNumber();n===0||n===1?(r.status!=null&&r.status!==n&&ss.throwArgumentError("alt-root-status/status mismatch","value",{root:r.root,status:r.status}),r.status=n,delete r.root):ss.throwArgumentError("invalid alt-root-status","value.root",r.root)}else r.root.length!==66&&ss.throwArgumentError("invalid root hash","value.root",r.root);return r.status!=null&&(r.byzantium=!0),r}topics(e){return Array.isArray(e)?e.map(r=>this.topics(r)):e!=null?this.hash(e,!0):null}filter(e){return ee.check(this.formats.filter,e)}filterLog(e){return ee.check(this.formats.filterLog,e)}static check(e,r){const n={};for(const i in e)try{const o=e[i](r[i]);o!==void 0&&(n[i]=o)}catch(o){throw o.checkKey=i,o.checkValue=r[i],o}return n}static allowNull(e,r){return function(n){return n==null?r:e(n)}}static allowFalsish(e,r){return function(n){return n?e(n):r}}static arrayOf(e){return function(r){if(!Array.isArray(r))throw new Error("not an array");const n=[];return r.forEach(function(i){n.push(e(i))}),n}}}function u1(t){return t&&typeof t.isCommunityResource=="function"}function gd(t){return u1(t)&&t.isCommunityResource()}let qp=!1;function bl(){qp||(qp=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var ae=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const he=new T($t),O3=10;function Wp(t){return t==null?"null":(On(t)!==32&&he.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function Gp(t){for(t=t.slice();t.length>0&&t[t.length-1]==null;)t.pop();return t.map(e=>{if(Array.isArray(e)){const r={};e.forEach(i=>{r[Wp(i)]=!0});const n=Object.keys(r);return n.sort(),n.join("|")}else return Wp(e)}).join("&")}function L3(t){return t===""?[]:t.split(/&/g).map(e=>{if(e==="")return[];const r=e.split("|").map(n=>n==="null"?null:n);return r.length===1?r[0]:r})}function Gi(t){if(typeof t=="string"){if(t=t.toLowerCase(),On(t)===32)return"tx:"+t;if(t.indexOf(":")===-1)return t}else{if(Array.isArray(t))return"filter:*:"+Gp(t);if(fb.isForkEvent(t))throw he.warn("not implemented"),new Error("not implemented");if(t&&typeof t=="object")return"filter:"+(t.address||"*")+":"+Gp(t.topics||[])}throw new Error("invalid event - "+t)}function ls(){return new Date().getTime()}function Vp(t){return new Promise(e=>{setTimeout(e,t)})}const B3=["block","network","pending","poll"];class D3{constructor(e,r,n){z(this,"tag",e),z(this,"listener",r),z(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){const e=this.tag.split(":");if(e[0]!=="filter")return null;const r=e[1],n=L3(e[2]),i={};return n.length>0&&(i.topics=n),r&&r!=="*"&&(i.address=r),i}pollable(){return this.tag.indexOf(":")>=0||B3.indexOf(this.tag)>=0}}const j3={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Yc(t){return pt(V.from(t).toHexString(),32)}function Kp(t){return pd.encode(Ut([t,It(Dp(Dp(t)),0,4)]))}const c1=new RegExp("^(ipfs)://(.*)$","i"),Qp=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),c1,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function wa(t,e){try{return wl(ol(t,e))}catch{}return null}function ol(t,e){if(t==="0x")return null;const r=V.from(It(t,e,e+32)).toNumber(),n=V.from(It(t,r,r+32)).toNumber();return It(t,r+32,r+32+n)}function Xc(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):he.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function Jp(t){const e=se(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function U3(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}function f1(t){const e=[];let r=0;for(let n=0;nV.from(e).eq(1)).catch(e=>{if(e.code===T.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,r){return ae(this,void 0,void 0,function*(){const n={to:this.address,ccipReadEnabled:!0,data:Xt([e,ma(this.name),r||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,n.data=Xt(["0x9061b923",f1([JA(this.name),n.data])]));try{let o=yield this.provider.call(n);return se(o).length%32===4&&he.throwError("resolver threw error",T.errors.CALL_EXCEPTION,{transaction:n,data:o}),i&&(o=ol(o,0)),o}catch(o){if(o.code===T.errors.CALL_EXCEPTION)return null;throw o}})}_fetchBytes(e,r){return ae(this,void 0,void 0,function*(){const n=yield this._fetch(e,r);return n!=null?ol(n,0):null})}_getAddress(e,r){const n=j3[String(e)];if(n==null&&he.throwError(`unsupported coin type: ${e}`,T.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),n.ilk==="eth")return this.provider.formatter.address(r);const i=se(r);if(n.p2pkh!=null){const o=r.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(o){const s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return Kp(Ut([[n.p2pkh],"0x"+o[2]]))}}if(n.p2sh!=null){const o=r.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(o){const s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return Kp(Ut([[n.p2sh],"0x"+o[2]]))}}if(n.prefix!=null){const o=i[1];let s=i[0];if(s===0?o!==20&&o!==32&&(s=-1):s=-1,s>=0&&i.length===2+o&&o>=1&&o<=75){const l=Hp.toWords(i.slice(2));return l.unshift(s),Hp.encode(n.prefix,l)}}return null}getAddress(e){return ae(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===pA?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===T.errors.CALL_EXCEPTION)return null;throw i}const r=yield this._fetchBytes("0xf1cb7e06",Yc(e));if(r==null||r==="0x")return null;const n=this._getAddress(e,r);return n==null&&he.throwError("invalid or unsupported coin data",T.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:r}),n})}getAvatar(){return ae(this,void 0,void 0,function*(){const e=[{type:"name",content:this.name}];try{const r=yield this.getText("avatar");if(r==null)return null;for(let n=0;ns[a])}return he.throwError("invalid or unsupported content hash data",T.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return ae(this,void 0,void 0,function*(){let r=mr(e);r=Ut([Yc(64),Yc(r.length),r]),r.length%32!==0&&(r=Ut([r,pt("0x",32-e.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",re(r));return n==null||n==="0x"?null:wl(n)})}}let Zc=null,F3=1;class $u extends qo{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),z(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(r=>{}),this._ready().catch(r=>{});else{const r=fr(new.target,"getNetwork")(e);r?(z(this,"_network",r),this.emit("network",r,null)):he.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return ae(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||he.throwError("no network detected",T.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:z(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return ho(()=>this._ready().then(e=>e,e=>{if(!(e.code===T.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return Zc==null&&(Zc=new ee),Zc}static getNetwork(e){return Th(e??"homestead")}ccipReadFetch(e,r,n){return ae(this,void 0,void 0,function*(){if(this.disableCcipRead||n.length===0)return null;const i=e.to.toLowerCase(),o=r.toLowerCase(),s=[];for(let l=0;l=0?null:JSON.stringify({data:o,sender:i}),d=yield Al({url:u,errorPassThrough:!0},c,(v,p)=>(v.status=p.statusCode,v));if(d.data)return d.data;const m=d.message||"unknown error";if(d.status>=400&&d.status<500)return he.throwError(`response not found during CCIP fetch: ${m}`,T.errors.SERVER_ERROR,{url:a,errorMessage:m});s.push(m)}return he.throwError(`error encountered during CCIP fetch: ${s.map(l=>JSON.stringify(l)).join(", ")}`,T.errors.SERVER_ERROR,{urls:n,errorMessages:s})})}_getInternalBlockNumber(e){return ae(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const i=this._internalBlockNumber;try{const o=yield i;if(ls()-o.respTime<=e)return o.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const r=ls(),n=yt({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(i=>null,i=>i)}).then(({blockNumber:i,networkError:o})=>{if(o)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),o;const s=ls();return i=V.from(i).toNumber(),i{this._internalBlockNumber===n&&(this._internalBlockNumber=null)}),(yield n).blockNumber})}poll(){return ae(this,void 0,void 0,function*(){const e=F3++,r=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(i){this.emit("error",i);return}if(this._setFastBlockNumber(n),this.emit("poll",e,n),n===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)he.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",he.makeError("network block skew detected",T.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let i=this._emitted.block+1;i<=n;i++)this.emit("block",i);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach(i=>{if(i==="block")return;const o=this._emitted[i];o!=="pending"&&n-o>12&&delete this._emitted[i]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=n-1),this._events.forEach(i=>{switch(i.type){case"tx":{const o=i.hash;let s=this.getTransactionReceipt(o).then(l=>(!l||l.blockNumber==null||(this._emitted["t:"+o]=l.blockNumber,this.emit(o,l)),null)).catch(l=>{this.emit("error",l)});r.push(s);break}case"filter":{if(!i._inflight){i._inflight=!0,i._lastBlockNumber===-2&&(i._lastBlockNumber=n-1);const o=i.filter;o.fromBlock=i._lastBlockNumber+1,o.toBlock=n;const s=o.toBlock-this._maxFilterBlockRange;s>o.fromBlock&&(o.fromBlock=s),o.fromBlock<0&&(o.fromBlock=0);const l=this.getLogs(o).then(a=>{i._inflight=!1,a.length!==0&&a.forEach(u=>{u.blockNumber>i._lastBlockNumber&&(i._lastBlockNumber=u.blockNumber),this._emitted["b:"+u.blockHash]=u.blockNumber,this._emitted["t:"+u.transactionHash]=u.blockNumber,this.emit(o,u)})}).catch(a=>{this.emit("error",a),i._inflight=!1});r.push(l)}break}}}),this._lastBlockNumber=n,Promise.all(r).then(()=>{this.emit("didPoll",e)}).catch(i=>{this.emit("error",i)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return ae(this,void 0,void 0,function*(){return he.throwError("provider does not support network detection",T.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return ae(this,void 0,void 0,function*(){const e=yield this._ready(),r=yield this.detectNetwork();if(e.chainId!==r.chainId){if(this.anyNetwork)return this._network=r,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",r,e),yield Vp(0),this._network;const n=he.makeError("underlying network changed",T.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:r});throw this.emit("error",n),n}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const e=ls();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(r=>((this._fastBlockNumber==null||r>this._fastBlockNumber)&&(this._fastBlockNumber=r),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,r,n){return ae(this,void 0,void 0,function*(){return this._waitForTransaction(e,r??1,n||0,null)})}_waitForTransaction(e,r,n,i){return ae(this,void 0,void 0,function*(){const o=yield this.getTransactionReceipt(e);return(o?o.confirmations:0)>=r?o:new Promise((s,l)=>{const a=[];let u=!1;const c=function(){return u?!0:(u=!0,a.forEach(m=>{m()}),!1)},d=m=>{m.confirmations{this.removeListener(e,d)}),i){let m=i.startBlock,v=null;const p=x=>ae(this,void 0,void 0,function*(){u||(yield Vp(1e3),this.getTransactionCount(i.from).then(k=>ae(this,void 0,void 0,function*(){if(!u){if(k<=i.nonce)m=x;else{{const E=yield this.getTransaction(e);if(E&&E.blockNumber!=null)return}for(v==null&&(v=m-3,v{u||this.once("block",p)}))});if(u)return;this.once("block",p),a.push(()=>{this.removeListener("block",p)})}if(typeof n=="number"&&n>0){const m=setTimeout(()=>{c()||l(he.makeError("timeout exceeded",T.errors.TIMEOUT,{timeout:n}))},n);m.unref&&m.unref(),a.push(()=>{clearTimeout(m)})}})})}getBlockNumber(){return ae(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return V.from(e)}catch(r){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:r})}})}getBalance(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getBalance",n);try{return V.from(i)}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getBalance",params:n,result:i,error:o})}})}getTransactionCount(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getTransactionCount",n);try{return V.from(i).toNumber()}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:i,error:o})}})}getCode(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getCode",n);try{return re(i)}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getCode",params:n,result:i,error:o})}})}getStorageAt(e,r,n){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(n),position:Promise.resolve(r).then(s=>Tu(s))}),o=yield this.perform("getStorageAt",i);try{return re(o)}catch(s){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:o,error:s})}})}_wrapTransaction(e,r,n){if(r!=null&&On(r)!==32)throw new Error("invalid response - sendTransaction");const i=e;return r!=null&&e.hash!==r&&he.throwError("Transaction hash mismatch from Provider.sendTransaction.",T.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:r}),i.wait=(o,s)=>ae(this,void 0,void 0,function*(){o==null&&(o=1),s==null&&(s=0);let l;o!==0&&n!=null&&(l={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:n});const a=yield this._waitForTransaction(e.hash,o,s,l);return a==null&&o===0?null:(this._emitted["t:"+e.hash]=a.blockNumber,a.status===0&&he.throwError("transaction failed",T.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:a}),a)}),i}sendTransaction(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield Promise.resolve(e).then(o=>re(o)),n=this.formatter.transaction(e);n.confirmations==null&&(n.confirmations=0);const i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const o=yield this.perform("sendTransaction",{signedTransaction:r});return this._wrapTransaction(n,o,i)}catch(o){throw o.transaction=n,o.transactionHash=n.hash,o}})}_getTransactionRequest(e){return ae(this,void 0,void 0,function*(){const r=yield e,n={};return["from","to"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?this._getAddress(o):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?V.from(o):null))}),["type"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o??null))}),r.accessList&&(n.accessList=this.formatter.accessList(r.accessList)),["data"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?re(o):null))}),this.formatter.transactionRequest(yield yt(n))})}_getFilter(e){return ae(this,void 0,void 0,function*(){e=yield e;const r={};return e.address!=null&&(r.address=this._getAddress(e.address)),["blockHash","topics"].forEach(n=>{e[n]!=null&&(r[n]=e[n])}),["fromBlock","toBlock"].forEach(n=>{e[n]!=null&&(r[n]=this._getBlockTag(e[n]))}),this.formatter.filter(yield yt(r))})}_call(e,r,n){return ae(this,void 0,void 0,function*(){n>=O3&&he.throwError("CCIP read exceeded maximum redirections",T.errors.SERVER_ERROR,{redirects:n,transaction:e});const i=e.to,o=yield this.perform("call",{transaction:e,blockTag:r});if(n>=0&&r==="latest"&&i!=null&&o.substring(0,10)==="0x556f1830"&&On(o)%32===4)try{const s=It(o,4),l=It(s,0,32);V.from(l).eq(i)||he.throwError("CCIP Read sender did not match",T.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o});const a=[],u=V.from(It(s,32,64)).toNumber(),c=V.from(It(s,u,u+32)).toNumber(),d=It(s,u+32);for(let E=0;Eae(this,void 0,void 0,function*(){const o=yield this.perform("getBlock",i);if(o==null)return i.blockHash!=null&&this._emitted["b:"+i.blockHash]==null||i.blockTag!=null&&n>this._emitted.block?null:void 0;if(r){let s=null;for(let a=0;athis._wrapTransaction(a)),l}return this.formatter.block(o)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return ho(()=>ae(this,void 0,void 0,function*(){const n=yield this.perform("getTransaction",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;const i=this.formatter.transactionResponse(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;s<=0&&(s=1),i.confirmations=s}return this._wrapTransaction(i)}),{oncePoll:this})})}getTransactionReceipt(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return ho(()=>ae(this,void 0,void 0,function*(){const n=yield this.perform("getTransactionReceipt",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;if(n.blockHash==null)return;const i=this.formatter.receipt(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;s<=0&&(s=1),i.confirmations=s}return i}),{oncePoll:this})})}getLogs(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield yt({filter:this._getFilter(e)}),n=yield this.perform("getLogs",r);return n.forEach(i=>{i.removed==null&&(i.removed=!1)}),ee.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)})}getEtherPrice(){return ae(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return ae(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&he.throwArgumentError("invalid BlockTag","blockTag",e);let r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return r+=e,r<0&&(r=0),this.formatter.blockTag(r)}return this.formatter.blockTag(e)})}getResolver(e){return ae(this,void 0,void 0,function*(){let r=e;for(;;){if(r===""||r==="."||e!=="eth"&&r==="eth")return null;const n=yield this._getResolver(r,"getResolver");if(n!=null){const i=new vd(this,n,e);return r!==e&&!(yield i.supportsWildcard())?null:i}r=r.split(".").slice(1).join(".")}})}_getResolver(e,r){return ae(this,void 0,void 0,function*(){r==null&&(r="ENS");const n=yield this.getNetwork();n.ensAddress||he.throwError("network does not support ENS",T.errors.UNSUPPORTED_OPERATION,{operation:r,network:n.name});try{const i=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+ma(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return ae(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(n){if(pe(e))throw n}typeof e!="string"&&he.throwArgumentError("invalid ENS name","name",e);const r=yield this.getResolver(e);return r?yield r.getAddress():null})}lookupAddress(e){return ae(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);const r=e.substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"lookupAddress");if(n==null)return null;const i=wa(yield this.call({to:n,data:"0x691f3431"+ma(r).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return ae(this,void 0,void 0,function*(){let r=null;if(pe(e)){const o=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",s=yield this._getResolver(o,"getAvatar");if(!s)return null;r=new vd(this,s,o);try{const l=yield r.getAvatar();if(l)return l.url}catch(l){if(l.code!==T.errors.CALL_EXCEPTION)throw l}try{const l=wa(yield this.call({to:s,data:"0x691f3431"+ma(o).substring(2)}),0);r=yield this.getResolver(l)}catch(l){if(l.code!==T.errors.CALL_EXCEPTION)throw l;return null}}else if(r=yield this.getResolver(e),!r)return null;const n=yield r.getAvatar();return n==null?null:n.url})}perform(e,r){return he.throwError(e+" not implemented",T.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_addEventListener(e,r,n){const i=new D3(Gi(e),r,n);return this._events.push(i),this._startEvent(i),this}on(e,r){return this._addEventListener(e,r,!1)}once(e,r){return this._addEventListener(e,r,!0)}emit(e,...r){let n=!1,i=[],o=Gi(e);return this._events=this._events.filter(s=>s.tag!==o?!0:(setTimeout(()=>{s.listener.apply(this,r)},0),n=!0,s.once?(i.push(s),!1):!0)),i.forEach(s=>{this._stopEvent(s)}),n}listenerCount(e){if(!e)return this._events.length;let r=Gi(e);return this._events.filter(n=>n.tag===r).length}listeners(e){if(e==null)return this._events.map(n=>n.listener);let r=Gi(e);return this._events.filter(n=>n.tag===r).map(n=>n.listener)}off(e,r){if(r==null)return this.removeAllListeners(e);const n=[];let i=!1,o=Gi(e);return this._events=this._events.filter(s=>s.tag!==o||s.listener!=r||i?!0:(i=!0,n.push(s),!1)),n.forEach(s=>{this._stopEvent(s)}),this}removeAllListeners(e){let r=[];if(e==null)r=this._events,this._events=[];else{const n=Gi(e);this._events=this._events.filter(i=>i.tag!==n?!0:(r.push(i),!1))}return r.forEach(n=>{this._stopEvent(n)}),this}}var xn=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const wt=new T($t),z3=["call","estimateGas"];function Ps(t,e){if(t==null)return null;if(typeof t.message=="string"&&t.message.match("reverted")){const r=pe(t.data)?t.data:null;if(!e||r)return{message:t.message,data:r}}if(typeof t=="object"){for(const r in t){const n=Ps(t[r],e);if(n)return n}return null}if(typeof t=="string")try{return Ps(JSON.parse(t),e)}catch{}return null}function d1(t,e,r){const n=r.transaction||r.signedTransaction;if(t==="call"){const o=Ps(e,!0);if(o)return o.data;wt.throwError("missing revert data in call exception; Transaction reverted without a reason string",T.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:e})}if(t==="estimateGas"){let o=Ps(e.body,!1);o==null&&(o=Ps(e,!1)),o&&wt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{reason:o.message,method:t,transaction:n,error:e})}let i=e.message;throw e.code===T.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&wt.throwError("insufficient funds for intrinsic transaction cost",T.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:n}),i.match(/nonce (is )?too low/i)&&wt.throwError("nonce has already been used",T.errors.NONCE_EXPIRED,{error:e,method:t,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&wt.throwError("replacement fee too low",T.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:n}),i.match(/only replay-protected/i)&&wt.throwError("legacy pre-eip-155 transactions not supported",T.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:n}),z3.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&wt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:n}),e}function Yp(t){return new Promise(function(e){setTimeout(e,t)})}function $3(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function as(t){return t&&t.toLowerCase()}const yd={};class Oh extends El{constructor(e,r,n){if(super(),e!==yd)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");z(this,"provider",r),n==null&&(n=0),typeof n=="string"?(z(this,"_address",this.provider.formatter.address(n)),z(this,"_index",null)):typeof n=="number"?(z(this,"_index",n),z(this,"_address",null)):wt.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(e){return wt.throwError("cannot alter JSON-RPC Signer connection",T.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new H3(yd,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&wt.throwError("unknown account #"+this._index,T.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=it(e);const r=this.getAddress().then(n=>(n&&(n=n.toLowerCase()),n));if(e.gasLimit==null){const n=it(e);n.from=r,e.gasLimit=this.provider.estimateGas(n)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(n=>xn(this,void 0,void 0,function*(){if(n==null)return null;const i=yield this.provider.resolveName(n);return i==null&&wt.throwArgumentError("provided ENS name resolves to null","tx.to",n),i}))),yt({tx:yt(e),sender:r}).then(({tx:n,sender:i})=>{n.from!=null?n.from.toLowerCase()!==i&&wt.throwArgumentError("from address mismatch","transaction",e):n.from=i;const o=this.provider.constructor.hexlifyTransaction(n,{from:!0});return this.provider.send("eth_sendTransaction",[o]).then(s=>s,s=>(typeof s.message=="string"&&s.message.match(/user denied/i)&&wt.throwError("user rejected transaction",T.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:n}),d1("sendTransaction",s,o)))})}signTransaction(e){return wt.throwError("signing transactions is unsupported",T.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return xn(this,void 0,void 0,function*(){const r=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(e);try{return yield ho(()=>xn(this,void 0,void 0,function*(){const i=yield this.provider.getTransaction(n);if(i!==null)return this.provider._wrapTransaction(i,n,r)}),{oncePoll:this.provider})}catch(i){throw i.transactionHash=n,i}})}signMessage(e){return xn(this,void 0,void 0,function*(){const r=typeof e=="string"?mr(e):e,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[re(r),n.toLowerCase()])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),i}})}_legacySignMessage(e){return xn(this,void 0,void 0,function*(){const r=typeof e=="string"?mr(e):e,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),re(r)])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),i}})}_signTypedData(e,r,n){return xn(this,void 0,void 0,function*(){const i=yield sr.resolveNames(e,r,n,s=>this.provider.resolveName(s)),o=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[o.toLowerCase(),JSON.stringify(sr.getPayload(i.domain,r,i.value))])}catch(s){throw typeof s.message=="string"&&s.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"_signTypedData",from:o,messageData:{domain:i.domain,types:r,value:i.value}}),s}})}unlock(e){return xn(this,void 0,void 0,function*(){const r=this.provider,n=yield this.getAddress();return r.send("personal_unlockAccount",[n.toLowerCase(),e,null])})}}class H3 extends Oh{sendTransaction(e){return this.sendUncheckedTransaction(e).then(r=>({hash:r,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:n=>this.provider.waitForTransaction(r,n)}))}}const q3={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class vi extends $u{constructor(e,r){let n=r;n==null&&(n=new Promise((i,o)=>{setTimeout(()=>{this.detectNetwork().then(s=>{i(s)},s=>{o(s)})},0)})),super(n),e||(e=fr(this.constructor,"defaultUrl")()),typeof e=="string"?z(this,"connection",Object.freeze({url:e})):z(this,"connection",Object.freeze(it(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return xn(this,void 0,void 0,function*(){yield Yp(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){const r=fr(this.constructor,"getNetwork");try{return r(V.from(e).toNumber())}catch(n){return wt.throwError("could not detect network",T.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:n})}}return wt.throwError("could not detect network",T.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new Oh(yd,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(r=>this.formatter.address(r)))}send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:nr(n),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const o=Al(this.connection,JSON.stringify(n),$3).then(s=>(this.emit("debug",{action:"response",request:n,response:s,provider:this}),s),s=>{throw this.emit("debug",{action:"response",error:s,request:n,provider:this}),s});return i&&(this._cache[e]=o,setTimeout(()=>{this._cache[e]=null},0)),o}prepareRequest(e,r){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[as(r.address),r.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[as(r.address),r.blockTag]];case"getCode":return["eth_getCode",[as(r.address),r.blockTag]];case"getStorageAt":return["eth_getStorageAt",[as(r.address),pt(r.position,32),r.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[r.signedTransaction]];case"getBlock":return r.blockTag?["eth_getBlockByNumber",[r.blockTag,!!r.includeTransactions]]:r.blockHash?["eth_getBlockByHash",[r.blockHash,!!r.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[r.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[r.transactionHash]];case"call":return["eth_call",[fr(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0}),r.blockTag]];case"estimateGas":return["eth_estimateGas",[fr(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0})]];case"getLogs":return r.filter&&r.filter.address!=null&&(r.filter.address=as(r.filter.address)),["eth_getLogs",[r.filter]]}return null}perform(e,r){return xn(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){const i=r.transaction;if(i&&i.type!=null&&V.from(i.type).isZero()&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const o=yield this.getFeeData();o.maxFeePerGas==null&&o.maxPriorityFeePerGas==null&&(r=it(r),r.transaction=it(i),delete r.transaction.type)}}const n=this.prepareRequest(e,r);n==null&&wt.throwError(e+" not implemented",T.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(n[0],n[1])}catch(i){return d1(e,i,r)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;const e=this,r=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=r,r.then(function(n){function i(){e.send("eth_getFilterChanges",[n]).then(function(o){if(e._pendingFilter!=r)return null;let s=Promise.resolve();return o.forEach(function(l){e._emitted["t:"+l.toLowerCase()]="pending",s=s.then(function(){return e.getTransaction(l).then(function(a){return e.emit("pending",a),null})})}),s.then(function(){return Yp(1e3)})}).then(function(){if(e._pendingFilter!=r){e.send("eth_uninstallFilter",[n]);return}return setTimeout(function(){i()},0),null}).catch(o=>{})}return i(),n}).catch(n=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,r){const n=it(q3);if(r)for(const o in r)r[o]&&(n[o]=!0);jx(e,n);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(o){if(e[o]==null)return;const s=Tu(V.from(e[o]));o==="gasLimit"&&(o="gas"),i[o]=s}),["from","to","data"].forEach(function(o){e[o]!=null&&(i[o]=re(e[o]))}),e.accessList&&(i.accessList=qi(e.accessList)),i}}let Cs=null;try{if(Cs=WebSocket,Cs==null)throw new Error("inject please")}catch{const e=new T($t);Cs=function(){e.throwError("WebSockets not supported in this environment",T.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var ef=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Vl=new T($t);let W3=1;class Hu extends vi{constructor(e,r){r==="any"&&Vl.throwError("WebSocketProvider does not support 'any' network yet",T.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,r):super("_websocket",r),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?z(this,"_websocket",new Cs(this.connection.url)):z(this,"_websocket",e),z(this,"_requests",{}),z(this,"_subs",{}),z(this,"_subIds",{}),z(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(i=>{this.websocket.send(this._requests[i].payload)})},this.websocket.onmessage=i=>{const o=i.data,s=JSON.parse(o);if(s.id!=null){const l=String(s.id),a=this._requests[l];if(delete this._requests[l],s.result!==void 0)a.callback(null,s.result),this.emit("debug",{action:"response",request:JSON.parse(a.payload),response:s.result,provider:this});else{let u=null;s.error?(u=new Error(s.error.message||"unknown error"),z(u,"code",s.error.code||null),z(u,"response",o)):u=new Error("unknown error"),a.callback(u,void 0),this.emit("debug",{action:"response",error:u,request:JSON.parse(a.payload),provider:this})}}else if(s.method==="eth_subscription"){const l=this._subs[s.params.subscription];l&&l.processFunc(s.params.result)}else console.warn("this should not happen")};const n=setInterval(()=>{this.emit("poll")},1e3);n.unref&&n.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){Vl.throwError("cannot reset events block on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){Vl.throwError("cannot set polling interval on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return ef(this,void 0,void 0,function*(){return null})}set polling(e){e&&Vl.throwError("cannot set polling on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,r){const n=W3++;return new Promise((i,o)=>{function s(a,u){return a?o(a):i(u)}const l=JSON.stringify({method:e,params:r,id:n,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(l),provider:this}),this._requests[String(n)]={callback:s,payload:l},this._wsReady&&this.websocket.send(l)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,r,n){return ef(this,void 0,void 0,function*(){let i=this._subIds[e];i==null&&(i=Promise.all(r).then(s=>this.send("eth_subscribe",s)),this._subIds[e]=i);const o=yield i;this._subs[o]={tag:e,processFunc:n}})}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],r=>{const n=V.from(r.number).toNumber();this._emitted.block=n,this.emit("block",n)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],r=>{this.emit("pending",r)});break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],r=>{r.removed==null&&(r.removed=!1),this.emit(e.filter,this.formatter.filterLog(r))});break;case"tx":{const r=n=>{const i=n.hash;this.getTransactionReceipt(i).then(o=>{o&&this.emit(i,o)})};r(e),this._subscribe("tx",["newHeads"],n=>{this._events.filter(i=>i.type==="tx").forEach(r)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e);break}}_stopEvent(e){let r=e.tag;if(e.type==="tx"){if(this._events.filter(i=>i.type==="tx").length)return;r="tx"}else if(this.listenerCount(e.event))return;const n=this._subIds[r];n&&(delete this._subIds[r],n.then(i=>{this._subs[i]&&(delete this._subs[i],this.send("eth_unsubscribe",[i]))}))}destroy(){return ef(this,void 0,void 0,function*(){this.websocket.readyState===Cs.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}var G3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const gs=new T($t);class h1 extends vi{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return G3(this,void 0,void 0,function*(){let r=this.network;return r==null&&(r=yield e.detectNetwork.call(this),r||gs.throwError("no network detected",T.errors.UNKNOWN_ERROR,{}),this._network==null&&(z(this,"_network",r),this.emit("network",r,null))),r})}}class Fn extends h1{constructor(e,r){gs.checkAbstract(new.target,Fn),e=fr(new.target,"getNetwork")(e),r=fr(new.target,"getApiKey")(r);const n=fr(new.target,"getUrl")(e,r);super(n,e),typeof r=="string"?z(this,"apiKey",r):r!=null&&Object.keys(r).forEach(i=>{z(this,i,r[i])})}_startPending(){gs.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return gs.throwError("API provider does not support signing",T.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,r){return gs.throwError("not implemented; sub-classes must override getUrl",T.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const Xp=new T($t),Ea="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class p1 extends Hu{constructor(e,r){const n=new Lh(e,r),i=n.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(i,n.network),z(this,"apiKey",n.apiKey)}isCommunityResource(){return this.apiKey===Ea}}class Lh extends Fn{static getWebSocketProvider(e,r){return new p1(e,r)}static getApiKey(e){return e==null?Ea:(e&&typeof e!="string"&&Xp.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,r){let n=null;switch(e.name){case"homestead":n="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":n="eth-goerli.g.alchemy.com/v2/";break;case"matic":n="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":n="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":n="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":n="arb-goerli.g.alchemy.com/v2/";break;case"optimism":n="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":n="opt-goerli.g.alchemy.com/v2/";break;default:Xp.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+n+r,throttleCallback:(i,o)=>(r===Ea&&bl(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===Ea}}const V3=new T($t),Kl="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function K3(t){switch(t){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return V3.throwArgumentError("unsupported network","name",t)}class m1 extends Fn{isCommunityResource(){return this.apiKey===Kl}static getApiKey(e){return e??Kl}static getUrl(e,r){r==null&&(r=Kl);const n={allowGzip:!0,url:"https://"+K3(e.name)+r,throttleCallback:(i,o)=>(r.apiKey===Kl&&bl(),Promise.resolve(!0))};return r.projectSecret!=null&&(n.user="",n.password=r.projectSecret),n}}var Q3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Zp=new T($t);class g1 extends Fn{static getApiKey(e){return e!=null&&Zp.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,r){let n=null;switch(e.name){case"homestead":n="https://cloudflare-eth.com/";break;default:Zp.throwArgumentError("unsupported network","network",arguments[0])}return n}perform(e,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return Q3(this,void 0,void 0,function*(){return e==="getBlockNumber"?(yield n.perform.call(this,"getBlock",{blockTag:"latest"})).number:n.perform.call(this,e,r)})}}var Ql=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const ti=new T($t);function em(t){const e={};for(let r in t){if(t[r]==null)continue;let n=t[r];r==="type"&&n===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?n=Tu(re(n)):r==="accessList"?n="["+qi(n).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":n=re(n),e[r]=n)}return e}function J3(t){if(t.status==0&&(t.message==="No records found"||t.message==="No transactions found"))return t.result;if(t.status!=1||typeof t.message!="string"||!t.message.match(/^OK/)){const e=new Error("invalid response");throw e.result=JSON.stringify(t),(t.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return t.result}function tm(t){if(t&&t.status==0&&t.message=="NOTOK"&&(t.result||"").toLowerCase().indexOf("rate limit")>=0){const e=new Error("throttled response");throw e.result=JSON.stringify(t),e.throttleRetry=!0,e}if(t.jsonrpc!="2.0"){const e=new Error("invalid response");throw e.result=JSON.stringify(t),e}if(t.error){const e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function rm(t){if(t==="pending")throw new Error("pending not supported");return t==="latest"?t:parseInt(t.substring(2),16)}function tf(t,e,r){if(t==="call"&&e.code===T.errors.SERVER_ERROR){const i=e.error;if(i&&(i.message.match(/reverted/i)||i.message.match(/VM execution error/i))){let o=i.data;if(o&&(o="0x"+o.replace(/^.*0x/i,"")),pe(o))return o;ti.throwError("missing revert data in call exception",T.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let n=e.message;throw e.code===T.errors.SERVER_ERROR&&(e.error&&typeof e.error.message=="string"?n=e.error.message:typeof e.body=="string"?n=e.body:typeof e.responseText=="string"&&(n=e.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&ti.throwError("insufficient funds for intrinsic transaction cost",T.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&ti.throwError("nonce has already been used",T.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),n.match(/another transaction with same nonce/)&&ti.throwError("replacement fee too low",T.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&ti.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}class v1 extends $u{constructor(e,r){super(e),z(this,"baseUrl",this.getBaseUrl()),z(this,"apiKey",r||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return ti.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,r){const n=Object.keys(r).reduce((o,s)=>{const l=r[s];return l!=null&&(o+=`&${s}=${l}`),o},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${n}${i}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,r){return r.module=e,r.apikey=this.apiKey,r}fetch(e,r,n){return Ql(this,void 0,void 0,function*(){const i=n?this.getPostUrl():this.getUrl(e,r),o=n?this.getPostData(e,r):null,s=e==="proxy"?tm:J3;this.emit("debug",{action:"request",request:i,provider:this});const l={url:i,throttleSlotInterval:1e3,throttleCallback:(c,d)=>(this.isCommunityResource()&&bl(),Promise.resolve(!0))};let a=null;o&&(l.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},a=Object.keys(o).map(c=>`${c}=${o[c]}`).join("&"));const u=yield Al(l,a,s||tm);return this.emit("debug",{action:"response",request:i,response:nr(u),provider:this}),u})}detectNetwork(){return Ql(this,void 0,void 0,function*(){return this.network})}perform(e,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return Ql(this,void 0,void 0,function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:r.address,tag:r.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:r.address,tag:r.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:r.address,tag:r.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:r.address,position:r.position,tag:r.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:r.signedTransaction},!0).catch(i=>tf("sendTransaction",i,r.signedTransaction));case"getBlock":if(r.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:r.blockTag,boolean:r.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:r.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:r.transactionHash});case"call":{if(r.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const i=em(r.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(o){return tf("call",o,r.transaction)}}case"estimateGas":{const i=em(r.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(o){return tf("estimateGas",o,r.transaction)}}case"getLogs":{const i={action:"getLogs"};if(r.filter.fromBlock&&(i.fromBlock=rm(r.filter.fromBlock)),r.filter.toBlock&&(i.toBlock=rm(r.filter.toBlock)),r.filter.address&&(i.address=r.filter.address),r.filter.topics&&r.filter.topics.length>0&&(r.filter.topics.length>1&&ti.throwError("unsupported topic count",T.errors.UNSUPPORTED_OPERATION,{topics:r.filter.topics}),r.filter.topics.length===1)){const l=r.filter.topics[0];(typeof l!="string"||l.length!==66)&&ti.throwError("unsupported topic format",T.errors.UNSUPPORTED_OPERATION,{topic0:l}),i.topic0=l}const o=yield this.fetch("logs",i);let s={};for(let l=0;l{["contractAddress","to"].forEach(function(a){s[a]==""&&delete s[a]}),s.creates==null&&s.contractAddress!=null&&(s.creates=s.contractAddress);const l=this.formatter.transactionResponse(s);return s.timeStamp&&(l.timestamp=parseInt(s.timeStamp)),l})})}isCommunityResource(){return this.apiKey==null}}var iu=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Si=new T($t);function Jl(){return new Date().getTime()}function nm(t){let e=null;for(let r=0;re?null:(n+i)/2}function po(t){if(t===null)return"null";if(typeof t=="number"||typeof t=="boolean")return JSON.stringify(t);if(typeof t=="string")return t;if(V.isBigNumber(t))return t.toString();if(Array.isArray(t))return JSON.stringify(t.map(e=>po(e)));if(typeof t=="object"){const e=Object.keys(t);return e.sort(),"{"+e.map(r=>{let n=t[r];return typeof n=="function"?n="[function]":n=po(n),JSON.stringify(r)+":"+n}).join(",")+"}"}throw new Error("unknown value type: "+typeof t)}let Y3=1;function om(t){let e=null,r=null,n=new Promise(s=>{e=function(){r&&(clearTimeout(r),r=null),s()},r=setTimeout(e,t)});const i=s=>(n=n.then(s),n);function o(){return n}return{cancel:e,getPromise:o,wait:i}}const X3=[T.errors.CALL_EXCEPTION,T.errors.INSUFFICIENT_FUNDS,T.errors.NONCE_EXPIRED,T.errors.REPLACEMENT_UNDERPRICED,T.errors.UNPREDICTABLE_GAS_LIMIT],Z3=["address","args","errorArgs","errorSignature","method","transaction"];function Yl(t,e){const r={weight:t.weight};return Object.defineProperty(r,"provider",{get:()=>t.provider}),t.start&&(r.start=t.start),e&&(r.duration=e-t.start),t.done&&(t.error?r.error=t.error:r.result=t.result||null),r}function eS(t,e){return function(r){const n={};r.forEach(o=>{const s=t(o.result);n[s]||(n[s]={count:0,result:o.result}),n[s].count++});const i=Object.keys(n);for(let o=0;o=e)return s.result}}}function tS(t,e,r){let n=po;switch(e){case"getBlockNumber":return function(i){const o=i.map(l=>l.result);let s=im(i.map(l=>l.result),2);if(s!=null)return s=Math.ceil(s),o.indexOf(s+1)>=0&&s++,s>=t._highestBlockNumber&&(t._highestBlockNumber=s),t._highestBlockNumber};case"getGasPrice":return function(i){const o=i.map(s=>s.result);return o.sort(),o[Math.floor(o.length/2)]};case"getEtherPrice":return function(i){return im(i.map(o=>o.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(i){return i==null?null:(i=it(i),i.confirmations=-1,po(i))};break;case"getBlock":r.includeTransactions?n=function(i){return i==null?null:(i=it(i),i.transactions=i.transactions.map(o=>(o=it(o),o.confirmations=-1,o)),po(i))}:n=function(i){return i==null?null:po(i)};break;default:throw new Error("unknown method: "+e)}return eS(n,t.quorum)}function us(t,e){return iu(this,void 0,void 0,function*(){const r=t.provider;return r.blockNumber!=null&&r.blockNumber>=e||e===-1?r:ho(()=>new Promise((n,i)=>{setTimeout(function(){return r.blockNumber>=e?n(r):t.cancelled?n(null):n(void 0)},0)}),{oncePoll:r})})}function rS(t,e,r,n){return iu(this,void 0,void 0,function*(){let i=t.provider;switch(r){case"getBlockNumber":case"getGasPrice":return i[r]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),r==="call"&&n.blockTag?i[r](n.transaction,n.blockTag):i[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return i[r](n.transactionHash);case"getLogs":{let o=n.filter;return(o.fromBlock&&pe(o.fromBlock)||o.toBlock&&pe(o.toBlock))&&(i=yield us(t,e)),i.getLogs(o)}}return Si.throwError("unknown method error",T.errors.UNKNOWN_ERROR,{method:r,params:n})})}class y1 extends $u{constructor(e,r){e.length===0&&Si.throwArgumentError("missing providers","providers",e);const n=e.map((s,l)=>{if(qo.isProvider(s)){const c=gd(s)?2e3:750;return Object.freeze({provider:s,weight:1,stallTimeout:c,priority:1})}const a=it(s);a.priority==null&&(a.priority=1),a.stallTimeout==null&&(a.stallTimeout=gd(s)?2e3:750),a.weight==null&&(a.weight=1);const u=a.weight;return(u%1||u>512||u<1)&&Si.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${l}].weight`,u),Object.freeze(a)}),i=n.reduce((s,l)=>s+l.weight,0);r==null?r=i/2:r>i&&Si.throwArgumentError("quorum will always fail; larger than total weight","quorum",r);let o=nm(n.map(s=>s.provider.network));o==null&&(o=new Promise((s,l)=>{setTimeout(()=>{this.detectNetwork().then(s,l)},0)})),super(o),z(this,"providerConfigs",Object.freeze(n)),z(this,"quorum",r),this._highestBlockNumber=-1}detectNetwork(){return iu(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(r=>r.provider.getNetwork()));return nm(e)})}perform(e,r){return iu(this,void 0,void 0,function*(){if(e==="sendTransaction"){const a=yield Promise.all(this.providerConfigs.map(u=>u.provider.sendTransaction(r.signedTransaction).then(c=>c.hash,c=>c)));for(let u=0;ua.priority-u.priority);const o=this._highestBlockNumber;let s=0,l=!0;for(;;){const a=Jl();let u=i.filter(v=>v.runner&&a-v.startv+p.weight,0);for(;u{v.staller=null}),v.runner=rS(v,o,e,r).then(x=>{v.done=!0,v.result=x,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Yl(v,Jl()),request:{method:e,params:nr(r)},provider:this})},x=>{v.done=!0,v.error=x,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Yl(v,Jl()),request:{method:e,params:nr(r)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Yl(v,null),request:{method:e,params:nr(r)},provider:this}),u+=v.weight}const c=[];i.forEach(v=>{v.done||!v.runner||(c.push(v.runner),v.staller&&c.push(v.staller.getPromise()))}),c.length&&(yield Promise.race(c));const d=i.filter(v=>v.done&&v.error==null);if(d.length>=this.quorum){const v=n(d);if(v!==void 0)return i.forEach(p=>{p.staller&&p.staller.cancel(),p.cancelled=!0}),v;l||(yield om(100).getPromise()),l=!1}const m=i.reduce((v,p)=>{if(!p.done||p.error==null)return v;const x=p.error.code;return X3.indexOf(x)>=0&&(v[x]||(v[x]={error:p.error,weight:0}),v[x].weight+=p.weight),v},{});if(Object.keys(m).forEach(v=>{const p=m[v];if(p.weight{E.staller&&E.staller.cancel(),E.cancelled=!0});const x=p.error,k={};Z3.forEach(E=>{x[E]!=null&&(k[E]=x[E])}),Si.throwError(x.reason||x.message,v,k)}),i.filter(v=>!v.done).length===0)break}return i.forEach(a=>{a.staller&&a.staller.cancel(),a.cancelled=!0}),Si.throwError("failed to meet quorum",T.errors.SERVER_ERROR,{method:e,params:r,results:i.map(a=>Yl(a)),provider:this})})}}const w1=null,xa=new T($t),vs="84842078b09946638c03157f83405213";class E1 extends Hu{constructor(e,r){const n=new Bh(e,r),i=n.connection;i.password&&xa.throwError("INFURA WebSocket project secrets unsupported",T.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const o=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(o,e),z(this,"apiKey",n.projectId),z(this,"projectId",n.projectId),z(this,"projectSecret",n.projectSecret)}isCommunityResource(){return this.projectId===vs}}class Bh extends Fn{static getWebSocketProvider(e,r){return new E1(e,r)}static getApiKey(e){const r={apiKey:vs,projectId:vs,projectSecret:null};return e==null||(typeof e=="string"?r.projectId=e:e.projectSecret!=null?(xa.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),xa.assertArgument(typeof e.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),r.projectId=e.projectId,r.projectSecret=e.projectSecret):e.projectId&&(r.projectId=e.projectId),r.apiKey=r.projectId),r}static getUrl(e,r){let n=null;switch(e?e.name:"unknown"){case"homestead":n="mainnet.infura.io";break;case"goerli":n="goerli.infura.io";break;case"sepolia":n="sepolia.infura.io";break;case"matic":n="polygon-mainnet.infura.io";break;case"maticmum":n="polygon-mumbai.infura.io";break;case"optimism":n="optimism-mainnet.infura.io";break;case"optimism-goerli":n="optimism-goerli.infura.io";break;case"arbitrum":n="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":n="arbitrum-goerli.infura.io";break;default:xa.throwError("unsupported network",T.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+n+"/v3/"+r.projectId,throttleCallback:(o,s)=>(r.projectId===vs&&bl(),Promise.resolve(!0))};return r.projectSecret!=null&&(i.user="",i.password=r.projectSecret),i}isCommunityResource(){return this.projectId===vs}}class nS extends vi{send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this._pendingBatch==null&&(this._pendingBatch=[]);const i={request:n,resolve:null,reject:null},o=new Promise((s,l)=>{i.resolve=s,i.reject=l});return this._pendingBatch.push(i),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout(()=>{const s=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const l=s.map(a=>a.request);return this.emit("debug",{action:"requestBatch",request:nr(l),provider:this}),Al(this.connection,JSON.stringify(l)).then(a=>{this.emit("debug",{action:"response",request:l,response:a,provider:this}),s.forEach((u,c)=>{const d=a[c];if(d.error){const m=new Error(d.error.message);m.code=d.error.code,m.data=d.error.data,u.reject(m)}else u.resolve(d.result)})},a=>{this.emit("debug",{action:"response",error:a,request:l,provider:this}),s.forEach(u=>{u.reject(a)})})},10)),o}}const rf=new T($t),iS="ETHERS_JS_SHARED";class x1 extends Fn{static getApiKey(e){return e&&typeof e!="string"&&rf.throwArgumentError("invalid apiKey","apiKey",e),e||iS}static getUrl(e,r){rf.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let n=null;switch(e.name){case"homestead":n="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":n="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":n="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":n="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":n="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:rf.throwArgumentError("unsupported network","network",arguments[0])}return n+"?apiKey="+r}}const sm=new T($t),lm="62e1ad51b37b8e00394bda3b";class A1 extends Fn{static getApiKey(e){const r={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?r.applicationId=lm:typeof e=="string"?r.applicationId=e:e.applicationSecretKey!=null?(r.applicationId=e.applicationId,r.applicationSecretKey=e.applicationSecretKey):e.applicationId?r.applicationId=e.applicationId:sm.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),r}static getUrl(e,r){let n=null;switch(e?e.name:"unknown"){case"goerli":n="eth-goerli.gateway.pokt.network";break;case"homestead":n="eth-mainnet.gateway.pokt.network";break;case"kovan":n="poa-kovan.gateway.pokt.network";break;case"matic":n="poly-mainnet.gateway.pokt.network";break;case"maticmum":n="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":n="eth-rinkeby.gateway.pokt.network";break;case"ropsten":n="eth-ropsten.gateway.pokt.network";break;default:sm.throwError("unsupported network",T.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i=`https://${n}/v1/lb/${r.applicationId}`,o={headers:{},url:i};return r.applicationSecretKey!=null&&(o.user="",o.password=r.applicationSecretKey),o}isCommunityResource(){return this.applicationId===lm}}const am=new T($t);let oS=1;function um(t,e){const r="Web3LegacyFetcher";return function(n,i){const o={method:n,params:i,id:oS++,jsonrpc:"2.0"};return new Promise((s,l)=>{this.emit("debug",{action:"request",fetcher:r,request:nr(o),provider:this}),e(o,(a,u)=>{if(a)return this.emit("debug",{action:"response",fetcher:r,error:a,request:o,provider:this}),l(a);if(this.emit("debug",{action:"response",fetcher:r,request:o,response:u,provider:this}),u.error){const c=new Error(u.error.message);return c.code=u.error.code,c.data=u.error.data,l(c)}s(u.result)})})}}function sS(t){return function(e,r){r==null&&(r=[]);const n={method:e,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:nr(n),provider:this}),t.request(n).then(i=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,response:i,provider:this}),i),i=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,error:i,provider:this}),i})}}class b1 extends vi{constructor(e,r){e==null&&am.throwArgumentError("missing provider","provider",e);let n=null,i=null,o=null;typeof e=="function"?(n="unknown:",i=e):(n=e.host||e.path||"",!n&&e.isMetaMask&&(n="metamask"),o=e,e.request?(n===""&&(n="eip-1193:"),i=sS(e)):e.sendAsync?i=um(e,e.sendAsync.bind(e)):e.send?i=um(e,e.send.bind(e)):am.throwArgumentError("unsupported provider","provider",e),n||(n="unknown:")),super(n,r),z(this,"jsonRpcFetchFunc",i),z(this,"provider",o)}send(e,r){return this.jsonRpcFetchFunc(e,r)}}const cm=new T($t);function lS(t,e){if(t==null&&(t="homestead"),typeof t=="string"){const n=t.match(/^(ws|http)s?:/i);if(n)switch(n[1].toLowerCase()){case"http":case"https":return new vi(t);case"ws":case"wss":return new Hu(t);default:cm.throwArgumentError("unsupported URL scheme","network",t)}}const r=Th(t);return(!r||!r._defaultProvider)&&cm.throwError("unsupported getDefaultProvider network",T.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:t}),r._defaultProvider({FallbackProvider:y1,AlchemyProvider:Lh,AnkrProvider:m1,CloudflareProvider:g1,EtherscanProvider:v1,InfuraProvider:Bh,JsonRpcProvider:vi,NodesmithProvider:x1,PocketProvider:A1,Web3Provider:b1,IpcProvider:w1},e)}const aS=Object.freeze(Object.defineProperty({__proto__:null,AlchemyProvider:Lh,AlchemyWebSocketProvider:p1,AnkrProvider:m1,BaseProvider:$u,CloudflareProvider:g1,EtherscanProvider:v1,FallbackProvider:y1,Formatter:ee,InfuraProvider:Bh,InfuraWebSocketProvider:E1,IpcProvider:w1,JsonRpcBatchProvider:nS,JsonRpcProvider:vi,JsonRpcSigner:Oh,NodesmithProvider:x1,PocketProvider:A1,Provider:qo,Resolver:vd,StaticJsonRpcProvider:h1,UrlJsonRpcProvider:Fn,Web3Provider:b1,WebSocketProvider:Hu,getDefaultProvider:lS,getNetwork:Th,isCommunityResourcable:u1,isCommunityResource:gd,showThrottleMessage:bl},Symbol.toStringTag,{value:"Module"})),uS="solidity/5.7.0",cS=new RegExp("^bytes([0-9]+)$"),fS=new RegExp("^(u?int)([0-9]*)$"),dS=new RegExp("^(.*)\\[([0-9]*)\\]$"),hS="0000000000000000000000000000000000000000000000000000000000000000",Yi=new T(uS);function _1(t,e,r){switch(t){case"address":return r?ha(e,32):se(e);case"string":return mr(e);case"bytes":return se(e);case"bool":return e=e?"0x01":"0x00",r?ha(e,32):se(e)}let n=t.match(fS);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!==0||i===0||i>256)&&Yi.throwArgumentError("invalid number type","type",t),r&&(i=256),e=V.from(e).toTwos(i),ha(e,i/8)}if(n=t.match(cS),n){const i=parseInt(n[1]);return(String(i)!==n[1]||i===0||i>32)&&Yi.throwArgumentError("invalid bytes type","type",t),se(e).byteLength!==i&&Yi.throwArgumentError(`invalid value for ${t}`,"value",e),r?se((e+hS).substring(0,66)):e}if(n=t.match(dS),n&&Array.isArray(e)){const i=n[1];parseInt(n[2]||String(e.length))!=e.length&&Yi.throwArgumentError(`invalid array length for ${t}`,"value",e);const s=[];return e.forEach(function(l){s.push(_1(i,l,!0))}),Ut(s)}return Yi.throwArgumentError("invalid type","type",t)}function pS(t,e){t.length!=e.length&&Yi.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);const r=[];return t.forEach(function(n,i){r.push(_1(n,e[i]))}),re(Ut(r))}function mS(t,e){return ut(pS(t,e))}var qu={},Cn={},S1={};const gS=Uo(rA);var vS={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const fm=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??typeof c!="object"?c:Object.assign({},e,c),r.forEach(m=>m(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(vS?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},k1=t=>t?fm(t):fm;var N1={exports:{}},P1={},C1={exports:{}},M1={};/** + */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&typeof self=="object",s=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;s?i=Fe:o&&(i=self);var l=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,a=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),c=[31,7936,2031616,520093696],d=[4,1024,262144,67108864],p=[1,256,65536,16777216],v=[6,1536,393216,100663296],g=[0,8,16,24],x=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],k=[224,256,384,512],E=[128,256],w=["hex","buffer","arrayBuffer","array","digest"],_={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(y){return Object.prototype.toString.call(y)==="[object Array]"}),a&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(y){return typeof y=="object"&&y.buffer&&y.buffer.constructor===ArrayBuffer});for(var O=function(y,D,U){return function(F){return new h(y,D,y).update(F)[U]()}},B=function(y,D,U){return function(F,W){return new h(y,D,W).update(F)[U]()}},j=function(y,D,U){return function(F,W,oe,Y){return f["cshake"+y].update(F,W,oe,Y)[U]()}},$=function(y,D,U){return function(F,W,oe,Y){return f["kmac"+y].update(F,W,oe,Y)[U]()}},H=function(y,D,U,F){for(var W=0;W>5,this.byteCount=this.blockCount<<2,this.outputBlocks=U>>5,this.extraBytes=(U&31)>>3;for(var F=0;F<50;++F)this.s[F]=0}h.prototype.update=function(y){if(this.finalized)throw new Error(r);var D,U=typeof y;if(U!=="string"){if(U==="object"){if(y===null)throw new Error(e);if(a&&y.constructor===ArrayBuffer)y=new Uint8Array(y);else if(!Array.isArray(y)&&(!a||!ArrayBuffer.isView(y)))throw new Error(e)}else throw new Error(e);D=!0}for(var F=this.blocks,W=this.byteCount,oe=y.length,Y=this.blockCount,K=0,Je=this.s,Q,le;K>2]|=y[K]<>2]|=le<>2]|=(192|le>>6)<>2]|=(128|le&63)<=57344?(F[Q>>2]|=(224|le>>12)<>2]|=(128|le>>6&63)<>2]|=(128|le&63)<>2]|=(240|le>>18)<>2]|=(128|le>>12&63)<>2]|=(128|le>>6&63)<>2]|=(128|le&63)<=W){for(this.start=Q-W,this.block=F[Y],Q=0;Q>8,U=y&255;U>0;)W.unshift(U),y=y>>8,U=y&255,++F;return D?W.push(F):W.unshift(F),this.update(W),W.length},h.prototype.encodeString=function(y){var D,U=typeof y;if(U!=="string"){if(U==="object"){if(y===null)throw new Error(e);if(a&&y.constructor===ArrayBuffer)y=new Uint8Array(y);else if(!Array.isArray(y)&&(!a||!ArrayBuffer.isView(y)))throw new Error(e)}else throw new Error(e);D=!0}var F=0,W=y.length;if(D)F=W;else for(var oe=0;oe=57344?F+=3:(Y=65536+((Y&1023)<<10|y.charCodeAt(++oe)&1023),F+=4)}return F+=this.encode(F*8),this.update(y),F},h.prototype.bytepad=function(y,D){for(var U=this.encode(D),F=0;F>2]|=this.padding[D&3],this.lastByteIndex===this.byteCount)for(y[0]=y[U],D=1;D>4&15]+u[K&15]+u[K>>12&15]+u[K>>8&15]+u[K>>20&15]+u[K>>16&15]+u[K>>28&15]+u[K>>24&15];oe%y===0&&(te(D),W=0)}return F&&(K=D[W],Y+=u[K>>4&15]+u[K&15],F>1&&(Y+=u[K>>12&15]+u[K>>8&15]),F>2&&(Y+=u[K>>20&15]+u[K>>16&15])),Y},h.prototype.arrayBuffer=function(){this.finalize();var y=this.blockCount,D=this.s,U=this.outputBlocks,F=this.extraBytes,W=0,oe=0,Y=this.outputBits>>3,K;F?K=new ArrayBuffer(U+1<<2):K=new ArrayBuffer(Y);for(var Je=new Uint32Array(K);oe>8&255,Y[K+2]=Je>>16&255,Y[K+3]=Je>>24&255;oe%y===0&&te(D)}return F&&(K=oe<<2,Je=D[W],Y[K]=Je&255,F>1&&(Y[K+1]=Je>>8&255),F>2&&(Y[K+2]=Je>>16&255)),Y};function P(y,D,U){h.call(this,y,D,U)}P.prototype=new h,P.prototype.finalize=function(){return this.encode(this.outputBits,!0),h.prototype.finalize.call(this)};var te=function(y){var D,U,F,W,oe,Y,K,Je,Q,le,Qr,Te,Ne,Jr,Pe,ce,wr,fe,Oe,Yr,me,ze,gn,$e,He,Ht,Le,qe,Rr,Ce,We,vn,Be,Ge,yn,De,ne,ot,ge,de,rt,be,_e,Ct,Me,je,Kt,Ve,Ke,Qt,Ie,Ue,Er,ke,Ye,Ai,Xe,Ze,$n,Hn,qn,Wn,Gn;for(F=0;F<48;F+=2)W=y[0]^y[10]^y[20]^y[30]^y[40],oe=y[1]^y[11]^y[21]^y[31]^y[41],Y=y[2]^y[12]^y[22]^y[32]^y[42],K=y[3]^y[13]^y[23]^y[33]^y[43],Je=y[4]^y[14]^y[24]^y[34]^y[44],Q=y[5]^y[15]^y[25]^y[35]^y[45],le=y[6]^y[16]^y[26]^y[36]^y[46],Qr=y[7]^y[17]^y[27]^y[37]^y[47],Te=y[8]^y[18]^y[28]^y[38]^y[48],Ne=y[9]^y[19]^y[29]^y[39]^y[49],D=Te^(Y<<1|K>>>31),U=Ne^(K<<1|Y>>>31),y[0]^=D,y[1]^=U,y[10]^=D,y[11]^=U,y[20]^=D,y[21]^=U,y[30]^=D,y[31]^=U,y[40]^=D,y[41]^=U,D=W^(Je<<1|Q>>>31),U=oe^(Q<<1|Je>>>31),y[2]^=D,y[3]^=U,y[12]^=D,y[13]^=U,y[22]^=D,y[23]^=U,y[32]^=D,y[33]^=U,y[42]^=D,y[43]^=U,D=Y^(le<<1|Qr>>>31),U=K^(Qr<<1|le>>>31),y[4]^=D,y[5]^=U,y[14]^=D,y[15]^=U,y[24]^=D,y[25]^=U,y[34]^=D,y[35]^=U,y[44]^=D,y[45]^=U,D=Je^(Te<<1|Ne>>>31),U=Q^(Ne<<1|Te>>>31),y[6]^=D,y[7]^=U,y[16]^=D,y[17]^=U,y[26]^=D,y[27]^=U,y[36]^=D,y[37]^=U,y[46]^=D,y[47]^=U,D=le^(W<<1|oe>>>31),U=Qr^(oe<<1|W>>>31),y[8]^=D,y[9]^=U,y[18]^=D,y[19]^=U,y[28]^=D,y[29]^=U,y[38]^=D,y[39]^=U,y[48]^=D,y[49]^=U,Jr=y[0],Pe=y[1],je=y[11]<<4|y[10]>>>28,Kt=y[10]<<4|y[11]>>>28,qe=y[20]<<3|y[21]>>>29,Rr=y[21]<<3|y[20]>>>29,Hn=y[31]<<9|y[30]>>>23,qn=y[30]<<9|y[31]>>>23,be=y[40]<<18|y[41]>>>14,_e=y[41]<<18|y[40]>>>14,Ge=y[2]<<1|y[3]>>>31,yn=y[3]<<1|y[2]>>>31,ce=y[13]<<12|y[12]>>>20,wr=y[12]<<12|y[13]>>>20,Ve=y[22]<<10|y[23]>>>22,Ke=y[23]<<10|y[22]>>>22,Ce=y[33]<<13|y[32]>>>19,We=y[32]<<13|y[33]>>>19,Wn=y[42]<<2|y[43]>>>30,Gn=y[43]<<2|y[42]>>>30,ke=y[5]<<30|y[4]>>>2,Ye=y[4]<<30|y[5]>>>2,De=y[14]<<6|y[15]>>>26,ne=y[15]<<6|y[14]>>>26,fe=y[25]<<11|y[24]>>>21,Oe=y[24]<<11|y[25]>>>21,Qt=y[34]<<15|y[35]>>>17,Ie=y[35]<<15|y[34]>>>17,vn=y[45]<<29|y[44]>>>3,Be=y[44]<<29|y[45]>>>3,$e=y[6]<<28|y[7]>>>4,He=y[7]<<28|y[6]>>>4,Ai=y[17]<<23|y[16]>>>9,Xe=y[16]<<23|y[17]>>>9,ot=y[26]<<25|y[27]>>>7,ge=y[27]<<25|y[26]>>>7,Yr=y[36]<<21|y[37]>>>11,me=y[37]<<21|y[36]>>>11,Ue=y[47]<<24|y[46]>>>8,Er=y[46]<<24|y[47]>>>8,Ct=y[8]<<27|y[9]>>>5,Me=y[9]<<27|y[8]>>>5,Ht=y[18]<<20|y[19]>>>12,Le=y[19]<<20|y[18]>>>12,Ze=y[29]<<7|y[28]>>>25,$n=y[28]<<7|y[29]>>>25,de=y[38]<<8|y[39]>>>24,rt=y[39]<<8|y[38]>>>24,ze=y[48]<<14|y[49]>>>18,gn=y[49]<<14|y[48]>>>18,y[0]=Jr^~ce&fe,y[1]=Pe^~wr&Oe,y[10]=$e^~Ht&qe,y[11]=He^~Le&Rr,y[20]=Ge^~De&ot,y[21]=yn^~ne&ge,y[30]=Ct^~je&Ve,y[31]=Me^~Kt&Ke,y[40]=ke^~Ai&Ze,y[41]=Ye^~Xe&$n,y[2]=ce^~fe&Yr,y[3]=wr^~Oe&me,y[12]=Ht^~qe&Ce,y[13]=Le^~Rr&We,y[22]=De^~ot&de,y[23]=ne^~ge&rt,y[32]=je^~Ve&Qt,y[33]=Kt^~Ke&Ie,y[42]=Ai^~Ze&Hn,y[43]=Xe^~$n&qn,y[4]=fe^~Yr&ze,y[5]=Oe^~me&gn,y[14]=qe^~Ce&vn,y[15]=Rr^~We&Be,y[24]=ot^~de&be,y[25]=ge^~rt&_e,y[34]=Ve^~Qt&Ue,y[35]=Ke^~Ie&Er,y[44]=Ze^~Hn&Wn,y[45]=$n^~qn&Gn,y[6]=Yr^~ze&Jr,y[7]=me^~gn&Pe,y[16]=Ce^~vn&$e,y[17]=We^~Be&He,y[26]=de^~be&Ge,y[27]=rt^~_e&yn,y[36]=Qt^~Ue&Ct,y[37]=Ie^~Er&Me,y[46]=Hn^~Wn&ke,y[47]=qn^~Gn&Ye,y[8]=ze^~Jr&ce,y[9]=gn^~Pe&wr,y[18]=vn^~$e&Ht,y[19]=Be^~He&Le,y[28]=be^~Ge&De,y[29]=_e^~yn&ne,y[38]=Ue^~Ct&je,y[39]=Er^~Me&Kt,y[48]=Wn^~ke&Ai,y[49]=Gn^~Ye&Xe,y[0]^=x[F],y[1]^=x[F+1]};if(l)t.exports=f;else for(A=0;A>=8;return e}function gp(t,e,r){let n=0;for(let i=0;ie+1+n&&tn.throwError("child data too short",T.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function fy(t,e){if(t.length===0&&tn.throwError("data too short",T.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&tn.throwError("data short segment too short",T.errors.BUFFER_OVERRUN,{});const n=gp(t,e+1,r);return e+1+r+n>t.length&&tn.throwError("data long segment too short",T.errors.BUFFER_OVERRUN,{}),vp(t,e,e+1+r,r+n)}else if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{}),vp(t,e,e+1,r)}else if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{});const n=gp(t,e+1,r);e+1+r+n>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{});const i=re(t.slice(e+1+r,e+1+r+n));return{consumed:1+r+n,result:i}}else if(t[e]>=128){const r=t[e]-128;e+1+r>t.length&&tn.throwError("data too short",T.errors.BUFFER_OVERRUN,{});const n=re(t.slice(e+1,e+1+r));return{consumed:1+r,result:n}}return{consumed:1,result:re(t[e])}}function Sh(t){const e=se(t),r=fy(e,0);return r.consumed!==e.length&&tn.throwArgumentError("invalid rlp data","data",t),r.result}const Jx="address/5.7.0",oi=new T(Jx);function yp(t){pe(t,20)||oi.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=se(ut(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const Yx=9007199254740991;function Xx(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const kh={};for(let t=0;t<10;t++)kh[String(t)]=String(t);for(let t=0;t<26;t++)kh[String.fromCharCode(65+t)]=String(10+t);const wp=Math.floor(Xx(Yx));function dy(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>kh[n]).join("");for(;e.length>=wp;){let n=e.substring(0,wp);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function mt(t){let e=null;if(typeof t!="string"&&oi.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=yp(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&oi.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==dy(t)&&oi.throwArgumentError("bad icap checksum","address",t),e=Ox(t.substring(4));e.length<40;)e="0"+e;e=yp("0x"+e)}else oi.throwArgumentError("invalid address","address",t);return e}function Zx(t){try{return mt(t),!0}catch{}return!1}function eA(t){let e=Lx(mt(t).substring(2)).toUpperCase();for(;e.length<30;)e="0"+e;return"XE"+dy("XE00"+e)+e}function Nh(t){let e=null;try{e=mt(t.from)}catch{oi.throwArgumentError("missing from address","transaction",t)}const r=Ro(se(V.from(t.nonce).toHexString()));return mt(It(ut(Lu([e,r])),12))}function tA(t,e,r){return On(e)!==32&&oi.throwArgumentError("salt must be 32 bytes","salt",e),On(r)!==32&&oi.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),mt(It(ut(Ut(["0xff",mt(t),e,r])),12))}const rA=Object.freeze(Object.defineProperty({__proto__:null,getAddress:mt,getContractAddress:Nh,getCreate2Address:tA,getIcapAddress:eA,isAddress:Zx},Symbol.toStringTag,{value:"Module"}));class nA extends jn{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){try{r=mt(r)}catch(n){this._throwError(n.message,r)}return e.writeValue(r)}decode(e){return mt(pt(e.readValue().toHexString(),20))}}class iA extends jn{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,r){return this.coder.encode(e,r)}decode(e){return this.coder.decode(e)}}const co=new T(yl);function hy(t,e,r){let n=null;if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let a={};n=e.map(u=>{const c=u.localName;return c||co.throwError("cannot encode object for signature with missing names",T.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),a[c]&&co.throwError("cannot encode object for signature with duplicate names",T.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),a[c]=!0,r[c]})}else co.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&co.throwArgumentError("types/value length mismatch","tuple",r);let i=new sd(t.wordSize),o=new sd(t.wordSize),s=[];e.forEach((a,u)=>{let c=n[u];if(a.dynamic){let d=o.length;a.encode(o,c);let p=i.writeUpdatableValue();s.push(v=>{p(v+d)})}else a.encode(i,c)}),s.forEach(a=>{a(i.length)});let l=t.appendWriter(i);return l+=t.appendWriter(o),l}function py(t,e){let r=[],n=t.subReader(0);e.forEach(o=>{let s=null;if(o.dynamic){let l=t.readValue(),a=n.subReader(l.toNumber());try{s=o.decode(a)}catch(u){if(u.code===T.errors.BUFFER_OVERRUN)throw u;s=u,s.baseType=o.name,s.name=o.localName,s.type=o.type}}else try{s=o.decode(t)}catch(l){if(l.code===T.errors.BUFFER_OVERRUN)throw l;s=l,s.baseType=o.name,s.name=o.localName,s.type=o.type}s!=null&&r.push(s)});const i=e.reduce((o,s)=>{const l=s.localName;return l&&(o[l]||(o[l]=0),o[l]++),o},{});e.forEach((o,s)=>{let l=o.localName;if(!l||i[l]!==1||(l==="length"&&(l="_length"),r[l]!=null))return;const a=r[s];a instanceof Error?Object.defineProperty(r,l,{enumerable:!0,get:()=>{throw a}}):r[l]=a});for(let o=0;o{throw s}})}return Object.freeze(r)}class oA extends jn{constructor(e,r,n){const i=e.type+"["+(r>=0?r:"")+"]",o=r===-1||e.dynamic;super("array",i,n,o),this.coder=e,this.length=r}defaultValue(){const e=this.coder.defaultValue(),r=[];for(let n=0;ne._data.length&&co.throwError("insufficient data length",T.errors.BUFFER_OVERRUN,{length:e._data.length,count:r}));let n=[];for(let i=0;i>6===2;s++)o++;return o}return t===ar.OVERRUN?r.length-e-1:0}function yA(t,e,r,n,i){return t===ar.OVERLONG?(n.push(i),0):(n.push(65533),yy(t,e,r))}const wA=Object.freeze({error:vA,ignore:yy,replace:yA});function wy(t,e){e==null&&(e=wA.error),t=se(t);const r=[];let n=0;for(;n>7)){r.push(i);continue}let o=null,s=null;if((i&224)===192)o=1,s=127;else if((i&240)===224)o=2,s=2047;else if((i&248)===240)o=3,s=65535;else{(i&192)===128?n+=e(ar.UNEXPECTED_CONTINUE,n-1,t,r):n+=e(ar.BAD_PREFIX,n-1,t,r);continue}if(n-1+o>=t.length){n+=e(ar.OVERRUN,n-1,t,r);continue}let l=i&(1<<8-o-1)-1;for(let a=0;a1114111){n+=e(ar.OUT_OF_RANGE,n-1-o,t,r,l);continue}if(l>=55296&&l<=57343){n+=e(ar.UTF16_SURROGATE,n-1-o,t,r,l);continue}if(l<=s){n+=e(ar.OVERLONG,n-1-o,t,r,l);continue}r.push(l)}}return r}function mr(t,e=nl.current){e!=nl.current&&(vy.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const o=t.charCodeAt(n);if(n>=t.length||(o&64512)!==56320)throw new Error("invalid utf-8 string");const s=65536+((i&1023)<<10)+(o&1023);r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return se(r)}function EA(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function wl(t,e){return EA(wy(t,e))}function xA(t,e=nl.current){return wy(mr(t,e))}class AA extends my{constructor(e){super("string",e)}defaultValue(){return""}encode(e,r){return super.encode(e,mr(r))}decode(e){return wl(super.decode(e))}}class $l extends jn{constructor(e,r){let n=!1;const i=[];e.forEach(s=>{s.dynamic&&(n=!0),i.push(s.type)});const o="tuple("+i.join(",")+")";super("tuple",o,r,n),this.coders=e}defaultValue(){const e=[];this.coders.forEach(n=>{e.push(n.defaultValue())});const r=this.coders.reduce((n,i)=>{const o=i.localName;return o&&(n[o]||(n[o]=0),n[o]++),n},{});return this.coders.forEach((n,i)=>{let o=n.localName;!o||r[o]!==1||(o==="length"&&(o="_length"),e[o]==null&&(e[o]=e[i]))}),Object.freeze(e)}encode(e,r){return hy(e,this.coders,r)}decode(e){return e.coerce(this.name,py(e,this.coders))}}const Hl=new T(yl),bA=new RegExp(/^bytes([0-9]*)$/),_A=new RegExp(/^(u?int)([0-9]*)$/);class SA{constructor(e){z(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new nA(e.name);case"bool":return new sA(e.name);case"string":return new AA(e.name);case"bytes":return new lA(e.name);case"array":return new oA(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new $l((e.components||[]).map(n=>this._getCoder(n)),e.name);case"":return new uA(e.name)}let r=e.type.match(_A);if(r){let n=parseInt(r[2]||"256");return(n===0||n>256||n%8!==0)&&Hl.throwArgumentError("invalid "+r[1]+" bit length","param",e),new mA(n/8,r[1]==="int",e.name)}if(r=e.type.match(bA),r){let n=parseInt(r[1]);return(n===0||n>32)&&Hl.throwArgumentError("invalid bytes length","param",e),new aA(n,e.name)}return Hl.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,r){return new Ya(e,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new sd(this._getWordSize())}getDefaultValue(e){const r=e.map(i=>this._getCoder(kt.from(i)));return new $l(r,"_").defaultValue()}encode(e,r){e.length!==r.length&&Hl.throwError("types/values length mismatch",T.errors.INVALID_ARGUMENT,{count:{types:e.length,values:r.length},value:{types:e,values:r}});const n=e.map(s=>this._getCoder(kt.from(s))),i=new $l(n,"_"),o=this._getWriter();return i.encode(o,r),o.data}decode(e,r,n){const i=e.map(s=>this._getCoder(kt.from(s)));return new $l(i,"_").decode(this._getReader(se(r),n))}}const kA=new SA;function fo(t){return ut(mr(t))}const Ey="hash/5.7.0";function xy(t){t=atob(t);const e=[];for(let r=0;r0&&Array.isArray(l)?i(l,s-1):r.push(l)})};return i(t,e),r}function NA(t){const e={};for(let r=0;r>--a&1}const d=31,p=Math.pow(2,d),v=p>>>1,g=v>>1,x=p-1;let k=0;for(let B=0;B1;){let X=j+$>>>1;B>>1|c(),H=H<<1^v,ie=(ie^v)<<1|v|1;w=H,_=1+ie-H}let O=n-4;return E.map(B=>{switch(B-O){case 3:return O+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return O+256+(t[l++]<<8|t[l++]);case 1:return O+t[l++];default:return B-1}})}function CA(t){let e=0;return()=>t[e++]}function MA(t){return CA(PA(t))}function IA(t){return t&1?~t>>1:t>>1}function RA(t,e){let r=Array(t);for(let n=0;ne[s]):r}function OA(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(BA(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(DA(r,t))}return NA(by(e))}function LA(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function _y(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;in[s].push(o));return n}function BA(t,e){let r=1+e(),n=e(),i=LA(e),o=_y(i.length,1+t,e);return by(o.map((s,l)=>{const a=s[0],u=s.slice(1);return Array(i[l]).fill(void 0).map((c,d)=>{let p=d*n;return[a+d*r,u.map(v=>v+p)]})}))}function DA(t,e){let r=1+e();return _y(r,1+t,e).map(i=>[i[0],i.slice(1)])}function jA(t){let e=Xa(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let u=Xa(t,e);if(u.length==0)break;n.push({set:new Set(u),node:r()})}n.sort((u,c)=>c.set.size-u.set.size);let i=t(),o=i%3;i=i/3|0;let s=!!(i&1);i>>=1;let l=i==1,a=i==2;return{branches:n,valid:o,fe0f:s,save:l,check:a}}}function UA(){return MA(xy("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const Bu=UA(),FA=new Set(Xa(Bu)),zA=new Set(Xa(Bu)),$A=OA(Bu),HA=jA(Bu),xp=45,Ap=95;function Sy(t){return xA(t)}function qA(t){return t.filter(e=>e!=65039)}function ky(t){for(let e of t.split(".")){let r=Sy(e);try{for(let n=r.lastIndexOf(Ap)-1;n>=0;n--)if(r[n]!==Ap)throw new Error("underscore only allowed at start");if(r.length>=4&&r.every(n=>n<128)&&r[2]===xp&&r[3]===xp)throw new Error("invalid label extension")}catch(n){throw new Error(`Invalid label "${e}": ${n.message}`)}}return t}function WA(t){return ky(GA(t,qA))}function GA(t,e){let r=Sy(t).reverse(),n=[];for(;r.length;){let i=KA(r);if(i){n.push(...e(i));continue}let o=r.pop();if(FA.has(o)){n.push(o);continue}if(zA.has(o))continue;let s=$A[o];if(s){n.push(...s);continue}throw new Error(`Disallowed codepoint: 0x${o.toString(16).toUpperCase()}`)}return ky(VA(String.fromCodePoint(...n)))}function VA(t){return t.normalize("NFC")}function KA(t,e){var r;let n=HA,i,o,s=[],l=t.length;for(e&&(e.length=0);l;){let a=t[--l];if(n=(r=n.branches.find(u=>u.set.has(a)))===null||r===void 0?void 0:r.node,!n)break;if(n.save)o=a;else if(n.check&&a===o)break;s.push(a),n.fe0f&&(s.push(65039),l>0&&t[l-1]==65039&&l--),n.valid&&(i=s.slice(),n.valid==2&&i.splice(1,1),e&&e.push(...t.slice(l).reverse()),t.length=l)}return i}const QA=new T(Ey),Ny=new Uint8Array(32);Ny.fill(0);function bp(t){if(t.length===0)throw new Error("invalid ENS name; empty component");return t}function Py(t){const e=mr(WA(t)),r=[];if(t.length===0)return r;let n=0;for(let i=0;i=e.length)throw new Error("invalid ENS name; empty component");return r.push(bp(e.slice(n))),r}function ma(t){typeof t!="string"&&QA.throwArgumentError("invalid ENS name; not a string","name",t);let e=Ny;const r=Py(t);for(;r.length;)e=ut(Ut([e,ut(r.pop())]));return re(e)}function JA(t){return re(Ut(Py(t).map(e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const r=new Uint8Array(e.length+1);return r.set(e,1),r[0]=r.length-1,r})))+"00"}var YA=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const lt=new T(Ey),Cy=new Uint8Array(32);Cy.fill(0);const XA=V.from(-1),My=V.from(0),Iy=V.from(1),ZA=V.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function eb(t){const e=se(t),r=e.length%32;return r?Xt([e,Cy.slice(r)]):re(e)}const tb=pt(Iy.toHexString(),32),rb=pt(My.toHexString(),32),_p={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},zc=["name","version","chainId","verifyingContract","salt"];function Sp(t){return function(e){return typeof e!="string"&<.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const nb={name:Sp("name"),version:Sp("version"),chainId:function(t){try{return V.from(t).toString()}catch{}return lt.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return mt(t).toLowerCase()}catch{}return lt.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=se(t);if(e.length!==32)throw new Error("bad length");return re(e)}catch{}return lt.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function $c(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=e[1]==="",n=parseInt(e[2]||"256");(n%8!==0||n>256||e[2]&&e[2]!==String(n))&<.throwArgumentError("invalid numeric width","type",t);const i=ZA.mask(r?n-1:n),o=r?i.add(Iy).mul(XA):My;return function(s){const l=V.from(s);return(l.lt(o)||l.gt(i))&<.throwArgumentError(`value out-of-bounds for ${t}`,"value",s),pt(l.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(r===0||r>32||e[1]!==String(r))&<.throwArgumentError("invalid bytes width","type",t),function(n){return se(n).length!==r&<.throwArgumentError(`invalid length for ${t}`,"value",n),eb(n)}}}switch(t){case"address":return function(e){return pt(mt(e),32)};case"bool":return function(e){return e?tb:rb};case"bytes":return function(e){return ut(e)};case"string":return function(e){return fo(e)}}return null}function kp(t,e){return`${t}(${e.map(({name:r,type:n})=>n+" "+r).join(",")})`}class sr{constructor(e){z(this,"types",Object.freeze(nr(e))),z(this,"_encoderCache",{}),z(this,"_types",{});const r={},n={},i={};Object.keys(e).forEach(l=>{r[l]={},n[l]=[],i[l]={}});for(const l in e){const a={};e[l].forEach(u=>{a[u.name]&<.throwArgumentError(`duplicate variable name ${JSON.stringify(u.name)} in ${JSON.stringify(l)}`,"types",e),a[u.name]=!0;const c=u.type.match(/^([^\x5b]*)(\x5b|$)/)[1];c===l&<.throwArgumentError(`circular type reference to ${JSON.stringify(c)}`,"types",e),!$c(c)&&(n[c]||lt.throwArgumentError(`unknown type ${JSON.stringify(c)}`,"types",e),n[c].push(l),r[l][c]=!0)})}const o=Object.keys(n).filter(l=>n[l].length===0);o.length===0?lt.throwArgumentError("missing primary type","types",e):o.length>1&<.throwArgumentError(`ambiguous primary types or unused types: ${o.map(l=>JSON.stringify(l)).join(", ")}`,"types",e),z(this,"primaryType",o[0]);function s(l,a){a[l]&<.throwArgumentError(`circular type reference to ${JSON.stringify(l)}`,"types",e),a[l]=!0,Object.keys(r[l]).forEach(u=>{n[u]&&(s(u,a),Object.keys(a).forEach(c=>{i[c][u]=!0}))}),delete a[l]}s(this.primaryType,{});for(const l in i){const a=Object.keys(i[l]);a.sort(),this._types[l]=kp(l,e[l])+a.map(u=>kp(u,e[u])).join("")}}getEncoder(e){let r=this._encoderCache[e];return r||(r=this._encoderCache[e]=this._getEncoder(e)),r}_getEncoder(e){{const i=$c(e);if(i)return i}const r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const i=r[1],o=this.getEncoder(i),s=parseInt(r[3]);return l=>{s>=0&&l.length!==s&<.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",l);let a=l.map(o);return this._types[i]&&(a=a.map(ut)),ut(Xt(a))}}const n=this.types[e];if(n){const i=fo(this._types[e]);return o=>{const s=n.map(({name:l,type:a})=>{const u=this.getEncoder(a)(o[l]);return this._types[a]?ut(u):u});return s.unshift(i),Xt(s)}}return lt.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const r=this._types[e];return r||lt.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return ut(this.encodeData(e,r))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,r,n){if($c(e))return n(e,r);const i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const s=i[1],l=parseInt(i[3]);return l>=0&&r.length!==l&<.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map(a=>this._visit(s,a,n))}const o=this.types[e];return o?o.reduce((s,{name:l,type:a})=>(s[l]=this._visit(a,r[l],n),s),{}):lt.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new sr(e)}static getPrimaryType(e){return sr.from(e).primaryType}static hashStruct(e,r,n){return sr.from(r).hashStruct(e,n)}static hashDomain(e){const r=[];for(const n in e){const i=_p[n];i||lt.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),r.push({name:n,type:i})}return r.sort((n,i)=>zc.indexOf(n.name)-zc.indexOf(i.name)),sr.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,n){return Xt(["0x1901",sr.hashDomain(e),sr.from(r).hash(n)])}static hash(e,r,n){return ut(sr.encode(e,r,n))}static resolveNames(e,r,n,i){return YA(this,void 0,void 0,function*(){e=it(e);const o={};e.verifyingContract&&!pe(e.verifyingContract,20)&&(o[e.verifyingContract]="0x");const s=sr.from(r);s.visit(n,(l,a)=>(l==="address"&&!pe(a,20)&&(o[a]="0x"),a));for(const l in o)o[l]=yield i(l);return e.verifyingContract&&o[e.verifyingContract]&&(e.verifyingContract=o[e.verifyingContract]),n=s.visit(n,(l,a)=>l==="address"&&o[a]?o[a]:a),{domain:e,value:n}})}static getPayload(e,r,n){sr.hashDomain(e);const i={},o=[];zc.forEach(a=>{const u=e[a];u!=null&&(i[a]=nb[a](u),o.push({name:a,type:_p[a]}))});const s=sr.from(r),l=it(r);return l.EIP712Domain?lt.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):l.EIP712Domain=o,s.encode(n),{types:l,domain:i,primaryType:s.primaryType,message:s.visit(n,(a,u)=>{if(a.match(/^bytes(\d*)/))return re(se(u));if(a.match(/^u?int/))return V.from(u).toString();switch(a){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return typeof u!="string"&<.throwArgumentError("invalid string","value",u),u}return lt.throwArgumentError("unsupported type","type",a)})}}}const st=new T(yl);class ib extends vl{}class ob extends vl{}class sb extends vl{}class ld extends vl{static isIndexed(e){return!!(e&&e._isIndexed)}}const lb={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Np(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class ad{constructor(e){let r=[];typeof e=="string"?r=JSON.parse(e):r=e,z(this,"fragments",r.map(n=>Nn.from(n)).filter(n=>n!=null)),z(this,"_abiCoder",fr(new.target,"getAbiCoder")()),z(this,"functions",{}),z(this,"errors",{}),z(this,"events",{}),z(this,"structs",{}),this.fragments.forEach(n=>{let i=null;switch(n.type){case"constructor":if(this.deploy){st.warn("duplicate definition - constructor");return}z(this,"deploy",n);return;case"function":i=this.functions;break;case"event":i=this.events;break;case"error":i=this.errors;break;default:return}let o=n.format();if(i[o]){st.warn("duplicate definition - "+o);return}i[o]=n}),this.deploy||z(this,"deploy",on.from({payable:!1,type:"constructor"})),z(this,"_isInterface",!0)}format(e){e||(e=Se.full),e===Se.sighash&&st.throwArgumentError("interface does not support formatting sighash","format",e);const r=this.fragments.map(n=>n.format(e));return e===Se.json?JSON.stringify(r.map(n=>JSON.parse(n))):r}static getAbiCoder(){return kA}static getAddress(e){return mt(e)}static getSighash(e){return It(fo(e.format()),0,4)}static getEventTopic(e){return fo(e.format())}getFunction(e){if(pe(e)){for(const n in this.functions)if(e===this.getSighash(n))return this.functions[n];st.throwArgumentError("no matching function","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.functions).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching function","name",n):i.length>1&&st.throwArgumentError("multiple matching functions","name",n),this.functions[i[0]]}const r=this.functions[sn.fromString(e).format()];return r||st.throwArgumentError("no matching function","signature",e),r}getEvent(e){if(pe(e)){const n=e.toLowerCase();for(const i in this.events)if(n===this.getEventTopic(i))return this.events[i];st.throwArgumentError("no matching event","topichash",n)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.events).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching event","name",n):i.length>1&&st.throwArgumentError("multiple matching events","name",n),this.events[i[0]]}const r=this.events[_n.fromString(e).format()];return r||st.throwArgumentError("no matching event","signature",e),r}getError(e){if(pe(e)){const n=fr(this.constructor,"getSighash");for(const i in this.errors){const o=this.errors[i];if(e===n(o))return this.errors[i]}st.throwArgumentError("no matching error","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.errors).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching error","name",n):i.length>1&&st.throwArgumentError("multiple matching errors","name",n),this.errors[i[0]]}const r=this.errors[sn.fromString(e).format()];return r||st.throwArgumentError("no matching error","signature",e),r}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e)}catch(r){try{e=this.getError(e)}catch{throw r}}return fr(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),fr(this.constructor,"getEventTopic")(e)}_decodeParams(e,r){return this._abiCoder.decode(e,r)}_encodeParams(e,r){return this._abiCoder.encode(e,r)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,r){typeof e=="string"&&(e=this.getError(e));const n=se(r);return re(n.slice(0,4))!==this.getSighash(e)&&st.throwArgumentError(`data signature does not match error ${e.name}.`,"data",re(n)),this._decodeParams(e.inputs,n.slice(4))}encodeErrorResult(e,r){return typeof e=="string"&&(e=this.getError(e)),re(Ut([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionData(e,r){typeof e=="string"&&(e=this.getFunction(e));const n=se(r);return re(n.slice(0,4))!==this.getSighash(e)&&st.throwArgumentError(`data signature does not match function ${e.name}.`,"data",re(n)),this._decodeParams(e.inputs,n.slice(4))}encodeFunctionData(e,r){return typeof e=="string"&&(e=this.getFunction(e)),re(Ut([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionResult(e,r){typeof e=="string"&&(e=this.getFunction(e));let n=se(r),i=null,o="",s=null,l=null,a=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,n)}catch{}break;case 4:{const u=re(n.slice(0,4)),c=lb[u];if(c)s=this._abiCoder.decode(c.inputs,n.slice(4)),l=c.name,a=c.signature,c.reason&&(i=s[0]),l==="Error"?o=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(s[0])}`:l==="Panic"&&(o=`; VM Exception while processing transaction: reverted with panic code ${s[0]}`);else try{const d=this.getError(u);s=this._abiCoder.decode(d.inputs,n.slice(4)),l=d.name,a=d.format()}catch{}break}}return st.throwError("call revert exception"+o,T.errors.CALL_EXCEPTION,{method:e.format(),data:re(r),errorArgs:s,errorName:l,errorSignature:a,reason:i})}encodeFunctionResult(e,r){return typeof e=="string"&&(e=this.getFunction(e)),re(this._abiCoder.encode(e.outputs,r||[]))}encodeFilterTopics(e,r){typeof e=="string"&&(e=this.getEvent(e)),r.length>e.inputs.length&&st.throwError("too many arguments for "+e.format(),T.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:r});let n=[];e.anonymous||n.push(this.getEventTopic(e));const i=(o,s)=>o.type==="string"?fo(s):o.type==="bytes"?ut(re(s)):(o.type==="bool"&&typeof s=="boolean"&&(s=s?"0x01":"0x00"),o.type.match(/^u?int/)&&(s=V.from(s).toHexString()),o.type==="address"&&this._abiCoder.encode(["address"],[s]),pt(re(s),32));for(r.forEach((o,s)=>{let l=e.inputs[s];if(!l.indexed){o!=null&&st.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+l.name,o);return}o==null?n.push(null):l.baseType==="array"||l.baseType==="tuple"?st.throwArgumentError("filtering with tuples or arrays not supported","contract."+l.name,o):Array.isArray(o)?n.push(o.map(a=>i(l,a))):n.push(i(l,o))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,r){typeof e=="string"&&(e=this.getEvent(e));const n=[],i=[],o=[];return e.anonymous||n.push(this.getEventTopic(e)),r.length!==e.inputs.length&&st.throwArgumentError("event arguments/values mismatch","values",r),e.inputs.forEach((s,l)=>{const a=r[l];if(s.indexed)if(s.type==="string")n.push(fo(a));else if(s.type==="bytes")n.push(ut(a));else{if(s.baseType==="tuple"||s.baseType==="array")throw new Error("not implemented");n.push(this._abiCoder.encode([s.type],[a]))}else i.push(s),o.push(a)}),{data:this._abiCoder.encode(i,o),topics:n}}decodeEventLog(e,r,n){if(typeof e=="string"&&(e=this.getEvent(e)),n!=null&&!e.anonymous){let p=this.getEventTopic(e);(!pe(n[0],32)||n[0].toLowerCase()!==p)&&st.throwError("fragment/topic mismatch",T.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:p,value:n[0]}),n=n.slice(1)}let i=[],o=[],s=[];e.inputs.forEach((p,v)=>{p.indexed?p.type==="string"||p.type==="bytes"||p.baseType==="tuple"||p.baseType==="array"?(i.push(kt.fromObject({type:"bytes32",name:p.name})),s.push(!0)):(i.push(p),s.push(!1)):(o.push(p),s.push(!1))});let l=n!=null?this._abiCoder.decode(i,Ut(n)):null,a=this._abiCoder.decode(o,r,!0),u=[],c=0,d=0;e.inputs.forEach((p,v)=>{if(p.indexed)if(l==null)u[v]=new ld({_isIndexed:!0,hash:null});else if(s[v])u[v]=new ld({_isIndexed:!0,hash:l[d++]});else try{u[v]=l[d++]}catch(g){u[v]=g}else try{u[v]=a[c++]}catch(g){u[v]=g}if(p.name&&u[p.name]==null){const g=u[v];g instanceof Error?Object.defineProperty(u,p.name,{enumerable:!0,get:()=>{throw Np(`property ${JSON.stringify(p.name)}`,g)}}):u[p.name]=g}});for(let p=0;p{throw Np(`index ${p}`,v)}})}return Object.freeze(u)}parseTransaction(e){let r=this.getFunction(e.data.substring(0,10).toLowerCase());return r?new ob({args:this._abiCoder.decode(r.inputs,"0x"+e.data.substring(10)),functionFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r),value:V.from(e.value||"0")}):null}parseLog(e){let r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new ib({eventFragment:r,name:r.name,signature:r.format(),topic:this.getEventTopic(r),args:this.decodeEventLog(r,e.data,e.topics)})}parseError(e){const r=re(e);let n=this.getError(r.substring(0,10).toLowerCase());return n?new sb({args:this._abiCoder.decode(n.inputs,"0x"+r.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(e){return!!(e&&e._isInterface)}}const ab="abstract-provider/5.7.0";var ub=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const cb=new T(ab);class fb extends vl{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class qo{constructor(){cb.checkAbstract(new.target,qo),z(this,"_isProvider",!0)}getFeeData(){return ub(this,void 0,void 0,function*(){const{block:e,gasPrice:r}=yield yt({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(s=>null)});let n=null,i=null,o=null;return e&&e.baseFeePerGas&&(n=e.baseFeePerGas,o=V.from("1500000000"),i=e.baseFeePerGas.mul(2).add(o)),{lastBaseFeePerGas:n,maxFeePerGas:i,maxPriorityFeePerGas:o,gasPrice:r}})}addListener(e,r){return this.on(e,r)}removeListener(e,r){return this.off(e,r)}static isProvider(e){return!!(e&&e._isProvider)}}const db="abstract-signer/5.7.0";var Or=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Ar=new T(db),hb=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],pb=[T.errors.INSUFFICIENT_FUNDS,T.errors.NONCE_EXPIRED,T.errors.REPLACEMENT_UNDERPRICED];class El{constructor(){Ar.checkAbstract(new.target,El),z(this,"_isSigner",!0)}getBalance(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return Or(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const r=yield yt(this.checkTransaction(e));return yield this.provider.estimateGas(r)})}call(e,r){return Or(this,void 0,void 0,function*(){this._checkProvider("call");const n=yield yt(this.checkTransaction(e));return yield this.provider.call(n,r)})}sendTransaction(e){return Or(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const r=yield this.populateTransaction(e),n=yield this.signTransaction(r);return yield this.provider.sendTransaction(n)})}getChainId(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const n in e)hb.indexOf(n)===-1&&Ar.throwArgumentError("invalid transaction key: "+n,"transaction",e);const r=it(e);return r.from==null?r.from=this.getAddress():r.from=Promise.all([Promise.resolve(r.from),this.getAddress()]).then(n=>(n[0].toLowerCase()!==n[1].toLowerCase()&&Ar.throwArgumentError("from address mismatch","transaction",e),n[0])),r}populateTransaction(e){return Or(this,void 0,void 0,function*(){const r=yield yt(this.checkTransaction(e));r.to!=null&&(r.to=Promise.resolve(r.to).then(i=>Or(this,void 0,void 0,function*(){if(i==null)return null;const o=yield this.resolveName(i);return o==null&&Ar.throwArgumentError("provided ENS name resolves to null","tx.to",i),o})),r.to.catch(i=>{}));const n=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||n)?Ar.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(r.type===0||r.type===1)&&n&&Ar.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1)r.gasPrice==null&&(r.gasPrice=this.getGasPrice());else{const i=yield this.getFeeData();if(r.type==null)if(i.maxFeePerGas!=null&&i.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){const o=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=o,r.maxPriorityFeePerGas=o}else r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas);else i.gasPrice!=null?(n&&Ar.throwError("network does not support EIP-1559",T.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=i.gasPrice),r.type=0):Ar.throwError("failed to get consistent fee data",T.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else r.type===2&&(r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas))}return r.nonce==null&&(r.nonce=this.getTransactionCount("pending")),r.gasLimit==null&&(r.gasLimit=this.estimateGas(r).catch(i=>{if(pb.indexOf(i.code)>=0)throw i;return Ar.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:i,tx:r})})),r.chainId==null?r.chainId=this.getChainId():r.chainId=Promise.all([Promise.resolve(r.chainId),this.getChainId()]).then(i=>(i[1]!==0&&i[0]!==i[1]&&Ar.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield yt(r)})}_checkProvider(e){this.provider||Ar.throwError("missing provider",T.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class Ph extends El{constructor(e,r){super(),z(this,"address",e),z(this,"provider",r||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,r){return Promise.resolve().then(()=>{Ar.throwError(e,T.errors.UNSUPPORTED_OPERATION,{operation:r})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,r,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new Ph(this.address,e)}}var Ry={},we={},xl=Ty;function Ty(t,e){if(!t)throw new Error(e||"Assertion failed")}Ty.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var ud={exports:{}};typeof Object.create=="function"?ud.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ud.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var mb=ud.exports,gb=xl,vb=mb;we.inherits=vb;function yb(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function wb(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=o&63|128):yb(t,i)?(o=65536+((o&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=o&63|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=o&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}we.htonl=Oy;function xb(t,e){for(var r="",n=0;n>>0}return o}we.join32=Ab;function bb(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=o&255):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=o&255)}return r}we.split32=bb;function _b(t,e){return t>>>e|t<<32-e}we.rotr32=_b;function Sb(t,e){return t<>>32-e}we.rotl32=Sb;function kb(t,e){return t+e>>>0}we.sum32=kb;function Nb(t,e,r){return t+e+r>>>0}we.sum32_3=Nb;function Pb(t,e,r,n){return t+e+r+n>>>0}we.sum32_4=Pb;function Cb(t,e,r,n,i){return t+e+r+n+i>>>0}we.sum32_5=Cb;function Mb(t,e,r,n){var i=t[e],o=t[e+1],s=n+o>>>0,l=(s>>0,t[e+1]=s}we.sum64=Mb;function Ib(t,e,r,n){var i=e+n>>>0,o=(i>>0}we.sum64_hi=Ib;function Rb(t,e,r,n){var i=e+n;return i>>>0}we.sum64_lo=Rb;function Tb(t,e,r,n,i,o,s,l){var a=0,u=e;u=u+n>>>0,a+=u>>0,a+=u>>0,a+=u>>0}we.sum64_4_hi=Tb;function Ob(t,e,r,n,i,o,s,l){var a=e+n+o+l;return a>>>0}we.sum64_4_lo=Ob;function Lb(t,e,r,n,i,o,s,l,a,u){var c=0,d=e;d=d+n>>>0,c+=d>>0,c+=d>>0,c+=d>>0,c+=d>>0}we.sum64_5_hi=Lb;function Bb(t,e,r,n,i,o,s,l,a,u){var c=e+n+o+l+u;return c>>>0}we.sum64_5_lo=Bb;function Db(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}we.rotr64_hi=Db;function jb(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}we.rotr64_lo=jb;function Ub(t,e,r){return t>>>r}we.shr64_hi=Ub;function Fb(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}we.shr64_lo=Fb;var Wo={},Pp=we,zb=xl;function Du(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Wo.BlockHash=Du;Du.prototype.update=function(e,r){if(e=Pp.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Pp.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[o++]=e>>>16&255,i[o++]=e>>>8&255,i[o++]=e&255}else for(i[o++]=e&255,i[o++]=e>>>8&255,i[o++]=e>>>16&255,i[o++]=e>>>24&255,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,s=8;s>>3}mn.g0_256=Gb;function Vb(t){return un(t,17)^un(t,19)^t>>>10}mn.g1_256=Vb;var To=we,Kb=Wo,Qb=mn,Hc=To.rotl32,is=To.sum32,Jb=To.sum32_5,Yb=Qb.ft_1,Fy=Kb.BlockHash,Xb=[1518500249,1859775393,2400959708,3395469782];function dn(){if(!(this instanceof dn))return new dn;Fy.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}To.inherits(dn,Fy);var Zb=dn;dn.blockSize=512;dn.outSize=160;dn.hmacStrength=80;dn.padLength=64;dn.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),F_(e.length<=this.blockSize);for(var r=e.length;r>8,p=c&255;d?a.push(d,p):a.push(p)}return a}r.toArray=n;function i(s){return s.length===1?"0"+s:s}r.zero2=i;function o(s){for(var l="",a=0;a(p>>1)-1?x=(p>>1)-k:x=k,v.isubn(x)):x=0,d[g]=x,v.iushrn(1)}return d}r.getNAF=n;function i(a,u){var c=[[],[]];a=a.clone(),u=u.clone();for(var d=0,p=0,v;a.cmpn(-d)>0||u.cmpn(-p)>0;){var g=a.andln(3)+d&3,x=u.andln(3)+p&3;g===3&&(g=-1),x===3&&(x=-1);var k;g&1?(v=a.andln(7)+d&7,(v===3||v===5)&&x===2?k=-g:k=g):k=0,c[0].push(k);var E;x&1?(v=u.andln(7)+p&7,(v===3||v===5)&&g===2?E=-x:E=x):E=0,c[1].push(E),2*d===k+1&&(d=1-d),2*p===E+1&&(p=1-p),a.iushrn(1),u.iushrn(1)}return c}r.getJSF=i;function o(a,u,c){var d="_"+u;a.prototype[u]=function(){return this[d]!==void 0?this[d]:this[d]=c.call(this)}}r.cachedProperty=o;function s(a){return typeof a=="string"?r.toArray(a,"hex"):a}r.parseBytes=s;function l(a){return new ue(a,"hex","le")}r.intFromLE=l}),Za=yr.getNAF,H_=yr.getJSF,eu=yr.assert;function xi(t,e){this.type=t,this.p=new ue(e.p,16),this.red=e.prime?ue.red(e.prime):ue.mont(this.p),this.zero=new ue(0).toRed(this.red),this.one=new ue(1).toRed(this.red),this.two=new ue(2).toRed(this.red),this.n=e.n&&new ue(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Hi=xi;xi.prototype.point=function(){throw new Error("Not implemented")};xi.prototype.validate=function(){throw new Error("Not implemented")};xi.prototype._fixedNafMul=function(e,r){eu(e.precomputed);var n=e._getDoubles(),i=Za(r,1,this._bitLength),o=(1<=l;u--)a=(a<<1)+i[u];s.push(a)}for(var c=this.jpoint(null,null,null),d=this.jpoint(null,null,null),p=o;p>0;p--){for(l=0;l=0;a--){for(var u=0;a>=0&&s[a]===0;a--)u++;if(a>=0&&u++,l=l.dblp(u),a<0)break;var c=s[a];eu(c!==0),e.type==="affine"?c>0?l=l.mixedAdd(o[c-1>>1]):l=l.mixedAdd(o[-c-1>>1].neg()):c>0?l=l.add(o[c-1>>1]):l=l.add(o[-c-1>>1].neg())}return e.type==="affine"?l.toP():l};xi.prototype._wnafMulAdd=function(e,r,n,i,o){var s=this._wnafT1,l=this._wnafT2,a=this._wnafT3,u=0,c,d,p;for(c=0;c=1;c-=2){var g=c-1,x=c;if(s[g]!==1||s[x]!==1){a[g]=Za(n[g],s[g],this._bitLength),a[x]=Za(n[x],s[x],this._bitLength),u=Math.max(a[g].length,u),u=Math.max(a[x].length,u);continue}var k=[r[g],null,null,r[x]];r[g].y.cmp(r[x].y)===0?(k[1]=r[g].add(r[x]),k[2]=r[g].toJ().mixedAdd(r[x].neg())):r[g].y.cmp(r[x].y.redNeg())===0?(k[1]=r[g].toJ().mixedAdd(r[x]),k[2]=r[g].add(r[x].neg())):(k[1]=r[g].toJ().mixedAdd(r[x]),k[2]=r[g].toJ().mixedAdd(r[x].neg()));var E=[-3,-1,-5,-7,0,7,5,1,3],w=H_(n[g],n[x]);for(u=Math.max(w[0].length,u),a[g]=new Array(u),a[x]=new Array(u),d=0;d=0;c--){for(var $=0;c>=0;){var H=!0;for(d=0;d=0&&$++,B=B.dblp($),c<0)break;for(d=0;d0?p=l[d][ie-1>>1]:ie<0&&(p=l[d][-ie-1>>1].neg()),p.type==="affine"?B=B.mixedAdd(p):B=B.add(p))}}for(c=0;c=Math.ceil((e.bitLength()+1)/r.step):!1};Mr.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,o=0;o=0&&(v=u,g=c),d.negative&&(d=d.neg(),p=p.neg()),v.negative&&(v=v.neg(),g=g.neg()),[{a:d,b:p},{a:v,b:g}]};Ir.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],o=i.b.mul(e).divRound(this.n),s=n.b.neg().mul(e).divRound(this.n),l=o.mul(n.a),a=s.mul(i.a),u=o.mul(n.b),c=s.mul(i.b),d=e.sub(l).sub(a),p=u.add(c).neg();return{k1:d,k2:p}};Ir.prototype.pointFromX=function(e,r){e=new ue(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var o=i.fromRed().isOdd();return(r&&!o||!r&&o)&&(i=i.redNeg()),this.point(e,i)};Ir.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),o=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(o).cmpn(0)===0};Ir.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,o=this._endoWnafT2,s=0;s":""};Pt.prototype.isInfinity=function(){return this.inf};Pt.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};Pt.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),s=o.redSqr().redISub(this.x.redAdd(this.x)),l=o.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,l)};Pt.prototype.getX=function(){return this.x.fromRed()};Pt.prototype.getY=function(){return this.y.fromRed()};Pt.prototype.mul=function(e){return e=new ue(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Pt.prototype.mulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o):this.curve._wnafMulAdd(1,i,o,2)};Pt.prototype.jmulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o,!0):this.curve._wnafMulAdd(1,i,o,2,!0)};Pt.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Pt.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(o){return o.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};Pt.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Ot(t,e,r,n){Hi.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new ue(0)):(this.x=new ue(e,16),this.y=new ue(r,16),this.z=new ue(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Mh(Ot,Hi.BasePoint);Ir.prototype.jpoint=function(e,r,n){return new Ot(this,e,r,n)};Ot.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};Ot.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Ot.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),o=e.x.redMul(n),s=this.y.redMul(r.redMul(e.z)),l=e.y.redMul(n.redMul(this.z)),a=i.redSub(o),u=s.redSub(l);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),d=c.redMul(a),p=i.redMul(c),v=u.redSqr().redIAdd(d).redISub(p).redISub(p),g=u.redMul(p.redISub(v)).redISub(s.redMul(d)),x=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(v,g,x)};Ot.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),o=this.y,s=e.y.redMul(r).redMul(this.z),l=n.redSub(i),a=o.redSub(s);if(l.cmpn(0)===0)return a.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=l.redSqr(),c=u.redMul(l),d=n.redMul(u),p=a.redSqr().redIAdd(c).redISub(d).redISub(d),v=a.redMul(d.redISub(p)).redISub(o.redMul(c)),g=this.z.redMul(l);return this.curve.jpoint(p,v,g)};Ot.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(o),this.x.cmp(n)===0)return!0}};Ot.prototype.inspect=function(){return this.isInfinity()?"":""};Ot.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var ga=Ko(function(t,e){var r=e;r.base=Hi,r.short=W_,r.mont=null,r.edwards=null}),va=Ko(function(t,e){var r=e,n=yr.assert;function i(l){l.type==="short"?this.curve=new ga.short(l):l.type==="edwards"?this.curve=new ga.edwards(l):this.curve=new ga.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function o(l,a){Object.defineProperty(r,l,{configurable:!0,enumerable:!0,get:function(){var u=new i(a);return Object.defineProperty(r,l,{configurable:!0,enumerable:!0,value:u}),u}})}o("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:en.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:en.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:en.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:en.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),o("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:en.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:en.sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:en.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var s;try{s=null.crash()}catch{s=void 0}o("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:en.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",s]})});function gi(t){if(!(this instanceof gi))return new gi(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Hr.toArray(t.entropy,t.entropyEnc||"hex"),r=Hr.toArray(t.nonce,t.nonceEnc||"hex"),n=Hr.toArray(t.pers,t.persEnc||"hex");Ch(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Xy=gi;gi.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};gi.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Hr.toArray(n,i||"hex"),this._update(n));for(var o=[];o.length"};var G_=yr.assert;function ju(t,e){if(t instanceof ju)return t;this._importDER(t,e)||(G_(t.r&&t.s,"Signature without r or s"),this.r=new ue(t.r,16),this.s=new ue(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Uu=ju;function V_(){this.place=0}function Gc(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,o=0,s=e.place;o>>=0;return i<=127?!1:(e.place=s,i)}function Rp(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}ju.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=Rp(r),n=Rp(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Vc(i,r.length),i=i.concat(r),i.push(2),Vc(i,n.length);var o=i.concat(n),s=[48];return Vc(s,o.length),s=s.concat(o),yr.encode(s,e)};var K_=function(){throw new Error("unsupported")},Zy=yr.assert;function Cr(t){if(!(this instanceof Cr))return new Cr(t);typeof t=="string"&&(Zy(Object.prototype.hasOwnProperty.call(va,t),"Unknown curve "+t),t=va[t]),t instanceof va.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Q_=Cr;Cr.prototype.keyPair=function(e){return new Ih(this,e)};Cr.prototype.keyFromPrivate=function(e,r){return Ih.fromPrivate(this,e,r)};Cr.prototype.keyFromPublic=function(e,r){return Ih.fromPublic(this,e,r)};Cr.prototype.genKeyPair=function(e){e||(e={});for(var r=new Xy({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||K_(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new ue(2));;){var o=new ue(r.generate(n));if(!(o.cmp(i)>0))return o.iaddn(1),this.keyFromPrivate(o)}};Cr.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};Cr.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new ue(e,16));for(var o=this.n.byteLength(),s=r.getPrivate().toArray("be",o),l=e.toArray("be",o),a=new Xy({hash:this.hash,entropy:s,nonce:l,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new ue(1)),c=0;;c++){var d=i.k?i.k(c):new ue(a.generate(this.n.byteLength()));if(d=this._truncateToN(d,!0),!(d.cmpn(1)<=0||d.cmp(u)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var v=p.getX(),g=v.umod(this.n);if(g.cmpn(0)!==0){var x=d.invm(this.n).mul(g.mul(r.getPrivate()).iadd(e));if(x=x.umod(this.n),x.cmpn(0)!==0){var k=(p.getY().isOdd()?1:0)|(v.cmp(g)!==0?2:0);return i.canonical&&x.cmp(this.nh)>0&&(x=this.n.sub(x),k^=1),new Uu({r:g,s:x,recoveryParam:k})}}}}}};Cr.prototype.verify=function(e,r,n,i){e=this._truncateToN(new ue(e,16)),n=this.keyFromPublic(n,i),r=new Uu(r,"hex");var o=r.r,s=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var l=s.invm(this.n),a=l.mul(e).umod(this.n),u=l.mul(o).umod(this.n),c;return this.curve._maxwellTrick?(c=this.g.jmulAdd(a,n.getPublic(),u),c.isInfinity()?!1:c.eqXToP(o)):(c=this.g.mulAdd(a,n.getPublic(),u),c.isInfinity()?!1:c.getX().umod(this.n).cmp(o)===0)};Cr.prototype.recoverPubKey=function(t,e,r,n){Zy((3&r)===r,"The recovery param is more than two bits"),e=new Uu(e,n);var i=this.n,o=new ue(t),s=e.r,l=e.s,a=r&1,u=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?s=this.curve.pointFromX(s.add(this.curve.n),a):s=this.curve.pointFromX(s,a);var c=e.r.invm(i),d=i.sub(o).mul(c).umod(i),p=l.mul(c).umod(i);return this.g.mulAdd(d,s,p)};Cr.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Uu(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch{continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var J_=Ko(function(t,e){var r=e;r.version="6.5.4",r.utils=yr,r.rand=function(){throw new Error("unsupported")},r.curve=ga,r.curves=va,r.ec=Q_,r.eddsa=null}),Y_=J_.ec;const X_="signing-key/5.7.0",hd=new T(X_);let Kc=null;function rn(){return Kc||(Kc=new Y_("secp256k1")),Kc}class Z_{constructor(e){z(this,"curve","secp256k1"),z(this,"privateKey",re(e)),On(this.privateKey)!==32&&hd.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=rn().keyFromPrivate(se(this.privateKey));z(this,"publicKey","0x"+r.getPublic(!1,"hex")),z(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),z(this,"_isSigningKey",!0)}_addPoint(e){const r=rn().keyFromPublic(se(this.publicKey)),n=rn().keyFromPublic(se(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=rn().keyFromPrivate(se(this.privateKey)),n=se(e);n.length!==32&&hd.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Ou({recoveryParam:i.recoveryParam,r:pt("0x"+i.r.toString(16),32),s:pt("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=rn().keyFromPrivate(se(this.privateKey)),n=rn().keyFromPublic(se(e1(e)));return pt("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function e3(t,e){const r=Ou(e),n={r:se(r.r),s:se(r.s)};return"0x"+rn().recoverPubKey(se(t),n,r.recoveryParam).encode("hex",!1)}function e1(t,e){const r=se(t);if(r.length===32){const n=new Z_(r);return e?"0x"+rn().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return e?re(r):"0x"+rn().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+rn().keyFromPublic(r).getPublic(!0,"hex"):re(r)}return hd.throwArgumentError("invalid public or private key","key","[REDACTED]")}const t3="transactions/5.7.0",Un=new T(t3);var Tp;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(Tp||(Tp={}));function Rh(t){return t==="0x"?null:mt(t)}function jt(t){return t==="0x"?gy:V.from(t)}function r3(t){const e=e1(t);return mt(It(ut(It(e,1)),12))}function t1(t,e){return r3(e3(se(t),e))}function ur(t,e){const r=Ro(V.from(t).toHexString());return r.length>32&&Un.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function Qc(t,e){return{address:mt(t),storageKeys:(e||[]).map((r,n)=>(On(r)!==32&&Un.throwArgumentError("invalid access list storageKey",`accessList[${t}:${n}]`,r),r.toLowerCase()))}}function qi(t){if(Array.isArray(t))return t.map((r,n)=>Array.isArray(r)?(r.length>2&&Un.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${n}]`,r),Qc(r[0],r[1])):Qc(r.address,r.storageKeys));const e=Object.keys(t).map(r=>{const n=t[r].reduce((i,o)=>(i[o]=!0,i),{});return Qc(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function r1(t){return qi(t).map(e=>[e.address,e.storageKeys])}function n3(t,e){if(t.gasPrice!=null){const n=V.from(t.gasPrice),i=V.from(t.maxFeePerGas||0);n.eq(i)||Un.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:n,maxFeePerGas:i})}const r=[ur(t.chainId||0,"chainId"),ur(t.nonce||0,"nonce"),ur(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ur(t.maxFeePerGas||0,"maxFeePerGas"),ur(t.gasLimit||0,"gasLimit"),t.to!=null?mt(t.to):"0x",ur(t.value||0,"value"),t.data||"0x",r1(t.accessList||[])];if(e){const n=Ou(e);r.push(ur(n.recoveryParam,"recoveryParam")),r.push(Ro(n.r)),r.push(Ro(n.s))}return Xt(["0x02",Lu(r)])}function i3(t,e){const r=[ur(t.chainId||0,"chainId"),ur(t.nonce||0,"nonce"),ur(t.gasPrice||0,"gasPrice"),ur(t.gasLimit||0,"gasLimit"),t.to!=null?mt(t.to):"0x",ur(t.value||0,"value"),t.data||"0x",r1(t.accessList||[])];if(e){const n=Ou(e);r.push(ur(n.recoveryParam,"recoveryParam")),r.push(Ro(n.r)),r.push(Ro(n.s))}return Xt(["0x01",Lu(r)])}function n1(t,e,r){try{const n=jt(e[0]).toNumber();if(n!==0&&n!==1)throw new Error("bad recid");t.v=n}catch{Un.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=pt(e[1],32),t.s=pt(e[2],32);try{const n=ut(r(t));t.from=t1(n,{r:t.r,s:t.s,recoveryParam:t.v})}catch{}}function o3(t){const e=Sh(t.slice(1));e.length!==9&&e.length!==12&&Un.throwArgumentError("invalid component count for transaction type: 2","payload",re(t));const r=jt(e[2]),n=jt(e[3]),i={type:2,chainId:jt(e[0]).toNumber(),nonce:jt(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:jt(e[4]),to:Rh(e[5]),value:jt(e[6]),data:e[7],accessList:qi(e[8])};return e.length===9||(i.hash=ut(t),n1(i,e.slice(9),n3)),i}function s3(t){const e=Sh(t.slice(1));e.length!==8&&e.length!==11&&Un.throwArgumentError("invalid component count for transaction type: 1","payload",re(t));const r={type:1,chainId:jt(e[0]).toNumber(),nonce:jt(e[1]).toNumber(),gasPrice:jt(e[2]),gasLimit:jt(e[3]),to:Rh(e[4]),value:jt(e[5]),data:e[6],accessList:qi(e[7])};return e.length===8||(r.hash=ut(t),n1(r,e.slice(8),i3)),r}function l3(t){const e=Sh(t);e.length!==9&&e.length!==6&&Un.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:jt(e[0]).toNumber(),gasPrice:jt(e[1]),gasLimit:jt(e[2]),to:Rh(e[3]),value:jt(e[4]),data:e[5],chainId:0};if(e.length===6)return r;try{r.v=V.from(e[6]).toNumber()}catch{return r}if(r.r=pt(e[7],32),r.s=pt(e[8],32),V.from(r.r).isZero()&&V.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=e.slice(0,6);r.chainId!==0&&(i.push(re(r.chainId)),i.push("0x"),i.push("0x"),n-=r.chainId*2+8);const o=ut(Lu(i));try{r.from=t1(o,{r:re(r.r),s:re(r.s),recoveryParam:n})}catch{}r.hash=ut(t)}return r.type=null,r}function a3(t){const e=se(t);if(e[0]>127)return l3(e);switch(e[0]){case 1:return s3(e);case 2:return o3(e)}return Un.throwError(`unsupported transaction type: ${e[0]}`,T.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const u3="contracts/5.7.0";var Ui=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const gt=new T(u3);function tu(t,e){return Ui(this,void 0,void 0,function*(){const r=yield e;typeof r!="string"&>.throwArgumentError("invalid address or ENS name","name",r);try{return mt(r)}catch{}t||gt.throwError("a provider or signer is needed to resolve ENS names",T.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield t.resolveName(r);return n==null&>.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n})}function ya(t,e,r){return Ui(this,void 0,void 0,function*(){return Array.isArray(r)?yield Promise.all(r.map((n,i)=>ya(t,Array.isArray(e)?e[i]:e[n.name],n))):r.type==="address"?yield tu(t,e):r.type==="tuple"?yield ya(t,e,r.components):r.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(n=>ya(t,n,r.arrayChildren))):Promise.reject(gt.makeError("invalid value for array",T.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function Fu(t,e,r){return Ui(this,void 0,void 0,function*(){let n={};r.length===e.inputs.length+1&&typeof r[r.length-1]=="object"&&(n=it(r.pop())),gt.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?n.from?n.from=yt({override:tu(t.signer,n.from),signer:t.signer.getAddress()}).then(u=>Ui(this,void 0,void 0,function*(){return mt(u.signer)!==u.override&>.throwError("Contract with a Signer cannot override from",T.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),u.override})):n.from=t.signer.getAddress():n.from&&(n.from=tu(t.provider,n.from));const i=yield yt({args:ya(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:yt(n)||{}}),o=t.interface.encodeFunctionData(e,i.args),s={data:o,to:i.address},l=i.overrides;if(l.nonce!=null&&(s.nonce=V.from(l.nonce).toNumber()),l.gasLimit!=null&&(s.gasLimit=V.from(l.gasLimit)),l.gasPrice!=null&&(s.gasPrice=V.from(l.gasPrice)),l.maxFeePerGas!=null&&(s.maxFeePerGas=V.from(l.maxFeePerGas)),l.maxPriorityFeePerGas!=null&&(s.maxPriorityFeePerGas=V.from(l.maxPriorityFeePerGas)),l.from!=null&&(s.from=l.from),l.type!=null&&(s.type=l.type),l.accessList!=null&&(s.accessList=qi(l.accessList)),s.gasLimit==null&&e.gas!=null){let u=21e3;const c=se(o);for(let d=0;dn[u]!=null);return a.length&>.throwError(`cannot override ${a.map(u=>JSON.stringify(u)).join(",")}`,T.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:a}),s})}function c3(t,e){return function(...r){return Fu(t,e,r)}}function f3(t,e){const r=t.signer||t.provider;return function(...n){return Ui(this,void 0,void 0,function*(){r||gt.throwError("estimate require a provider or signer",T.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield Fu(t,e,n);return yield r.estimateGas(i)})}}function d3(t,e){const r=e.wait.bind(e);e.wait=n=>r(n).then(i=>(i.events=i.logs.map(o=>{let s=nr(o),l=null;try{l=t.interface.parseLog(o)}catch{}return l&&(s.args=l.args,s.decode=(a,u)=>t.interface.decodeEventLog(l.eventFragment,a,u),s.event=l.name,s.eventSignature=l.signature),s.removeListener=()=>t.provider,s.getBlock=()=>t.provider.getBlock(i.blockHash),s.getTransaction=()=>t.provider.getTransaction(i.transactionHash),s.getTransactionReceipt=()=>Promise.resolve(i),s}),i))}function i1(t,e,r){const n=t.signer||t.provider;return function(...i){return Ui(this,void 0,void 0,function*(){let o;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const a=it(i.pop());a.blockTag!=null&&(o=yield a.blockTag),delete a.blockTag,i.push(a)}t.deployTransaction!=null&&(yield t._deployed(o));const s=yield Fu(t,e,i),l=yield n.call(s,o);try{let a=t.interface.decodeFunctionResult(e,l);return r&&e.outputs.length===1&&(a=a[0]),a}catch(a){throw a.code===T.errors.CALL_EXCEPTION&&(a.address=t.address,a.args=i,a.transaction=s),a}})}}function h3(t,e){return function(...r){return Ui(this,void 0,void 0,function*(){t.signer||gt.throwError("sending a transaction requires a signer",T.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),t.deployTransaction!=null&&(yield t._deployed());const n=yield Fu(t,e,r),i=yield t.signer.sendTransaction(n);return d3(t,i),i})}}function Op(t,e,r){return e.constant?i1(t,e,r):h3(t,e)}function o1(t){return t.address&&(t.topics==null||t.topics.length===0)?"*":(t.address||"*")+"@"+(t.topics?t.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):"")}class il{constructor(e,r){z(this,"tag",e),z(this,"filter",r),this._listeners=[]}addListener(e,r){this._listeners.push({listener:e,once:r})}removeListener(e){let r=!1;this._listeners=this._listeners.filter(n=>r||n.listener!==e?!0:(r=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){const r=this.listenerCount();return this._listeners=this._listeners.filter(n=>{const i=e.slice();return setTimeout(()=>{n.listener.apply(this,i)},0),!n.once}),r}prepareEvent(e){}getEmit(e){return[e]}}class p3 extends il{constructor(){super("error",null)}}class Lp extends il{constructor(e,r,n,i){const o={address:e};let s=r.getEventTopic(n);i?(s!==i[0]&>.throwArgumentError("topic mismatch","topics",i),o.topics=i.slice()):o.topics=[s],super(o1(o),o),z(this,"address",e),z(this,"interface",r),z(this,"fragment",n)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(r,n)=>this.interface.decodeEventLog(this.fragment,r,n);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(r){e.args=null,e.decodeError=r}}getEmit(e){const r=Gx(e.args);if(r.length)throw r[0].error;const n=(e.args||[]).slice();return n.push(e),n}}class Bp extends il{constructor(e,r){super("*",{address:e}),z(this,"address",e),z(this,"interface",r)}prepareEvent(e){super.prepareEvent(e);try{const r=this.interface.parseLog(e);e.event=r.name,e.eventSignature=r.signature,e.decode=(n,i)=>this.interface.decodeEventLog(r.eventFragment,n,i),e.args=r.args}catch{}}}class m3{constructor(e,r,n){z(this,"interface",fr(new.target,"getInterface")(r)),n==null?(z(this,"provider",null),z(this,"signer",null)):El.isSigner(n)?(z(this,"provider",n.provider||null),z(this,"signer",n)):qo.isProvider(n)?(z(this,"provider",n),z(this,"signer",null)):gt.throwArgumentError("invalid signer or provider","signerOrProvider",n),z(this,"callStatic",{}),z(this,"estimateGas",{}),z(this,"functions",{}),z(this,"populateTransaction",{}),z(this,"filters",{});{const s={};Object.keys(this.interface.events).forEach(l=>{const a=this.interface.events[l];z(this.filters,l,(...u)=>({address:this.address,topics:this.interface.encodeFilterTopics(a,u)})),s[a.name]||(s[a.name]=[]),s[a.name].push(l)}),Object.keys(s).forEach(l=>{const a=s[l];a.length===1?z(this.filters,l,this.filters[a[0]]):gt.warn(`Duplicate definition of ${l} (${a.join(", ")})`)})}if(z(this,"_runningEvents",{}),z(this,"_wrappedEmits",{}),e==null&>.throwArgumentError("invalid contract address or ENS name","addressOrName",e),z(this,"address",e),this.provider)z(this,"resolvedAddress",tu(this.provider,e));else try{z(this,"resolvedAddress",Promise.resolve(mt(e)))}catch{gt.throwError("provider is required to use ENS name as contract address",T.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(s=>{});const i={},o={};Object.keys(this.interface.functions).forEach(s=>{const l=this.interface.functions[s];if(o[s]){gt.warn(`Duplicate ABI entry for ${JSON.stringify(s)}`);return}o[s]=!0;{const a=l.name;i[`%${a}`]||(i[`%${a}`]=[]),i[`%${a}`].push(s)}this[s]==null&&z(this,s,Op(this,l,!0)),this.functions[s]==null&&z(this.functions,s,Op(this,l,!1)),this.callStatic[s]==null&&z(this.callStatic,s,i1(this,l,!0)),this.populateTransaction[s]==null&&z(this.populateTransaction,s,c3(this,l)),this.estimateGas[s]==null&&z(this.estimateGas,s,f3(this,l))}),Object.keys(i).forEach(s=>{const l=i[s];if(l.length>1)return;s=s.substring(1);const a=l[0];try{this[s]==null&&z(this,s,this[a])}catch{}this.functions[s]==null&&z(this.functions,s,this.functions[a]),this.callStatic[s]==null&&z(this.callStatic,s,this.callStatic[a]),this.populateTransaction[s]==null&&z(this.populateTransaction,s,this.populateTransaction[a]),this.estimateGas[s]==null&&z(this.estimateGas,s,this.estimateGas[a])})}static getContractAddress(e){return Nh(e)}static getInterface(e){return ad.isInterface(e)?e:new ad(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(r=>(r==="0x"&>.throwError("contract not deployed",T.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||gt.throwError("sending a transactions require a signer",T.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const r=it(e||{});return["from","to"].forEach(function(n){r[n]!=null&>.throwError("cannot override "+n,T.errors.UNSUPPORTED_OPERATION,{operation:n})}),r.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(r))}connect(e){typeof e=="string"&&(e=new Ph(e,this.provider));const r=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&z(r,"deployTransaction",this.deployTransaction),r}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return ld.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if(typeof e=="string"){if(e==="error")return this._normalizeRunningEvent(new p3);if(e==="event")return this._normalizeRunningEvent(new il("event",null));if(e==="*")return this._normalizeRunningEvent(new Bp(this.address,this.interface));const r=this.interface.getEvent(e);return this._normalizeRunningEvent(new Lp(this.address,this.interface,r))}if(e.topics&&e.topics.length>0){try{const n=e.topics[0];if(typeof n!="string")throw new Error("invalid topic");const i=this.interface.getEvent(n);return this._normalizeRunningEvent(new Lp(this.address,this.interface,i,e.topics))}catch{}const r={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new il(o1(r),r))}return this._normalizeRunningEvent(new Bp(this.address,this.interface))}_checkRunningEvents(e){if(e.listenerCount()===0){delete this._runningEvents[e.tag];const r=this._wrappedEmits[e.tag];r&&e.filter&&(this.provider.off(e.filter,r),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,r,n){const i=nr(r);return i.removeListener=()=>{n&&(e.removeListener(n),this._checkRunningEvents(e))},i.getBlock=()=>this.provider.getBlock(r.blockHash),i.getTransaction=()=>this.provider.getTransaction(r.transactionHash),i.getTransactionReceipt=()=>this.provider.getTransactionReceipt(r.transactionHash),e.prepareEvent(i),i}_addEventListener(e,r,n){if(this.provider||gt.throwError("events require a provider or a signer with a provider",T.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(r,n),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const i=o=>{let s=this._wrapEvent(e,o,r);if(s.decodeError==null)try{const l=e.getEmit(s);this.emit(e.filter,...l)}catch(l){s.decodeError=l.error}e.filter!=null&&this.emit("event",s),s.decodeError!=null&&this.emit("error",s.decodeError,s)};this._wrappedEmits[e.tag]=i,e.filter!=null&&this.provider.on(e.filter,i)}}queryFilter(e,r,n){const i=this._getRunningEvent(e),o=it(i.filter);return typeof r=="string"&&pe(r,32)?(n!=null&>.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),o.blockHash=r):(o.fromBlock=r??0,o.toBlock=n??"latest"),this.provider.getLogs(o).then(s=>s.map(l=>this._wrapEvent(i,l,null)))}on(e,r){return this._addEventListener(this._getRunningEvent(e),r,!1),this}once(e,r){return this._addEventListener(this._getRunningEvent(e),r,!0),this}emit(e,...r){if(!this.provider)return!1;const n=this._getRunningEvent(e),i=n.run(r)>0;return this._checkRunningEvents(n),i}listenerCount(e){return this.provider?e==null?Object.keys(this._runningEvents).reduce((r,n)=>r+this._runningEvents[n].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(e==null){const r=[];for(let n in this._runningEvents)this._runningEvents[n].listeners().forEach(i=>{r.push(i)});return r}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(e==null){for(const n in this._runningEvents){const i=this._runningEvents[n];i.removeAllListeners(),this._checkRunningEvents(i)}return this}const r=this._getRunningEvent(e);return r.removeAllListeners(),this._checkRunningEvents(r),this}off(e,r){if(!this.provider)return this;const n=this._getRunningEvent(e);return n.removeListener(r),this._checkRunningEvents(n),this}removeListener(e,r){return this.off(e,r)}}class g3 extends m3{}class s1{constructor(e){z(this,"alphabet",e),z(this,"base",e.length),z(this,"_alphabetMap",{}),z(this,"_leader",e.charAt(0));for(let r=0;r0;)n.push(s%this.base),s=s/this.base|0}let i="";for(let o=0;r[o]===0&&o=0;--o)i+=this.alphabet[n[o]];return i}decode(e){if(typeof e!="string")throw new TypeError("Expected String");let r=[];if(e.length===0)return new Uint8Array(r);r.push(0);for(let n=0;n>=8;for(;o>0;)r.push(o&255),o>>=8}for(let n=0;e[n]===this._leader&&n0;e--){const r=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[r],t[r]=n}return t}const y3="networks/5.7.1",jp=new T(y3);function w3(t){return t&&typeof t.renetwork=="function"}function bn(t){const e=function(r,n){n==null&&(n={});const i=[];if(r.InfuraProvider&&n.infura!=="-")try{i.push(new r.InfuraProvider(t,n.infura))}catch{}if(r.EtherscanProvider&&n.etherscan!=="-")try{i.push(new r.EtherscanProvider(t,n.etherscan))}catch{}if(r.AlchemyProvider&&n.alchemy!=="-")try{i.push(new r.AlchemyProvider(t,n.alchemy))}catch{}if(r.PocketProvider&&n.pocket!=="-"){const o=["goerli","ropsten","rinkeby","sepolia"];try{const s=new r.PocketProvider(t,n.pocket);s.network&&o.indexOf(s.network.name)===-1&&i.push(s)}catch{}}if(r.CloudflareProvider&&n.cloudflare!=="-")try{i.push(new r.CloudflareProvider(t))}catch{}if(r.AnkrProvider&&n.ankr!=="-")try{const o=["ropsten"],s=new r.AnkrProvider(t,n.ankr);s.network&&o.indexOf(s.network.name)===-1&&i.push(s)}catch{}if(i.length===0)return null;if(r.FallbackProvider){let o=1;return n.quorum!=null?o=n.quorum:t==="homestead"&&(o=2),new r.FallbackProvider(i,o)}return i[0]};return e.renetwork=function(r){return bn(r)},e}function ru(t,e){const r=function(n,i){return n.JsonRpcProvider?new n.JsonRpcProvider(t,e):null};return r.renetwork=function(n){return ru(t,n)},r}const Up={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:bn("homestead")},Fp={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:bn("ropsten")},zp={chainId:63,name:"classicMordor",_defaultProvider:ru("https://www.ethercluster.com/mordor","classicMordor")},Wl={unspecified:{chainId:0,name:"unspecified"},homestead:Up,mainnet:Up,morden:{chainId:2,name:"morden"},ropsten:Fp,testnet:Fp,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:bn("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:bn("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:bn("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:bn("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:ru("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:zp,classicTestnet:zp,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:ru("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:bn("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:bn("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function Th(t){if(t==null)return null;if(typeof t=="number"){for(const n in Wl){const i=Wl[n];if(i.chainId===t)return{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress||null,_defaultProvider:i._defaultProvider||null}}return{chainId:t,name:"unknown"}}if(typeof t=="string"){const n=Wl[t];return n==null?null:{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress,_defaultProvider:n._defaultProvider||null}}const e=Wl[t.name];if(!e)return typeof t.chainId!="number"&&jp.throwArgumentError("invalid network chainId","network",t),t;t.chainId!==0&&t.chainId!==e.chainId&&jp.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;return r==null&&e._defaultProvider&&(w3(e._defaultProvider)?r=e._defaultProvider.renetwork(t):r=e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}const E3="web/5.7.1";var x3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};function A3(t,e){return x3(this,void 0,void 0,function*(){e==null&&(e={});const r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};if(e.skipFetchSetup!==!0&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),e.fetchOptions!=null){const s=e.fetchOptions;s.mode&&(r.mode=s.mode),s.cache&&(r.cache=s.cache),s.credentials&&(r.credentials=s.credentials),s.redirect&&(r.redirect=s.redirect),s.referrer&&(r.referrer=s.referrer)}const n=yield fetch(t,r),i=yield n.arrayBuffer(),o={};return n.headers.forEach?n.headers.forEach((s,l)=>{o[l.toLowerCase()]=s}):n.headers.keys().forEach(s=>{o[s.toLowerCase()]=n.headers.get(s)}),{headers:o,statusCode:n.status,statusMessage:n.statusText,body:se(new Uint8Array(i))}})}var b3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Br=new T(E3);function $p(t){return new Promise(e=>{setTimeout(e,t)})}function Qn(t,e){if(t==null)return null;if(typeof t=="string")return t;if(bh(t)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return wl(t)}catch{}return re(t)}return t}function _3(t){return mr(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function S3(t,e,r){const n=typeof t=="object"&&t.throttleLimit!=null?t.throttleLimit:12;Br.assertArgument(n>0&&n%1===0,"invalid connection throttle limit","connection.throttleLimit",n);const i=typeof t=="object"?t.throttleCallback:null,o=typeof t=="object"&&typeof t.throttleSlotInterval=="number"?t.throttleSlotInterval:100;Br.assertArgument(o>0&&o%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const s=typeof t=="object"?!!t.errorPassThrough:!1,l={};let a=null;const u={method:"GET"};let c=!1,d=2*60*1e3;if(typeof t=="string")a=t;else if(typeof t=="object"){if((t==null||t.url==null)&&Br.throwArgumentError("missing URL","connection.url",t),a=t.url,typeof t.timeout=="number"&&t.timeout>0&&(d=t.timeout),t.headers)for(const E in t.headers)l[E.toLowerCase()]={key:E,value:String(t.headers[E])},["if-none-match","if-modified-since"].indexOf(E.toLowerCase())>=0&&(c=!0);if(u.allowGzip=!!t.allowGzip,t.user!=null&&t.password!=null){a.substring(0,6)!=="https:"&&t.allowInsecureAuthentication!==!0&&Br.throwError("basic authentication requires a secure https url",T.errors.INVALID_ARGUMENT,{argument:"url",url:a,user:t.user,password:"[REDACTED]"});const E=t.user+":"+t.password;l.authorization={key:"Authorization",value:"Basic "+Ay(mr(E))}}t.skipFetchSetup!=null&&(u.skipFetchSetup=!!t.skipFetchSetup),t.fetchOptions!=null&&(u.fetchOptions=it(t.fetchOptions))}const p=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),v=a?a.match(p):null;if(v)try{const E={statusCode:200,statusMessage:"OK",headers:{"content-type":v[1]||"text/plain"},body:v[2]?xy(v[3]):_3(v[3])};let w=E.body;return r&&(w=r(E.body,E)),Promise.resolve(w)}catch(E){Br.throwError("processing response error",T.errors.SERVER_ERROR,{body:Qn(v[1],v[2]),error:E,requestBody:null,requestMethod:"GET",url:a})}e&&(u.method="POST",u.body=e,l["content-type"]==null&&(l["content-type"]={key:"Content-Type",value:"application/octet-stream"}),l["content-length"]==null&&(l["content-length"]={key:"Content-Length",value:String(e.length)}));const g={};Object.keys(l).forEach(E=>{const w=l[E];g[w.key]=w.value}),u.headers=g;const x=function(){let E=null;return{promise:new Promise(function(O,B){d&&(E=setTimeout(()=>{E!=null&&(E=null,B(Br.makeError("timeout",T.errors.TIMEOUT,{requestBody:Qn(u.body,g["content-type"]),requestMethod:u.method,timeout:d,url:a})))},d))}),cancel:function(){E!=null&&(clearTimeout(E),E=null)}}}(),k=function(){return b3(this,void 0,void 0,function*(){for(let E=0;E=300)&&(x.cancel(),Br.throwError("bad response",T.errors.SERVER_ERROR,{status:w.statusCode,headers:w.headers,body:Qn(_,w.headers?w.headers["content-type"]:null),requestBody:Qn(u.body,g["content-type"]),requestMethod:u.method,url:a})),r)try{const O=yield r(_,w);return x.cancel(),O}catch(O){if(O.throttleRetry&&E{let l=null;if(o!=null)try{l=JSON.parse(wl(o))}catch(a){Br.throwError("invalid JSON",T.errors.SERVER_ERROR,{body:o,error:a})}return r&&(l=r(l,s)),l},i=null;if(e!=null){i=mr(e);const o=typeof t=="string"?{url:t}:it(t);o.headers?Object.keys(o.headers).filter(l=>l.toLowerCase()==="content-type").length!==0||(o.headers=it(o.headers),o.headers["content-type"]="application/json"):o.headers={"content-type":"application/json"},t=o}return S3(t,i,n)}function ho(t,e){return e||(e={}),e=it(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(r,n){let i=null,o=!1;const s=()=>o?!1:(o=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout(()=>{s()&&n(new Error("timeout"))},e.timeout));const l=e.retryLimit;let a=0;function u(){return t().then(function(c){if(c!==void 0)s()&&r(c);else if(e.oncePoll)e.oncePoll.once("poll",u);else if(e.onceBlock)e.onceBlock.once("block",u);else if(!o){if(a++,a>l){s()&&n(new Error("retry limit reached"));return}let d=e.interval*parseInt(String(Math.random()*Math.pow(2,a)));de.ceiling&&(d=e.ceiling),setTimeout(u,d)}return null},function(c){s()&&n(c)})}u()})}var nu="qpzry9x8gf2tvdw0s3jn54khce6mua7l",md={};for(var Gl=0;Gl>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function l1(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=bo(e)^n>>5}for(e=bo(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=l1(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",o=0;o>5)throw new Error("Non 5-bit word");n=bo(n)^s,i+=nu.charAt(s)}for(o=0;o<6;++o)n=bo(n);for(n^=1,o=0;o<6;++o){var l=n>>(5-o)*5&31;i+=nu.charAt(l)}return i}function a1(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var o=t.slice(0,i),s=t.slice(i+1);if(s.length<6)return"Data too short";var l=l1(o);if(typeof l=="string")return l;for(var a=[],u=0;u=s.length)&&a.push(d)}return l!==1?"Invalid checksum for "+t:{prefix:o,words:a}}function N3(){var t=a1.apply(null,arguments);if(typeof t=="object")return t}function P3(t){var e=a1.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function zu(t,e,r,n){for(var i=0,o=0,s=(1<=r;)o-=r,l.push(i>>o&s);if(n)o>0&&l.push(i<=e)return"Excess padding";if(i<this.data(d,!0);return e.transaction={hash:s,type:u,accessList:ee.allowNull(this.accessList.bind(this),null),blockHash:ee.allowNull(s,null),blockNumber:ee.allowNull(a,null),transactionIndex:ee.allowNull(a,null),confirmations:ee.allowNull(a,null),from:r,gasPrice:ee.allowNull(n),maxPriorityFeePerGas:ee.allowNull(n),maxFeePerGas:ee.allowNull(n),gasLimit:n,to:ee.allowNull(r,null),value:n,nonce:a,data:o,r:ee.allowNull(this.uint256),s:ee.allowNull(this.uint256),v:ee.allowNull(a),creates:ee.allowNull(r,null),raw:ee.allowNull(o)},e.transactionRequest={from:ee.allowNull(r),nonce:ee.allowNull(a),gasLimit:ee.allowNull(n),gasPrice:ee.allowNull(n),maxPriorityFeePerGas:ee.allowNull(n),maxFeePerGas:ee.allowNull(n),to:ee.allowNull(r),value:ee.allowNull(n),data:ee.allowNull(c),type:ee.allowNull(a),accessList:ee.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:s,address:r,topics:ee.arrayOf(s),data:o,logIndex:a,blockHash:s},e.receipt={to:ee.allowNull(this.address,null),from:ee.allowNull(this.address,null),contractAddress:ee.allowNull(r,null),transactionIndex:a,root:ee.allowNull(l),gasUsed:n,logsBloom:ee.allowNull(o),blockHash:s,transactionHash:s,logs:ee.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:ee.allowNull(a,null),cumulativeGasUsed:n,effectiveGasPrice:ee.allowNull(n),status:ee.allowNull(a),type:u},e.block={hash:ee.allowNull(s),parentHash:s,number:a,timestamp:a,nonce:ee.allowNull(l),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:ee.allowNull(r),extraData:o,transactions:ee.allowNull(ee.arrayOf(s)),baseFeePerGas:ee.allowNull(n)},e.blockWithTransactions=it(e.block),e.blockWithTransactions.transactions=ee.allowNull(ee.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:ee.allowNull(i,void 0),toBlock:ee.allowNull(i,void 0),blockHash:ee.allowNull(s,void 0),address:ee.allowNull(r,void 0),topics:ee.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:ee.allowNull(a),blockHash:ee.allowNull(s),transactionIndex:a,removed:ee.allowNull(this.boolean.bind(this)),address:r,data:ee.allowFalsish(o,"0x"),topics:ee.arrayOf(s),transactionHash:s,logIndex:a},e}accessList(e){return qi(e||[])}number(e){return e==="0x"?0:V.from(e).toNumber()}type(e){return e==="0x"||e==null?0:V.from(e).toNumber()}bigNumber(e){return V.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,r){return typeof e=="string"&&(!r&&e.substring(0,2)!=="0x"&&(e="0x"+e),pe(e))?e.toLowerCase():ss.throwArgumentError("invalid hash","value",e)}data(e,r){const n=this.hex(e,r);if(n.length%2!==0)throw new Error("invalid data; odd-length - "+e);return n}address(e){return mt(e)}callAddress(e){if(!pe(e,32))return null;const r=mt(It(e,12));return r===cA?null:r}contractAddress(e){return Nh(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||pe(e))return Tu(e);throw new Error("invalid blockTag")}hash(e,r){const n=this.hex(e,r);return On(n)!==32?ss.throwArgumentError("invalid hash","value",e):n}difficulty(e){if(e==null)return null;const r=V.from(e);try{return r.toNumber()}catch{}return null}uint256(e){if(!pe(e))throw new Error("invalid uint256");return pt(e,32)}_block(e,r){e.author!=null&&e.miner==null&&(e.miner=e.author);const n=e._difficulty!=null?e._difficulty:e.difficulty,i=ee.check(r,e);return i._difficulty=n==null?null:V.from(n),i}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return ee.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&V.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);const r=ee.check(this.formats.transaction,e);if(e.chainId!=null){let n=e.chainId;pe(n)&&(n=V.from(n).toNumber()),r.chainId=n}else{let n=e.networkId;n==null&&r.v==null&&(n=e.chainId),pe(n)&&(n=V.from(n).toNumber()),typeof n!="number"&&r.v!=null&&(n=(r.v-35)/2,n<0&&(n=0),n=parseInt(n)),typeof n!="number"&&(n=0),r.chainId=n}return r.blockHash&&r.blockHash.replace(/0/g,"")==="x"&&(r.blockHash=null),r}transaction(e){return a3(e)}receiptLog(e){return ee.check(this.formats.receiptLog,e)}receipt(e){const r=ee.check(this.formats.receipt,e);if(r.root!=null)if(r.root.length<=4){const n=V.from(r.root).toNumber();n===0||n===1?(r.status!=null&&r.status!==n&&ss.throwArgumentError("alt-root-status/status mismatch","value",{root:r.root,status:r.status}),r.status=n,delete r.root):ss.throwArgumentError("invalid alt-root-status","value.root",r.root)}else r.root.length!==66&&ss.throwArgumentError("invalid root hash","value.root",r.root);return r.status!=null&&(r.byzantium=!0),r}topics(e){return Array.isArray(e)?e.map(r=>this.topics(r)):e!=null?this.hash(e,!0):null}filter(e){return ee.check(this.formats.filter,e)}filterLog(e){return ee.check(this.formats.filterLog,e)}static check(e,r){const n={};for(const i in e)try{const o=e[i](r[i]);o!==void 0&&(n[i]=o)}catch(o){throw o.checkKey=i,o.checkValue=r[i],o}return n}static allowNull(e,r){return function(n){return n==null?r:e(n)}}static allowFalsish(e,r){return function(n){return n?e(n):r}}static arrayOf(e){return function(r){if(!Array.isArray(r))throw new Error("not an array");const n=[];return r.forEach(function(i){n.push(e(i))}),n}}}function u1(t){return t&&typeof t.isCommunityResource=="function"}function gd(t){return u1(t)&&t.isCommunityResource()}let qp=!1;function bl(){qp||(qp=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var ae=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const he=new T($t),O3=10;function Wp(t){return t==null?"null":(On(t)!==32&&he.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function Gp(t){for(t=t.slice();t.length>0&&t[t.length-1]==null;)t.pop();return t.map(e=>{if(Array.isArray(e)){const r={};e.forEach(i=>{r[Wp(i)]=!0});const n=Object.keys(r);return n.sort(),n.join("|")}else return Wp(e)}).join("&")}function L3(t){return t===""?[]:t.split(/&/g).map(e=>{if(e==="")return[];const r=e.split("|").map(n=>n==="null"?null:n);return r.length===1?r[0]:r})}function Gi(t){if(typeof t=="string"){if(t=t.toLowerCase(),On(t)===32)return"tx:"+t;if(t.indexOf(":")===-1)return t}else{if(Array.isArray(t))return"filter:*:"+Gp(t);if(fb.isForkEvent(t))throw he.warn("not implemented"),new Error("not implemented");if(t&&typeof t=="object")return"filter:"+(t.address||"*")+":"+Gp(t.topics||[])}throw new Error("invalid event - "+t)}function ls(){return new Date().getTime()}function Vp(t){return new Promise(e=>{setTimeout(e,t)})}const B3=["block","network","pending","poll"];class D3{constructor(e,r,n){z(this,"tag",e),z(this,"listener",r),z(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){const e=this.tag.split(":");if(e[0]!=="filter")return null;const r=e[1],n=L3(e[2]),i={};return n.length>0&&(i.topics=n),r&&r!=="*"&&(i.address=r),i}pollable(){return this.tag.indexOf(":")>=0||B3.indexOf(this.tag)>=0}}const j3={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Yc(t){return pt(V.from(t).toHexString(),32)}function Kp(t){return pd.encode(Ut([t,It(Dp(Dp(t)),0,4)]))}const c1=new RegExp("^(ipfs)://(.*)$","i"),Qp=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),c1,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function wa(t,e){try{return wl(ol(t,e))}catch{}return null}function ol(t,e){if(t==="0x")return null;const r=V.from(It(t,e,e+32)).toNumber(),n=V.from(It(t,r,r+32)).toNumber();return It(t,r+32,r+32+n)}function Xc(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):he.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function Jp(t){const e=se(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function U3(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}function f1(t){const e=[];let r=0;for(let n=0;nV.from(e).eq(1)).catch(e=>{if(e.code===T.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,r){return ae(this,void 0,void 0,function*(){const n={to:this.address,ccipReadEnabled:!0,data:Xt([e,ma(this.name),r||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,n.data=Xt(["0x9061b923",f1([JA(this.name),n.data])]));try{let o=yield this.provider.call(n);return se(o).length%32===4&&he.throwError("resolver threw error",T.errors.CALL_EXCEPTION,{transaction:n,data:o}),i&&(o=ol(o,0)),o}catch(o){if(o.code===T.errors.CALL_EXCEPTION)return null;throw o}})}_fetchBytes(e,r){return ae(this,void 0,void 0,function*(){const n=yield this._fetch(e,r);return n!=null?ol(n,0):null})}_getAddress(e,r){const n=j3[String(e)];if(n==null&&he.throwError(`unsupported coin type: ${e}`,T.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),n.ilk==="eth")return this.provider.formatter.address(r);const i=se(r);if(n.p2pkh!=null){const o=r.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(o){const s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return Kp(Ut([[n.p2pkh],"0x"+o[2]]))}}if(n.p2sh!=null){const o=r.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(o){const s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return Kp(Ut([[n.p2sh],"0x"+o[2]]))}}if(n.prefix!=null){const o=i[1];let s=i[0];if(s===0?o!==20&&o!==32&&(s=-1):s=-1,s>=0&&i.length===2+o&&o>=1&&o<=75){const l=Hp.toWords(i.slice(2));return l.unshift(s),Hp.encode(n.prefix,l)}}return null}getAddress(e){return ae(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===pA?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===T.errors.CALL_EXCEPTION)return null;throw i}const r=yield this._fetchBytes("0xf1cb7e06",Yc(e));if(r==null||r==="0x")return null;const n=this._getAddress(e,r);return n==null&&he.throwError("invalid or unsupported coin data",T.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:r}),n})}getAvatar(){return ae(this,void 0,void 0,function*(){const e=[{type:"name",content:this.name}];try{const r=yield this.getText("avatar");if(r==null)return null;for(let n=0;ns[a])}return he.throwError("invalid or unsupported content hash data",T.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return ae(this,void 0,void 0,function*(){let r=mr(e);r=Ut([Yc(64),Yc(r.length),r]),r.length%32!==0&&(r=Ut([r,pt("0x",32-e.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",re(r));return n==null||n==="0x"?null:wl(n)})}}let Zc=null,F3=1;class $u extends qo{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),z(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(r=>{}),this._ready().catch(r=>{});else{const r=fr(new.target,"getNetwork")(e);r?(z(this,"_network",r),this.emit("network",r,null)):he.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return ae(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||he.throwError("no network detected",T.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:z(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return ho(()=>this._ready().then(e=>e,e=>{if(!(e.code===T.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return Zc==null&&(Zc=new ee),Zc}static getNetwork(e){return Th(e??"homestead")}ccipReadFetch(e,r,n){return ae(this,void 0,void 0,function*(){if(this.disableCcipRead||n.length===0)return null;const i=e.to.toLowerCase(),o=r.toLowerCase(),s=[];for(let l=0;l=0?null:JSON.stringify({data:o,sender:i}),d=yield Al({url:u,errorPassThrough:!0},c,(v,g)=>(v.status=g.statusCode,v));if(d.data)return d.data;const p=d.message||"unknown error";if(d.status>=400&&d.status<500)return he.throwError(`response not found during CCIP fetch: ${p}`,T.errors.SERVER_ERROR,{url:a,errorMessage:p});s.push(p)}return he.throwError(`error encountered during CCIP fetch: ${s.map(l=>JSON.stringify(l)).join(", ")}`,T.errors.SERVER_ERROR,{urls:n,errorMessages:s})})}_getInternalBlockNumber(e){return ae(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const i=this._internalBlockNumber;try{const o=yield i;if(ls()-o.respTime<=e)return o.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const r=ls(),n=yt({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(i=>null,i=>i)}).then(({blockNumber:i,networkError:o})=>{if(o)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),o;const s=ls();return i=V.from(i).toNumber(),i{this._internalBlockNumber===n&&(this._internalBlockNumber=null)}),(yield n).blockNumber})}poll(){return ae(this,void 0,void 0,function*(){const e=F3++,r=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(i){this.emit("error",i);return}if(this._setFastBlockNumber(n),this.emit("poll",e,n),n===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)he.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",he.makeError("network block skew detected",T.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let i=this._emitted.block+1;i<=n;i++)this.emit("block",i);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach(i=>{if(i==="block")return;const o=this._emitted[i];o!=="pending"&&n-o>12&&delete this._emitted[i]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=n-1),this._events.forEach(i=>{switch(i.type){case"tx":{const o=i.hash;let s=this.getTransactionReceipt(o).then(l=>(!l||l.blockNumber==null||(this._emitted["t:"+o]=l.blockNumber,this.emit(o,l)),null)).catch(l=>{this.emit("error",l)});r.push(s);break}case"filter":{if(!i._inflight){i._inflight=!0,i._lastBlockNumber===-2&&(i._lastBlockNumber=n-1);const o=i.filter;o.fromBlock=i._lastBlockNumber+1,o.toBlock=n;const s=o.toBlock-this._maxFilterBlockRange;s>o.fromBlock&&(o.fromBlock=s),o.fromBlock<0&&(o.fromBlock=0);const l=this.getLogs(o).then(a=>{i._inflight=!1,a.length!==0&&a.forEach(u=>{u.blockNumber>i._lastBlockNumber&&(i._lastBlockNumber=u.blockNumber),this._emitted["b:"+u.blockHash]=u.blockNumber,this._emitted["t:"+u.transactionHash]=u.blockNumber,this.emit(o,u)})}).catch(a=>{this.emit("error",a),i._inflight=!1});r.push(l)}break}}}),this._lastBlockNumber=n,Promise.all(r).then(()=>{this.emit("didPoll",e)}).catch(i=>{this.emit("error",i)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return ae(this,void 0,void 0,function*(){return he.throwError("provider does not support network detection",T.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return ae(this,void 0,void 0,function*(){const e=yield this._ready(),r=yield this.detectNetwork();if(e.chainId!==r.chainId){if(this.anyNetwork)return this._network=r,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",r,e),yield Vp(0),this._network;const n=he.makeError("underlying network changed",T.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:r});throw this.emit("error",n),n}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const e=ls();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(r=>((this._fastBlockNumber==null||r>this._fastBlockNumber)&&(this._fastBlockNumber=r),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,r,n){return ae(this,void 0,void 0,function*(){return this._waitForTransaction(e,r??1,n||0,null)})}_waitForTransaction(e,r,n,i){return ae(this,void 0,void 0,function*(){const o=yield this.getTransactionReceipt(e);return(o?o.confirmations:0)>=r?o:new Promise((s,l)=>{const a=[];let u=!1;const c=function(){return u?!0:(u=!0,a.forEach(p=>{p()}),!1)},d=p=>{p.confirmations{this.removeListener(e,d)}),i){let p=i.startBlock,v=null;const g=x=>ae(this,void 0,void 0,function*(){u||(yield Vp(1e3),this.getTransactionCount(i.from).then(k=>ae(this,void 0,void 0,function*(){if(!u){if(k<=i.nonce)p=x;else{{const E=yield this.getTransaction(e);if(E&&E.blockNumber!=null)return}for(v==null&&(v=p-3,v{u||this.once("block",g)}))});if(u)return;this.once("block",g),a.push(()=>{this.removeListener("block",g)})}if(typeof n=="number"&&n>0){const p=setTimeout(()=>{c()||l(he.makeError("timeout exceeded",T.errors.TIMEOUT,{timeout:n}))},n);p.unref&&p.unref(),a.push(()=>{clearTimeout(p)})}})})}getBlockNumber(){return ae(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return V.from(e)}catch(r){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:r})}})}getBalance(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getBalance",n);try{return V.from(i)}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getBalance",params:n,result:i,error:o})}})}getTransactionCount(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getTransactionCount",n);try{return V.from(i).toNumber()}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:i,error:o})}})}getCode(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getCode",n);try{return re(i)}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getCode",params:n,result:i,error:o})}})}getStorageAt(e,r,n){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(n),position:Promise.resolve(r).then(s=>Tu(s))}),o=yield this.perform("getStorageAt",i);try{return re(o)}catch(s){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:o,error:s})}})}_wrapTransaction(e,r,n){if(r!=null&&On(r)!==32)throw new Error("invalid response - sendTransaction");const i=e;return r!=null&&e.hash!==r&&he.throwError("Transaction hash mismatch from Provider.sendTransaction.",T.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:r}),i.wait=(o,s)=>ae(this,void 0,void 0,function*(){o==null&&(o=1),s==null&&(s=0);let l;o!==0&&n!=null&&(l={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:n});const a=yield this._waitForTransaction(e.hash,o,s,l);return a==null&&o===0?null:(this._emitted["t:"+e.hash]=a.blockNumber,a.status===0&&he.throwError("transaction failed",T.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:a}),a)}),i}sendTransaction(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield Promise.resolve(e).then(o=>re(o)),n=this.formatter.transaction(e);n.confirmations==null&&(n.confirmations=0);const i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const o=yield this.perform("sendTransaction",{signedTransaction:r});return this._wrapTransaction(n,o,i)}catch(o){throw o.transaction=n,o.transactionHash=n.hash,o}})}_getTransactionRequest(e){return ae(this,void 0,void 0,function*(){const r=yield e,n={};return["from","to"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?this._getAddress(o):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?V.from(o):null))}),["type"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o??null))}),r.accessList&&(n.accessList=this.formatter.accessList(r.accessList)),["data"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?re(o):null))}),this.formatter.transactionRequest(yield yt(n))})}_getFilter(e){return ae(this,void 0,void 0,function*(){e=yield e;const r={};return e.address!=null&&(r.address=this._getAddress(e.address)),["blockHash","topics"].forEach(n=>{e[n]!=null&&(r[n]=e[n])}),["fromBlock","toBlock"].forEach(n=>{e[n]!=null&&(r[n]=this._getBlockTag(e[n]))}),this.formatter.filter(yield yt(r))})}_call(e,r,n){return ae(this,void 0,void 0,function*(){n>=O3&&he.throwError("CCIP read exceeded maximum redirections",T.errors.SERVER_ERROR,{redirects:n,transaction:e});const i=e.to,o=yield this.perform("call",{transaction:e,blockTag:r});if(n>=0&&r==="latest"&&i!=null&&o.substring(0,10)==="0x556f1830"&&On(o)%32===4)try{const s=It(o,4),l=It(s,0,32);V.from(l).eq(i)||he.throwError("CCIP Read sender did not match",T.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o});const a=[],u=V.from(It(s,32,64)).toNumber(),c=V.from(It(s,u,u+32)).toNumber(),d=It(s,u+32);for(let E=0;Eae(this,void 0,void 0,function*(){const o=yield this.perform("getBlock",i);if(o==null)return i.blockHash!=null&&this._emitted["b:"+i.blockHash]==null||i.blockTag!=null&&n>this._emitted.block?null:void 0;if(r){let s=null;for(let a=0;athis._wrapTransaction(a)),l}return this.formatter.block(o)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return ho(()=>ae(this,void 0,void 0,function*(){const n=yield this.perform("getTransaction",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;const i=this.formatter.transactionResponse(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;s<=0&&(s=1),i.confirmations=s}return this._wrapTransaction(i)}),{oncePoll:this})})}getTransactionReceipt(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return ho(()=>ae(this,void 0,void 0,function*(){const n=yield this.perform("getTransactionReceipt",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;if(n.blockHash==null)return;const i=this.formatter.receipt(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;s<=0&&(s=1),i.confirmations=s}return i}),{oncePoll:this})})}getLogs(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield yt({filter:this._getFilter(e)}),n=yield this.perform("getLogs",r);return n.forEach(i=>{i.removed==null&&(i.removed=!1)}),ee.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)})}getEtherPrice(){return ae(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return ae(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&he.throwArgumentError("invalid BlockTag","blockTag",e);let r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return r+=e,r<0&&(r=0),this.formatter.blockTag(r)}return this.formatter.blockTag(e)})}getResolver(e){return ae(this,void 0,void 0,function*(){let r=e;for(;;){if(r===""||r==="."||e!=="eth"&&r==="eth")return null;const n=yield this._getResolver(r,"getResolver");if(n!=null){const i=new vd(this,n,e);return r!==e&&!(yield i.supportsWildcard())?null:i}r=r.split(".").slice(1).join(".")}})}_getResolver(e,r){return ae(this,void 0,void 0,function*(){r==null&&(r="ENS");const n=yield this.getNetwork();n.ensAddress||he.throwError("network does not support ENS",T.errors.UNSUPPORTED_OPERATION,{operation:r,network:n.name});try{const i=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+ma(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return ae(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(n){if(pe(e))throw n}typeof e!="string"&&he.throwArgumentError("invalid ENS name","name",e);const r=yield this.getResolver(e);return r?yield r.getAddress():null})}lookupAddress(e){return ae(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);const r=e.substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"lookupAddress");if(n==null)return null;const i=wa(yield this.call({to:n,data:"0x691f3431"+ma(r).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return ae(this,void 0,void 0,function*(){let r=null;if(pe(e)){const o=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",s=yield this._getResolver(o,"getAvatar");if(!s)return null;r=new vd(this,s,o);try{const l=yield r.getAvatar();if(l)return l.url}catch(l){if(l.code!==T.errors.CALL_EXCEPTION)throw l}try{const l=wa(yield this.call({to:s,data:"0x691f3431"+ma(o).substring(2)}),0);r=yield this.getResolver(l)}catch(l){if(l.code!==T.errors.CALL_EXCEPTION)throw l;return null}}else if(r=yield this.getResolver(e),!r)return null;const n=yield r.getAvatar();return n==null?null:n.url})}perform(e,r){return he.throwError(e+" not implemented",T.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_addEventListener(e,r,n){const i=new D3(Gi(e),r,n);return this._events.push(i),this._startEvent(i),this}on(e,r){return this._addEventListener(e,r,!1)}once(e,r){return this._addEventListener(e,r,!0)}emit(e,...r){let n=!1,i=[],o=Gi(e);return this._events=this._events.filter(s=>s.tag!==o?!0:(setTimeout(()=>{s.listener.apply(this,r)},0),n=!0,s.once?(i.push(s),!1):!0)),i.forEach(s=>{this._stopEvent(s)}),n}listenerCount(e){if(!e)return this._events.length;let r=Gi(e);return this._events.filter(n=>n.tag===r).length}listeners(e){if(e==null)return this._events.map(n=>n.listener);let r=Gi(e);return this._events.filter(n=>n.tag===r).map(n=>n.listener)}off(e,r){if(r==null)return this.removeAllListeners(e);const n=[];let i=!1,o=Gi(e);return this._events=this._events.filter(s=>s.tag!==o||s.listener!=r||i?!0:(i=!0,n.push(s),!1)),n.forEach(s=>{this._stopEvent(s)}),this}removeAllListeners(e){let r=[];if(e==null)r=this._events,this._events=[];else{const n=Gi(e);this._events=this._events.filter(i=>i.tag!==n?!0:(r.push(i),!1))}return r.forEach(n=>{this._stopEvent(n)}),this}}var xn=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const wt=new T($t),z3=["call","estimateGas"];function Ps(t,e){if(t==null)return null;if(typeof t.message=="string"&&t.message.match("reverted")){const r=pe(t.data)?t.data:null;if(!e||r)return{message:t.message,data:r}}if(typeof t=="object"){for(const r in t){const n=Ps(t[r],e);if(n)return n}return null}if(typeof t=="string")try{return Ps(JSON.parse(t),e)}catch{}return null}function d1(t,e,r){const n=r.transaction||r.signedTransaction;if(t==="call"){const o=Ps(e,!0);if(o)return o.data;wt.throwError("missing revert data in call exception; Transaction reverted without a reason string",T.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:e})}if(t==="estimateGas"){let o=Ps(e.body,!1);o==null&&(o=Ps(e,!1)),o&&wt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{reason:o.message,method:t,transaction:n,error:e})}let i=e.message;throw e.code===T.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&wt.throwError("insufficient funds for intrinsic transaction cost",T.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:n}),i.match(/nonce (is )?too low/i)&&wt.throwError("nonce has already been used",T.errors.NONCE_EXPIRED,{error:e,method:t,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&wt.throwError("replacement fee too low",T.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:n}),i.match(/only replay-protected/i)&&wt.throwError("legacy pre-eip-155 transactions not supported",T.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:n}),z3.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&wt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:n}),e}function Yp(t){return new Promise(function(e){setTimeout(e,t)})}function $3(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function as(t){return t&&t.toLowerCase()}const yd={};class Oh extends El{constructor(e,r,n){if(super(),e!==yd)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");z(this,"provider",r),n==null&&(n=0),typeof n=="string"?(z(this,"_address",this.provider.formatter.address(n)),z(this,"_index",null)):typeof n=="number"?(z(this,"_index",n),z(this,"_address",null)):wt.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(e){return wt.throwError("cannot alter JSON-RPC Signer connection",T.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new H3(yd,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&wt.throwError("unknown account #"+this._index,T.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=it(e);const r=this.getAddress().then(n=>(n&&(n=n.toLowerCase()),n));if(e.gasLimit==null){const n=it(e);n.from=r,e.gasLimit=this.provider.estimateGas(n)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(n=>xn(this,void 0,void 0,function*(){if(n==null)return null;const i=yield this.provider.resolveName(n);return i==null&&wt.throwArgumentError("provided ENS name resolves to null","tx.to",n),i}))),yt({tx:yt(e),sender:r}).then(({tx:n,sender:i})=>{n.from!=null?n.from.toLowerCase()!==i&&wt.throwArgumentError("from address mismatch","transaction",e):n.from=i;const o=this.provider.constructor.hexlifyTransaction(n,{from:!0});return this.provider.send("eth_sendTransaction",[o]).then(s=>s,s=>(typeof s.message=="string"&&s.message.match(/user denied/i)&&wt.throwError("user rejected transaction",T.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:n}),d1("sendTransaction",s,o)))})}signTransaction(e){return wt.throwError("signing transactions is unsupported",T.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return xn(this,void 0,void 0,function*(){const r=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(e);try{return yield ho(()=>xn(this,void 0,void 0,function*(){const i=yield this.provider.getTransaction(n);if(i!==null)return this.provider._wrapTransaction(i,n,r)}),{oncePoll:this.provider})}catch(i){throw i.transactionHash=n,i}})}signMessage(e){return xn(this,void 0,void 0,function*(){const r=typeof e=="string"?mr(e):e,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[re(r),n.toLowerCase()])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),i}})}_legacySignMessage(e){return xn(this,void 0,void 0,function*(){const r=typeof e=="string"?mr(e):e,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),re(r)])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),i}})}_signTypedData(e,r,n){return xn(this,void 0,void 0,function*(){const i=yield sr.resolveNames(e,r,n,s=>this.provider.resolveName(s)),o=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[o.toLowerCase(),JSON.stringify(sr.getPayload(i.domain,r,i.value))])}catch(s){throw typeof s.message=="string"&&s.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"_signTypedData",from:o,messageData:{domain:i.domain,types:r,value:i.value}}),s}})}unlock(e){return xn(this,void 0,void 0,function*(){const r=this.provider,n=yield this.getAddress();return r.send("personal_unlockAccount",[n.toLowerCase(),e,null])})}}class H3 extends Oh{sendTransaction(e){return this.sendUncheckedTransaction(e).then(r=>({hash:r,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:n=>this.provider.waitForTransaction(r,n)}))}}const q3={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class vi extends $u{constructor(e,r){let n=r;n==null&&(n=new Promise((i,o)=>{setTimeout(()=>{this.detectNetwork().then(s=>{i(s)},s=>{o(s)})},0)})),super(n),e||(e=fr(this.constructor,"defaultUrl")()),typeof e=="string"?z(this,"connection",Object.freeze({url:e})):z(this,"connection",Object.freeze(it(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return xn(this,void 0,void 0,function*(){yield Yp(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){const r=fr(this.constructor,"getNetwork");try{return r(V.from(e).toNumber())}catch(n){return wt.throwError("could not detect network",T.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:n})}}return wt.throwError("could not detect network",T.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new Oh(yd,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(r=>this.formatter.address(r)))}send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:nr(n),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const o=Al(this.connection,JSON.stringify(n),$3).then(s=>(this.emit("debug",{action:"response",request:n,response:s,provider:this}),s),s=>{throw this.emit("debug",{action:"response",error:s,request:n,provider:this}),s});return i&&(this._cache[e]=o,setTimeout(()=>{this._cache[e]=null},0)),o}prepareRequest(e,r){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[as(r.address),r.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[as(r.address),r.blockTag]];case"getCode":return["eth_getCode",[as(r.address),r.blockTag]];case"getStorageAt":return["eth_getStorageAt",[as(r.address),pt(r.position,32),r.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[r.signedTransaction]];case"getBlock":return r.blockTag?["eth_getBlockByNumber",[r.blockTag,!!r.includeTransactions]]:r.blockHash?["eth_getBlockByHash",[r.blockHash,!!r.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[r.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[r.transactionHash]];case"call":return["eth_call",[fr(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0}),r.blockTag]];case"estimateGas":return["eth_estimateGas",[fr(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0})]];case"getLogs":return r.filter&&r.filter.address!=null&&(r.filter.address=as(r.filter.address)),["eth_getLogs",[r.filter]]}return null}perform(e,r){return xn(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){const i=r.transaction;if(i&&i.type!=null&&V.from(i.type).isZero()&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const o=yield this.getFeeData();o.maxFeePerGas==null&&o.maxPriorityFeePerGas==null&&(r=it(r),r.transaction=it(i),delete r.transaction.type)}}const n=this.prepareRequest(e,r);n==null&&wt.throwError(e+" not implemented",T.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(n[0],n[1])}catch(i){return d1(e,i,r)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;const e=this,r=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=r,r.then(function(n){function i(){e.send("eth_getFilterChanges",[n]).then(function(o){if(e._pendingFilter!=r)return null;let s=Promise.resolve();return o.forEach(function(l){e._emitted["t:"+l.toLowerCase()]="pending",s=s.then(function(){return e.getTransaction(l).then(function(a){return e.emit("pending",a),null})})}),s.then(function(){return Yp(1e3)})}).then(function(){if(e._pendingFilter!=r){e.send("eth_uninstallFilter",[n]);return}return setTimeout(function(){i()},0),null}).catch(o=>{})}return i(),n}).catch(n=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,r){const n=it(q3);if(r)for(const o in r)r[o]&&(n[o]=!0);jx(e,n);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(o){if(e[o]==null)return;const s=Tu(V.from(e[o]));o==="gasLimit"&&(o="gas"),i[o]=s}),["from","to","data"].forEach(function(o){e[o]!=null&&(i[o]=re(e[o]))}),e.accessList&&(i.accessList=qi(e.accessList)),i}}let Cs=null;try{if(Cs=WebSocket,Cs==null)throw new Error("inject please")}catch{const e=new T($t);Cs=function(){e.throwError("WebSockets not supported in this environment",T.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var ef=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Vl=new T($t);let W3=1;class Hu extends vi{constructor(e,r){r==="any"&&Vl.throwError("WebSocketProvider does not support 'any' network yet",T.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,r):super("_websocket",r),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?z(this,"_websocket",new Cs(this.connection.url)):z(this,"_websocket",e),z(this,"_requests",{}),z(this,"_subs",{}),z(this,"_subIds",{}),z(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(i=>{this.websocket.send(this._requests[i].payload)})},this.websocket.onmessage=i=>{const o=i.data,s=JSON.parse(o);if(s.id!=null){const l=String(s.id),a=this._requests[l];if(delete this._requests[l],s.result!==void 0)a.callback(null,s.result),this.emit("debug",{action:"response",request:JSON.parse(a.payload),response:s.result,provider:this});else{let u=null;s.error?(u=new Error(s.error.message||"unknown error"),z(u,"code",s.error.code||null),z(u,"response",o)):u=new Error("unknown error"),a.callback(u,void 0),this.emit("debug",{action:"response",error:u,request:JSON.parse(a.payload),provider:this})}}else if(s.method==="eth_subscription"){const l=this._subs[s.params.subscription];l&&l.processFunc(s.params.result)}else console.warn("this should not happen")};const n=setInterval(()=>{this.emit("poll")},1e3);n.unref&&n.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){Vl.throwError("cannot reset events block on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){Vl.throwError("cannot set polling interval on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return ef(this,void 0,void 0,function*(){return null})}set polling(e){e&&Vl.throwError("cannot set polling on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,r){const n=W3++;return new Promise((i,o)=>{function s(a,u){return a?o(a):i(u)}const l=JSON.stringify({method:e,params:r,id:n,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(l),provider:this}),this._requests[String(n)]={callback:s,payload:l},this._wsReady&&this.websocket.send(l)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,r,n){return ef(this,void 0,void 0,function*(){let i=this._subIds[e];i==null&&(i=Promise.all(r).then(s=>this.send("eth_subscribe",s)),this._subIds[e]=i);const o=yield i;this._subs[o]={tag:e,processFunc:n}})}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],r=>{const n=V.from(r.number).toNumber();this._emitted.block=n,this.emit("block",n)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],r=>{this.emit("pending",r)});break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],r=>{r.removed==null&&(r.removed=!1),this.emit(e.filter,this.formatter.filterLog(r))});break;case"tx":{const r=n=>{const i=n.hash;this.getTransactionReceipt(i).then(o=>{o&&this.emit(i,o)})};r(e),this._subscribe("tx",["newHeads"],n=>{this._events.filter(i=>i.type==="tx").forEach(r)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e);break}}_stopEvent(e){let r=e.tag;if(e.type==="tx"){if(this._events.filter(i=>i.type==="tx").length)return;r="tx"}else if(this.listenerCount(e.event))return;const n=this._subIds[r];n&&(delete this._subIds[r],n.then(i=>{this._subs[i]&&(delete this._subs[i],this.send("eth_unsubscribe",[i]))}))}destroy(){return ef(this,void 0,void 0,function*(){this.websocket.readyState===Cs.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}var G3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const gs=new T($t);class h1 extends vi{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return G3(this,void 0,void 0,function*(){let r=this.network;return r==null&&(r=yield e.detectNetwork.call(this),r||gs.throwError("no network detected",T.errors.UNKNOWN_ERROR,{}),this._network==null&&(z(this,"_network",r),this.emit("network",r,null))),r})}}class Fn extends h1{constructor(e,r){gs.checkAbstract(new.target,Fn),e=fr(new.target,"getNetwork")(e),r=fr(new.target,"getApiKey")(r);const n=fr(new.target,"getUrl")(e,r);super(n,e),typeof r=="string"?z(this,"apiKey",r):r!=null&&Object.keys(r).forEach(i=>{z(this,i,r[i])})}_startPending(){gs.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return gs.throwError("API provider does not support signing",T.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,r){return gs.throwError("not implemented; sub-classes must override getUrl",T.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const Xp=new T($t),Ea="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class p1 extends Hu{constructor(e,r){const n=new Lh(e,r),i=n.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(i,n.network),z(this,"apiKey",n.apiKey)}isCommunityResource(){return this.apiKey===Ea}}class Lh extends Fn{static getWebSocketProvider(e,r){return new p1(e,r)}static getApiKey(e){return e==null?Ea:(e&&typeof e!="string"&&Xp.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,r){let n=null;switch(e.name){case"homestead":n="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":n="eth-goerli.g.alchemy.com/v2/";break;case"matic":n="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":n="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":n="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":n="arb-goerli.g.alchemy.com/v2/";break;case"optimism":n="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":n="opt-goerli.g.alchemy.com/v2/";break;default:Xp.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+n+r,throttleCallback:(i,o)=>(r===Ea&&bl(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===Ea}}const V3=new T($t),Kl="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function K3(t){switch(t){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return V3.throwArgumentError("unsupported network","name",t)}class m1 extends Fn{isCommunityResource(){return this.apiKey===Kl}static getApiKey(e){return e??Kl}static getUrl(e,r){r==null&&(r=Kl);const n={allowGzip:!0,url:"https://"+K3(e.name)+r,throttleCallback:(i,o)=>(r.apiKey===Kl&&bl(),Promise.resolve(!0))};return r.projectSecret!=null&&(n.user="",n.password=r.projectSecret),n}}var Q3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Zp=new T($t);class g1 extends Fn{static getApiKey(e){return e!=null&&Zp.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,r){let n=null;switch(e.name){case"homestead":n="https://cloudflare-eth.com/";break;default:Zp.throwArgumentError("unsupported network","network",arguments[0])}return n}perform(e,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return Q3(this,void 0,void 0,function*(){return e==="getBlockNumber"?(yield n.perform.call(this,"getBlock",{blockTag:"latest"})).number:n.perform.call(this,e,r)})}}var Ql=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const ti=new T($t);function em(t){const e={};for(let r in t){if(t[r]==null)continue;let n=t[r];r==="type"&&n===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?n=Tu(re(n)):r==="accessList"?n="["+qi(n).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":n=re(n),e[r]=n)}return e}function J3(t){if(t.status==0&&(t.message==="No records found"||t.message==="No transactions found"))return t.result;if(t.status!=1||typeof t.message!="string"||!t.message.match(/^OK/)){const e=new Error("invalid response");throw e.result=JSON.stringify(t),(t.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return t.result}function tm(t){if(t&&t.status==0&&t.message=="NOTOK"&&(t.result||"").toLowerCase().indexOf("rate limit")>=0){const e=new Error("throttled response");throw e.result=JSON.stringify(t),e.throttleRetry=!0,e}if(t.jsonrpc!="2.0"){const e=new Error("invalid response");throw e.result=JSON.stringify(t),e}if(t.error){const e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function rm(t){if(t==="pending")throw new Error("pending not supported");return t==="latest"?t:parseInt(t.substring(2),16)}function tf(t,e,r){if(t==="call"&&e.code===T.errors.SERVER_ERROR){const i=e.error;if(i&&(i.message.match(/reverted/i)||i.message.match(/VM execution error/i))){let o=i.data;if(o&&(o="0x"+o.replace(/^.*0x/i,"")),pe(o))return o;ti.throwError("missing revert data in call exception",T.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let n=e.message;throw e.code===T.errors.SERVER_ERROR&&(e.error&&typeof e.error.message=="string"?n=e.error.message:typeof e.body=="string"?n=e.body:typeof e.responseText=="string"&&(n=e.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&ti.throwError("insufficient funds for intrinsic transaction cost",T.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&ti.throwError("nonce has already been used",T.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),n.match(/another transaction with same nonce/)&&ti.throwError("replacement fee too low",T.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&ti.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}class v1 extends $u{constructor(e,r){super(e),z(this,"baseUrl",this.getBaseUrl()),z(this,"apiKey",r||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return ti.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,r){const n=Object.keys(r).reduce((o,s)=>{const l=r[s];return l!=null&&(o+=`&${s}=${l}`),o},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${n}${i}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,r){return r.module=e,r.apikey=this.apiKey,r}fetch(e,r,n){return Ql(this,void 0,void 0,function*(){const i=n?this.getPostUrl():this.getUrl(e,r),o=n?this.getPostData(e,r):null,s=e==="proxy"?tm:J3;this.emit("debug",{action:"request",request:i,provider:this});const l={url:i,throttleSlotInterval:1e3,throttleCallback:(c,d)=>(this.isCommunityResource()&&bl(),Promise.resolve(!0))};let a=null;o&&(l.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},a=Object.keys(o).map(c=>`${c}=${o[c]}`).join("&"));const u=yield Al(l,a,s||tm);return this.emit("debug",{action:"response",request:i,response:nr(u),provider:this}),u})}detectNetwork(){return Ql(this,void 0,void 0,function*(){return this.network})}perform(e,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return Ql(this,void 0,void 0,function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:r.address,tag:r.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:r.address,tag:r.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:r.address,tag:r.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:r.address,position:r.position,tag:r.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:r.signedTransaction},!0).catch(i=>tf("sendTransaction",i,r.signedTransaction));case"getBlock":if(r.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:r.blockTag,boolean:r.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:r.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:r.transactionHash});case"call":{if(r.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const i=em(r.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(o){return tf("call",o,r.transaction)}}case"estimateGas":{const i=em(r.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(o){return tf("estimateGas",o,r.transaction)}}case"getLogs":{const i={action:"getLogs"};if(r.filter.fromBlock&&(i.fromBlock=rm(r.filter.fromBlock)),r.filter.toBlock&&(i.toBlock=rm(r.filter.toBlock)),r.filter.address&&(i.address=r.filter.address),r.filter.topics&&r.filter.topics.length>0&&(r.filter.topics.length>1&&ti.throwError("unsupported topic count",T.errors.UNSUPPORTED_OPERATION,{topics:r.filter.topics}),r.filter.topics.length===1)){const l=r.filter.topics[0];(typeof l!="string"||l.length!==66)&&ti.throwError("unsupported topic format",T.errors.UNSUPPORTED_OPERATION,{topic0:l}),i.topic0=l}const o=yield this.fetch("logs",i);let s={};for(let l=0;l{["contractAddress","to"].forEach(function(a){s[a]==""&&delete s[a]}),s.creates==null&&s.contractAddress!=null&&(s.creates=s.contractAddress);const l=this.formatter.transactionResponse(s);return s.timeStamp&&(l.timestamp=parseInt(s.timeStamp)),l})})}isCommunityResource(){return this.apiKey==null}}var iu=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Si=new T($t);function Jl(){return new Date().getTime()}function nm(t){let e=null;for(let r=0;re?null:(n+i)/2}function po(t){if(t===null)return"null";if(typeof t=="number"||typeof t=="boolean")return JSON.stringify(t);if(typeof t=="string")return t;if(V.isBigNumber(t))return t.toString();if(Array.isArray(t))return JSON.stringify(t.map(e=>po(e)));if(typeof t=="object"){const e=Object.keys(t);return e.sort(),"{"+e.map(r=>{let n=t[r];return typeof n=="function"?n="[function]":n=po(n),JSON.stringify(r)+":"+n}).join(",")+"}"}throw new Error("unknown value type: "+typeof t)}let Y3=1;function om(t){let e=null,r=null,n=new Promise(s=>{e=function(){r&&(clearTimeout(r),r=null),s()},r=setTimeout(e,t)});const i=s=>(n=n.then(s),n);function o(){return n}return{cancel:e,getPromise:o,wait:i}}const X3=[T.errors.CALL_EXCEPTION,T.errors.INSUFFICIENT_FUNDS,T.errors.NONCE_EXPIRED,T.errors.REPLACEMENT_UNDERPRICED,T.errors.UNPREDICTABLE_GAS_LIMIT],Z3=["address","args","errorArgs","errorSignature","method","transaction"];function Yl(t,e){const r={weight:t.weight};return Object.defineProperty(r,"provider",{get:()=>t.provider}),t.start&&(r.start=t.start),e&&(r.duration=e-t.start),t.done&&(t.error?r.error=t.error:r.result=t.result||null),r}function eS(t,e){return function(r){const n={};r.forEach(o=>{const s=t(o.result);n[s]||(n[s]={count:0,result:o.result}),n[s].count++});const i=Object.keys(n);for(let o=0;o=e)return s.result}}}function tS(t,e,r){let n=po;switch(e){case"getBlockNumber":return function(i){const o=i.map(l=>l.result);let s=im(i.map(l=>l.result),2);if(s!=null)return s=Math.ceil(s),o.indexOf(s+1)>=0&&s++,s>=t._highestBlockNumber&&(t._highestBlockNumber=s),t._highestBlockNumber};case"getGasPrice":return function(i){const o=i.map(s=>s.result);return o.sort(),o[Math.floor(o.length/2)]};case"getEtherPrice":return function(i){return im(i.map(o=>o.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(i){return i==null?null:(i=it(i),i.confirmations=-1,po(i))};break;case"getBlock":r.includeTransactions?n=function(i){return i==null?null:(i=it(i),i.transactions=i.transactions.map(o=>(o=it(o),o.confirmations=-1,o)),po(i))}:n=function(i){return i==null?null:po(i)};break;default:throw new Error("unknown method: "+e)}return eS(n,t.quorum)}function us(t,e){return iu(this,void 0,void 0,function*(){const r=t.provider;return r.blockNumber!=null&&r.blockNumber>=e||e===-1?r:ho(()=>new Promise((n,i)=>{setTimeout(function(){return r.blockNumber>=e?n(r):t.cancelled?n(null):n(void 0)},0)}),{oncePoll:r})})}function rS(t,e,r,n){return iu(this,void 0,void 0,function*(){let i=t.provider;switch(r){case"getBlockNumber":case"getGasPrice":return i[r]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),r==="call"&&n.blockTag?i[r](n.transaction,n.blockTag):i[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return i[r](n.transactionHash);case"getLogs":{let o=n.filter;return(o.fromBlock&&pe(o.fromBlock)||o.toBlock&&pe(o.toBlock))&&(i=yield us(t,e)),i.getLogs(o)}}return Si.throwError("unknown method error",T.errors.UNKNOWN_ERROR,{method:r,params:n})})}class y1 extends $u{constructor(e,r){e.length===0&&Si.throwArgumentError("missing providers","providers",e);const n=e.map((s,l)=>{if(qo.isProvider(s)){const c=gd(s)?2e3:750;return Object.freeze({provider:s,weight:1,stallTimeout:c,priority:1})}const a=it(s);a.priority==null&&(a.priority=1),a.stallTimeout==null&&(a.stallTimeout=gd(s)?2e3:750),a.weight==null&&(a.weight=1);const u=a.weight;return(u%1||u>512||u<1)&&Si.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${l}].weight`,u),Object.freeze(a)}),i=n.reduce((s,l)=>s+l.weight,0);r==null?r=i/2:r>i&&Si.throwArgumentError("quorum will always fail; larger than total weight","quorum",r);let o=nm(n.map(s=>s.provider.network));o==null&&(o=new Promise((s,l)=>{setTimeout(()=>{this.detectNetwork().then(s,l)},0)})),super(o),z(this,"providerConfigs",Object.freeze(n)),z(this,"quorum",r),this._highestBlockNumber=-1}detectNetwork(){return iu(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(r=>r.provider.getNetwork()));return nm(e)})}perform(e,r){return iu(this,void 0,void 0,function*(){if(e==="sendTransaction"){const a=yield Promise.all(this.providerConfigs.map(u=>u.provider.sendTransaction(r.signedTransaction).then(c=>c.hash,c=>c)));for(let u=0;ua.priority-u.priority);const o=this._highestBlockNumber;let s=0,l=!0;for(;;){const a=Jl();let u=i.filter(v=>v.runner&&a-v.startv+g.weight,0);for(;u{v.staller=null}),v.runner=rS(v,o,e,r).then(x=>{v.done=!0,v.result=x,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:g,backend:Yl(v,Jl()),request:{method:e,params:nr(r)},provider:this})},x=>{v.done=!0,v.error=x,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:g,backend:Yl(v,Jl()),request:{method:e,params:nr(r)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:g,backend:Yl(v,null),request:{method:e,params:nr(r)},provider:this}),u+=v.weight}const c=[];i.forEach(v=>{v.done||!v.runner||(c.push(v.runner),v.staller&&c.push(v.staller.getPromise()))}),c.length&&(yield Promise.race(c));const d=i.filter(v=>v.done&&v.error==null);if(d.length>=this.quorum){const v=n(d);if(v!==void 0)return i.forEach(g=>{g.staller&&g.staller.cancel(),g.cancelled=!0}),v;l||(yield om(100).getPromise()),l=!1}const p=i.reduce((v,g)=>{if(!g.done||g.error==null)return v;const x=g.error.code;return X3.indexOf(x)>=0&&(v[x]||(v[x]={error:g.error,weight:0}),v[x].weight+=g.weight),v},{});if(Object.keys(p).forEach(v=>{const g=p[v];if(g.weight{E.staller&&E.staller.cancel(),E.cancelled=!0});const x=g.error,k={};Z3.forEach(E=>{x[E]!=null&&(k[E]=x[E])}),Si.throwError(x.reason||x.message,v,k)}),i.filter(v=>!v.done).length===0)break}return i.forEach(a=>{a.staller&&a.staller.cancel(),a.cancelled=!0}),Si.throwError("failed to meet quorum",T.errors.SERVER_ERROR,{method:e,params:r,results:i.map(a=>Yl(a)),provider:this})})}}const w1=null,xa=new T($t),vs="84842078b09946638c03157f83405213";class E1 extends Hu{constructor(e,r){const n=new Bh(e,r),i=n.connection;i.password&&xa.throwError("INFURA WebSocket project secrets unsupported",T.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const o=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(o,e),z(this,"apiKey",n.projectId),z(this,"projectId",n.projectId),z(this,"projectSecret",n.projectSecret)}isCommunityResource(){return this.projectId===vs}}class Bh extends Fn{static getWebSocketProvider(e,r){return new E1(e,r)}static getApiKey(e){const r={apiKey:vs,projectId:vs,projectSecret:null};return e==null||(typeof e=="string"?r.projectId=e:e.projectSecret!=null?(xa.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),xa.assertArgument(typeof e.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),r.projectId=e.projectId,r.projectSecret=e.projectSecret):e.projectId&&(r.projectId=e.projectId),r.apiKey=r.projectId),r}static getUrl(e,r){let n=null;switch(e?e.name:"unknown"){case"homestead":n="mainnet.infura.io";break;case"goerli":n="goerli.infura.io";break;case"sepolia":n="sepolia.infura.io";break;case"matic":n="polygon-mainnet.infura.io";break;case"maticmum":n="polygon-mumbai.infura.io";break;case"optimism":n="optimism-mainnet.infura.io";break;case"optimism-goerli":n="optimism-goerli.infura.io";break;case"arbitrum":n="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":n="arbitrum-goerli.infura.io";break;default:xa.throwError("unsupported network",T.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+n+"/v3/"+r.projectId,throttleCallback:(o,s)=>(r.projectId===vs&&bl(),Promise.resolve(!0))};return r.projectSecret!=null&&(i.user="",i.password=r.projectSecret),i}isCommunityResource(){return this.projectId===vs}}class nS extends vi{send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this._pendingBatch==null&&(this._pendingBatch=[]);const i={request:n,resolve:null,reject:null},o=new Promise((s,l)=>{i.resolve=s,i.reject=l});return this._pendingBatch.push(i),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout(()=>{const s=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const l=s.map(a=>a.request);return this.emit("debug",{action:"requestBatch",request:nr(l),provider:this}),Al(this.connection,JSON.stringify(l)).then(a=>{this.emit("debug",{action:"response",request:l,response:a,provider:this}),s.forEach((u,c)=>{const d=a[c];if(d.error){const p=new Error(d.error.message);p.code=d.error.code,p.data=d.error.data,u.reject(p)}else u.resolve(d.result)})},a=>{this.emit("debug",{action:"response",error:a,request:l,provider:this}),s.forEach(u=>{u.reject(a)})})},10)),o}}const rf=new T($t),iS="ETHERS_JS_SHARED";class x1 extends Fn{static getApiKey(e){return e&&typeof e!="string"&&rf.throwArgumentError("invalid apiKey","apiKey",e),e||iS}static getUrl(e,r){rf.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let n=null;switch(e.name){case"homestead":n="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":n="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":n="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":n="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":n="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:rf.throwArgumentError("unsupported network","network",arguments[0])}return n+"?apiKey="+r}}const sm=new T($t),lm="62e1ad51b37b8e00394bda3b";class A1 extends Fn{static getApiKey(e){const r={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?r.applicationId=lm:typeof e=="string"?r.applicationId=e:e.applicationSecretKey!=null?(r.applicationId=e.applicationId,r.applicationSecretKey=e.applicationSecretKey):e.applicationId?r.applicationId=e.applicationId:sm.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),r}static getUrl(e,r){let n=null;switch(e?e.name:"unknown"){case"goerli":n="eth-goerli.gateway.pokt.network";break;case"homestead":n="eth-mainnet.gateway.pokt.network";break;case"kovan":n="poa-kovan.gateway.pokt.network";break;case"matic":n="poly-mainnet.gateway.pokt.network";break;case"maticmum":n="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":n="eth-rinkeby.gateway.pokt.network";break;case"ropsten":n="eth-ropsten.gateway.pokt.network";break;default:sm.throwError("unsupported network",T.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i=`https://${n}/v1/lb/${r.applicationId}`,o={headers:{},url:i};return r.applicationSecretKey!=null&&(o.user="",o.password=r.applicationSecretKey),o}isCommunityResource(){return this.applicationId===lm}}const am=new T($t);let oS=1;function um(t,e){const r="Web3LegacyFetcher";return function(n,i){const o={method:n,params:i,id:oS++,jsonrpc:"2.0"};return new Promise((s,l)=>{this.emit("debug",{action:"request",fetcher:r,request:nr(o),provider:this}),e(o,(a,u)=>{if(a)return this.emit("debug",{action:"response",fetcher:r,error:a,request:o,provider:this}),l(a);if(this.emit("debug",{action:"response",fetcher:r,request:o,response:u,provider:this}),u.error){const c=new Error(u.error.message);return c.code=u.error.code,c.data=u.error.data,l(c)}s(u.result)})})}}function sS(t){return function(e,r){r==null&&(r=[]);const n={method:e,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:nr(n),provider:this}),t.request(n).then(i=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,response:i,provider:this}),i),i=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,error:i,provider:this}),i})}}class b1 extends vi{constructor(e,r){e==null&&am.throwArgumentError("missing provider","provider",e);let n=null,i=null,o=null;typeof e=="function"?(n="unknown:",i=e):(n=e.host||e.path||"",!n&&e.isMetaMask&&(n="metamask"),o=e,e.request?(n===""&&(n="eip-1193:"),i=sS(e)):e.sendAsync?i=um(e,e.sendAsync.bind(e)):e.send?i=um(e,e.send.bind(e)):am.throwArgumentError("unsupported provider","provider",e),n||(n="unknown:")),super(n,r),z(this,"jsonRpcFetchFunc",i),z(this,"provider",o)}send(e,r){return this.jsonRpcFetchFunc(e,r)}}const cm=new T($t);function lS(t,e){if(t==null&&(t="homestead"),typeof t=="string"){const n=t.match(/^(ws|http)s?:/i);if(n)switch(n[1].toLowerCase()){case"http":case"https":return new vi(t);case"ws":case"wss":return new Hu(t);default:cm.throwArgumentError("unsupported URL scheme","network",t)}}const r=Th(t);return(!r||!r._defaultProvider)&&cm.throwError("unsupported getDefaultProvider network",T.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:t}),r._defaultProvider({FallbackProvider:y1,AlchemyProvider:Lh,AnkrProvider:m1,CloudflareProvider:g1,EtherscanProvider:v1,InfuraProvider:Bh,JsonRpcProvider:vi,NodesmithProvider:x1,PocketProvider:A1,Web3Provider:b1,IpcProvider:w1},e)}const aS=Object.freeze(Object.defineProperty({__proto__:null,AlchemyProvider:Lh,AlchemyWebSocketProvider:p1,AnkrProvider:m1,BaseProvider:$u,CloudflareProvider:g1,EtherscanProvider:v1,FallbackProvider:y1,Formatter:ee,InfuraProvider:Bh,InfuraWebSocketProvider:E1,IpcProvider:w1,JsonRpcBatchProvider:nS,JsonRpcProvider:vi,JsonRpcSigner:Oh,NodesmithProvider:x1,PocketProvider:A1,Provider:qo,Resolver:vd,StaticJsonRpcProvider:h1,UrlJsonRpcProvider:Fn,Web3Provider:b1,WebSocketProvider:Hu,getDefaultProvider:lS,getNetwork:Th,isCommunityResourcable:u1,isCommunityResource:gd,showThrottleMessage:bl},Symbol.toStringTag,{value:"Module"})),uS="solidity/5.7.0",cS=new RegExp("^bytes([0-9]+)$"),fS=new RegExp("^(u?int)([0-9]*)$"),dS=new RegExp("^(.*)\\[([0-9]*)\\]$"),hS="0000000000000000000000000000000000000000000000000000000000000000",Yi=new T(uS);function _1(t,e,r){switch(t){case"address":return r?ha(e,32):se(e);case"string":return mr(e);case"bytes":return se(e);case"bool":return e=e?"0x01":"0x00",r?ha(e,32):se(e)}let n=t.match(fS);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!==0||i===0||i>256)&&Yi.throwArgumentError("invalid number type","type",t),r&&(i=256),e=V.from(e).toTwos(i),ha(e,i/8)}if(n=t.match(cS),n){const i=parseInt(n[1]);return(String(i)!==n[1]||i===0||i>32)&&Yi.throwArgumentError("invalid bytes type","type",t),se(e).byteLength!==i&&Yi.throwArgumentError(`invalid value for ${t}`,"value",e),r?se((e+hS).substring(0,66)):e}if(n=t.match(dS),n&&Array.isArray(e)){const i=n[1];parseInt(n[2]||String(e.length))!=e.length&&Yi.throwArgumentError(`invalid array length for ${t}`,"value",e);const s=[];return e.forEach(function(l){s.push(_1(i,l,!0))}),Ut(s)}return Yi.throwArgumentError("invalid type","type",t)}function pS(t,e){t.length!=e.length&&Yi.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);const r=[];return t.forEach(function(n,i){r.push(_1(n,e[i]))}),re(Ut(r))}function mS(t,e){return ut(pS(t,e))}var qu={},Cn={},S1={};const gS=Uo(rA);var vS={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const fm=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??typeof c!="object"?c:Object.assign({},e,c),r.forEach(p=>p(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(vS?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},k1=t=>t?fm(t):fm;var N1={exports:{}},P1={},C1={exports:{}},M1={};/** * @license React * use-sync-external-store-shim.production.min.js * @@ -87,4 +87,4 @@ Error generating stack: `+o.message+` * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var Wu=L,PS=NS;function CS(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var MS=typeof Object.is=="function"?Object.is:CS,IS=PS.useSyncExternalStore,RS=Wu.useRef,TS=Wu.useEffect,OS=Wu.useMemo,LS=Wu.useDebugValue;P1.useSyncExternalStoreWithSelector=function(t,e,r,n,i){var o=RS(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=OS(function(){function a(v){if(!u){if(u=!0,c=v,v=n(v),i!==void 0&&s.hasValue){var p=s.value;if(i(p,v))return d=p}return d=v}if(p=d,MS(c,v))return p;var x=n(v);return i!==void 0&&i(p,x)?p:(c=v,d=x)}var u=!1,c,d,m=r===void 0?null:r;return[function(){return a(e())},m===null?void 0:function(){return a(m())}]},[e,r,n,i]);var l=IS(t,o[0],o[1]);return TS(function(){s.hasValue=!0,s.value=l},[l]),LS(l),l};N1.exports=P1;var BS=N1.exports;const Gu=jo(BS),{useSyncExternalStoreWithSelector:DS}=Gu;function I1(t,e=t.getState,r){const n=DS(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const dm=t=>{const e=typeof t=="function"?k1(t):t,r=(n,i)=>I1(e,n,i);return Object.assign(r,e),r},R1=t=>t?dm(t):dm;var jS=t=>R1(t);const US=Object.freeze(Object.defineProperty({__proto__:null,create:R1,createStore:k1,default:jS,useStore:I1},Symbol.toStringTag,{value:"Module"})),FS=Uo(US);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createWeb3ReactStoreAndActions=t.MAX_SAFE_CHAIN_ID=void 0;const e=gS,r=FS;t.MAX_SAFE_CHAIN_ID=0xfffffffffffec;function n(l){if(!Number.isInteger(l)||l<=0||l>t.MAX_SAFE_CHAIN_ID)throw new Error(`Invalid chainId ${l}`)}function i(l){return(0,e.getAddress)(l)}const o={chainId:void 0,accounts:void 0,activating:!1};function s(){const l=(0,r.createStore)()(()=>o);let a=0;function u(){const m=++a;return l.setState(Object.assign(Object.assign({},o),{activating:!0})),()=>{a===m&&l.setState({activating:!1})}}function c(m){if(m.chainId!==void 0&&n(m.chainId),m.accounts!==void 0)for(let v=0;v{var p,x;const k=(p=m.chainId)!==null&&p!==void 0?p:v.chainId,E=(x=m.accounts)!==null&&x!==void 0?x:v.accounts;let w=v.activating;return w&&k&&E&&(w=!1),{chainId:k,accounts:E,activating:w}})}function d(){a++,l.setState(o)}return[l,{startActivation:u,update:c,resetState:d}]}t.createWeb3ReactStoreAndActions=s})(S1);var zS={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const hm=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??typeof c!="object"?c:Object.assign({},e,c),r.forEach(m=>m(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(zS?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},Dh=t=>t?hm(t):hm,{useSyncExternalStoreWithSelector:$S}=Gu;function T1(t,e=t.getState,r){const n=$S(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const pm=t=>{const e=typeof t=="function"?Dh(t):t,r=(n,i)=>T1(e,n,i);return Object.assign(r,e),r},O1=t=>t?pm(t):pm;var HS=t=>O1(t);const qS=Object.freeze(Object.defineProperty({__proto__:null,create:O1,createStore:Dh,default:HS,useStore:T1},Symbol.toStringTag,{value:"Module"})),WS=Uo(qS),{useSyncExternalStoreWithSelector:GS}=Gu;function L1(t,e=t.getState,r){const n=GS(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const mm=(t,e)=>{const r=Dh(t),n=(i,o=e)=>L1(r,i,o);return Object.assign(n,r),n},VS=(t,e)=>t?mm(t,e):mm,KS=Object.freeze(Object.defineProperty({__proto__:null,createWithEqualityFn:VS,useStoreWithEqualityFn:L1},Symbol.toStringTag,{value:"Module"})),QS=Uo(KS),JS=Uo(aS);var YS=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XS=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZS=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&YS(e,t,r);return XS(e,t),e},ek=Fe&&Fe.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(Cn,"__esModule",{value:!0});Cn.getPriorityConnector=Cn.getSelectedConnector=Cn.initializeConnector=void 0;const tk=S1,mo=L,gm=WS,rk=QS;let _o;function nk(){return ek(this,void 0,void 0,function*(){if(_o===void 0)try{const{Web3Provider:t}=yield Promise.resolve().then(()=>ZS(JS));_o=t}catch{console.debug("@ethersproject/providers not available"),_o=null}})}function ik(t){const[e,r]=(0,tk.createWeb3ReactStoreAndActions)(),n=t(r),i=fk(e),o=dk(i),s=hk(n,i,o);return[n,Object.assign(Object.assign(Object.assign({},i),o),s),e]}Cn.initializeConnector=ik;function ok({chainId:t,accounts:e,activating:r}){return!!(t&&e&&!r)}function B1(...t){function e(d){const m=t.findIndex(([v])=>d===v);if(m===-1)throw new Error("Connector not found");return m}function r(d){const m=t[e(d)][2];if(!m)throw new Error("Stores not passed");return m}function n(d){return t.map(([,{useChainId:v}])=>v())[e(d)]}function i(d){return t.map(([,{useAccounts:v}])=>v())[e(d)]}function o(d){return t.map(([,{useIsActivating:v}])=>v())[e(d)]}function s(d){return t.map(([,{useAccount:v}])=>v())[e(d)]}function l(d){return t.map(([,{useIsActive:v}])=>v())[e(d)]}function a(d,m){const v=e(d);return t.map(([,{useProvider:x}],k)=>x(m,k===v))[v]}function u(d,m){const v=e(d);return t.map(([,{useENSNames:x}],k)=>x(k===v?m:void 0))[v]}function c(d,m){const v=e(d);return t.map(([,{useENSName:x}],k)=>x(k===v?m:void 0))[v]}return{useSelectedStore:r,useSelectedChainId:n,useSelectedAccounts:i,useSelectedIsActivating:o,useSelectedAccount:s,useSelectedIsActive:l,useSelectedProvider:a,useSelectedENSNames:u,useSelectedENSName:c}}Cn.getSelectedConnector=B1;function sk(...t){const{useSelectedStore:e,useSelectedChainId:r,useSelectedAccounts:n,useSelectedIsActivating:i,useSelectedAccount:o,useSelectedIsActive:s,useSelectedProvider:l,useSelectedENSNames:a,useSelectedENSName:u}=B1(...t);function c(){const B=t.map(([,{useIsActive:j}])=>j()).findIndex(j=>j);return t[B===-1?0:B][0]}function d(){return e(c())}function m(){return r(c())}function v(){return n(c())}function p(){return i(c())}function x(){return o(c())}function k(){return s(c())}function E(O){return l(c(),O)}function w(O){return a(c(),O)}function _(O){return u(c(),O)}return{useSelectedStore:e,useSelectedChainId:r,useSelectedAccounts:n,useSelectedIsActivating:i,useSelectedAccount:o,useSelectedIsActive:s,useSelectedProvider:l,useSelectedENSNames:a,useSelectedENSName:u,usePriorityConnector:c,usePriorityStore:d,usePriorityChainId:m,usePriorityAccounts:v,usePriorityIsActivating:p,usePriorityAccount:x,usePriorityIsActive:k,usePriorityProvider:E,usePriorityENSNames:w,usePriorityENSName:_}}Cn.getPriorityConnector=sk;const lk=({chainId:t})=>t,ak=({accounts:t})=>t,uk=({activating:t})=>t,ck=(t,e)=>t===void 0&&e===void 0||t!==void 0&&t.length===(e==null?void 0:e.length)&&t.every((r,n)=>r===e[n]);function fk(t){function e(){return(0,gm.useStore)(t,lk)}function r(){return(0,rk.useStoreWithEqualityFn)(t,ak,ck)}function n(){return(0,gm.useStore)(t,uk)}return{useChainId:e,useAccounts:r,useIsActivating:n}}function dk({useChainId:t,useAccounts:e,useIsActivating:r}){function n(){var o;return(o=e())===null||o===void 0?void 0:o[0]}function i(){const o=t(),s=e(),l=r();return ok({chainId:o,accounts:s,activating:l})}return{useAccount:n,useIsActive:i}}function vm(t,e=[]){const[r,n]=(0,mo.useState)();return(0,mo.useEffect)(()=>{if(t&&e.length){let i=!1;return Promise.all(e.map(o=>t.lookupAddress(o))).then(o=>{i||n(o)}).catch(o=>{i||(console.debug("Could not fetch ENS names",o),n(new Array(e.length).fill(null)))}),()=>{i=!0,n(void 0)}}},[t,e]),r??new Array(e.length).fill(void 0)}function hk(t,{useAccounts:e,useChainId:r},{useAccount:n,useIsActive:i}){function o(a,u=!0){const c=i(),d=r(),[m,v]=(0,mo.useState)(_o!==void 0);return(0,mo.useEffect)(()=>{if(m)return;let p=!1;return nk().then(()=>{p||v(!0)}),()=>{p=!0}},[m]),(0,mo.useMemo)(()=>{if(u){if(t.customProvider)return t.customProvider;if(_o&&t.provider)return new _o(t.provider,a)}},[m,u,c,d,a])}function s(a){const u=e();return vm(a,u)}function l(a){var u;const c=n(),d=(0,mo.useMemo)(()=>c===void 0?void 0:[c],[c]);return(u=vm(a,d))===null||u===void 0?void 0:u[0]}return{useProvider:o,useENSNames:s,useENSName:l}}var Vu={},D1={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(a,u,c){this.fn=a,this.context=u,this.once=c||!1}function o(a,u,c,d,m){if(typeof c!="function")throw new TypeError("The listener must be a function");var v=new i(c,d||a,m),p=r?r+u:u;return a._events[p]?a._events[p].fn?a._events[p]=[a._events[p],v]:a._events[p].push(v):(a._events[p]=v,a._eventsCount++),a}function s(a,u){--a._eventsCount===0?a._events=new n:delete a._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],c,d;if(this._eventsCount===0)return u;for(d in c=this._events)e.call(c,d)&&u.push(r?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},l.prototype.listeners=function(u){var c=r?r+u:u,d=this._events[c];if(!d)return[];if(d.fn)return[d.fn];for(var m=0,v=d.length,p=new Array(v);me),this.eth_accounts=jest.fn(e=>e),this.eth_requestAccounts=jest.fn(e=>e)}request(e){if(!this.chainId)return Promise.reject(new Error);switch(e.method){case"eth_chainId":return Promise.resolve(this.eth_chainId(this.chainId));case"eth_accounts":return Promise.resolve(this.eth_accounts(this.accounts));case"eth_requestAccounts":return Promise.resolve(this.eth_requestAccounts(this.accounts));default:throw new Error(`Method not supported on mock: ${JSON.stringify(e)}`)}}emitConnect(e){this.emit("connect",{chainId:e})}emitDisconnect(e){this.emit("disconnect",e)}emitChainChanged(e){this.emit("chainChanged",e)}emitAccountsChanged(e){this.emit("accountsChanged",e)}}Vu.MockEIP1193Provider=gk;var Do={},vk=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yk=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wk=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vk(e,t,r);return yk(e,t),e};Object.defineProperty(Do,"__esModule",{value:!0});Do.useWeb3React=Do.Web3ReactProvider=void 0;const ou=wk(L),Ek=Cn,j1=(0,ou.createContext)(void 0);function xk({children:t,connectors:e,connectorOverride:r,network:n,lookupENS:i=!0}){const o=(0,ou.useRef)(e);if(e.length!=o.current.length||e.some((X,G)=>{const J=o.current[G];return X[0]!==J[0]}))throw new Error("The connectors prop passed to Web3ReactProvider must be referentially static. If connectors is changing, try providing a key prop to Web3ReactProvider that changes every time connectors changes.");const s=(0,Ek.getPriorityConnector)(...e),{usePriorityConnector:l,useSelectedChainId:a,useSelectedAccounts:u,useSelectedIsActivating:c,useSelectedAccount:d,useSelectedIsActive:m,useSelectedProvider:v,useSelectedENSNames:p,useSelectedENSName:x}=s,k=l(),E=r??k,w=a(E),_=u(E),O=c(E),B=d(E),j=m(E),$=v(E,n),H=p(E,i?$:void 0),ie=x(E,i?$:void 0);return ou.default.createElement(j1.Provider,{value:{connector:E,chainId:w,accounts:_,isActivating:O,account:B,isActive:j,provider:$,ENSNames:H,ENSName:ie,hooks:s}},t)}Do.Web3ReactProvider=xk;function Ak(){const t=(0,ou.useContext)(j1);if(!t)throw Error("useWeb3React can only be used within the Web3ReactProvider component");return t}Do.useWeb3React=Ak;(function(t){var e=Fe&&Fe.__createBinding||(Object.create?function(n,i,o,s){s===void 0&&(s=o);var l=Object.getOwnPropertyDescriptor(i,o);(!l||("get"in l?!i.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(n,s,l)}:function(n,i,o,s){s===void 0&&(s=o),n[s]=i[o]}),r=Fe&&Fe.__exportStar||function(n,i){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&e(i,n,o)};Object.defineProperty(t,"__esModule",{value:!0}),r(Cn,t),r(Vu,t),r(Do,t)})(qu);const of=[{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"approve",inputs:[{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"apps",inputs:[{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"balanceOf",inputs:[{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"contractURI",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"getApproved",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"getInitializedVersion",inputs:[],outputs:[{name:"",type:"uint64",internalType:"uint64"}],stateMutability:"view"},{type:"function",name:"getPackageId",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"pure"},{type:"function",name:"getPackageInfo",inputs:[{name:"package",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"tuple",internalType:"struct IKinodeAppStore.PackageInfo",components:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"getPackageInfo",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"tuple",internalType:"struct IKinodeAppStore.PackageInfo",components:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[{name:"_knsResolver",type:"address",internalType:"contract KNSRegistryResolver"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"isApprovedForAll",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"operator",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"knsResolver",inputs:[],outputs:[{name:"",type:"address",internalType:"contract KNSRegistryResolver"}],stateMutability:"view"},{type:"function",name:"name",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"ownerOf",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"proxiableUUID",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"registerApp",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setApprovalForAll",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"approved",type:"bool",internalType:"bool"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"symbol",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"tokenURI",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"transferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"unlistPacakge",inputs:[{name:"package",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateContractURI",inputs:[{name:"uri",type:"string",internalType:"string"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateMetadata",inputs:[{name:"package",type:"uint256",internalType:"uint256"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"upgradeToAndCall",inputs:[{name:"newImplementation",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"event",name:"AppMetadataUpdated",inputs:[{name:"package",type:"uint256",indexed:!0,internalType:"uint256"},{name:"metadataUrl",type:"string",indexed:!1,internalType:"string"},{name:"metadataHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"AppRegistered",inputs:[{name:"package",type:"uint256",indexed:!0,internalType:"uint256"},{name:"packageName",type:"string",indexed:!1,internalType:"string"},{name:"publisherName",type:"bytes",indexed:!1,internalType:"bytes"},{name:"metadataUrl",type:"string",indexed:!1,internalType:"string"},{name:"metadataHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"Approval",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"ApprovalForAll",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"operator",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint64",indexed:!1,internalType:"uint64"}],anonymous:!1},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Transfer",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"AddressEmptyCode",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{name:"implementation",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ERC721IncorrectOwner",inputs:[{name:"sender",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InsufficientApproval",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC721InvalidApprover",inputs:[{name:"approver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOperator",inputs:[{name:"operator",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidReceiver",inputs:[{name:"receiver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidSender",inputs:[{name:"sender",type:"address",internalType:"address"}]},{type:"error",name:"ERC721NonexistentToken",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"FailedInnerCall",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"OwnableInvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{name:"account",type:"address",internalType:"address"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{name:"slot",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"Unauthorized",inputs:[]}];class wd{static createInterface(){return new ad(of)}static connect(e,r){return new g3(e,of,r)}}zh(wd,"abi",of);var U1={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ym=qr.createContext&&qr.createContext(U1),bk=["attr","size","title"];function _k(t,e){if(t==null)return{};var r=Sk(t,e),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Sk(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,o;for(o=0;o=0)&&(r[i]=t[i]);return r}function su(){return su=Object.assign?Object.assign.bind():function(t){for(var e=1;eqr.createElement(e.tag,lu({key:r},e.attr),F1(e.child)))}function zn(t){return e=>qr.createElement(Ck,su({attr:lu({},t.attr)},e),F1(t.child))}function Ck(t){var e=r=>{var{attr:n,size:i,title:o}=t,s=_k(t,bk),l=i||r.size||"1em",a;return r.className&&(a=r.className),t.className&&(a=(a?a+" ":"")+t.className),qr.createElement("svg",su({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,n,s,{className:a,style:lu(lu({color:t.color||r.color},r.style),t.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),o&&qr.createElement("title",null,o),t.children)};return ym!==void 0?qr.createElement(ym.Consumer,null,r=>e(r)):e(U1)}function Mk(t){return zn({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"},child:[]}]})(t)}function Ik(t){return zn({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"},child:[]}]})(t)}function Rk(t){return zn({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"},child:[]}]})(t)}function Tk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(t)}function Ok(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"},child:[]}]})(t)}function Lk(t){return zn({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"},child:[]}]})(t)}function Bk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"},child:[]}]})(t)}function z1(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M296 384h-80c-13.3 0-24-10.7-24-24V192h-87.7c-17.8 0-26.7-21.5-14.1-34.1L242.3 5.7c7.5-7.5 19.8-7.5 27.3 0l152.2 152.2c12.6 12.6 3.7 34.1-14.1 34.1H320v168c0 13.3-10.7 24-24 24zm216-8v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h136v8c0 30.9 25.1 56 56 56h80c30.9 0 56-25.1 56-56v-8h136c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(t)}function Dk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm101.8-262.2L295.6 256l62.2 62.2c4.7 4.7 4.7 12.3 0 17l-22.6 22.6c-4.7 4.7-12.3 4.7-17 0L256 295.6l-62.2 62.2c-4.7 4.7-12.3 4.7-17 0l-22.6-22.6c-4.7-4.7-4.7-12.3 0-17l62.2-62.2-62.2-62.2c-4.7-4.7-4.7-12.3 0-17l22.6-22.6c4.7-4.7 12.3-4.7 17 0l62.2 62.2 62.2-62.2c4.7-4.7 12.3-4.7 17 0l22.6 22.6c4.7 4.7 4.7 12.3 0 17z"},child:[]}]})(t)}var jk={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Em=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??(typeof c!="object"||c===null)?c:Object.assign({},e,c),r.forEach(m=>m(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(jk?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},Uk=t=>t?Em(t):Em;var $1={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{useDebugValue:Fk}=qr,{useSyncExternalStoreWithSelector:zk}=Gu;let xm=!1;function $k(t,e=t.getState,r){($1?"production":void 0)!=="production"&&r&&!xm&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),xm=!0);const n=zk(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return Fk(n),n}const Am=t=>{($1?"production":void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof t=="function"?Uk(t):t,r=(n,i)=>$k(e,n,i);return Object.assign(r,e),r},Hk=t=>t?Am(t):Am;var qk={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function H1(t,e){let r;try{r=t()}catch{return}return{getItem:i=>{var o;const s=a=>a===null?null:JSON.parse(a,e==null?void 0:e.reviver),l=(o=r.getItem(i))!=null?o:null;return l instanceof Promise?l.then(s):s(l)},setItem:(i,o)=>r.setItem(i,JSON.stringify(o,e==null?void 0:e.replacer)),removeItem:i=>r.removeItem(i)}}const sl=t=>e=>{try{const r=t(e);return r instanceof Promise?r:{then(n){return sl(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return sl(n)(r)}}}},Wk=(t,e)=>(r,n,i)=>{let o={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:k=>k,version:0,merge:(k,E)=>({...E,...k}),...e},s=!1;const l=new Set,a=new Set;let u;try{u=o.getStorage()}catch{}if(!u)return t((...k)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...k)},n,i);const c=sl(o.serialize),d=()=>{const k=o.partialize({...n()});let E;const w=c({state:k,version:o.version}).then(_=>u.setItem(o.name,_)).catch(_=>{E=_});if(E)throw E;return w},m=i.setState;i.setState=(k,E)=>{m(k,E),d()};const v=t((...k)=>{r(...k),d()},n,i);let p;const x=()=>{var k;if(!u)return;s=!1,l.forEach(w=>w(n()));const E=((k=o.onRehydrateStorage)==null?void 0:k.call(o,n()))||void 0;return sl(u.getItem.bind(u))(o.name).then(w=>{if(w)return o.deserialize(w)}).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==o.version){if(o.migrate)return o.migrate(w.state,w.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return w.state}).then(w=>{var _;return p=o.merge(w,(_=n())!=null?_:v),r(p,!0),d()}).then(()=>{E==null||E(p,void 0),s=!0,a.forEach(w=>w(p))}).catch(w=>{E==null||E(void 0,w)})};return i.persist={setOptions:k=>{o={...o,...k},k.getStorage&&(u=k.getStorage())},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>x(),hasHydrated:()=>s,onHydrate:k=>(l.add(k),()=>{l.delete(k)}),onFinishHydration:k=>(a.add(k),()=>{a.delete(k)})},x(),p||v},Gk=(t,e)=>(r,n,i)=>{let o={storage:H1(()=>localStorage),partialize:x=>x,version:0,merge:(x,k)=>({...k,...x}),...e},s=!1;const l=new Set,a=new Set;let u=o.storage;if(!u)return t((...x)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...x)},n,i);const c=()=>{const x=o.partialize({...n()});return u.setItem(o.name,{state:x,version:o.version})},d=i.setState;i.setState=(x,k)=>{d(x,k),c()};const m=t((...x)=>{r(...x),c()},n,i);let v;const p=()=>{var x,k;if(!u)return;s=!1,l.forEach(w=>{var _;return w((_=n())!=null?_:m)});const E=((k=o.onRehydrateStorage)==null?void 0:k.call(o,(x=n())!=null?x:m))||void 0;return sl(u.getItem.bind(u))(o.name).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==o.version){if(o.migrate)return o.migrate(w.state,w.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return w.state}).then(w=>{var _;return v=o.merge(w,(_=n())!=null?_:m),r(v,!0),c()}).then(()=>{E==null||E(v,void 0),v=n(),s=!0,a.forEach(w=>w(v))}).catch(w=>{E==null||E(void 0,w)})};return i.persist={setOptions:x=>{o={...o,...x},x.storage&&(u=x.storage)},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>p(),hasHydrated:()=>s,onHydrate:x=>(l.add(x),()=>{l.delete(x)}),onFinishHydration:x=>(a.add(x),()=>{a.delete(x)})},o.skipHydration||p(),v||m},Vk=(t,e)=>"getStorage"in e||"serialize"in e||"deserialize"in e?((qk?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),Wk(t,e)):Gk(t,e),Kk=Vk;var Dr=(t=>(t[t.OK=200]="OK",t[t.CREATED=201]="CREATED",t[t.ACCEPTED=202]="ACCEPTED",t[t.NO_CONTENT=204]="NO_CONTENT",t[t.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",t[t.FOUND=302]="FOUND",t[t.SEE_OTHER=303]="SEE_OTHER",t[t.NOT_MODIFIED=304]="NOT_MODIFIED",t[t.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",t[t.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",t[t.BAD_REQUEST=400]="BAD_REQUEST",t[t.UNAUTHORIZED=401]="UNAUTHORIZED",t[t.FORBIDDEN=403]="FORBIDDEN",t[t.NOT_FOUND=404]="NOT_FOUND",t[t.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",t[t.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",t[t.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",t[t.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",t[t.BAD_GATEWAY=502]="BAD_GATEWAY",t[t.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",t))(Dr||{});const xe=t=>`${t.package}:${t.publisher}`,cs=t=>{var e;return((e=t.metadata)==null?void 0:e.name)||xe(t)},sf=t=>{var e,r;return t.publisher==="sys"?"system":(e=t.state)!=null&&e.our_version&&!((r=t.state)!=null&&r.capsApproved)?"downloaded":t.metadata?"installed":"local"},or="/main:app_store:sys",Xl=(t,e)=>t.package===e.package&&t.publisher===e.publisher,Qo=Hk()(Kk((t,e)=>({myApps:{downloaded:[],installed:[],local:[],system:[]},listedApps:[],searchResults:[],query:"",getMyApps:async()=>{const i=(await(await fetch(`${or}/apps`)).json()).reduce((o,s)=>{const l=sf(s);return o[l].push(s),o},{downloaded:[],installed:[],local:[],system:[]});return t(()=>({myApps:i})),i},getListedApps:async()=>{const n=await(await fetch(`${or}/apps/listed`)).json();return t({listedApps:n}),n},getMyApp:async r=>{const i=await(await fetch(`${or}/apps/${xe(r)}`)).json(),o=sf(i),s=e().myApps;s[o]=s[o].map(a=>Xl(a,i)?i:a);const l=[...e().listedApps].map(a=>Xl(a,i)?i:a);return t({myApps:s,listedApps:l}),i},installApp:async r=>{if((await fetch(`${or}/apps/${xe(r)}/caps`,{method:"POST"})).status!==Dr.OK)throw new Error(`Failed to approve caps for app: ${xe(r)}`);if((await fetch(`${or}/apps/${xe(r)}`,{method:"POST"})).status!==Dr.CREATED)throw new Error(`Failed to install app: ${xe(r)}`)},updateApp:async r=>{if((await fetch(`${or}/apps/${xe(r)}`,{method:"PUT"})).status!==Dr.NO_CONTENT)throw new Error(`Failed to update app: ${xe(r)}`)},uninstallApp:async r=>{if(!confirm(`Are you sure you want to remove ${xe(r)}?`))return;if((await fetch(`${or}/apps/${xe(r)}`,{method:"DELETE"})).status!==Dr.NO_CONTENT)throw new Error(`Failed to remove app: ${xe(r)}`);const i={...e().myApps},o=sf(r);i[o]=i[o].filter(l=>!Xl(l,r));const s=e().listedApps.map(l=>Xl(l,r)?{...l,state:void 0,installed:!1}:l);t({myApps:i,listedApps:s})},getListedApp:async r=>{const n=await fetch(`${or}/apps/listed/${r}`);if(n.status!==Dr.OK)throw new Error(`Failed to get app: ${r}`);return await n.json()},downloadApp:async r=>{if((await fetch(`${or}/apps/listed/${xe(r)}`,{method:"POST"})).status!==Dr.CREATED)throw new Error(`Failed to get app: ${xe(r)}`)},getCaps:async r=>{const n=await fetch(`${or}/apps/${xe(r)}/caps`);if(n.status!==Dr.OK)throw new Error(`Failed to get app: ${xe(r)}`);return(await n.json())[0]},approveCaps:async r=>{if((await fetch(`${or}/apps/${xe(r)}/caps`,{method:"POST"})).status!==Dr.OK)throw new Error(`Failed to get app: ${xe(r)}`)},setMirroring:async(r,n)=>{if((await fetch(`${or}/apps/${xe(r)}/mirror`,{method:n?"PUT":"DELETE"})).status!==Dr.OK)throw new Error(`Failed to start mirror: ${xe(r)}`);e().getMyApp(r)},setAutoUpdate:async(r,n)=>{if((await fetch(`${or}/apps/${xe(r)}/auto-update`,{method:n?"PUT":"DELETE"})).status!==Dr.OK)throw new Error(`Failed to change auto update: ${xe(r)}`);e().getMyApp(r)},get:e,set:t}),{name:"app_store",storage:H1(()=>sessionStorage)}));function q1({app:t,size:e="medium",...r}){var i,o,s,l,a;const n=Iu();return I.jsxs("div",{...r,className:`app-header row ${e} ${r.className||""}`,onClick:()=>n(`/app-details/${xe(t)}`),children:[I.jsx("img",{src:((i=t.metadata)==null?void 0:i.image)||"https://png.pngtree.com/png-vector/20190215/ourmid/pngtree-vector-question-mark-icon-png-image_515448.jpg",alt:"app icon"}),I.jsxs("div",{className:"col title",children:[I.jsx("div",{className:"app-name ellipsis",children:((o=t.metadata)==null?void 0:o.name)||xe(t)}),((s=t.metadata)==null?void 0:s.subtitle)&&I.jsx("div",{className:"ellipsis",children:(a=(l=t.metadata)==null?void 0:l.subtitle)==null?void 0:a.slice(0,100)})]})]})}const Qk=({show:t,hide:e,hideClose:r=!1,title:n,...i})=>{const o=s=>{s.stopPropagation()};return t?I.jsx("div",{className:`modal-backdrop ${t?"show":""}`,onClick:e,children:I.jsxs("div",{...i,className:`col modal ${i.className||""}`,onClick:o,children:[!!n&&I.jsx("h3",{className:"modal-title",children:n}),!r&&I.jsx(Lk,{className:"close",onClick:e}),I.jsx("div",{className:"col modal-content",onClick:o,children:i.children})]})}):null};function Ed({msg:t}){return I.jsxs("div",{id:"loading",className:"col center",children:[I.jsx("h3",{children:t}),I.jsxs("div",{id:"loader",children:[" ",I.jsx("div",{})," ",I.jsx("div",{})," ",I.jsx("div",{})," ",I.jsx("div",{})," "]})]})}function W1({app:t,...e}){var $,H,ie,X,G;const{updateApp:r,downloadApp:n,installApp:i,getCaps:o,getMyApp:s}=Qo(),[l,a]=L.useState(!1),[u,c]=L.useState(((H=($=t.metadata)==null?void 0:$.mirrors)==null?void 0:H[0])||""),[d,m]=L.useState([]),[v,p]=L.useState(""),{clean:x,installed:k,downloaded:E,updatable:w}=L.useMemo(()=>{var A,N,b,M,R;const J=((A=t.metadata)==null?void 0:A.versions)&&((b=t.metadata)==null?void 0:b.versions[((N=t.metadata)==null?void 0:N.versions.length)-1]),C=t.installed,f=!!t.state,g=!!((M=t.state)!=null&&M.our_version&&J)&&((R=t.state)==null?void 0:R.our_version)!==J&&t.publisher!==window.our.node;return{clean:!C&&!f&&!g,installed:C,downloaded:f,updatable:g}},[t]),_=L.useCallback(async()=>{k&&!w?window.alert("App is installed"):(E&&o(t).then(J=>{m(J.request_capabilities)}),a(!0))},[t,k,E,w,a,o]),O=L.useCallback(async()=>{try{p(`Downloading ${cs(t)}...`),await n(t);const J=setInterval(()=>{s(t).then(()=>{p(""),a(!1),clearInterval(J)}).catch(console.log)},2e3)}catch(J){console.error(J),window.alert(`Failed to download app from ${u}, please try a different mirror.`),p("")}},[u,t,n,s]),B=L.useCallback(async()=>{try{p(`Installing ${cs(t)}...`),await i(t);const J=setInterval(()=>{s(t).then(C=>{C.installed&&(p(""),a(!1),clearInterval(J))}).catch(console.log)},2e3)}catch(J){console.error(J),window.alert("Failed to install, please try again."),p("")}},[t,i,s]),j=L.useCallback(async()=>{try{p(`Updating ${cs(t)}...`),await r(t);const J=setInterval(()=>{s(t).then(C=>{C.installed&&(p(""),a(!1),clearInterval(J))}).catch(console.log)},2e3)}catch(J){console.error(J),window.alert("Failed to update, please try again."),p("")}},[t,r,s]);return I.jsxs(I.Fragment,{children:[I.jsx("button",{...e,type:"button",className:`unstyled action-btn ${e.className||""}`,onClick:_,children:k&&w?"Update":k?"Installed":E?"Install":"Download"}),I.jsx(Qk,{show:l,hide:()=>a(!1),children:v?I.jsx(Ed,{msg:v}):x?I.jsxs(I.Fragment,{children:[I.jsxs("h3",{children:["Download ",(ie=t.metadata)==null?void 0:ie.name,"?"]}),I.jsx("h4",{style:{margin:0},children:"Select Mirror"}),I.jsx("select",{style:{margin:"1em 0"},value:u,onChange:J=>c(J.target.value),children:(G=(X=t.metadata)==null?void 0:X.mirrors)==null?void 0:G.map(J=>I.jsx("option",{value:J,children:J},J))}),I.jsx("button",{type:"button",onClick:O,children:"Download"})]}):E?I.jsxs(I.Fragment,{children:[I.jsx("h3",{children:"Approve App Permissions"}),I.jsxs("h4",{style:{margin:0},children:[cs(t)," needs the following permissions:"]}),I.jsx("ul",{className:"col",style:{margin:"1em 0",alignItems:"flex-start"},children:d.map(J=>I.jsx("li",{children:J},J))}),I.jsx("button",{type:"button",onClick:B,children:"Approve & Install"})]}):I.jsxs(I.Fragment,{children:[I.jsx("h3",{children:"Approve App Permissions"}),I.jsxs("h4",{style:{margin:0},children:[cs(t)," needs the following permissions:"]}),I.jsx("br",{}),I.jsx("ul",{className:"col",style:{margin:"1em 0",alignItems:"flex-start"},children:d.map(J=>I.jsx("li",{children:J},J))}),I.jsx("button",{type:"button",onClick:j,children:"Approve & Update"})]})})]})}const G1=t=>!!t&&t[0]==="o",bm=Qs.unstable_batchedUpdates||(t=>t()),Vi=(t,e,r=1e-4)=>Math.abs(t-e)t===!0||!!(t&&t[e]),hr=(t,e)=>typeof t=="function"?t(e):t,V1="_szhsinMenu",Jk=t=>t[V1],Yk=(t,e)=>Object.defineProperty(e,V1,{value:t}),Ku=(t,e)=>(e&&Object.keys(e).forEach(r=>{const n=t[r],i=e[r];typeof i=="function"&&n?t[r]=(...o)=>{i(...o),n(...o)}:t[r]=i}),t),Xk=t=>{if(typeof t!="string")return{top:0,right:0,bottom:0,left:0};const e=t.trim().split(/\s+/,4).map(parseFloat),r=isNaN(e[0])?0:e[0],n=isNaN(e[1])?r:e[1];return{top:r,right:n,bottom:isNaN(e[2])?r:e[2],left:isNaN(e[3])?n:e[3]}},lf=t=>{for(;t;){if(t=t.parentNode,!t||t===document.body||!t.parentNode)return;const{overflow:e,overflowX:r,overflowY:n}=getComputedStyle(t);if(/auto|scroll|overlay|hidden/.test(e+n+r))return t}};function K1(t,e){return{"aria-disabled":t||void 0,tabIndex:e?0:-1}}function _m(t,e){for(let r=0;rL.useMemo(()=>{const i=e?`${t}__${e}`:t;let o=i;r&&Object.keys(r).forEach(l=>{const a=r[l];a&&(o+=` ${i}--${a===!0?l:`${l}-${a}`}`)});let s=typeof n=="function"?n(r):n;return typeof s=="string"&&(s=s.trim(),s&&(o+=` ${s}`)),o},[t,e,r,n]),Zk="szh-menu-container",Aa="szh-menu",e4="szh-menu-button",t4="arrow",r4="item",Q1=L.createContext(),J1=L.createContext({}),Sm=L.createContext({}),Y1=L.createContext({}),n4=L.createContext({}),jh=L.createContext({}),$r=Object.freeze({ENTER:"Enter",ESC:"Escape",SPACE:" ",HOME:"Home",END:"End",LEFT:"ArrowLeft",RIGHT:"ArrowRight",UP:"ArrowUp",DOWN:"ArrowDown"}),xt=Object.freeze({RESET:0,SET:1,UNSET:2,INCREASE:3,DECREASE:4,FIRST:5,LAST:6,SET_INDEX:7}),ul=Object.freeze({CLICK:"click",CANCEL:"cancel",BLUR:"blur",SCROLL:"scroll"}),Ms=Object.freeze({FIRST:"first",LAST:"last"}),i4=Object.freeze({entering:"opening",entered:"open",exiting:"closing",exited:"closed"}),af="absolute",o4="presentation",X1="menuitem",km={"aria-hidden":!0,role:X1},s4=Yk("MenuButton",L.forwardRef(function({className:e,isOpen:r,disabled:n,children:i,...o},s){const l=L.useMemo(()=>({open:r}),[r]);return I.jsx("button",{"aria-haspopup":!0,"aria-expanded":r,"aria-disabled":n||void 0,type:"button",disabled:n,...o,ref:s,className:al({block:e4,modifiers:l,className:e}),children:i})})),l4=({className:t,containerRef:e,containerProps:r,children:n,isOpen:i,theming:o,transition:s,onClose:l})=>{const a=ll(s,"item"),u=({key:d})=>{switch(d){case $r.ESC:hr(l,{key:d,reason:ul.CANCEL});break}},c=d=>{i&&!d.currentTarget.contains(d.relatedTarget)&&hr(l,{reason:ul.BLUR})};return I.jsx("div",{...Ku({onKeyDown:u,onBlur:c},r),className:al({block:Zk,modifiers:L.useMemo(()=>({theme:o,itemTransition:a}),[o,a]),className:t}),style:{position:"absolute",...r==null?void 0:r.style},ref:e,children:n})},a4=()=>{let t,e=0;return{toggle:r=>{r?e++:e--,e=Math.max(e,0)},on:(r,n,i)=>{e?t||(t=setTimeout(()=>{t=0,n()},r)):i==null||i()},off:()=>{t&&(clearTimeout(t),t=0)}}},u4=(t,e)=>{const[r,n]=L.useState(),o=L.useRef({items:[],hoverIndex:-1,sorted:!1}).current,s=L.useCallback((a,u)=>{const{items:c}=o;if(!a)o.items=[];else if(u)c.push(a);else{const d=c.indexOf(a);d>-1&&(c.splice(d,1),a.contains(document.activeElement)&&(e.current.focus(),n()))}o.hoverIndex=-1,o.sorted=!1},[o,e]),l=L.useCallback((a,u,c)=>{const{items:d,hoverIndex:m}=o,v=()=>{if(o.sorted)return;const k=t.current.querySelectorAll(".szh-menu__item");d.sort((E,w)=>_m(k,E)-_m(k,w)),o.sorted=!0};let p=-1,x;switch(a){case xt.RESET:break;case xt.SET:x=u;break;case xt.UNSET:x=k=>k===u?void 0:k;break;case xt.FIRST:v(),p=0,x=d[p];break;case xt.LAST:v(),p=d.length-1,x=d[p];break;case xt.SET_INDEX:v(),p=c,x=d[p];break;case xt.INCREASE:v(),p=m,p<0&&(p=d.indexOf(u)),p++,p>=d.length&&(p=0),x=d[p];break;case xt.DECREASE:v(),p=m,p<0&&(p=d.indexOf(u)),p--,p<0&&(p=d.length-1),x=d[p];break}x||(p=-1),n(x),o.hoverIndex=p},[t,o]);return{hoverItem:r,dispatch:l,updateItems:s}},c4=(t,e,r,n)=>{const i=e.current.getBoundingClientRect(),o=t.current.getBoundingClientRect(),s=r===window?{left:0,top:0,right:document.documentElement.clientWidth,bottom:window.innerHeight}:r.getBoundingClientRect(),l=Xk(n),a=p=>p+o.left-s.left-l.left,u=p=>p+o.left+i.width-s.right+l.right,c=p=>p+o.top-s.top-l.top,d=p=>p+o.top+i.height-s.bottom+l.bottom;return{menuRect:i,containerRect:o,getLeftOverflow:a,getRightOverflow:u,getTopOverflow:c,getBottomOverflow:d,confineHorizontally:p=>{let x=a(p);if(x<0)p-=x;else{const k=u(p);k>0&&(p-=k,x=a(p),x<0&&(p-=x))}return p},confineVertically:p=>{let x=c(p);if(x<0)p-=x;else{const k=d(p);k>0&&(p-=k,x=c(p),x<0&&(p-=x))}return p}}},f4=({arrowRef:t,menuY:e,anchorRect:r,containerRect:n,menuRect:i})=>{let o=r.top-n.top-e+r.height/2;const s=t.current.offsetHeight*1.25;return o=Math.max(s,o),o=Math.min(o,i.height-s),o},d4=({anchorRect:t,containerRect:e,menuRect:r,placeLeftorRightY:n,placeLeftX:i,placeRightX:o,getLeftOverflow:s,getRightOverflow:l,confineHorizontally:a,confineVertically:u,arrowRef:c,arrow:d,direction:m,position:v})=>{let p=m,x=n;v!=="initial"&&(x=u(x),v==="anchor"&&(x=Math.min(x,t.bottom-e.top),x=Math.max(x,t.top-e.top-r.height)));let k,E,w;return p==="left"?(k=i,v!=="initial"&&(E=s(k),E<0&&(w=l(o),(w<=0||-E>w)&&(k=o,p="right")))):(k=o,v!=="initial"&&(w=l(k),w>0&&(E=s(i),(E>=0||-E{let o=r.left-n.left-e+r.width/2;const s=t.current.offsetWidth*1.25;return o=Math.max(s,o),o=Math.min(o,i.width-s),o},p4=({anchorRect:t,containerRect:e,menuRect:r,placeToporBottomX:n,placeTopY:i,placeBottomY:o,getTopOverflow:s,getBottomOverflow:l,confineHorizontally:a,confineVertically:u,arrowRef:c,arrow:d,direction:m,position:v})=>{let p=m==="top"?"top":"bottom",x=n;v!=="initial"&&(x=a(x),v==="anchor"&&(x=Math.min(x,t.right-e.left),x=Math.max(x,t.left-e.left-r.width)));let k,E,w;return p==="top"?(k=i,v!=="initial"&&(E=s(k),E<0&&(w=l(o),(w<=0||-E>w)&&(k=o,p="bottom")))):(k=o,v!=="initial"&&(w=l(k),w>0&&(E=s(i),(E>=0||-E{const{menuRect:u,containerRect:c}=a,d=r==="left"||r==="right";let m=d?n:i,v=d?i:n;if(t){const B=l.current;d?m+=B.offsetWidth:v+=B.offsetHeight}const p=s.left-c.left-u.width-m,x=s.right-c.left+m,k=s.top-c.top-u.height-v,E=s.bottom-c.top+v;let w,_;e==="end"?(w=s.right-c.left-u.width,_=s.bottom-c.top-u.height):e==="center"?(w=s.left-c.left-(u.width-s.width)/2,_=s.top-c.top-(u.height-s.height)/2):(w=s.left-c.left,_=s.top-c.top),w+=m,_+=v;const O={...a,anchorRect:s,placeLeftX:p,placeRightX:x,placeLeftorRightY:_,placeTopY:k,placeBottomY:E,placeToporBottomX:w,arrowRef:l,arrow:t,direction:r,position:o};switch(r){case"left":case"right":return d4(O);case"top":case"bottom":default:return p4(O)}},ba=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?L.useLayoutEffect:L.useEffect;function Nm(t,e){typeof t=="function"?t(e):t.current=e}const Uh=(t,e)=>L.useMemo(()=>t?e?r=>{Nm(t,r),Nm(e,r)}:t:e,[t,e]),Pm=-9999,g4=({ariaLabel:t,menuClassName:e,menuStyle:r,arrow:n,arrowProps:i={},anchorPoint:o,anchorRef:s,containerRef:l,containerProps:a,focusProps:u,externalRef:c,parentScrollingRef:d,align:m="start",direction:v="bottom",position:p="auto",overflow:x="visible",setDownOverflow:k,repositionFlag:E,captureFocus:w=!0,state:_,endTransition:O,isDisabled:B,menuItemFocus:j,gap:$=0,shift:H=0,children:ie,onClose:X,...G})=>{const[J,C]=L.useState({x:Pm,y:Pm}),[f,g]=L.useState({}),[A,N]=L.useState(),[b,M]=L.useState(v),[R]=L.useState(a4),[S,h]=L.useReducer(ne=>ne+1,1),{transition:P,boundingBoxRef:te,boundingBoxPadding:y,rootMenuRef:D,rootAnchorRef:U,scrollNodesRef:F,reposition:W,viewScroll:oe,submenuCloseDelay:Y}=L.useContext(jh),{submenuCtx:K,reposSubmenu:Je=E}=L.useContext(Sm),Q=L.useRef(null),le=L.useRef(),Qr=L.useRef(),Te=L.useRef(!1),Ne=L.useRef({width:0,height:0}),Jr=L.useRef(()=>{}),{hoverItem:Pe,dispatch:ce,updateItems:wr}=u4(Q,le),fe=G1(_),Oe=ll(P,"open"),Yr=ll(P,"close"),me=F.current,ze=ne=>{switch(ne.key){case $r.HOME:ce(xt.FIRST);break;case $r.END:ce(xt.LAST);break;case $r.UP:ce(xt.DECREASE,Pe);break;case $r.DOWN:ce(xt.INCREASE,Pe);break;case $r.SPACE:ne.target&&ne.target.className.indexOf(Aa)!==-1&&ne.preventDefault();return;default:return}ne.preventDefault(),ne.stopPropagation()},gn=()=>{_==="closing"&&N(),hr(O)},$e=ne=>{ne.stopPropagation(),R.on(Y,()=>{ce(xt.RESET),le.current.focus()})},He=ne=>{ne.target===ne.currentTarget&&R.off()},Ht=L.useCallback(ne=>{var ot;const ge=s?(ot=s.current)==null?void 0:ot.getBoundingClientRect():o?{left:o.x,right:o.x,top:o.y,bottom:o.y,width:0,height:0}:null;if(!ge)return;me.menu||(me.menu=(te?te.current:lf(D.current))||window);const de=c4(l,Q,me.menu,y);let{arrowX:rt,arrowY:be,x:_e,y:Ct,computedDirection:Me}=m4({arrow:n,align:m,direction:v,gap:$,shift:H,position:p,anchorRect:ge,arrowRef:Qr,positionHelpers:de});const{menuRect:je}=de;let Kt=je.height;if(!ne&&x!=="visible"){const{getTopOverflow:Ve,getBottomOverflow:Ke}=de;let Qt,Ie;const Ue=Ne.current.height,Er=Ke(Ct);if(Er>0||Vi(Er,0)&&Vi(Kt,Ue))Qt=Kt-Er,Ie=Er;else{const ke=Ve(Ct);(ke<0||Vi(ke,0)&&Vi(Kt,Ue))&&(Qt=Kt+ke,Ie=0-ke,Qt>=0&&(Ct-=ke))}Qt>=0?(Kt=Qt,N({height:Qt,overflowAmt:Ie})):N()}n&&g({x:rt,y:be}),C({x:_e,y:Ct}),M(Me),Ne.current={width:je.width,height:Kt}},[n,m,y,v,$,H,p,x,o,s,l,te,D,me]);ba(()=>{fe&&(Ht(),Te.current&&h()),Te.current=fe,Jr.current=Ht},[fe,Ht,Je]),ba(()=>{A&&!k&&(Q.current.scrollTop=0)},[A,k]),ba(()=>wr,[wr]),L.useEffect(()=>{let{menu:ne}=me;if(!fe||!ne)return;if(ne=ne.addEventListener?ne:window,!me.anchors){me.anchors=[];let rt=lf(U&&U.current);for(;rt&&rt!==ne;)me.anchors.push(rt),rt=lf(rt)}let ot=oe;if(me.anchors.length&&ot==="initial"&&(ot="auto"),ot==="initial")return;const ge=()=>{ot==="auto"?bm(()=>Ht(!0)):hr(X,{reason:ul.SCROLL})},de=me.anchors.concat(oe!=="initial"?ne:[]);return de.forEach(rt=>rt.addEventListener("scroll",ge)),()=>de.forEach(rt=>rt.removeEventListener("scroll",ge))},[U,me,fe,X,oe,Ht]);const Le=!!A&&A.overflowAmt>0;L.useEffect(()=>{if(Le||!fe||!d)return;const ne=()=>bm(Ht),ot=d.current;return ot.addEventListener("scroll",ne),()=>ot.removeEventListener("scroll",ne)},[fe,Le,d,Ht]),L.useEffect(()=>{if(typeof ResizeObserver!="function"||W==="initial")return;const ne=new ResizeObserver(([ge])=>{const{borderBoxSize:de,target:rt}=ge;let be,_e;if(de){const{inlineSize:Ct,blockSize:Me}=de[0]||de;be=Ct,_e=Me}else{const Ct=rt.getBoundingClientRect();be=Ct.width,_e=Ct.height}be===0||_e===0||Vi(be,Ne.current.width,1)&&Vi(_e,Ne.current.height,1)||Qs.flushSync(()=>{Jr.current(),h()})}),ot=Q.current;return ne.observe(ot,{box:"border-box"}),()=>ne.unobserve(ot)},[W]),L.useEffect(()=>{if(!fe){ce(xt.RESET),Yr||N();return}const{position:ne,alwaysUpdate:ot}=j||{},ge=()=>{ne===Ms.FIRST?ce(xt.FIRST):ne===Ms.LAST?ce(xt.LAST):ne>=-1&&ce(xt.SET_INDEX,void 0,ne)};if(ot)ge();else if(w){const de=setTimeout(()=>{const rt=Q.current;rt&&!rt.contains(document.activeElement)&&(le.current.focus(),ge())},Oe?170:100);return()=>clearTimeout(de)}},[fe,Oe,Yr,w,j,ce]);const qe=L.useMemo(()=>({isParentOpen:fe,submenuCtx:R,dispatch:ce,updateItems:wr}),[fe,R,ce,wr]);let Rr,Ce;A&&(k?Ce=A.overflowAmt:Rr=A.height);const We=L.useMemo(()=>({reposSubmenu:S,submenuCtx:R,overflow:x,overflowAmt:Ce,parentMenuRef:Q,parentDir:b}),[S,R,x,Ce,b]),vn=Rr>=0?{maxHeight:Rr,overflow:x}:void 0,Be=L.useMemo(()=>({state:_,dir:b}),[_,b]),Ge=L.useMemo(()=>({dir:b}),[b]),yn=al({block:Aa,element:t4,modifiers:Ge,className:i.className}),De=I.jsxs("ul",{role:"menu","aria-label":t,...K1(B),...Ku({onPointerEnter:K==null?void 0:K.off,onPointerMove:$e,onPointerLeave:He,onKeyDown:ze,onAnimationEnd:gn},G),ref:Uh(c,Q),className:al({block:Aa,modifiers:Be,className:e}),style:{...r,...vn,margin:0,display:_==="closed"?"none":void 0,position:af,left:J.x,top:J.y},children:[I.jsx("li",{tabIndex:-1,style:{position:af,left:0,top:0,display:"block",outline:"none"},ref:le,...km,...u}),n&&I.jsx("li",{...km,...i,className:yn,style:{display:"block",position:af,left:f.x,top:f.y,...i.style},ref:Qr}),I.jsx(Sm.Provider,{value:We,children:I.jsx(J1.Provider,{value:qe,children:I.jsx(Q1.Provider,{value:Pe,children:hr(ie,Be)})})})]});return a?I.jsx(l4,{...a,isOpen:fe,children:De}):De},v4=L.forwardRef(function({"aria-label":e,className:r,containerProps:n,initialMounted:i,unmountOnClose:o,transition:s,transitionTimeout:l,boundingBoxRef:a,boundingBoxPadding:u,reposition:c="auto",submenuOpenDelay:d=300,submenuCloseDelay:m=150,viewScroll:v="initial",portal:p,theming:x,onItemClick:k,...E},w){const _=L.useRef(null),O=L.useRef({}),{anchorRef:B,state:j,onClose:$}=E,H=L.useMemo(()=>({initialMounted:i,unmountOnClose:o,transition:s,transitionTimeout:l,boundingBoxRef:a,boundingBoxPadding:u,rootMenuRef:_,rootAnchorRef:B,scrollNodesRef:O,reposition:c,viewScroll:v,submenuOpenDelay:d,submenuCloseDelay:m}),[i,o,s,l,B,a,u,c,v,d,m]),ie=L.useMemo(()=>({handleClick(G,J){G.stopPropagation||hr(k,G);let C=G.keepOpen;C===void 0&&(C=J&&G.key===$r.SPACE),C||hr($,{value:G.value,key:G.key,reason:ul.CLICK})},handleClose(G){hr($,{key:G,reason:ul.CLICK})}}),[k,$]);if(!j)return null;const X=I.jsx(jh.Provider,{value:H,children:I.jsx(Y1.Provider,{value:ie,children:I.jsx(g4,{...E,ariaLabel:e||"Menu",externalRef:w,containerRef:_,containerProps:{className:r,containerRef:_,containerProps:n,theming:x,transition:s,onClose:$}})})});return p===!0&&typeof document<"u"?Qs.createPortal(X,document.body):p?p.target?Qs.createPortal(X,p.target):p.stablePosition?null:X:X}),xd=0,Ad=1,au=2,uu=3,cu=4,y4=5,Z1=6,w4=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],ew=t=>({_s:t,status:w4[t],isEnter:tcu}),bd=t=>t?Z1:y4,E4=(t,e)=>{switch(t){case Ad:case xd:return au;case cu:case uu:return bd(e)}},x4=t=>typeof t=="object"?[t.enter,t.exit]:[t,t],A4=(t,e)=>setTimeout(()=>{isNaN(document.body.offsetTop)||t(e+1)},0),Cm=(t,e,r,n,i)=>{clearTimeout(n.current);const o=ew(t);e(o),r.current=o,i&&i({current:o})},b4=({enter:t=!0,exit:e=!0,preEnter:r,preExit:n,timeout:i,initialEntered:o,mountOnEnter:s,unmountOnExit:l,onStateChange:a}={})=>{const[u,c]=L.useState(()=>ew(o?au:bd(s))),d=L.useRef(u),m=L.useRef(),[v,p]=x4(i),x=L.useCallback(()=>{const E=E4(d.current._s,l);E&&Cm(E,c,d,m,a)},[a,l]),k=L.useCallback(E=>{const w=O=>{switch(Cm(O,c,d,m,a),O){case Ad:v>=0&&(m.current=setTimeout(x,v));break;case cu:p>=0&&(m.current=setTimeout(x,p));break;case xd:case uu:m.current=A4(w,O);break}},_=d.current.isEnter;typeof E!="boolean"&&(E=!_),E?!_&&w(t?r?xd:Ad:au):_&&w(e?n?uu:cu:bd(l))},[x,a,t,e,r,n,v,p,l]);return L.useEffect(()=>()=>clearTimeout(m.current),[]),[u,k,x]},_4=({initialOpen:t,initialMounted:e,unmountOnClose:r,transition:n,transitionTimeout:i=500}={})=>{const[{status:o},s,l]=b4({initialEntered:t,mountOnEnter:!e,unmountOnExit:r,timeout:i,enter:ll(n,"open"),exit:ll(n,"close")});return[{state:i4[o],endTransition:l},s]},S4=t=>{const[e,r]=_4(t),[n,i]=L.useState(),o=(s,l)=>{i({position:s,alwaysUpdate:l}),r(!0)};return[{menuItemFocus:n,...e},r,o]},k4=(t,e)=>{const[r]=L.useState({});return{onMouseDown:()=>{r.v=t&&t!=="closed"},onClick:n=>r.v?r.v=!1:e(!0,n)}},N4=(t,e)=>{const r=L.useRef(e);L.useEffect(()=>{r.current!==e&&hr(t,{open:e}),r.current=e},[t,e])},P4=L.forwardRef(function({"aria-label":e,captureFocus:r,initialOpen:n,menuButton:i,instanceRef:o,onMenuChange:s,...l},a){const[u,c,d]=S4(l),{state:m}=u,v=G1(m),p=L.useRef(null),x=k4(m,(B,j)=>d(j.detail?void 0:Ms.FIRST)),k=L.useCallback(B=>{c(!1),B.key&&p.current.focus()},[c]),E=B=>{switch(B.key){case $r.UP:d(Ms.LAST);break;case $r.DOWN:d(Ms.FIRST);break;default:return}B.preventDefault()},w=hr(i,{open:v});if(!w||!w.type)throw new Error("Menu requires a menuButton prop.");const _={ref:Uh(w.ref,p),...Ku({onKeyDown:E,...x},w.props)};Jk(w.type)==="MenuButton"&&(_.isOpen=v);const O=L.cloneElement(w,_);return N4(s,v),L.useImperativeHandle(o,()=>({openMenu:d,closeMenu:()=>c(!1)})),I.jsxs(L.Fragment,{children:[O,I.jsx(v4,{...l,...u,"aria-label":e||(typeof w.props.children=="string"?w.props.children:"Menu"),anchorRef:p,ref:a,onClose:k})]})}),C4=(t,e)=>{const r=L.memo(e),n=L.forwardRef((i,o)=>{const s=L.useRef(null);return I.jsx(r,{...i,itemRef:s,externalRef:o,isHovering:L.useContext(Q1)===s.current})});return n.displayName=`WithHovering(${t})`,n},M4=(t,e,r)=>{ba(()=>{if(t)return;const n=e.current;return r(n,!0),()=>{r(n)}},[t,e,r])},I4=(t,e,r,n)=>{const{submenuCloseDelay:i}=L.useContext(jh),{isParentOpen:o,submenuCtx:s,dispatch:l,updateItems:a}=L.useContext(J1),u=()=>{!r&&!n&&l(xt.SET,t.current)},c=()=>{!n&&l(xt.UNSET,t.current)},d=p=>{r&&!p.currentTarget.contains(p.relatedTarget)&&c()},m=p=>{n||(p.stopPropagation(),s.on(i,u,u))},v=(p,x)=>{s.off(),!x&&c()};return M4(n,t,a),L.useEffect(()=>{r&&o&&e.current&&e.current.focus()},[e,r,o]),{setHover:u,onBlur:d,onPointerMove:m,onPointerLeave:v}},Ki=C4("MenuItem",function({className:e,value:r,href:n,type:i,checked:o,disabled:s,children:l,onClick:a,isHovering:u,itemRef:c,externalRef:d,...m}){const v=!!s,{setHover:p,...x}=I4(c,c,u,v),k=L.useContext(Y1),E=L.useContext(n4),w=i==="radio",_=i==="checkbox",O=!!n&&!v&&!w&&!_,B=w?E.value===r:_?!!o:!1,j=G=>{if(v){G.stopPropagation(),G.preventDefault();return}const J={value:r,syntheticEvent:G};G.key!==void 0&&(J.key=G.key),_&&(J.checked=!B),w&&(J.name=E.name),hr(a,J),w&&hr(E.onRadioChange,J),k.handleClick(J,_||w)},$=G=>{if(u)switch(G.key){case $r.ENTER:G.preventDefault();case $r.SPACE:O?c.current.click():j(G)}},H=L.useMemo(()=>({type:i,disabled:v,hover:u,checked:B,anchor:O}),[i,v,u,B,O]),ie=Ku({...x,onPointerDown:p,onKeyDown:$,onClick:j},m),X={role:w?"menuitemradio":_?"menuitemcheckbox":X1,"aria-checked":w||_?B:void 0,...K1(v,u),...ie,ref:Uh(d,c),className:al({block:Aa,element:r4,modifiers:H,className:e}),children:L.useMemo(()=>hr(l,H),[l,H])};return O?I.jsx("li",{role:o4,children:I.jsx("a",{href:n,...X})}):I.jsx("li",{...X})});function Mm({...t}){return I.jsx(P4,{...t,className:"dropdown "+t.className,menuButton:I.jsx(s4,{className:"unstyled",children:I.jsx(Ok,{style:{marginBottom:"-0.125em"}})}),children:t.children})}function R4({app:t}){var s,l,a,u,c;const{uninstallApp:e,setMirroring:r,setAutoUpdate:n}=Qo(),i=Iu();return!t.state?t.metadata?I.jsxs(Mm,{children:[((s=t.metadata)==null?void 0:s.description)&&I.jsx(Ki,{className:"action-entry",onClick:()=>i(`/app-details/${xe(t)}`),children:"View Details"}),((l=t.metadata)==null?void 0:l.website)&&I.jsx(Ki,{children:I.jsx("a",{style:{color:"inherit",whiteSpace:"nowrap",cursor:"pointer",marginTop:"0.25em"},target:"_blank",href:(a=t.metadata)==null?void 0:a.website,children:"View Site"})})]}):I.jsx("div",{style:{width:24}}):I.jsxs(Mm,{children:[I.jsx(Ki,{className:"action-entry",onClick:()=>i(`/app-details/${xe(t)}`),children:"View Details"}),t.installed&&I.jsxs(I.Fragment,{children:[I.jsx(Ki,{className:"action-entry",onClick:()=>e(t),children:"Uninstall"}),I.jsxs(Ki,{className:"action-entry",onClick:()=>{var d;return r(t,!((d=t.state)!=null&&d.mirroring))},children:[(u=t.state)!=null&&u.mirroring?"Stop":"Start"," Mirroring"]}),I.jsxs(Ki,{className:"action-entry",onClick:()=>{var d;return n(t,!((d=t.state)!=null&&d.auto_update))},children:[(c=t.state)!=null&&c.auto_update?"Disable":"Enable"," Auto Update"]})]})]})}function ys({app:t,...e}){var r;return L.createElement("div",{...e,key:xe(t),className:"app-entry row between"},I.jsx(q1,{app:t,size:"small"}),I.jsxs("div",{className:"app-actions row",children:[!((r=t.state)!=null&&r.capsApproved)&&I.jsx(W1,{app:t,style:{marginRight:"1em"}}),I.jsx(R4,{app:t})]}))}const _d="/my-apps";function Qu({value:t="",onChange:e=()=>null,hideSearch:r=!1}){const n=Iu(),i=xh(),o=qr.useRef(null),s=i.key!=="default",l=i.pathname===_d;return I.jsxs("div",{className:"search-header row between",children:[i.pathname!=="/"?I.jsx("button",{className:"back-btn col center",onClick:()=>n(s?-1:"/"),children:I.jsx(Mk,{})}):I.jsx("button",{className:"back-btn col center",onClick:()=>n("/publish"),children:I.jsx(z1,{})}),!r&&I.jsxs("div",{className:"searchbar row",children:[I.jsx(Bk,{className:"search-icon",onClick:()=>{var a;return(a=o.current)==null?void 0:a.focus()}}),I.jsx("input",{ref:o,onChange:a=>e(a.target.value),value:t,placeholder:"Search for apps..."}),t.length>0&&I.jsx(Dk,{className:"search-icon",style:{margin:"0 -0.25em 0 0.25em"},onClick:()=>e("")})]}),I.jsx("div",{className:"row",children:I.jsxs("button",{className:`my-pkg-btn row ${l?"selected":""}`,onClick:()=>n(l?-1:_d),children:[I.jsx(Tk,{style:{marginRight:"0.5em"}}),"My Packages"]})})]})}function T4(t){const{listedApps:e,getListedApps:r}=Qo(),[n,i]=L.useState("Recently published"),[o,s]=L.useState(""),[l,a]=L.useState(e),[u,c]=L.useState(1),d=L.useMemo(()=>Array.from({length:Math.ceil(l.length/10)},(p,x)=>x+1),[l]);L.useEffect(()=>{const p=(u-1)*10,x=p+10;a(e.slice(p,x))},[e]),L.useEffect(()=>{r().then(p=>{a(Object.values(p))}).catch(p=>console.error(p))},[]);const m=L.useCallback(async p=>{},[]),v=L.useCallback(p=>{s(p);const x=e.filter(k=>{var E,w,_,O;return k.package.toLowerCase().includes(p.toLowerCase())||((w=(E=k.metadata)==null?void 0:E.description)==null?void 0:w.toLowerCase().includes(p.toLowerCase()))||((O=(_=k.metadata)==null?void 0:_.description)==null?void 0:O.toLowerCase().includes(p.toLowerCase()))},[e]);a(x)},[e]);return I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{value:o,onChange:v}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"New"}),I.jsxs("select",{value:n,onChange:p=>{i(p.target.value),m(p.target.value)},style:{marginBottom:"-1em"},children:[I.jsx("option",{children:"Recently published"}),I.jsx("option",{children:"Most popular"}),I.jsx("option",{children:"Best rating"}),I.jsx("option",{children:"Recently updated"})]})]}),I.jsxs("div",{className:"new card col",style:{flex:1,overflowY:"scroll"},children:[l.map(p=>{var x;return I.jsx(ys,{app:p},xe(p)+(((x=p.state)==null?void 0:x.our_version)||""))}),d.length>1&&I.jsxs("div",{className:"row",style:{alignSelf:"center"},children:[u!==d[0]&&I.jsx(Ik,{onClick:()=>c(u-1)}),d.map(p=>I.jsx("div",{className:`page-selector ${p===u?"selected":""}`,onClick:()=>c(p),children:p},`page-${p}`)),u!==d[d.length-1]&&I.jsx(Rk,{onClick:()=>c(u+1)})]})]})]})}function O4(t){const{myApps:e,getMyApps:r}=Qo(),n=Iu(),[i,o]=L.useState(""),[s,l]=L.useState(e);L.useEffect(()=>{r().then(l).catch(u=>console.error(u))},[]);const a=L.useCallback(u=>{o(u);const c=Object.keys(e).reduce((d,m)=>(d[m]=e[m].filter(v=>{var p,x,k,E;return v.package.toLowerCase().includes(u.toLowerCase())||((x=(p=v.metadata)==null?void 0:p.description)==null?void 0:x.toLowerCase().includes(u.toLowerCase()))||((E=(k=v.metadata)==null?void 0:k.description)==null?void 0:E.toLowerCase().includes(u.toLowerCase()))}),d),{downloaded:[],installed:[],local:[],system:[]});l(c)},[e]);return I.jsxs("div",{style:{width:"100%",height:"100%"},children:[I.jsx(Qu,{value:i,onChange:a}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"My Packages"}),I.jsxs("button",{className:"row",onClick:()=>n("/publish"),children:[I.jsx(z1,{style:{marginRight:"0.5em"}}),"Publish Package"]})]}),I.jsx("div",{className:"my-apps-list",children:I.jsxs("div",{className:"new card col",children:[I.jsx("h3",{children:"Downloaded"}),(s.downloaded||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"Installed"}),(s.installed||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"Local"}),(s.local||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"System"}),(s.system||[]).map(u=>I.jsx(ys,{app:u},xe(u)))]})})]})}function L4(t){var a,u,c,d,m;const{myApps:e,listedApps:r}=Qo(),n=lx(),[i,o]=L.useState(void 0);L.useEffect(()=>{const v=e.local.find(p=>xe(p)===n.id);if(v)return o(v);if(n.id){const p=r.find(x=>xe(x)===n.id);if(p)return o(p)}},[n,e,r]);const s=L.useMemo(()=>{var v;return((v=i==null?void 0:i.metadata)==null?void 0:v.version)||"Unknown"},[i]),l=((a=i==null?void 0:i.state)==null?void 0:a.our_version)||"";return i?I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{value:"",onChange:()=>null,hideSearch:!0}),I.jsx("div",{className:"card",style:{marginTop:"1em"},children:i?I.jsxs(I.Fragment,{children:[I.jsxs("div",{className:"row between",children:[I.jsx(q1,{app:i,size:"large"}),I.jsx(W1,{app:i,style:{marginRight:"0.5em"}})]}),I.jsxs("div",{className:"col",style:{marginTop:"1em"},children:[I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Description"}),I.jsx("div",{className:"value",children:(((u=i.metadata)==null?void 0:u.description)||"No description given").slice(0,2e3)})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Publisher"}),I.jsx("div",{className:"value underline",children:i.publisher})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Version"}),I.jsx("div",{className:"value",children:s})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Mirrors"}),I.jsx("div",{className:"col",children:(((c=i.metadata)==null?void 0:c.mirrors)||[]).map((v,p)=>I.jsx("div",{className:"value underline",children:v},p+v))})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Permissions"}),I.jsx("div",{className:"col",children:(d=i.permissions)==null?void 0:d.map((v,p)=>I.jsx("div",{className:"value permission",children:v},p+v))})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Hash"}),I.jsx("div",{className:"value",style:{wordBreak:"break-all"},children:l})]})]}),I.jsx("div",{className:"app-screenshots row",children:(((m=i.metadata)==null?void 0:m.screenshots)||[]).map((v,p)=>I.jsx("img",{src:v},p+v))})]}):I.jsx("h3",{children:"App not found"})})]}):I.jsx("div",{children:"Loading..."})}var _a=(t=>(t[t.SEPOLIA=11155111]="SEPOLIA",t[t.OPTIMISM=10]="OPTIMISM",t[t.OPTIMISM_GOERLI=420]="OPTIMISM_GOERLI",t[t.LOCAL=1337]="LOCAL",t))(_a||{});const fu="0xaa36a7",Im="0xa",Rm={11155111:"0x18c39eB547A0060C6034f8bEaFB947D1C16eADF1"},B4="4902",Tm={[fu]:{chainId:fu,chainName:"Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:["https://rpc.sepolia.org"],blockExplorerUrls:["https://sepolia.etherscan.io"]},[Im]:{chainId:Im,chainName:"Optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:["https://mainnet.optimism.io"],blockExplorerUrls:["https://optimistic.etherscan.io"]}},D4=t=>{switch(t){case"1":case"0x1":return"Ethereum";case"10":case"a":case"0xa":return"Optimism";case"42161":return"Arbitrum";case"11155111":case"aa36a7":case"0xaa36a7":return"Sepolia";default:return"Unknown"}},Om=async t=>{var r,n,i;let e=await((r=window.ethereum)==null?void 0:r.request({method:"net_version"}).catch(()=>"1"));if(e="0x"+(typeof e=="string"?e.replace(/^0x/,""):e.toString(16)),!Tm[t]){console.error(`Invalid chain ID: ${t}`);return}if(t!==e)try{await((n=window.ethereum)==null?void 0:n.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}))}catch(o){if(String(o).includes(B4))await((i=window.ethereum)==null?void 0:i.request({method:"wallet_addEthereumChain",params:[Tm[t]]}));else throw window.alert(`You must enable the ${D4(t)} network in your wallet.`),new Error(`User cancelled connection to ${t}`)}};var cl={},Ju={};Object.defineProperty(Ju,"__esModule",{value:!0});Ju.Connector=void 0;class j4{constructor(e,r){this.actions=e,this.onError=r}resetState(){this.actions.resetState()}}Ju.Connector=j4;var uf,Lm;function U4(){if(Lm)return uf;Lm=1;function t({mustBeMetaMask:e=!1,silent:r=!1,timeout:n=3e3}={}){o();let i=!1;return new Promise(s=>{window.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout(()=>{l()},n));function l(){if(i)return;i=!0,window.removeEventListener("ethereum#initialized",l);const{ethereum:a}=window;a&&(!e||a.isMetaMask)?s(a):(!r&&console.error("@metamask/detect-provider:",e&&a?"Non-MetaMask window.ethereum detected.":"Unable to detect window.ethereum."),s(null))}});function o(){if(typeof e!="boolean")throw new Error("@metamask/detect-provider: Expected option 'mustBeMetaMask' to be a boolean.");if(typeof r!="boolean")throw new Error("@metamask/detect-provider: Expected option 'silent' to be a boolean.");if(typeof n!="number")throw new Error("@metamask/detect-provider: Expected option 'timeout' to be a number.")}}return uf=t,uf}var F4=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z4=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$4=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&F4(e,t,r);return z4(e,t),e},Qi=Fe&&Fe.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(cl,"__esModule",{value:!0});var tw=cl.MetaMask=cl.NoMetaMaskError=void 0;const H4=Ju;class fl extends Error{constructor(){super("MetaMask not installed"),this.name=fl.name,Object.setPrototypeOf(this,fl.prototype)}}cl.NoMetaMaskError=fl;function Zl(t){return Number.parseInt(t,16)}class q4 extends H4.Connector{constructor({actions:e,options:r,onError:n}){super(e,n),this.options=r}isomorphicInitialize(){return Qi(this,void 0,void 0,function*(){if(!this.eagerConnection)return this.eagerConnection=Promise.resolve().then(()=>$4(U4())).then(e=>Qi(this,void 0,void 0,function*(){var r,n;const i=yield e.default(this.options);i&&(this.provider=i,!((r=this.provider.providers)===null||r===void 0)&&r.length&&(this.provider=(n=this.provider.providers.find(o=>o.isMetaMask))!==null&&n!==void 0?n:this.provider.providers[0]),this.provider.on("connect",({chainId:o})=>{this.actions.update({chainId:Zl(o)})}),this.provider.on("disconnect",o=>{var s;if(o.code===1013){console.debug('MetaMask logged connection error 1013: "Try again later"');return}this.actions.resetState(),(s=this.onError)===null||s===void 0||s.call(this,o)}),this.provider.on("chainChanged",o=>{this.actions.update({chainId:Zl(o)})}),this.provider.on("accountsChanged",o=>{o.length===0?this.actions.resetState():this.actions.update({accounts:o})}))}))})}connectEagerly(){return Qi(this,void 0,void 0,function*(){const e=this.actions.startActivation();try{if(yield this.isomorphicInitialize(),!this.provider)return e();const r=yield this.provider.request({method:"eth_accounts"});if(!r.length)throw new Error("No accounts returned");const n=yield this.provider.request({method:"eth_chainId"});this.actions.update({chainId:Zl(n),accounts:r})}catch(r){console.debug("Could not connect eagerly",r),this.actions.resetState()}})}activate(e){var r,n;return Qi(this,void 0,void 0,function*(){let i;return!((n=(r=this.provider)===null||r===void 0?void 0:r.isConnected)===null||n===void 0)&&n.call(r)||(i=this.actions.startActivation()),this.isomorphicInitialize().then(()=>Qi(this,void 0,void 0,function*(){if(!this.provider)throw new fl;const o=yield this.provider.request({method:"eth_requestAccounts"}),s=yield this.provider.request({method:"eth_chainId"}),l=Zl(s),a=typeof e=="number"?e:e==null?void 0:e.chainId;if(!a||l===a)return this.actions.update({chainId:l,accounts:o});const u=`0x${a.toString(16)}`;return this.provider.request({method:"wallet_switchEthereumChain",params:[{chainId:u}]}).catch(c=>{var d,m;if((((m=(d=c.data)===null||d===void 0?void 0:d.originalError)===null||m===void 0?void 0:m.code)||c.code)===4902&&typeof e!="number"){if(!this.provider)throw new Error("No provider");return this.provider.request({method:"wallet_addEthereumChain",params:[Object.assign(Object.assign({},e),{chainId:u})]})}throw c}).then(()=>this.activate(a))})).catch(o=>{throw i==null||i(),o})})}watchAsset({address:e,symbol:r,decimals:n,image:i}){return Qi(this,void 0,void 0,function*(){if(!this.provider)throw new Error("No provider");return this.provider.request({method:"wallet_watchAsset",params:{type:"ERC20",options:{address:e,symbol:r,decimals:n,image:i}}}).then(o=>{if(!o)throw new Error("Rejected");return!0})})}}tw=cl.MetaMask=q4;const[rw,Fh]=qu.initializeConnector(t=>new tw({actions:t}));function W4(t){const e=t.split("."),r=new Uint8Array(t.length+e.length);let n=0;for(const i of e){const o=i.length;r[n]=o,n++;for(let s=0;si.toString(16).padStart(2,"0")).join("")}`}const{useIsActivating:G4}=Fh;function V4({provider:t,packageAbi:e}){var X;const{listedApps:r}=Qo(),{account:n,isActive:i}=qu.useWeb3React(),o=G4(),[s,l]=L.useState(""),[a,u]=L.useState(),[c,d]=L.useState(!1),[m,v]=L.useState(""),[p,x]=L.useState(((X=window.our)==null?void 0:X.node)||""),[k,E]=L.useState(""),[w,_]=L.useState(""),[O,B]=L.useState(!1),j=L.useCallback(async()=>{await rw.activate().catch(()=>{});try{Om(fu)}catch(G){console.error(G)}},[]),$=L.useCallback(async()=>{if(!k){_("");return}try{const J=await(await fetch(k)).text();JSON.parse(J);const C=ut(mr(J));_(C)}catch{window.alert("Error calculating metadata hash. Please ensure the URL is valid and the metadata is in JSON format.")}},[k]),H=L.useCallback(async G=>{var C;G.preventDefault(),G.stopPropagation();let J=w;try{if(!J){const A=await fetch(k);await A.json();const N=await A.text();J=ut(mr(N))}l("Please confirm the transaction in your wallet");const f=W4(p);await Om(fu);const g=await(O?e.updateMetadata(V.from(mS(["string","bytes"],[m,f])),k,J):e.registerApp(m,f,k,J));await new Promise(A=>setTimeout(A,2e3)),l("Publishing package..."),await g.wait(),u({packageName:m,publisherId:p}),v(""),x(((C=window.our)==null?void 0:C.node)||p),E(""),_(""),B(!1)}catch(f){console.error(f),window.alert("Error publishing package. Please ensure the package name and publisher ID are valid, and the metadata is in JSON format.")}finally{l("")}},[m,O,p,k,w,e,u,v,x,E,_,B]),ie=L.useCallback(async()=>{O||m&&p&&r.find(G=>G.package===m&&G.publisher===p)&&B(!0)},[r,m,p,O,B]);return I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{hideSearch:!0}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"Publish Package"}),!!n&&I.jsxs("div",{style:{textAlign:"right",lineHeight:1.5},children:[" ","Connected as"," ",(n==null?void 0:n.slice(0,6))+"..."+(n==null?void 0:n.slice(n.length-6))]})]}),s?I.jsx("div",{className:"col center",children:I.jsx(Ed,{msg:s})}):a?I.jsxs("div",{className:"col center",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"Package Published!"}),I.jsxs("div",{style:{marginBottom:"0.5em"},children:[I.jsx("strong",{children:"Package Name:"})," ",a.packageName]}),I.jsxs("div",{style:{marginBottom:"0.5em"},children:[I.jsx("strong",{children:"Publisher ID:"})," ",a.publisherId]}),I.jsx("button",{className:"my-pkg-btn row",style:{marginTop:"1em"},onClick:()=>u(void 0),children:"Publish Another Package"})]}):!n||!i?I.jsxs(I.Fragment,{children:[I.jsx("h4",{style:{},children:"Please connect your wallet to publish a package"}),I.jsx("button",{className:"my-pkg-btn row",onClick:j,children:"Connect Wallet"})]}):o?I.jsx(Ed,{msg:"Approve connection in your wallet"}):I.jsxs("form",{className:"new card col",style:{flex:1,overflowY:"scroll"},onSubmit:H,children:[I.jsxs("div",{className:"row between",style:{cursor:"pointer",padding:"0.5em",margin:"0 0 0.5em -0.5em"},onClick:()=>B(!O),children:[I.jsx("input",{type:"checkbox",checked:O,readOnly:!0}),I.jsx("label",{htmlFor:"update",style:{cursor:"pointer"},children:"Update existing package"})]}),I.jsxs("div",{className:"col f-width",children:[I.jsx("label",{htmlFor:"package-name",children:"Package Name"}),I.jsx("input",{style:{minWidth:"80%"},id:"package-name",type:"text",required:!0,placeholder:"my-package",value:m,onChange:G=>v(G.target.value),onBlur:ie})]}),I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsx("label",{htmlFor:"publisher-id",children:"Publisher ID"}),I.jsx("input",{style:{minWidth:"80%"},id:"publisher-id",type:"text",required:!0,value:p,onChange:G=>x(G.target.value),onBlur:ie})]}),I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsxs("label",{htmlFor:"metadata-url",children:["Metadata URL",I.jsx("span",{style:{marginLeft:"2em",fontSize:"0.9em",textDecoration:"underline",cursor:"pointer"},onClick:()=>d(!c),children:"What is this?"})]}),c&&I.jsxs("div",{style:{textAlign:"left",marginBottom:"0.5em"},children:["Metadata is a JSON file that describes your package.",I.jsx("br",{})," You can"," ",I.jsx("a",{target:"_blank",href:"https://pongo-uploads.s3.us-east-2.amazonaws.com/sample_metadata.json",children:"download a template here"}),"."]}),I.jsx("input",{style:{minWidth:"80%"},id:"metadata-url",type:"text",required:!0,value:k,onChange:G=>E(G.target.value),onBlur:$,placeholder:"https://my-site/metadata.json"})]}),I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsx("label",{htmlFor:"metadata-hash",children:"Metadata Hash"}),I.jsx("input",{style:{minWidth:"80%"},readOnly:!0,id:"metadata-hash",type:"text",value:w,onChange:G=>_(G.target.value),placeholder:"Calculated automatically from metadata URL"})]}),I.jsx("button",{type:"submit",className:"primary",style:{marginTop:"1em"},children:"Publish"})]})]})}var K4={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Q4=[[rw,Fh]],{useProvider:J4}=Fh,Y4="https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",Is="/main:app_store:sys";window.our&&(window.our.process=Is==null?void 0:Is.replace("/",""));const X4=`${K4.VITE_NODE_URL||"http://localhost:8080"}${Is}`;function Z4(){const t=J4(),[e,r]=L.useState(!0),[n,i]=L.useState(wd.connect(Rm[_a.SEPOLIA],new vi(Y4)));if(L.useEffect(()=>{t==null||t.getNetwork().then(s=>{s.chainId===_a.SEPOLIA&&i(wd.connect(Rm[_a.SEPOLIA],t.getSigner()))})},[t]),L.useEffect(()=>{},[]),!e)return I.jsxs("div",{className:"node-not-connected",children:[I.jsx("h2",{style:{color:"red"},children:"Node not connected"}),I.jsxs("h4",{children:["You need to start a node at ",X4," before you can use this UI in development."]})]});const o={provider:t,packageAbi:n};return I.jsx(qu.Web3ReactProvider,{connectors:Q4,children:I.jsx(_x,{basename:Is,children:I.jsxs(Ax,{children:[I.jsx(ms,{path:"/",element:I.jsx(T4,{...o})}),I.jsx(ms,{path:_d,element:I.jsx(O4,{...o})}),I.jsx(ms,{path:"/app-details/:id",element:I.jsx(L4,{...o})}),I.jsx(ms,{path:"/publish",element:I.jsx(V4,{...o})})]})})})}cf.createRoot(document.getElementById("root")).render(I.jsx(qr.StrictMode,{children:I.jsx(Z4,{})})); + */var Wu=L,PS=NS;function CS(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var MS=typeof Object.is=="function"?Object.is:CS,IS=PS.useSyncExternalStore,RS=Wu.useRef,TS=Wu.useEffect,OS=Wu.useMemo,LS=Wu.useDebugValue;P1.useSyncExternalStoreWithSelector=function(t,e,r,n,i){var o=RS(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=OS(function(){function a(v){if(!u){if(u=!0,c=v,v=n(v),i!==void 0&&s.hasValue){var g=s.value;if(i(g,v))return d=g}return d=v}if(g=d,MS(c,v))return g;var x=n(v);return i!==void 0&&i(g,x)?g:(c=v,d=x)}var u=!1,c,d,p=r===void 0?null:r;return[function(){return a(e())},p===null?void 0:function(){return a(p())}]},[e,r,n,i]);var l=IS(t,o[0],o[1]);return TS(function(){s.hasValue=!0,s.value=l},[l]),LS(l),l};N1.exports=P1;var BS=N1.exports;const Gu=jo(BS),{useSyncExternalStoreWithSelector:DS}=Gu;function I1(t,e=t.getState,r){const n=DS(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const dm=t=>{const e=typeof t=="function"?k1(t):t,r=(n,i)=>I1(e,n,i);return Object.assign(r,e),r},R1=t=>t?dm(t):dm;var jS=t=>R1(t);const US=Object.freeze(Object.defineProperty({__proto__:null,create:R1,createStore:k1,default:jS,useStore:I1},Symbol.toStringTag,{value:"Module"})),FS=Uo(US);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createWeb3ReactStoreAndActions=t.MAX_SAFE_CHAIN_ID=void 0;const e=gS,r=FS;t.MAX_SAFE_CHAIN_ID=0xfffffffffffec;function n(l){if(!Number.isInteger(l)||l<=0||l>t.MAX_SAFE_CHAIN_ID)throw new Error(`Invalid chainId ${l}`)}function i(l){return(0,e.getAddress)(l)}const o={chainId:void 0,accounts:void 0,activating:!1};function s(){const l=(0,r.createStore)()(()=>o);let a=0;function u(){const p=++a;return l.setState(Object.assign(Object.assign({},o),{activating:!0})),()=>{a===p&&l.setState({activating:!1})}}function c(p){if(p.chainId!==void 0&&n(p.chainId),p.accounts!==void 0)for(let v=0;v{var g,x;const k=(g=p.chainId)!==null&&g!==void 0?g:v.chainId,E=(x=p.accounts)!==null&&x!==void 0?x:v.accounts;let w=v.activating;return w&&k&&E&&(w=!1),{chainId:k,accounts:E,activating:w}})}function d(){a++,l.setState(o)}return[l,{startActivation:u,update:c,resetState:d}]}t.createWeb3ReactStoreAndActions=s})(S1);var zS={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const hm=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??typeof c!="object"?c:Object.assign({},e,c),r.forEach(p=>p(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(zS?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},Dh=t=>t?hm(t):hm,{useSyncExternalStoreWithSelector:$S}=Gu;function T1(t,e=t.getState,r){const n=$S(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const pm=t=>{const e=typeof t=="function"?Dh(t):t,r=(n,i)=>T1(e,n,i);return Object.assign(r,e),r},O1=t=>t?pm(t):pm;var HS=t=>O1(t);const qS=Object.freeze(Object.defineProperty({__proto__:null,create:O1,createStore:Dh,default:HS,useStore:T1},Symbol.toStringTag,{value:"Module"})),WS=Uo(qS),{useSyncExternalStoreWithSelector:GS}=Gu;function L1(t,e=t.getState,r){const n=GS(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const mm=(t,e)=>{const r=Dh(t),n=(i,o=e)=>L1(r,i,o);return Object.assign(n,r),n},VS=(t,e)=>t?mm(t,e):mm,KS=Object.freeze(Object.defineProperty({__proto__:null,createWithEqualityFn:VS,useStoreWithEqualityFn:L1},Symbol.toStringTag,{value:"Module"})),QS=Uo(KS),JS=Uo(aS);var YS=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XS=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZS=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&YS(e,t,r);return XS(e,t),e},ek=Fe&&Fe.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(Cn,"__esModule",{value:!0});Cn.getPriorityConnector=Cn.getSelectedConnector=Cn.initializeConnector=void 0;const tk=S1,mo=L,gm=WS,rk=QS;let _o;function nk(){return ek(this,void 0,void 0,function*(){if(_o===void 0)try{const{Web3Provider:t}=yield Promise.resolve().then(()=>ZS(JS));_o=t}catch{console.debug("@ethersproject/providers not available"),_o=null}})}function ik(t){const[e,r]=(0,tk.createWeb3ReactStoreAndActions)(),n=t(r),i=fk(e),o=dk(i),s=hk(n,i,o);return[n,Object.assign(Object.assign(Object.assign({},i),o),s),e]}Cn.initializeConnector=ik;function ok({chainId:t,accounts:e,activating:r}){return!!(t&&e&&!r)}function B1(...t){function e(d){const p=t.findIndex(([v])=>d===v);if(p===-1)throw new Error("Connector not found");return p}function r(d){const p=t[e(d)][2];if(!p)throw new Error("Stores not passed");return p}function n(d){return t.map(([,{useChainId:v}])=>v())[e(d)]}function i(d){return t.map(([,{useAccounts:v}])=>v())[e(d)]}function o(d){return t.map(([,{useIsActivating:v}])=>v())[e(d)]}function s(d){return t.map(([,{useAccount:v}])=>v())[e(d)]}function l(d){return t.map(([,{useIsActive:v}])=>v())[e(d)]}function a(d,p){const v=e(d);return t.map(([,{useProvider:x}],k)=>x(p,k===v))[v]}function u(d,p){const v=e(d);return t.map(([,{useENSNames:x}],k)=>x(k===v?p:void 0))[v]}function c(d,p){const v=e(d);return t.map(([,{useENSName:x}],k)=>x(k===v?p:void 0))[v]}return{useSelectedStore:r,useSelectedChainId:n,useSelectedAccounts:i,useSelectedIsActivating:o,useSelectedAccount:s,useSelectedIsActive:l,useSelectedProvider:a,useSelectedENSNames:u,useSelectedENSName:c}}Cn.getSelectedConnector=B1;function sk(...t){const{useSelectedStore:e,useSelectedChainId:r,useSelectedAccounts:n,useSelectedIsActivating:i,useSelectedAccount:o,useSelectedIsActive:s,useSelectedProvider:l,useSelectedENSNames:a,useSelectedENSName:u}=B1(...t);function c(){const B=t.map(([,{useIsActive:j}])=>j()).findIndex(j=>j);return t[B===-1?0:B][0]}function d(){return e(c())}function p(){return r(c())}function v(){return n(c())}function g(){return i(c())}function x(){return o(c())}function k(){return s(c())}function E(O){return l(c(),O)}function w(O){return a(c(),O)}function _(O){return u(c(),O)}return{useSelectedStore:e,useSelectedChainId:r,useSelectedAccounts:n,useSelectedIsActivating:i,useSelectedAccount:o,useSelectedIsActive:s,useSelectedProvider:l,useSelectedENSNames:a,useSelectedENSName:u,usePriorityConnector:c,usePriorityStore:d,usePriorityChainId:p,usePriorityAccounts:v,usePriorityIsActivating:g,usePriorityAccount:x,usePriorityIsActive:k,usePriorityProvider:E,usePriorityENSNames:w,usePriorityENSName:_}}Cn.getPriorityConnector=sk;const lk=({chainId:t})=>t,ak=({accounts:t})=>t,uk=({activating:t})=>t,ck=(t,e)=>t===void 0&&e===void 0||t!==void 0&&t.length===(e==null?void 0:e.length)&&t.every((r,n)=>r===e[n]);function fk(t){function e(){return(0,gm.useStore)(t,lk)}function r(){return(0,rk.useStoreWithEqualityFn)(t,ak,ck)}function n(){return(0,gm.useStore)(t,uk)}return{useChainId:e,useAccounts:r,useIsActivating:n}}function dk({useChainId:t,useAccounts:e,useIsActivating:r}){function n(){var o;return(o=e())===null||o===void 0?void 0:o[0]}function i(){const o=t(),s=e(),l=r();return ok({chainId:o,accounts:s,activating:l})}return{useAccount:n,useIsActive:i}}function vm(t,e=[]){const[r,n]=(0,mo.useState)();return(0,mo.useEffect)(()=>{if(t&&e.length){let i=!1;return Promise.all(e.map(o=>t.lookupAddress(o))).then(o=>{i||n(o)}).catch(o=>{i||(console.debug("Could not fetch ENS names",o),n(new Array(e.length).fill(null)))}),()=>{i=!0,n(void 0)}}},[t,e]),r??new Array(e.length).fill(void 0)}function hk(t,{useAccounts:e,useChainId:r},{useAccount:n,useIsActive:i}){function o(a,u=!0){const c=i(),d=r(),[p,v]=(0,mo.useState)(_o!==void 0);return(0,mo.useEffect)(()=>{if(p)return;let g=!1;return nk().then(()=>{g||v(!0)}),()=>{g=!0}},[p]),(0,mo.useMemo)(()=>{if(u){if(t.customProvider)return t.customProvider;if(_o&&t.provider)return new _o(t.provider,a)}},[p,u,c,d,a])}function s(a){const u=e();return vm(a,u)}function l(a){var u;const c=n(),d=(0,mo.useMemo)(()=>c===void 0?void 0:[c],[c]);return(u=vm(a,d))===null||u===void 0?void 0:u[0]}return{useProvider:o,useENSNames:s,useENSName:l}}var Vu={},D1={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(a,u,c){this.fn=a,this.context=u,this.once=c||!1}function o(a,u,c,d,p){if(typeof c!="function")throw new TypeError("The listener must be a function");var v=new i(c,d||a,p),g=r?r+u:u;return a._events[g]?a._events[g].fn?a._events[g]=[a._events[g],v]:a._events[g].push(v):(a._events[g]=v,a._eventsCount++),a}function s(a,u){--a._eventsCount===0?a._events=new n:delete a._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],c,d;if(this._eventsCount===0)return u;for(d in c=this._events)e.call(c,d)&&u.push(r?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},l.prototype.listeners=function(u){var c=r?r+u:u,d=this._events[c];if(!d)return[];if(d.fn)return[d.fn];for(var p=0,v=d.length,g=new Array(v);pe),this.eth_accounts=jest.fn(e=>e),this.eth_requestAccounts=jest.fn(e=>e)}request(e){if(!this.chainId)return Promise.reject(new Error);switch(e.method){case"eth_chainId":return Promise.resolve(this.eth_chainId(this.chainId));case"eth_accounts":return Promise.resolve(this.eth_accounts(this.accounts));case"eth_requestAccounts":return Promise.resolve(this.eth_requestAccounts(this.accounts));default:throw new Error(`Method not supported on mock: ${JSON.stringify(e)}`)}}emitConnect(e){this.emit("connect",{chainId:e})}emitDisconnect(e){this.emit("disconnect",e)}emitChainChanged(e){this.emit("chainChanged",e)}emitAccountsChanged(e){this.emit("accountsChanged",e)}}Vu.MockEIP1193Provider=gk;var Do={},vk=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yk=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wk=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vk(e,t,r);return yk(e,t),e};Object.defineProperty(Do,"__esModule",{value:!0});Do.useWeb3React=Do.Web3ReactProvider=void 0;const ou=wk(L),Ek=Cn,j1=(0,ou.createContext)(void 0);function xk({children:t,connectors:e,connectorOverride:r,network:n,lookupENS:i=!0}){const o=(0,ou.useRef)(e);if(e.length!=o.current.length||e.some((X,G)=>{const J=o.current[G];return X[0]!==J[0]}))throw new Error("The connectors prop passed to Web3ReactProvider must be referentially static. If connectors is changing, try providing a key prop to Web3ReactProvider that changes every time connectors changes.");const s=(0,Ek.getPriorityConnector)(...e),{usePriorityConnector:l,useSelectedChainId:a,useSelectedAccounts:u,useSelectedIsActivating:c,useSelectedAccount:d,useSelectedIsActive:p,useSelectedProvider:v,useSelectedENSNames:g,useSelectedENSName:x}=s,k=l(),E=r??k,w=a(E),_=u(E),O=c(E),B=d(E),j=p(E),$=v(E,n),H=g(E,i?$:void 0),ie=x(E,i?$:void 0);return ou.default.createElement(j1.Provider,{value:{connector:E,chainId:w,accounts:_,isActivating:O,account:B,isActive:j,provider:$,ENSNames:H,ENSName:ie,hooks:s}},t)}Do.Web3ReactProvider=xk;function Ak(){const t=(0,ou.useContext)(j1);if(!t)throw Error("useWeb3React can only be used within the Web3ReactProvider component");return t}Do.useWeb3React=Ak;(function(t){var e=Fe&&Fe.__createBinding||(Object.create?function(n,i,o,s){s===void 0&&(s=o);var l=Object.getOwnPropertyDescriptor(i,o);(!l||("get"in l?!i.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(n,s,l)}:function(n,i,o,s){s===void 0&&(s=o),n[s]=i[o]}),r=Fe&&Fe.__exportStar||function(n,i){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&e(i,n,o)};Object.defineProperty(t,"__esModule",{value:!0}),r(Cn,t),r(Vu,t),r(Do,t)})(qu);const of=[{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"approve",inputs:[{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"apps",inputs:[{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"balanceOf",inputs:[{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"contractURI",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"getApproved",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"getInitializedVersion",inputs:[],outputs:[{name:"",type:"uint64",internalType:"uint64"}],stateMutability:"view"},{type:"function",name:"getPackageId",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"pure"},{type:"function",name:"getPackageInfo",inputs:[{name:"package",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"tuple",internalType:"struct IKinodeAppStore.PackageInfo",components:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"getPackageInfo",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"tuple",internalType:"struct IKinodeAppStore.PackageInfo",components:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[{name:"_knsResolver",type:"address",internalType:"contract KNSRegistryResolver"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"isApprovedForAll",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"operator",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"knsResolver",inputs:[],outputs:[{name:"",type:"address",internalType:"contract KNSRegistryResolver"}],stateMutability:"view"},{type:"function",name:"name",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"ownerOf",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"proxiableUUID",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"registerApp",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setApprovalForAll",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"approved",type:"bool",internalType:"bool"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"symbol",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"tokenURI",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"transferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"unlistPacakge",inputs:[{name:"package",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateContractURI",inputs:[{name:"uri",type:"string",internalType:"string"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateMetadata",inputs:[{name:"package",type:"uint256",internalType:"uint256"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"upgradeToAndCall",inputs:[{name:"newImplementation",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"event",name:"AppMetadataUpdated",inputs:[{name:"package",type:"uint256",indexed:!0,internalType:"uint256"},{name:"metadataUrl",type:"string",indexed:!1,internalType:"string"},{name:"metadataHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"AppRegistered",inputs:[{name:"package",type:"uint256",indexed:!0,internalType:"uint256"},{name:"packageName",type:"string",indexed:!1,internalType:"string"},{name:"publisherName",type:"bytes",indexed:!1,internalType:"bytes"},{name:"metadataUrl",type:"string",indexed:!1,internalType:"string"},{name:"metadataHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"Approval",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"ApprovalForAll",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"operator",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint64",indexed:!1,internalType:"uint64"}],anonymous:!1},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Transfer",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"AddressEmptyCode",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{name:"implementation",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ERC721IncorrectOwner",inputs:[{name:"sender",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InsufficientApproval",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC721InvalidApprover",inputs:[{name:"approver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOperator",inputs:[{name:"operator",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidReceiver",inputs:[{name:"receiver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidSender",inputs:[{name:"sender",type:"address",internalType:"address"}]},{type:"error",name:"ERC721NonexistentToken",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"FailedInnerCall",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"OwnableInvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{name:"account",type:"address",internalType:"address"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{name:"slot",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"Unauthorized",inputs:[]}];class wd{static createInterface(){return new ad(of)}static connect(e,r){return new g3(e,of,r)}}zh(wd,"abi",of);var U1={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ym=qr.createContext&&qr.createContext(U1),bk=["attr","size","title"];function _k(t,e){if(t==null)return{};var r=Sk(t,e),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Sk(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,o;for(o=0;o=0)&&(r[i]=t[i]);return r}function su(){return su=Object.assign?Object.assign.bind():function(t){for(var e=1;eqr.createElement(e.tag,lu({key:r},e.attr),F1(e.child)))}function zn(t){return e=>qr.createElement(Ck,su({attr:lu({},t.attr)},e),F1(t.child))}function Ck(t){var e=r=>{var{attr:n,size:i,title:o}=t,s=_k(t,bk),l=i||r.size||"1em",a;return r.className&&(a=r.className),t.className&&(a=(a?a+" ":"")+t.className),qr.createElement("svg",su({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,n,s,{className:a,style:lu(lu({color:t.color||r.color},r.style),t.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),o&&qr.createElement("title",null,o),t.children)};return ym!==void 0?qr.createElement(ym.Consumer,null,r=>e(r)):e(U1)}function Mk(t){return zn({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"},child:[]}]})(t)}function Ik(t){return zn({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"},child:[]}]})(t)}function Rk(t){return zn({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"},child:[]}]})(t)}function Tk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(t)}function Ok(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"},child:[]}]})(t)}function Lk(t){return zn({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"},child:[]}]})(t)}function Bk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"},child:[]}]})(t)}function z1(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M296 384h-80c-13.3 0-24-10.7-24-24V192h-87.7c-17.8 0-26.7-21.5-14.1-34.1L242.3 5.7c7.5-7.5 19.8-7.5 27.3 0l152.2 152.2c12.6 12.6 3.7 34.1-14.1 34.1H320v168c0 13.3-10.7 24-24 24zm216-8v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h136v8c0 30.9 25.1 56 56 56h80c30.9 0 56-25.1 56-56v-8h136c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(t)}function Dk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm101.8-262.2L295.6 256l62.2 62.2c4.7 4.7 4.7 12.3 0 17l-22.6 22.6c-4.7 4.7-12.3 4.7-17 0L256 295.6l-62.2 62.2c-4.7 4.7-12.3 4.7-17 0l-22.6-22.6c-4.7-4.7-4.7-12.3 0-17l62.2-62.2-62.2-62.2c-4.7-4.7-4.7-12.3 0-17l22.6-22.6c4.7-4.7 12.3-4.7 17 0l62.2 62.2 62.2-62.2c4.7-4.7 12.3-4.7 17 0l22.6 22.6c4.7 4.7 4.7 12.3 0 17z"},child:[]}]})(t)}var jk={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Em=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??(typeof c!="object"||c===null)?c:Object.assign({},e,c),r.forEach(p=>p(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(jk?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},Uk=t=>t?Em(t):Em;var $1={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{useDebugValue:Fk}=qr,{useSyncExternalStoreWithSelector:zk}=Gu;let xm=!1;function $k(t,e=t.getState,r){($1?"production":void 0)!=="production"&&r&&!xm&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),xm=!0);const n=zk(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return Fk(n),n}const Am=t=>{($1?"production":void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof t=="function"?Uk(t):t,r=(n,i)=>$k(e,n,i);return Object.assign(r,e),r},Hk=t=>t?Am(t):Am;var qk={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function H1(t,e){let r;try{r=t()}catch{return}return{getItem:i=>{var o;const s=a=>a===null?null:JSON.parse(a,e==null?void 0:e.reviver),l=(o=r.getItem(i))!=null?o:null;return l instanceof Promise?l.then(s):s(l)},setItem:(i,o)=>r.setItem(i,JSON.stringify(o,e==null?void 0:e.replacer)),removeItem:i=>r.removeItem(i)}}const sl=t=>e=>{try{const r=t(e);return r instanceof Promise?r:{then(n){return sl(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return sl(n)(r)}}}},Wk=(t,e)=>(r,n,i)=>{let o={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:k=>k,version:0,merge:(k,E)=>({...E,...k}),...e},s=!1;const l=new Set,a=new Set;let u;try{u=o.getStorage()}catch{}if(!u)return t((...k)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...k)},n,i);const c=sl(o.serialize),d=()=>{const k=o.partialize({...n()});let E;const w=c({state:k,version:o.version}).then(_=>u.setItem(o.name,_)).catch(_=>{E=_});if(E)throw E;return w},p=i.setState;i.setState=(k,E)=>{p(k,E),d()};const v=t((...k)=>{r(...k),d()},n,i);let g;const x=()=>{var k;if(!u)return;s=!1,l.forEach(w=>w(n()));const E=((k=o.onRehydrateStorage)==null?void 0:k.call(o,n()))||void 0;return sl(u.getItem.bind(u))(o.name).then(w=>{if(w)return o.deserialize(w)}).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==o.version){if(o.migrate)return o.migrate(w.state,w.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return w.state}).then(w=>{var _;return g=o.merge(w,(_=n())!=null?_:v),r(g,!0),d()}).then(()=>{E==null||E(g,void 0),s=!0,a.forEach(w=>w(g))}).catch(w=>{E==null||E(void 0,w)})};return i.persist={setOptions:k=>{o={...o,...k},k.getStorage&&(u=k.getStorage())},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>x(),hasHydrated:()=>s,onHydrate:k=>(l.add(k),()=>{l.delete(k)}),onFinishHydration:k=>(a.add(k),()=>{a.delete(k)})},x(),g||v},Gk=(t,e)=>(r,n,i)=>{let o={storage:H1(()=>localStorage),partialize:x=>x,version:0,merge:(x,k)=>({...k,...x}),...e},s=!1;const l=new Set,a=new Set;let u=o.storage;if(!u)return t((...x)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...x)},n,i);const c=()=>{const x=o.partialize({...n()});return u.setItem(o.name,{state:x,version:o.version})},d=i.setState;i.setState=(x,k)=>{d(x,k),c()};const p=t((...x)=>{r(...x),c()},n,i);let v;const g=()=>{var x,k;if(!u)return;s=!1,l.forEach(w=>{var _;return w((_=n())!=null?_:p)});const E=((k=o.onRehydrateStorage)==null?void 0:k.call(o,(x=n())!=null?x:p))||void 0;return sl(u.getItem.bind(u))(o.name).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==o.version){if(o.migrate)return o.migrate(w.state,w.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return w.state}).then(w=>{var _;return v=o.merge(w,(_=n())!=null?_:p),r(v,!0),c()}).then(()=>{E==null||E(v,void 0),v=n(),s=!0,a.forEach(w=>w(v))}).catch(w=>{E==null||E(void 0,w)})};return i.persist={setOptions:x=>{o={...o,...x},x.storage&&(u=x.storage)},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>g(),hasHydrated:()=>s,onHydrate:x=>(l.add(x),()=>{l.delete(x)}),onFinishHydration:x=>(a.add(x),()=>{a.delete(x)})},o.skipHydration||g(),v||p},Vk=(t,e)=>"getStorage"in e||"serialize"in e||"deserialize"in e?((qk?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),Wk(t,e)):Gk(t,e),Kk=Vk;var Dr=(t=>(t[t.OK=200]="OK",t[t.CREATED=201]="CREATED",t[t.ACCEPTED=202]="ACCEPTED",t[t.NO_CONTENT=204]="NO_CONTENT",t[t.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",t[t.FOUND=302]="FOUND",t[t.SEE_OTHER=303]="SEE_OTHER",t[t.NOT_MODIFIED=304]="NOT_MODIFIED",t[t.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",t[t.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",t[t.BAD_REQUEST=400]="BAD_REQUEST",t[t.UNAUTHORIZED=401]="UNAUTHORIZED",t[t.FORBIDDEN=403]="FORBIDDEN",t[t.NOT_FOUND=404]="NOT_FOUND",t[t.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",t[t.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",t[t.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",t[t.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",t[t.BAD_GATEWAY=502]="BAD_GATEWAY",t[t.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",t))(Dr||{});const xe=t=>`${t.package}:${t.publisher}`,cs=t=>{var e;return((e=t.metadata)==null?void 0:e.name)||xe(t)},sf=t=>{var e,r;return t.publisher==="sys"?"system":(e=t.state)!=null&&e.our_version&&!((r=t.state)!=null&&r.capsApproved)?"downloaded":t.metadata?"installed":"local"},or="/main:app_store:sys",Xl=(t,e)=>t.package===e.package&&t.publisher===e.publisher,Qo=Hk()(Kk((t,e)=>({myApps:{downloaded:[],installed:[],local:[],system:[]},listedApps:[],searchResults:[],query:"",getMyApps:async()=>{const i=(await(await fetch(`${or}/apps`)).json()).reduce((o,s)=>{const l=sf(s);return o[l].push(s),o},{downloaded:[],installed:[],local:[],system:[]});return t(()=>({myApps:i})),i},getListedApps:async()=>{const n=await(await fetch(`${or}/apps/listed`)).json();return t({listedApps:n}),n},getMyApp:async r=>{const i=await(await fetch(`${or}/apps/${xe(r)}`)).json(),o=sf(i),s=e().myApps;s[o]=s[o].map(a=>Xl(a,i)?i:a);const l=[...e().listedApps].map(a=>Xl(a,i)?i:a);return t({myApps:s,listedApps:l}),i},installApp:async r=>{if((await fetch(`${or}/apps/${xe(r)}/caps`,{method:"POST"})).status!==Dr.OK)throw new Error(`Failed to approve caps for app: ${xe(r)}`);if((await fetch(`${or}/apps/${xe(r)}`,{method:"POST"})).status!==Dr.CREATED)throw new Error(`Failed to install app: ${xe(r)}`)},updateApp:async r=>{if((await fetch(`${or}/apps/${xe(r)}`,{method:"PUT"})).status!==Dr.NO_CONTENT)throw new Error(`Failed to update app: ${xe(r)}`)},uninstallApp:async r=>{if(!confirm(`Are you sure you want to remove ${xe(r)}?`))return;if((await fetch(`${or}/apps/${xe(r)}`,{method:"DELETE"})).status!==Dr.NO_CONTENT)throw new Error(`Failed to remove app: ${xe(r)}`);const i={...e().myApps},o=sf(r);i[o]=i[o].filter(l=>!Xl(l,r));const s=e().listedApps.map(l=>Xl(l,r)?{...l,state:void 0,installed:!1}:l);t({myApps:i,listedApps:s})},getListedApp:async r=>{const n=await fetch(`${or}/apps/listed/${r}`);if(n.status!==Dr.OK)throw new Error(`Failed to get app: ${r}`);return await n.json()},downloadApp:async r=>{if((await fetch(`${or}/apps/listed/${xe(r)}`,{method:"POST"})).status!==Dr.CREATED)throw new Error(`Failed to get app: ${xe(r)}`)},getCaps:async r=>{const n=await fetch(`${or}/apps/${xe(r)}/caps`);if(n.status!==Dr.OK)throw new Error(`Failed to get app: ${xe(r)}`);return(await n.json())[0]},approveCaps:async r=>{if((await fetch(`${or}/apps/${xe(r)}/caps`,{method:"POST"})).status!==Dr.OK)throw new Error(`Failed to get app: ${xe(r)}`)},setMirroring:async(r,n)=>{if((await fetch(`${or}/apps/${xe(r)}/mirror`,{method:n?"PUT":"DELETE"})).status!==Dr.OK)throw new Error(`Failed to start mirror: ${xe(r)}`);e().getMyApp(r)},setAutoUpdate:async(r,n)=>{if((await fetch(`${or}/apps/${xe(r)}/auto-update`,{method:n?"PUT":"DELETE"})).status!==Dr.OK)throw new Error(`Failed to change auto update: ${xe(r)}`);e().getMyApp(r)},get:e,set:t}),{name:"app_store",storage:H1(()=>sessionStorage)}));function q1({app:t,size:e="medium",...r}){var i,o,s,l,a;const n=Iu();return I.jsxs("div",{...r,className:`app-header row ${e} ${r.className||""}`,onClick:()=>n(`/app-details/${xe(t)}`),children:[I.jsx("img",{src:((i=t.metadata)==null?void 0:i.image)||"https://png.pngtree.com/png-vector/20190215/ourmid/pngtree-vector-question-mark-icon-png-image_515448.jpg",alt:"app icon"}),I.jsxs("div",{className:"col title",children:[I.jsx("div",{className:"app-name ellipsis",children:((o=t.metadata)==null?void 0:o.name)||xe(t)}),((s=t.metadata)==null?void 0:s.subtitle)&&I.jsx("div",{className:"ellipsis",children:(a=(l=t.metadata)==null?void 0:l.subtitle)==null?void 0:a.slice(0,100)})]})]})}const Qk=({show:t,hide:e,hideClose:r=!1,title:n,...i})=>{const o=s=>{s.stopPropagation()};return t?I.jsx("div",{className:`modal-backdrop ${t?"show":""}`,onClick:e,children:I.jsxs("div",{...i,className:`col modal ${i.className||""}`,onClick:o,children:[!!n&&I.jsx("h3",{className:"modal-title",children:n}),!r&&I.jsx(Lk,{className:"close",onClick:e}),I.jsx("div",{className:"col modal-content",onClick:o,children:i.children})]})}):null};function Ed({msg:t}){return I.jsxs("div",{id:"loading",className:"col center",children:[I.jsx("h3",{children:t}),I.jsxs("div",{id:"loader",children:[" ",I.jsx("div",{})," ",I.jsx("div",{})," ",I.jsx("div",{})," ",I.jsx("div",{})," "]})]})}function W1({app:t,...e}){var $,H,ie,X,G;const{updateApp:r,downloadApp:n,installApp:i,getCaps:o,getMyApp:s}=Qo(),[l,a]=L.useState(!1),[u,c]=L.useState(((H=($=t.metadata)==null?void 0:$.mirrors)==null?void 0:H[0])||""),[d,p]=L.useState([]),[v,g]=L.useState(""),{clean:x,installed:k,downloaded:E,updatable:w}=L.useMemo(()=>{var A,N,b,M,R;const J=((A=t.metadata)==null?void 0:A.versions)&&((b=t.metadata)==null?void 0:b.versions[((N=t.metadata)==null?void 0:N.versions.length)-1]),C=t.installed,f=!!t.state,m=!!((M=t.state)!=null&&M.our_version&&J)&&((R=t.state)==null?void 0:R.our_version)!==J&&t.publisher!==window.our.node;return{clean:!C&&!f&&!m,installed:C,downloaded:f,updatable:m}},[t]),_=L.useCallback(async()=>{k&&!w?window.alert("App is installed"):(E&&o(t).then(J=>{p(J.request_capabilities)}),a(!0))},[t,k,E,w,a,o]),O=L.useCallback(async()=>{try{g(`Downloading ${cs(t)}...`),await n(t);const J=setInterval(()=>{s(t).then(()=>{g(""),a(!1),clearInterval(J)}).catch(console.log)},2e3)}catch(J){console.error(J),window.alert(`Failed to download app from ${u}, please try a different mirror.`),g("")}},[u,t,n,s]),B=L.useCallback(async()=>{try{g(`Installing ${cs(t)}...`),await i(t);const J=setInterval(()=>{s(t).then(C=>{C.installed&&(g(""),a(!1),clearInterval(J))}).catch(console.log)},2e3)}catch(J){console.error(J),window.alert("Failed to install, please try again."),g("")}},[t,i,s]),j=L.useCallback(async()=>{try{g(`Updating ${cs(t)}...`),await r(t);const J=setInterval(()=>{s(t).then(C=>{C.installed&&(g(""),a(!1),clearInterval(J))}).catch(console.log)},2e3)}catch(J){console.error(J),window.alert("Failed to update, please try again."),g("")}},[t,r,s]);return I.jsxs(I.Fragment,{children:[I.jsx("button",{...e,type:"button",className:`unstyled action-btn ${e.className||""}`,onClick:_,children:k&&w?"Update":k?"Installed":E?"Install":"Download"}),I.jsx(Qk,{show:l,hide:()=>a(!1),children:v?I.jsx(Ed,{msg:v}):x?I.jsxs(I.Fragment,{children:[I.jsxs("h3",{children:["Download ",(ie=t.metadata)==null?void 0:ie.name,"?"]}),I.jsx("h4",{style:{margin:0},children:"Select Mirror"}),I.jsx("select",{style:{margin:"1em 0"},value:u,onChange:J=>c(J.target.value),children:(G=(X=t.metadata)==null?void 0:X.mirrors)==null?void 0:G.map(J=>I.jsx("option",{value:J,children:J},J))}),I.jsx("button",{type:"button",onClick:O,children:"Download"})]}):E?I.jsxs(I.Fragment,{children:[I.jsx("h3",{children:"Approve App Permissions"}),I.jsxs("h4",{style:{margin:0},children:[cs(t)," needs the following permissions:"]}),I.jsx("ul",{className:"col",style:{margin:"1em 0",alignItems:"flex-start"},children:d.map(J=>I.jsx("li",{children:J},J))}),I.jsx("button",{type:"button",onClick:B,children:"Approve & Install"})]}):I.jsxs(I.Fragment,{children:[I.jsx("h3",{children:"Approve App Permissions"}),I.jsxs("h4",{style:{margin:0},children:[cs(t)," needs the following permissions:"]}),I.jsx("br",{}),I.jsx("ul",{className:"col",style:{margin:"1em 0",alignItems:"flex-start"},children:d.map(J=>I.jsx("li",{children:J},J))}),I.jsx("button",{type:"button",onClick:j,children:"Approve & Update"})]})})]})}const G1=t=>!!t&&t[0]==="o",bm=Qs.unstable_batchedUpdates||(t=>t()),Vi=(t,e,r=1e-4)=>Math.abs(t-e)t===!0||!!(t&&t[e]),hr=(t,e)=>typeof t=="function"?t(e):t,V1="_szhsinMenu",Jk=t=>t[V1],Yk=(t,e)=>Object.defineProperty(e,V1,{value:t}),Ku=(t,e)=>(e&&Object.keys(e).forEach(r=>{const n=t[r],i=e[r];typeof i=="function"&&n?t[r]=(...o)=>{i(...o),n(...o)}:t[r]=i}),t),Xk=t=>{if(typeof t!="string")return{top:0,right:0,bottom:0,left:0};const e=t.trim().split(/\s+/,4).map(parseFloat),r=isNaN(e[0])?0:e[0],n=isNaN(e[1])?r:e[1];return{top:r,right:n,bottom:isNaN(e[2])?r:e[2],left:isNaN(e[3])?n:e[3]}},lf=t=>{for(;t;){if(t=t.parentNode,!t||t===document.body||!t.parentNode)return;const{overflow:e,overflowX:r,overflowY:n}=getComputedStyle(t);if(/auto|scroll|overlay|hidden/.test(e+n+r))return t}};function K1(t,e){return{"aria-disabled":t||void 0,tabIndex:e?0:-1}}function _m(t,e){for(let r=0;rL.useMemo(()=>{const i=e?`${t}__${e}`:t;let o=i;r&&Object.keys(r).forEach(l=>{const a=r[l];a&&(o+=` ${i}--${a===!0?l:`${l}-${a}`}`)});let s=typeof n=="function"?n(r):n;return typeof s=="string"&&(s=s.trim(),s&&(o+=` ${s}`)),o},[t,e,r,n]),Zk="szh-menu-container",Aa="szh-menu",e4="szh-menu-button",t4="arrow",r4="item",Q1=L.createContext(),J1=L.createContext({}),Sm=L.createContext({}),Y1=L.createContext({}),n4=L.createContext({}),jh=L.createContext({}),$r=Object.freeze({ENTER:"Enter",ESC:"Escape",SPACE:" ",HOME:"Home",END:"End",LEFT:"ArrowLeft",RIGHT:"ArrowRight",UP:"ArrowUp",DOWN:"ArrowDown"}),xt=Object.freeze({RESET:0,SET:1,UNSET:2,INCREASE:3,DECREASE:4,FIRST:5,LAST:6,SET_INDEX:7}),ul=Object.freeze({CLICK:"click",CANCEL:"cancel",BLUR:"blur",SCROLL:"scroll"}),Ms=Object.freeze({FIRST:"first",LAST:"last"}),i4=Object.freeze({entering:"opening",entered:"open",exiting:"closing",exited:"closed"}),af="absolute",o4="presentation",X1="menuitem",km={"aria-hidden":!0,role:X1},s4=Yk("MenuButton",L.forwardRef(function({className:e,isOpen:r,disabled:n,children:i,...o},s){const l=L.useMemo(()=>({open:r}),[r]);return I.jsx("button",{"aria-haspopup":!0,"aria-expanded":r,"aria-disabled":n||void 0,type:"button",disabled:n,...o,ref:s,className:al({block:e4,modifiers:l,className:e}),children:i})})),l4=({className:t,containerRef:e,containerProps:r,children:n,isOpen:i,theming:o,transition:s,onClose:l})=>{const a=ll(s,"item"),u=({key:d})=>{switch(d){case $r.ESC:hr(l,{key:d,reason:ul.CANCEL});break}},c=d=>{i&&!d.currentTarget.contains(d.relatedTarget)&&hr(l,{reason:ul.BLUR})};return I.jsx("div",{...Ku({onKeyDown:u,onBlur:c},r),className:al({block:Zk,modifiers:L.useMemo(()=>({theme:o,itemTransition:a}),[o,a]),className:t}),style:{position:"absolute",...r==null?void 0:r.style},ref:e,children:n})},a4=()=>{let t,e=0;return{toggle:r=>{r?e++:e--,e=Math.max(e,0)},on:(r,n,i)=>{e?t||(t=setTimeout(()=>{t=0,n()},r)):i==null||i()},off:()=>{t&&(clearTimeout(t),t=0)}}},u4=(t,e)=>{const[r,n]=L.useState(),o=L.useRef({items:[],hoverIndex:-1,sorted:!1}).current,s=L.useCallback((a,u)=>{const{items:c}=o;if(!a)o.items=[];else if(u)c.push(a);else{const d=c.indexOf(a);d>-1&&(c.splice(d,1),a.contains(document.activeElement)&&(e.current.focus(),n()))}o.hoverIndex=-1,o.sorted=!1},[o,e]),l=L.useCallback((a,u,c)=>{const{items:d,hoverIndex:p}=o,v=()=>{if(o.sorted)return;const k=t.current.querySelectorAll(".szh-menu__item");d.sort((E,w)=>_m(k,E)-_m(k,w)),o.sorted=!0};let g=-1,x;switch(a){case xt.RESET:break;case xt.SET:x=u;break;case xt.UNSET:x=k=>k===u?void 0:k;break;case xt.FIRST:v(),g=0,x=d[g];break;case xt.LAST:v(),g=d.length-1,x=d[g];break;case xt.SET_INDEX:v(),g=c,x=d[g];break;case xt.INCREASE:v(),g=p,g<0&&(g=d.indexOf(u)),g++,g>=d.length&&(g=0),x=d[g];break;case xt.DECREASE:v(),g=p,g<0&&(g=d.indexOf(u)),g--,g<0&&(g=d.length-1),x=d[g];break}x||(g=-1),n(x),o.hoverIndex=g},[t,o]);return{hoverItem:r,dispatch:l,updateItems:s}},c4=(t,e,r,n)=>{const i=e.current.getBoundingClientRect(),o=t.current.getBoundingClientRect(),s=r===window?{left:0,top:0,right:document.documentElement.clientWidth,bottom:window.innerHeight}:r.getBoundingClientRect(),l=Xk(n),a=g=>g+o.left-s.left-l.left,u=g=>g+o.left+i.width-s.right+l.right,c=g=>g+o.top-s.top-l.top,d=g=>g+o.top+i.height-s.bottom+l.bottom;return{menuRect:i,containerRect:o,getLeftOverflow:a,getRightOverflow:u,getTopOverflow:c,getBottomOverflow:d,confineHorizontally:g=>{let x=a(g);if(x<0)g-=x;else{const k=u(g);k>0&&(g-=k,x=a(g),x<0&&(g-=x))}return g},confineVertically:g=>{let x=c(g);if(x<0)g-=x;else{const k=d(g);k>0&&(g-=k,x=c(g),x<0&&(g-=x))}return g}}},f4=({arrowRef:t,menuY:e,anchorRect:r,containerRect:n,menuRect:i})=>{let o=r.top-n.top-e+r.height/2;const s=t.current.offsetHeight*1.25;return o=Math.max(s,o),o=Math.min(o,i.height-s),o},d4=({anchorRect:t,containerRect:e,menuRect:r,placeLeftorRightY:n,placeLeftX:i,placeRightX:o,getLeftOverflow:s,getRightOverflow:l,confineHorizontally:a,confineVertically:u,arrowRef:c,arrow:d,direction:p,position:v})=>{let g=p,x=n;v!=="initial"&&(x=u(x),v==="anchor"&&(x=Math.min(x,t.bottom-e.top),x=Math.max(x,t.top-e.top-r.height)));let k,E,w;return g==="left"?(k=i,v!=="initial"&&(E=s(k),E<0&&(w=l(o),(w<=0||-E>w)&&(k=o,g="right")))):(k=o,v!=="initial"&&(w=l(k),w>0&&(E=s(i),(E>=0||-E{let o=r.left-n.left-e+r.width/2;const s=t.current.offsetWidth*1.25;return o=Math.max(s,o),o=Math.min(o,i.width-s),o},p4=({anchorRect:t,containerRect:e,menuRect:r,placeToporBottomX:n,placeTopY:i,placeBottomY:o,getTopOverflow:s,getBottomOverflow:l,confineHorizontally:a,confineVertically:u,arrowRef:c,arrow:d,direction:p,position:v})=>{let g=p==="top"?"top":"bottom",x=n;v!=="initial"&&(x=a(x),v==="anchor"&&(x=Math.min(x,t.right-e.left),x=Math.max(x,t.left-e.left-r.width)));let k,E,w;return g==="top"?(k=i,v!=="initial"&&(E=s(k),E<0&&(w=l(o),(w<=0||-E>w)&&(k=o,g="bottom")))):(k=o,v!=="initial"&&(w=l(k),w>0&&(E=s(i),(E>=0||-E{const{menuRect:u,containerRect:c}=a,d=r==="left"||r==="right";let p=d?n:i,v=d?i:n;if(t){const B=l.current;d?p+=B.offsetWidth:v+=B.offsetHeight}const g=s.left-c.left-u.width-p,x=s.right-c.left+p,k=s.top-c.top-u.height-v,E=s.bottom-c.top+v;let w,_;e==="end"?(w=s.right-c.left-u.width,_=s.bottom-c.top-u.height):e==="center"?(w=s.left-c.left-(u.width-s.width)/2,_=s.top-c.top-(u.height-s.height)/2):(w=s.left-c.left,_=s.top-c.top),w+=p,_+=v;const O={...a,anchorRect:s,placeLeftX:g,placeRightX:x,placeLeftorRightY:_,placeTopY:k,placeBottomY:E,placeToporBottomX:w,arrowRef:l,arrow:t,direction:r,position:o};switch(r){case"left":case"right":return d4(O);case"top":case"bottom":default:return p4(O)}},ba=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?L.useLayoutEffect:L.useEffect;function Nm(t,e){typeof t=="function"?t(e):t.current=e}const Uh=(t,e)=>L.useMemo(()=>t?e?r=>{Nm(t,r),Nm(e,r)}:t:e,[t,e]),Pm=-9999,g4=({ariaLabel:t,menuClassName:e,menuStyle:r,arrow:n,arrowProps:i={},anchorPoint:o,anchorRef:s,containerRef:l,containerProps:a,focusProps:u,externalRef:c,parentScrollingRef:d,align:p="start",direction:v="bottom",position:g="auto",overflow:x="visible",setDownOverflow:k,repositionFlag:E,captureFocus:w=!0,state:_,endTransition:O,isDisabled:B,menuItemFocus:j,gap:$=0,shift:H=0,children:ie,onClose:X,...G})=>{const[J,C]=L.useState({x:Pm,y:Pm}),[f,m]=L.useState({}),[A,N]=L.useState(),[b,M]=L.useState(v),[R]=L.useState(a4),[S,h]=L.useReducer(ne=>ne+1,1),{transition:P,boundingBoxRef:te,boundingBoxPadding:y,rootMenuRef:D,rootAnchorRef:U,scrollNodesRef:F,reposition:W,viewScroll:oe,submenuCloseDelay:Y}=L.useContext(jh),{submenuCtx:K,reposSubmenu:Je=E}=L.useContext(Sm),Q=L.useRef(null),le=L.useRef(),Qr=L.useRef(),Te=L.useRef(!1),Ne=L.useRef({width:0,height:0}),Jr=L.useRef(()=>{}),{hoverItem:Pe,dispatch:ce,updateItems:wr}=u4(Q,le),fe=G1(_),Oe=ll(P,"open"),Yr=ll(P,"close"),me=F.current,ze=ne=>{switch(ne.key){case $r.HOME:ce(xt.FIRST);break;case $r.END:ce(xt.LAST);break;case $r.UP:ce(xt.DECREASE,Pe);break;case $r.DOWN:ce(xt.INCREASE,Pe);break;case $r.SPACE:ne.target&&ne.target.className.indexOf(Aa)!==-1&&ne.preventDefault();return;default:return}ne.preventDefault(),ne.stopPropagation()},gn=()=>{_==="closing"&&N(),hr(O)},$e=ne=>{ne.stopPropagation(),R.on(Y,()=>{ce(xt.RESET),le.current.focus()})},He=ne=>{ne.target===ne.currentTarget&&R.off()},Ht=L.useCallback(ne=>{var ot;const ge=s?(ot=s.current)==null?void 0:ot.getBoundingClientRect():o?{left:o.x,right:o.x,top:o.y,bottom:o.y,width:0,height:0}:null;if(!ge)return;me.menu||(me.menu=(te?te.current:lf(D.current))||window);const de=c4(l,Q,me.menu,y);let{arrowX:rt,arrowY:be,x:_e,y:Ct,computedDirection:Me}=m4({arrow:n,align:p,direction:v,gap:$,shift:H,position:g,anchorRect:ge,arrowRef:Qr,positionHelpers:de});const{menuRect:je}=de;let Kt=je.height;if(!ne&&x!=="visible"){const{getTopOverflow:Ve,getBottomOverflow:Ke}=de;let Qt,Ie;const Ue=Ne.current.height,Er=Ke(Ct);if(Er>0||Vi(Er,0)&&Vi(Kt,Ue))Qt=Kt-Er,Ie=Er;else{const ke=Ve(Ct);(ke<0||Vi(ke,0)&&Vi(Kt,Ue))&&(Qt=Kt+ke,Ie=0-ke,Qt>=0&&(Ct-=ke))}Qt>=0?(Kt=Qt,N({height:Qt,overflowAmt:Ie})):N()}n&&m({x:rt,y:be}),C({x:_e,y:Ct}),M(Me),Ne.current={width:je.width,height:Kt}},[n,p,y,v,$,H,g,x,o,s,l,te,D,me]);ba(()=>{fe&&(Ht(),Te.current&&h()),Te.current=fe,Jr.current=Ht},[fe,Ht,Je]),ba(()=>{A&&!k&&(Q.current.scrollTop=0)},[A,k]),ba(()=>wr,[wr]),L.useEffect(()=>{let{menu:ne}=me;if(!fe||!ne)return;if(ne=ne.addEventListener?ne:window,!me.anchors){me.anchors=[];let rt=lf(U&&U.current);for(;rt&&rt!==ne;)me.anchors.push(rt),rt=lf(rt)}let ot=oe;if(me.anchors.length&&ot==="initial"&&(ot="auto"),ot==="initial")return;const ge=()=>{ot==="auto"?bm(()=>Ht(!0)):hr(X,{reason:ul.SCROLL})},de=me.anchors.concat(oe!=="initial"?ne:[]);return de.forEach(rt=>rt.addEventListener("scroll",ge)),()=>de.forEach(rt=>rt.removeEventListener("scroll",ge))},[U,me,fe,X,oe,Ht]);const Le=!!A&&A.overflowAmt>0;L.useEffect(()=>{if(Le||!fe||!d)return;const ne=()=>bm(Ht),ot=d.current;return ot.addEventListener("scroll",ne),()=>ot.removeEventListener("scroll",ne)},[fe,Le,d,Ht]),L.useEffect(()=>{if(typeof ResizeObserver!="function"||W==="initial")return;const ne=new ResizeObserver(([ge])=>{const{borderBoxSize:de,target:rt}=ge;let be,_e;if(de){const{inlineSize:Ct,blockSize:Me}=de[0]||de;be=Ct,_e=Me}else{const Ct=rt.getBoundingClientRect();be=Ct.width,_e=Ct.height}be===0||_e===0||Vi(be,Ne.current.width,1)&&Vi(_e,Ne.current.height,1)||Qs.flushSync(()=>{Jr.current(),h()})}),ot=Q.current;return ne.observe(ot,{box:"border-box"}),()=>ne.unobserve(ot)},[W]),L.useEffect(()=>{if(!fe){ce(xt.RESET),Yr||N();return}const{position:ne,alwaysUpdate:ot}=j||{},ge=()=>{ne===Ms.FIRST?ce(xt.FIRST):ne===Ms.LAST?ce(xt.LAST):ne>=-1&&ce(xt.SET_INDEX,void 0,ne)};if(ot)ge();else if(w){const de=setTimeout(()=>{const rt=Q.current;rt&&!rt.contains(document.activeElement)&&(le.current.focus(),ge())},Oe?170:100);return()=>clearTimeout(de)}},[fe,Oe,Yr,w,j,ce]);const qe=L.useMemo(()=>({isParentOpen:fe,submenuCtx:R,dispatch:ce,updateItems:wr}),[fe,R,ce,wr]);let Rr,Ce;A&&(k?Ce=A.overflowAmt:Rr=A.height);const We=L.useMemo(()=>({reposSubmenu:S,submenuCtx:R,overflow:x,overflowAmt:Ce,parentMenuRef:Q,parentDir:b}),[S,R,x,Ce,b]),vn=Rr>=0?{maxHeight:Rr,overflow:x}:void 0,Be=L.useMemo(()=>({state:_,dir:b}),[_,b]),Ge=L.useMemo(()=>({dir:b}),[b]),yn=al({block:Aa,element:t4,modifiers:Ge,className:i.className}),De=I.jsxs("ul",{role:"menu","aria-label":t,...K1(B),...Ku({onPointerEnter:K==null?void 0:K.off,onPointerMove:$e,onPointerLeave:He,onKeyDown:ze,onAnimationEnd:gn},G),ref:Uh(c,Q),className:al({block:Aa,modifiers:Be,className:e}),style:{...r,...vn,margin:0,display:_==="closed"?"none":void 0,position:af,left:J.x,top:J.y},children:[I.jsx("li",{tabIndex:-1,style:{position:af,left:0,top:0,display:"block",outline:"none"},ref:le,...km,...u}),n&&I.jsx("li",{...km,...i,className:yn,style:{display:"block",position:af,left:f.x,top:f.y,...i.style},ref:Qr}),I.jsx(Sm.Provider,{value:We,children:I.jsx(J1.Provider,{value:qe,children:I.jsx(Q1.Provider,{value:Pe,children:hr(ie,Be)})})})]});return a?I.jsx(l4,{...a,isOpen:fe,children:De}):De},v4=L.forwardRef(function({"aria-label":e,className:r,containerProps:n,initialMounted:i,unmountOnClose:o,transition:s,transitionTimeout:l,boundingBoxRef:a,boundingBoxPadding:u,reposition:c="auto",submenuOpenDelay:d=300,submenuCloseDelay:p=150,viewScroll:v="initial",portal:g,theming:x,onItemClick:k,...E},w){const _=L.useRef(null),O=L.useRef({}),{anchorRef:B,state:j,onClose:$}=E,H=L.useMemo(()=>({initialMounted:i,unmountOnClose:o,transition:s,transitionTimeout:l,boundingBoxRef:a,boundingBoxPadding:u,rootMenuRef:_,rootAnchorRef:B,scrollNodesRef:O,reposition:c,viewScroll:v,submenuOpenDelay:d,submenuCloseDelay:p}),[i,o,s,l,B,a,u,c,v,d,p]),ie=L.useMemo(()=>({handleClick(G,J){G.stopPropagation||hr(k,G);let C=G.keepOpen;C===void 0&&(C=J&&G.key===$r.SPACE),C||hr($,{value:G.value,key:G.key,reason:ul.CLICK})},handleClose(G){hr($,{key:G,reason:ul.CLICK})}}),[k,$]);if(!j)return null;const X=I.jsx(jh.Provider,{value:H,children:I.jsx(Y1.Provider,{value:ie,children:I.jsx(g4,{...E,ariaLabel:e||"Menu",externalRef:w,containerRef:_,containerProps:{className:r,containerRef:_,containerProps:n,theming:x,transition:s,onClose:$}})})});return g===!0&&typeof document<"u"?Qs.createPortal(X,document.body):g?g.target?Qs.createPortal(X,g.target):g.stablePosition?null:X:X}),xd=0,Ad=1,au=2,uu=3,cu=4,y4=5,Z1=6,w4=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],ew=t=>({_s:t,status:w4[t],isEnter:tcu}),bd=t=>t?Z1:y4,E4=(t,e)=>{switch(t){case Ad:case xd:return au;case cu:case uu:return bd(e)}},x4=t=>typeof t=="object"?[t.enter,t.exit]:[t,t],A4=(t,e)=>setTimeout(()=>{isNaN(document.body.offsetTop)||t(e+1)},0),Cm=(t,e,r,n,i)=>{clearTimeout(n.current);const o=ew(t);e(o),r.current=o,i&&i({current:o})},b4=({enter:t=!0,exit:e=!0,preEnter:r,preExit:n,timeout:i,initialEntered:o,mountOnEnter:s,unmountOnExit:l,onStateChange:a}={})=>{const[u,c]=L.useState(()=>ew(o?au:bd(s))),d=L.useRef(u),p=L.useRef(),[v,g]=x4(i),x=L.useCallback(()=>{const E=E4(d.current._s,l);E&&Cm(E,c,d,p,a)},[a,l]),k=L.useCallback(E=>{const w=O=>{switch(Cm(O,c,d,p,a),O){case Ad:v>=0&&(p.current=setTimeout(x,v));break;case cu:g>=0&&(p.current=setTimeout(x,g));break;case xd:case uu:p.current=A4(w,O);break}},_=d.current.isEnter;typeof E!="boolean"&&(E=!_),E?!_&&w(t?r?xd:Ad:au):_&&w(e?n?uu:cu:bd(l))},[x,a,t,e,r,n,v,g,l]);return L.useEffect(()=>()=>clearTimeout(p.current),[]),[u,k,x]},_4=({initialOpen:t,initialMounted:e,unmountOnClose:r,transition:n,transitionTimeout:i=500}={})=>{const[{status:o},s,l]=b4({initialEntered:t,mountOnEnter:!e,unmountOnExit:r,timeout:i,enter:ll(n,"open"),exit:ll(n,"close")});return[{state:i4[o],endTransition:l},s]},S4=t=>{const[e,r]=_4(t),[n,i]=L.useState(),o=(s,l)=>{i({position:s,alwaysUpdate:l}),r(!0)};return[{menuItemFocus:n,...e},r,o]},k4=(t,e)=>{const[r]=L.useState({});return{onMouseDown:()=>{r.v=t&&t!=="closed"},onClick:n=>r.v?r.v=!1:e(!0,n)}},N4=(t,e)=>{const r=L.useRef(e);L.useEffect(()=>{r.current!==e&&hr(t,{open:e}),r.current=e},[t,e])},P4=L.forwardRef(function({"aria-label":e,captureFocus:r,initialOpen:n,menuButton:i,instanceRef:o,onMenuChange:s,...l},a){const[u,c,d]=S4(l),{state:p}=u,v=G1(p),g=L.useRef(null),x=k4(p,(B,j)=>d(j.detail?void 0:Ms.FIRST)),k=L.useCallback(B=>{c(!1),B.key&&g.current.focus()},[c]),E=B=>{switch(B.key){case $r.UP:d(Ms.LAST);break;case $r.DOWN:d(Ms.FIRST);break;default:return}B.preventDefault()},w=hr(i,{open:v});if(!w||!w.type)throw new Error("Menu requires a menuButton prop.");const _={ref:Uh(w.ref,g),...Ku({onKeyDown:E,...x},w.props)};Jk(w.type)==="MenuButton"&&(_.isOpen=v);const O=L.cloneElement(w,_);return N4(s,v),L.useImperativeHandle(o,()=>({openMenu:d,closeMenu:()=>c(!1)})),I.jsxs(L.Fragment,{children:[O,I.jsx(v4,{...l,...u,"aria-label":e||(typeof w.props.children=="string"?w.props.children:"Menu"),anchorRef:g,ref:a,onClose:k})]})}),C4=(t,e)=>{const r=L.memo(e),n=L.forwardRef((i,o)=>{const s=L.useRef(null);return I.jsx(r,{...i,itemRef:s,externalRef:o,isHovering:L.useContext(Q1)===s.current})});return n.displayName=`WithHovering(${t})`,n},M4=(t,e,r)=>{ba(()=>{if(t)return;const n=e.current;return r(n,!0),()=>{r(n)}},[t,e,r])},I4=(t,e,r,n)=>{const{submenuCloseDelay:i}=L.useContext(jh),{isParentOpen:o,submenuCtx:s,dispatch:l,updateItems:a}=L.useContext(J1),u=()=>{!r&&!n&&l(xt.SET,t.current)},c=()=>{!n&&l(xt.UNSET,t.current)},d=g=>{r&&!g.currentTarget.contains(g.relatedTarget)&&c()},p=g=>{n||(g.stopPropagation(),s.on(i,u,u))},v=(g,x)=>{s.off(),!x&&c()};return M4(n,t,a),L.useEffect(()=>{r&&o&&e.current&&e.current.focus()},[e,r,o]),{setHover:u,onBlur:d,onPointerMove:p,onPointerLeave:v}},Ki=C4("MenuItem",function({className:e,value:r,href:n,type:i,checked:o,disabled:s,children:l,onClick:a,isHovering:u,itemRef:c,externalRef:d,...p}){const v=!!s,{setHover:g,...x}=I4(c,c,u,v),k=L.useContext(Y1),E=L.useContext(n4),w=i==="radio",_=i==="checkbox",O=!!n&&!v&&!w&&!_,B=w?E.value===r:_?!!o:!1,j=G=>{if(v){G.stopPropagation(),G.preventDefault();return}const J={value:r,syntheticEvent:G};G.key!==void 0&&(J.key=G.key),_&&(J.checked=!B),w&&(J.name=E.name),hr(a,J),w&&hr(E.onRadioChange,J),k.handleClick(J,_||w)},$=G=>{if(u)switch(G.key){case $r.ENTER:G.preventDefault();case $r.SPACE:O?c.current.click():j(G)}},H=L.useMemo(()=>({type:i,disabled:v,hover:u,checked:B,anchor:O}),[i,v,u,B,O]),ie=Ku({...x,onPointerDown:g,onKeyDown:$,onClick:j},p),X={role:w?"menuitemradio":_?"menuitemcheckbox":X1,"aria-checked":w||_?B:void 0,...K1(v,u),...ie,ref:Uh(d,c),className:al({block:Aa,element:r4,modifiers:H,className:e}),children:L.useMemo(()=>hr(l,H),[l,H])};return O?I.jsx("li",{role:o4,children:I.jsx("a",{href:n,...X})}):I.jsx("li",{...X})});function Mm({...t}){return I.jsx(P4,{...t,className:"dropdown "+t.className,menuButton:I.jsx(s4,{className:"unstyled",children:I.jsx(Ok,{style:{marginBottom:"-0.125em"}})}),children:t.children})}function R4({app:t}){var s,l,a,u,c;const{uninstallApp:e,setMirroring:r,setAutoUpdate:n}=Qo(),i=Iu();return!t.state?t.metadata?I.jsxs(Mm,{children:[((s=t.metadata)==null?void 0:s.description)&&I.jsx(Ki,{className:"action-entry",onClick:()=>i(`/app-details/${xe(t)}`),children:"View Details"}),((l=t.metadata)==null?void 0:l.website)&&I.jsx(Ki,{children:I.jsx("a",{style:{color:"inherit",whiteSpace:"nowrap",cursor:"pointer",marginTop:"0.25em"},target:"_blank",href:(a=t.metadata)==null?void 0:a.website,children:"View Site"})})]}):I.jsx("div",{style:{width:24}}):I.jsxs(Mm,{children:[I.jsx(Ki,{className:"action-entry",onClick:()=>i(`/app-details/${xe(t)}`),children:"View Details"}),t.installed&&I.jsxs(I.Fragment,{children:[I.jsx(Ki,{className:"action-entry",onClick:()=>e(t),children:"Uninstall"}),I.jsxs(Ki,{className:"action-entry",onClick:()=>{var d;return r(t,!((d=t.state)!=null&&d.mirroring))},children:[(u=t.state)!=null&&u.mirroring?"Stop":"Start"," Mirroring"]}),I.jsxs(Ki,{className:"action-entry",onClick:()=>{var d;return n(t,!((d=t.state)!=null&&d.auto_update))},children:[(c=t.state)!=null&&c.auto_update?"Disable":"Enable"," Auto Update"]})]})]})}function ys({app:t,...e}){var r;return L.createElement("div",{...e,key:xe(t),className:"app-entry row between"},I.jsx(q1,{app:t,size:"small"}),I.jsxs("div",{className:"app-actions row",children:[!((r=t.state)!=null&&r.capsApproved)&&I.jsx(W1,{app:t,style:{marginRight:"1em"}}),I.jsx(R4,{app:t})]}))}const _d="/my-apps";function Qu({value:t="",onChange:e=()=>null,hideSearch:r=!1}){const n=Iu(),i=xh(),o=qr.useRef(null),s=i.key!=="default",l=i.pathname===_d;return I.jsxs("div",{className:"search-header row between",children:[i.pathname!=="/"?I.jsx("button",{className:"back-btn col center",onClick:()=>n(s?-1:"/"),children:I.jsx(Mk,{})}):I.jsx("button",{className:"back-btn col center",onClick:()=>n("/publish"),children:I.jsx(z1,{})}),!r&&I.jsxs("div",{className:"searchbar row",children:[I.jsx(Bk,{className:"search-icon",onClick:()=>{var a;return(a=o.current)==null?void 0:a.focus()}}),I.jsx("input",{ref:o,onChange:a=>e(a.target.value),value:t,placeholder:"Search for apps..."}),t.length>0&&I.jsx(Dk,{className:"search-icon",style:{margin:"0 -0.25em 0 0.25em"},onClick:()=>e("")})]}),I.jsx("div",{className:"row",children:I.jsxs("button",{className:`my-pkg-btn row ${l?"selected":""}`,onClick:()=>n(l?-1:_d),children:[I.jsx(Tk,{style:{marginRight:"0.5em"}}),"My Packages"]})})]})}function T4(t){const{listedApps:e,getListedApps:r}=Qo(),[n,i]=L.useState("Recently published"),[o,s]=L.useState(""),[l,a]=L.useState(e),[u,c]=L.useState(1),d=L.useMemo(()=>Array.from({length:Math.ceil(l.length/10)},(g,x)=>x+1),[l]);L.useEffect(()=>{const g=(u-1)*10,x=g+10;a(e.slice(g,x))},[e]),L.useEffect(()=>{r().then(g=>{a(Object.values(g))}).catch(g=>console.error(g))},[]);const p=L.useCallback(async g=>{},[]),v=L.useCallback(g=>{s(g);const x=e.filter(k=>{var E,w,_,O;return k.package.toLowerCase().includes(g.toLowerCase())||((w=(E=k.metadata)==null?void 0:E.description)==null?void 0:w.toLowerCase().includes(g.toLowerCase()))||((O=(_=k.metadata)==null?void 0:_.description)==null?void 0:O.toLowerCase().includes(g.toLowerCase()))},[e]);a(x)},[e]);return I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{value:o,onChange:v}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"New"}),I.jsxs("select",{value:n,onChange:g=>{i(g.target.value),p(g.target.value)},style:{marginBottom:"-1em"},children:[I.jsx("option",{children:"Recently published"}),I.jsx("option",{children:"Most popular"}),I.jsx("option",{children:"Best rating"}),I.jsx("option",{children:"Recently updated"})]})]}),I.jsxs("div",{className:"new card col",style:{flex:1,overflowY:"scroll"},children:[l.map(g=>{var x;return I.jsx(ys,{app:g},xe(g)+(((x=g.state)==null?void 0:x.our_version)||""))}),d.length>1&&I.jsxs("div",{className:"row",style:{alignSelf:"center"},children:[u!==d[0]&&I.jsx(Ik,{onClick:()=>c(u-1)}),d.map(g=>I.jsx("div",{className:`page-selector ${g===u?"selected":""}`,onClick:()=>c(g),children:g},`page-${g}`)),u!==d[d.length-1]&&I.jsx(Rk,{onClick:()=>c(u+1)})]})]})]})}function O4(t){const{myApps:e,getMyApps:r}=Qo(),n=Iu(),[i,o]=L.useState(""),[s,l]=L.useState(e);L.useEffect(()=>{r().then(l).catch(u=>console.error(u))},[]);const a=L.useCallback(u=>{o(u);const c=Object.keys(e).reduce((d,p)=>(d[p]=e[p].filter(v=>{var g,x,k,E;return v.package.toLowerCase().includes(u.toLowerCase())||((x=(g=v.metadata)==null?void 0:g.description)==null?void 0:x.toLowerCase().includes(u.toLowerCase()))||((E=(k=v.metadata)==null?void 0:k.description)==null?void 0:E.toLowerCase().includes(u.toLowerCase()))}),d),{downloaded:[],installed:[],local:[],system:[]});l(c)},[e]);return I.jsxs("div",{style:{width:"100%",height:"100%"},children:[I.jsx(Qu,{value:i,onChange:a}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"My Packages"}),I.jsxs("button",{className:"row",onClick:()=>n("/publish"),children:[I.jsx(z1,{style:{marginRight:"0.5em"}}),"Publish Package"]})]}),I.jsx("div",{className:"my-apps-list",children:I.jsxs("div",{className:"new card col",children:[I.jsx("h3",{children:"Downloaded"}),(s.downloaded||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"Installed"}),(s.installed||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"Local"}),(s.local||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"System"}),(s.system||[]).map(u=>I.jsx(ys,{app:u},xe(u)))]})})]})}function L4(t){var u,c,d,p,v,g,x,k;const{myApps:e,listedApps:r,getListedApp:n}=Qo(),i=lx(),[o,s]=L.useState(void 0);L.useEffect(()=>{const E=e.local.find(w=>xe(w)===i.id);if(E)return s(E);if(i.id){const w=r.find(_=>xe(_)===i.id);w?s(w):n(i.id).then(_=>s(_)).catch(console.error)}},[i.id]);const l=L.useMemo(()=>{var E;return((E=o==null?void 0:o.metadata)==null?void 0:E.version)||"Unknown"},[o]),a=((u=o==null?void 0:o.state)==null?void 0:u.our_version)||((v=(c=o==null?void 0:o.metadata)==null?void 0:c.versions)==null?void 0:v[(((p=(d=o==null?void 0:o.metadata)==null?void 0:d.versions)==null?void 0:p.length)||1)-1])||"";return I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{value:"",onChange:()=>null,hideSearch:!0}),I.jsx("div",{className:"card",style:{marginTop:"1em"},children:o?I.jsxs(I.Fragment,{children:[I.jsxs("div",{className:"row between",children:[I.jsx(q1,{app:o,size:"large"}),I.jsx(W1,{app:o,style:{marginRight:"0.5em"}})]}),I.jsxs("div",{className:"col",style:{marginTop:"1em"},children:[I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Description"}),I.jsx("div",{className:"value",children:(((g=o.metadata)==null?void 0:g.description)||"No description given").slice(0,2e3)})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Publisher"}),I.jsx("div",{className:"value underline",children:o.publisher})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Version"}),I.jsx("div",{className:"value",children:l})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Mirrors"}),I.jsx("div",{className:"col",children:(((x=o.metadata)==null?void 0:x.mirrors)||[]).map((E,w)=>I.jsx("div",{className:"value underline",children:E},w+E))})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Hash"}),I.jsx("div",{className:"value",style:{wordBreak:"break-all"},children:a})]})]}),I.jsx("div",{className:"app-screenshots row",children:(((k=o.metadata)==null?void 0:k.screenshots)||[]).map((E,w)=>I.jsx("img",{src:E},w+E))})]}):I.jsxs(I.Fragment,{children:[I.jsx("h3",{children:"App details not found for "}),I.jsx("h3",{children:i.id})]})})]})}var _a=(t=>(t[t.SEPOLIA=11155111]="SEPOLIA",t[t.OPTIMISM=10]="OPTIMISM",t[t.OPTIMISM_GOERLI=420]="OPTIMISM_GOERLI",t[t.LOCAL=1337]="LOCAL",t))(_a||{});const fu="0xaa36a7",Im="0xa",Rm={11155111:"0x18c39eB547A0060C6034f8bEaFB947D1C16eADF1"},B4="4902",Tm={[fu]:{chainId:fu,chainName:"Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:["https://rpc.sepolia.org"],blockExplorerUrls:["https://sepolia.etherscan.io"]},[Im]:{chainId:Im,chainName:"Optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:["https://mainnet.optimism.io"],blockExplorerUrls:["https://optimistic.etherscan.io"]}},D4=t=>{switch(t){case"1":case"0x1":return"Ethereum";case"10":case"a":case"0xa":return"Optimism";case"42161":return"Arbitrum";case"11155111":case"aa36a7":case"0xaa36a7":return"Sepolia";default:return"Unknown"}},Om=async t=>{var r,n,i;let e=await((r=window.ethereum)==null?void 0:r.request({method:"net_version"}).catch(()=>"1"));if(e="0x"+(typeof e=="string"?e.replace(/^0x/,""):e.toString(16)),!Tm[t]){console.error(`Invalid chain ID: ${t}`);return}if(t!==e)try{await((n=window.ethereum)==null?void 0:n.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}))}catch(o){if(String(o).includes(B4))await((i=window.ethereum)==null?void 0:i.request({method:"wallet_addEthereumChain",params:[Tm[t]]}));else throw window.alert(`You must enable the ${D4(t)} network in your wallet.`),new Error(`User cancelled connection to ${t}`)}};var cl={},Ju={};Object.defineProperty(Ju,"__esModule",{value:!0});Ju.Connector=void 0;class j4{constructor(e,r){this.actions=e,this.onError=r}resetState(){this.actions.resetState()}}Ju.Connector=j4;var uf,Lm;function U4(){if(Lm)return uf;Lm=1;function t({mustBeMetaMask:e=!1,silent:r=!1,timeout:n=3e3}={}){o();let i=!1;return new Promise(s=>{window.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout(()=>{l()},n));function l(){if(i)return;i=!0,window.removeEventListener("ethereum#initialized",l);const{ethereum:a}=window;a&&(!e||a.isMetaMask)?s(a):(!r&&console.error("@metamask/detect-provider:",e&&a?"Non-MetaMask window.ethereum detected.":"Unable to detect window.ethereum."),s(null))}});function o(){if(typeof e!="boolean")throw new Error("@metamask/detect-provider: Expected option 'mustBeMetaMask' to be a boolean.");if(typeof r!="boolean")throw new Error("@metamask/detect-provider: Expected option 'silent' to be a boolean.");if(typeof n!="number")throw new Error("@metamask/detect-provider: Expected option 'timeout' to be a number.")}}return uf=t,uf}var F4=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z4=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$4=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&F4(e,t,r);return z4(e,t),e},Qi=Fe&&Fe.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(cl,"__esModule",{value:!0});var tw=cl.MetaMask=cl.NoMetaMaskError=void 0;const H4=Ju;class fl extends Error{constructor(){super("MetaMask not installed"),this.name=fl.name,Object.setPrototypeOf(this,fl.prototype)}}cl.NoMetaMaskError=fl;function Zl(t){return Number.parseInt(t,16)}class q4 extends H4.Connector{constructor({actions:e,options:r,onError:n}){super(e,n),this.options=r}isomorphicInitialize(){return Qi(this,void 0,void 0,function*(){if(!this.eagerConnection)return this.eagerConnection=Promise.resolve().then(()=>$4(U4())).then(e=>Qi(this,void 0,void 0,function*(){var r,n;const i=yield e.default(this.options);i&&(this.provider=i,!((r=this.provider.providers)===null||r===void 0)&&r.length&&(this.provider=(n=this.provider.providers.find(o=>o.isMetaMask))!==null&&n!==void 0?n:this.provider.providers[0]),this.provider.on("connect",({chainId:o})=>{this.actions.update({chainId:Zl(o)})}),this.provider.on("disconnect",o=>{var s;if(o.code===1013){console.debug('MetaMask logged connection error 1013: "Try again later"');return}this.actions.resetState(),(s=this.onError)===null||s===void 0||s.call(this,o)}),this.provider.on("chainChanged",o=>{this.actions.update({chainId:Zl(o)})}),this.provider.on("accountsChanged",o=>{o.length===0?this.actions.resetState():this.actions.update({accounts:o})}))}))})}connectEagerly(){return Qi(this,void 0,void 0,function*(){const e=this.actions.startActivation();try{if(yield this.isomorphicInitialize(),!this.provider)return e();const r=yield this.provider.request({method:"eth_accounts"});if(!r.length)throw new Error("No accounts returned");const n=yield this.provider.request({method:"eth_chainId"});this.actions.update({chainId:Zl(n),accounts:r})}catch(r){console.debug("Could not connect eagerly",r),this.actions.resetState()}})}activate(e){var r,n;return Qi(this,void 0,void 0,function*(){let i;return!((n=(r=this.provider)===null||r===void 0?void 0:r.isConnected)===null||n===void 0)&&n.call(r)||(i=this.actions.startActivation()),this.isomorphicInitialize().then(()=>Qi(this,void 0,void 0,function*(){if(!this.provider)throw new fl;const o=yield this.provider.request({method:"eth_requestAccounts"}),s=yield this.provider.request({method:"eth_chainId"}),l=Zl(s),a=typeof e=="number"?e:e==null?void 0:e.chainId;if(!a||l===a)return this.actions.update({chainId:l,accounts:o});const u=`0x${a.toString(16)}`;return this.provider.request({method:"wallet_switchEthereumChain",params:[{chainId:u}]}).catch(c=>{var d,p;if((((p=(d=c.data)===null||d===void 0?void 0:d.originalError)===null||p===void 0?void 0:p.code)||c.code)===4902&&typeof e!="number"){if(!this.provider)throw new Error("No provider");return this.provider.request({method:"wallet_addEthereumChain",params:[Object.assign(Object.assign({},e),{chainId:u})]})}throw c}).then(()=>this.activate(a))})).catch(o=>{throw i==null||i(),o})})}watchAsset({address:e,symbol:r,decimals:n,image:i}){return Qi(this,void 0,void 0,function*(){if(!this.provider)throw new Error("No provider");return this.provider.request({method:"wallet_watchAsset",params:{type:"ERC20",options:{address:e,symbol:r,decimals:n,image:i}}}).then(o=>{if(!o)throw new Error("Rejected");return!0})})}}tw=cl.MetaMask=q4;const[rw,Fh]=qu.initializeConnector(t=>new tw({actions:t}));function W4(t){const e=t.split("."),r=new Uint8Array(t.length+e.length);let n=0;for(const i of e){const o=i.length;r[n]=o,n++;for(let s=0;si.toString(16).padStart(2,"0")).join("")}`}const{useIsActivating:G4}=Fh;function V4({provider:t,packageAbi:e}){var X;const{listedApps:r}=Qo(),{account:n,isActive:i}=qu.useWeb3React(),o=G4(),[s,l]=L.useState(""),[a,u]=L.useState(),[c,d]=L.useState(!1),[p,v]=L.useState(""),[g,x]=L.useState(((X=window.our)==null?void 0:X.node)||""),[k,E]=L.useState(""),[w,_]=L.useState(""),[O,B]=L.useState(!1),j=L.useCallback(async()=>{await rw.activate().catch(()=>{});try{Om(fu)}catch(G){console.error(G)}},[]),$=L.useCallback(async()=>{if(!k){_("");return}try{const J=await(await fetch(k)).text();JSON.parse(J);const C=ut(mr(J));_(C)}catch{window.alert("Error calculating metadata hash. Please ensure the URL is valid and the metadata is in JSON format.")}},[k]),H=L.useCallback(async G=>{var C;G.preventDefault(),G.stopPropagation();let J=w;try{if(!J){const A=await fetch(k);await A.json();const N=await A.text();J=ut(mr(N))}l("Please confirm the transaction in your wallet");const f=W4(g);await Om(fu);const m=await(O?e.updateMetadata(V.from(mS(["string","bytes"],[p,f])),k,J):e.registerApp(p,f,k,J));await new Promise(A=>setTimeout(A,2e3)),l("Publishing package..."),await m.wait(),u({packageName:p,publisherId:g}),v(""),x(((C=window.our)==null?void 0:C.node)||g),E(""),_(""),B(!1)}catch(f){console.error(f),window.alert("Error publishing package. Please ensure the package name and publisher ID are valid, and the metadata is in JSON format.")}finally{l("")}},[p,O,g,k,w,e,u,v,x,E,_,B]),ie=L.useCallback(async()=>{O||p&&g&&r.find(G=>G.package===p&&G.publisher===g)&&B(!0)},[r,p,g,O,B]);return I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{hideSearch:!0}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"Publish Package"}),!!n&&I.jsxs("div",{style:{textAlign:"right",lineHeight:1.5},children:[" ","Connected as"," ",(n==null?void 0:n.slice(0,6))+"..."+(n==null?void 0:n.slice(n.length-6))]})]}),s?I.jsx("div",{className:"col center",children:I.jsx(Ed,{msg:s})}):a?I.jsxs("div",{className:"col center",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"Package Published!"}),I.jsxs("div",{style:{marginBottom:"0.5em"},children:[I.jsx("strong",{children:"Package Name:"})," ",a.packageName]}),I.jsxs("div",{style:{marginBottom:"0.5em"},children:[I.jsx("strong",{children:"Publisher ID:"})," ",a.publisherId]}),I.jsx("button",{className:"my-pkg-btn row",style:{marginTop:"1em"},onClick:()=>u(void 0),children:"Publish Another Package"})]}):!n||!i?I.jsxs(I.Fragment,{children:[I.jsx("h4",{style:{},children:"Please connect your wallet to publish a package"}),I.jsx("button",{className:"my-pkg-btn row",onClick:j,children:"Connect Wallet"})]}):o?I.jsx(Ed,{msg:"Approve connection in your wallet"}):I.jsxs("form",{className:"new card col",style:{flex:1,overflowY:"scroll"},onSubmit:H,children:[I.jsxs("div",{className:"row between",style:{cursor:"pointer",padding:"0.5em",margin:"0 0 0.5em -0.5em"},onClick:()=>B(!O),children:[I.jsx("input",{type:"checkbox",checked:O,readOnly:!0}),I.jsx("label",{htmlFor:"update",style:{cursor:"pointer"},children:"Update existing package"})]}),I.jsxs("div",{className:"col f-width",children:[I.jsx("label",{htmlFor:"package-name",children:"Package Name"}),I.jsx("input",{style:{minWidth:"80%"},id:"package-name",type:"text",required:!0,placeholder:"my-package",value:p,onChange:G=>v(G.target.value),onBlur:ie})]}),I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsx("label",{htmlFor:"publisher-id",children:"Publisher ID"}),I.jsx("input",{style:{minWidth:"80%"},id:"publisher-id",type:"text",required:!0,value:g,onChange:G=>x(G.target.value),onBlur:ie})]}),I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsxs("label",{htmlFor:"metadata-url",children:["Metadata URL",I.jsx("span",{style:{marginLeft:"2em",fontSize:"0.9em",textDecoration:"underline",cursor:"pointer"},onClick:()=>d(!c),children:"What is this?"})]}),c&&I.jsxs("div",{style:{textAlign:"left",marginBottom:"0.5em"},children:["Metadata is a JSON file that describes your package.",I.jsx("br",{})," You can"," ",I.jsx("a",{target:"_blank",href:"https://pongo-uploads.s3.us-east-2.amazonaws.com/sample_metadata.json",children:"download a template here"}),"."]}),I.jsx("input",{style:{minWidth:"80%"},id:"metadata-url",type:"text",required:!0,value:k,onChange:G=>E(G.target.value),onBlur:$,placeholder:"https://my-site/metadata.json"})]}),I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsx("label",{htmlFor:"metadata-hash",children:"Metadata Hash"}),I.jsx("input",{style:{minWidth:"80%"},readOnly:!0,id:"metadata-hash",type:"text",value:w,onChange:G=>_(G.target.value),placeholder:"Calculated automatically from metadata URL"})]}),I.jsx("button",{type:"submit",className:"primary",style:{marginTop:"1em"},children:"Publish"})]})]})}var K4={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Q4=[[rw,Fh]],{useProvider:J4}=Fh,Y4="https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",Is="/main:app_store:sys";window.our&&(window.our.process=Is==null?void 0:Is.replace("/",""));const X4=`${K4.VITE_NODE_URL||"http://localhost:8080"}${Is}`;function Z4(){const t=J4(),[e,r]=L.useState(!0),[n,i]=L.useState(wd.connect(Rm[_a.SEPOLIA],new vi(Y4)));if(L.useEffect(()=>{t==null||t.getNetwork().then(s=>{s.chainId===_a.SEPOLIA&&i(wd.connect(Rm[_a.SEPOLIA],t.getSigner()))})},[t]),L.useEffect(()=>{},[]),!e)return I.jsxs("div",{className:"node-not-connected",children:[I.jsx("h2",{style:{color:"red"},children:"Node not connected"}),I.jsxs("h4",{children:["You need to start a node at ",X4," before you can use this UI in development."]})]});const o={provider:t,packageAbi:n};return I.jsx(qu.Web3ReactProvider,{connectors:Q4,children:I.jsx(_x,{basename:Is,children:I.jsxs(Ax,{children:[I.jsx(ms,{path:"/",element:I.jsx(T4,{...o})}),I.jsx(ms,{path:_d,element:I.jsx(O4,{...o})}),I.jsx(ms,{path:"/app-details/:id",element:I.jsx(L4,{...o})}),I.jsx(ms,{path:"/publish",element:I.jsx(V4,{...o})})]})})})}cf.createRoot(document.getElementById("root")).render(I.jsx(qr.StrictMode,{children:I.jsx(Z4,{})})); diff --git a/kinode/packages/app_store/pkg/ui/index.html b/kinode/packages/app_store/pkg/ui/index.html index 62ed67cd3..7bb3aae70 100644 --- a/kinode/packages/app_store/pkg/ui/index.html +++ b/kinode/packages/app_store/pkg/ui/index.html @@ -18,7 +18,7 @@ content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1.00001, viewport-fit=cover" /> - + From acebc82a5926d6eacabe6c654bf93d2290969091 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Sat, 10 Feb 2024 19:17:23 -0300 Subject: [PATCH 043/171] app_store: allow frontend to select mirror to use via POST body --- .../app_store/app_store/src/http_api.rs | 17 +++++++++++------ kinode/packages/app_store/app_store/src/lib.rs | 4 ++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/kinode/packages/app_store/app_store/src/http_api.rs b/kinode/packages/app_store/app_store/src/http_api.rs index 30bb66e89..d6d24880e 100644 --- a/kinode/packages/app_store/app_store/src/http_api.rs +++ b/kinode/packages/app_store/app_store/src/http_api.rs @@ -235,10 +235,12 @@ fn serve_paths( } Method::POST => { // download an app - // TODO get fields from POST body let pkg_listing: &PackageListing = state .get_listing(&package_id) .ok_or(anyhow::anyhow!("No package"))?; + // from POST body, look for download_from field and use that as the mirror + let body = crate::get_blob()?.bytes; + let body_json: serde_json::Value = serde_json::from_slice(&body)?; let mirrors: &Vec = pkg_listing .metadata .as_ref() @@ -246,11 +248,14 @@ fn serve_paths( .mirrors .as_ref() .ok_or(anyhow::anyhow!("No mirrors for package {package_id}"))?; - // TODO select on FE - let download_from = mirrors - .first() - .ok_or(anyhow::anyhow!("No mirrors for package {package_id}"))?; - // TODO select on FE + let download_from = body_json + .get("download_from") + .ok_or(json!(mirrors.first().ok_or(anyhow::anyhow!( + "No mirrors for package {package_id}" + ))?))? + .as_str() + .ok_or(json!("download_from not a string"))?; + // TODO select on FE? or after download but before install? let mirror = false; let auto_update = false; let desired_version_hash = None; diff --git a/kinode/packages/app_store/app_store/src/lib.rs b/kinode/packages/app_store/app_store/src/lib.rs index 96bb5901f..56b190661 100644 --- a/kinode/packages/app_store/app_store/src/lib.rs +++ b/kinode/packages/app_store/app_store/src/lib.rs @@ -407,7 +407,7 @@ fn handle_receive_download( Some(hash) => { if download_hash != hash { return Err(anyhow::anyhow!( - "app store: downloaded package is not latest version--rejecting download!" + "app store: downloaded package is not desired version--rejecting download! download hash: {download_hash}, desired hash: {hash}" )); } } @@ -422,7 +422,7 @@ fn handle_receive_download( if let Some(latest_hash) = metadata.versions.clone().unwrap_or(vec![]).last() { if &download_hash != latest_hash { return Err(anyhow::anyhow!( - "app store: downloaded package is not latest version--rejecting download!" + "app store: downloaded package is not latest version--rejecting download! download hash: {download_hash}, latest hash: {latest_hash}" )); } } else { From a8b2d3534c438a8c2d68806a15662631970a1aa5 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Sat, 10 Feb 2024 20:21:15 -0300 Subject: [PATCH 044/171] add auto-update, make `update` http action real --- Cargo.lock | 2 +- .../app_store/app_store/src/http_api.rs | 52 +++++++++++++++---- .../packages/app_store/app_store/src/lib.rs | 39 ++++++++++++-- .../packages/app_store/app_store/src/types.rs | 49 ++++++++++++++++- 4 files changed, 125 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 41943ebf7..c7285c74a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3227,7 +3227,7 @@ dependencies = [ [[package]] name = "kit" version = "0.1.0" -source = "git+https://github.com/kinode-dao/kit?rev=25b098f#25b098fab136387065d6058162d33c727d277ab8" +source = "git+https://github.com/kinode-dao/kit?rev=0c43430#0c434306fdce55e11d3309959fc4a0fe6ae28def" dependencies = [ "anyhow", "base64 0.21.7", diff --git a/kinode/packages/app_store/app_store/src/http_api.rs b/kinode/packages/app_store/app_store/src/http_api.rs index d6d24880e..4d52c0772 100644 --- a/kinode/packages/app_store/app_store/src/http_api.rs +++ b/kinode/packages/app_store/app_store/src/http_api.rs @@ -188,8 +188,38 @@ fn serve_paths( } Method::PUT => { // update an app - // TODO - Ok((StatusCode::NO_CONTENT, None, format!("TODO").into_bytes())) + let pkg_listing: &PackageListing = state + .get_listing(&package_id) + .ok_or(anyhow::anyhow!("No package"))?; + let pkg_state: &PackageState = state + .downloaded_packages + .get(&package_id) + .ok_or(anyhow::anyhow!("No package"))?; + let download_from = pkg_state + .mirrored_from + .as_ref() + .ok_or(anyhow::anyhow!("No mirror for package {package_id}"))? + .to_string(); + match crate::start_download( + our, + requested_packages, + &package_id, + &download_from, + pkg_state.mirroring, + pkg_state.auto_update, + &None, + ) { + DownloadResponse::Started => Ok(( + StatusCode::CREATED, + None, + format!("Downloading").into_bytes(), + )), + DownloadResponse::Failure => Ok(( + StatusCode::SERVICE_UNAVAILABLE, + None, + format!("Failed to download").into_bytes(), + )), + } } Method::DELETE => { // uninstall an app @@ -239,8 +269,11 @@ fn serve_paths( .get_listing(&package_id) .ok_or(anyhow::anyhow!("No package"))?; // from POST body, look for download_from field and use that as the mirror - let body = crate::get_blob()?.bytes; - let body_json: serde_json::Value = serde_json::from_slice(&body)?; + let body = crate::get_blob() + .ok_or(anyhow::anyhow!("missing blob"))? + .bytes; + let body_json: serde_json::Value = + serde_json::from_slice(&body).unwrap_or_default(); let mirrors: &Vec = pkg_listing .metadata .as_ref() @@ -250,11 +283,12 @@ fn serve_paths( .ok_or(anyhow::anyhow!("No mirrors for package {package_id}"))?; let download_from = body_json .get("download_from") - .ok_or(json!(mirrors.first().ok_or(anyhow::anyhow!( - "No mirrors for package {package_id}" - ))?))? + .unwrap_or(&json!(mirrors + .first() + .ok_or(anyhow::anyhow!("No mirrors for package {package_id}"))?)) .as_str() - .ok_or(json!("download_from not a string"))?; + .ok_or(anyhow::anyhow!("download_from not a string"))? + .to_string(); // TODO select on FE? or after download but before install? let mirror = false; let auto_update = false; @@ -263,7 +297,7 @@ fn serve_paths( our, requested_packages, &package_id, - download_from, + &download_from, mirror, auto_update, &desired_version_hash, diff --git a/kinode/packages/app_store/app_store/src/lib.rs b/kinode/packages/app_store/app_store/src/lib.rs index 56b190661..a2bde02d7 100644 --- a/kinode/packages/app_store/app_store/src/lib.rs +++ b/kinode/packages/app_store/app_store/src/lib.rs @@ -178,7 +178,7 @@ fn handle_message( if source.node() != our.node() || source.process != "eth:distro:sys" { return Err(anyhow::anyhow!("eth sub event from weird addr: {source}")); } - handle_eth_sub_event(&mut state, e)?; + handle_eth_sub_event(our, &mut state, e)?; } Req::Http(incoming) => { if source.node() != our.node() @@ -187,7 +187,7 @@ fn handle_message( return Err(anyhow::anyhow!("http_server from non-local node")); } if let HttpServerRequest::Http(req) = incoming { - http_api::handle_http_request(&our, &mut state, requested_packages, &req)?; + http_api::handle_http_request(our, &mut state, requested_packages, &req)?; } } }, @@ -269,6 +269,7 @@ fn handle_local_request( our_version, installed: false, caps_approved: true, // TODO see if we want to auto-approve local installs + manifest_hash: None, // generated in the add fn mirroring: *mirror, auto_update: false, // can't auto-update a local package metadata: None, // TODO @@ -436,6 +437,14 @@ fn handle_receive_download( } } + let old_manifest_hash = match state.downloaded_packages.get(&package_id) { + Some(package_state) => package_state + .manifest_hash + .clone() + .unwrap_or("OLD".to_string()), + _ => "OLD".to_string(), + }; + state.add_downloaded_package( &package_id, PackageState { @@ -443,12 +452,28 @@ fn handle_receive_download( our_version: download_hash, installed: false, caps_approved: false, + manifest_hash: None, // generated in the add fn mirroring: requested_package.mirror, auto_update: requested_package.auto_update, metadata: None, // TODO }, Some(blob.bytes), - ) + )?; + + let new_manifest_hash = match state.downloaded_packages.get(&package_id) { + Some(package_state) => package_state + .manifest_hash + .clone() + .unwrap_or("NEW".to_string()), + _ => "NEW".to_string(), + }; + + // lastly, if auto_update is true, AND the caps_hash has NOT changed, + // trigger install! + if requested_package.auto_update && old_manifest_hash == new_manifest_hash { + handle_install(our, state, &package_id)?; + } + Ok(()) } fn handle_ft_worker_result(body: &[u8], context: &[u8]) -> anyhow::Result<()> { @@ -470,11 +495,15 @@ fn handle_ft_worker_result(body: &[u8], context: &[u8]) -> anyhow::Result<()> { Ok(()) } -fn handle_eth_sub_event(state: &mut State, event: EthSubEvent) -> anyhow::Result<()> { +fn handle_eth_sub_event( + our: &Address, + state: &mut State, + event: EthSubEvent, +) -> anyhow::Result<()> { let EthSubEvent::Log(log) = event else { return Err(anyhow::anyhow!("app store: got non-log event")); }; - state.ingest_listings_contract_event(log) + state.ingest_listings_contract_event(our, log) } fn fetch_package_manifest(package: &PackageId) -> anyhow::Result> { diff --git a/kinode/packages/app_store/app_store/src/types.rs b/kinode/packages/app_store/app_store/src/types.rs index 3e9504f6c..c31bc1ad5 100644 --- a/kinode/packages/app_store/app_store/src/types.rs +++ b/kinode/packages/app_store/app_store/src/types.rs @@ -1,3 +1,4 @@ +use crate::LocalRequest; use alloy_rpc_types::Log; use alloy_sol_types::{sol, SolEvent}; use kinode_process_lib::kernel_types as kt; @@ -86,6 +87,7 @@ pub struct PackageState { pub our_version: String, pub installed: bool, pub caps_approved: bool, + pub manifest_hash: Option, /// are we serving this package to others? pub mirroring: bool, /// if we get a listing data update, will we try to download it? @@ -171,7 +173,7 @@ impl State { pub fn add_downloaded_package( &mut self, package_id: &PackageId, - package_state: PackageState, + mut package_state: PackageState, package_bytes: Option>, ) -> anyhow::Result<()> { if let Some(package_bytes) = package_bytes { @@ -215,6 +217,13 @@ impl State { })?) .blob(blob) .send_and_await_response(5)??; + + let manifest_file = vfs::File { + path: format!("/{}/pkg/manifest.json", package_id), + }; + let manifest_bytes = manifest_file.read()?; + let manifest_hash = generate_metadata_hash(&manifest_bytes); + package_state.manifest_hash = Some(manifest_hash); } self.downloaded_packages .insert(package_id.to_owned(), package_state); @@ -296,6 +305,10 @@ impl State { // generate entry from this data // for the version hash, take the SHA-256 hash of the zip file let our_version = generate_version_hash(&zip_file_bytes); + let manifest_file = vfs::File { + path: format!("/{}/pkg/manifest.json", package_id), + }; + let manifest_bytes = manifest_file.read()?; // the user will need to turn mirroring and auto-update back on if they // have to reset the state of their app store for some reason. the apps // themselves will remain on disk unless explicitly deleted. @@ -306,6 +319,7 @@ impl State { our_version, installed: true, caps_approved: true, // since it's already installed this must be true + manifest_hash: Some(generate_metadata_hash(&manifest_bytes)), mirroring: false, auto_update: false, metadata: None, @@ -362,7 +376,11 @@ impl State { } /// only saves state if last_saved_block is more than 1000 blocks behind - pub fn ingest_listings_contract_event(&mut self, log: Log) -> anyhow::Result<()> { + pub fn ingest_listings_contract_event( + &mut self, + our: &Address, + log: Log, + ) -> anyhow::Result<()> { let block_number: u64 = log .block_number .ok_or(anyhow::anyhow!("app store: got log with no block number"))? @@ -454,6 +472,33 @@ impl State { current_listing.metadata_hash = metadata_hash; current_listing.metadata = metadata; + + let package_id = PackageId::new(¤t_listing.name, ¤t_listing.publisher); + + // if we have this app installed, and we have auto_update set to true, + // we should try to download new version from the mirrored_from node + // and install it if successful. + if let Some(package_state) = self.downloaded_packages.get(&package_id) { + if package_state.auto_update { + if let Some(mirrored_from) = &package_state.mirrored_from { + crate::print_to_terminal( + 1, + &format!( + "app store: auto-updating package {package_id} from {mirrored_from}" + ), + ); + Request::to(our) + .body(serde_json::to_vec(&LocalRequest::Download { + package: package_id, + download_from: mirrored_from.clone(), + mirror: package_state.mirroring, + auto_update: package_state.auto_update, + desired_version_hash: None, + })?) + .send()?; + } + } + } } Transfer::SIGNATURE_HASH => { let from = alloy_primitives::Address::from_word(log.topics[1]); From 382b9174ac540081ece240b9d77ee2b611a2a105 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Mon, 12 Feb 2024 12:41:11 -0500 Subject: [PATCH 045/171] timer refactor --- Cargo.lock | 2 +- kinode/src/timer.rs | 77 +++++++++++++++++++++++++-------------------- lib/src/core.rs | 6 ++++ 3 files changed, 50 insertions(+), 35 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 41943ebf7..c7285c74a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3227,7 +3227,7 @@ dependencies = [ [[package]] name = "kit" version = "0.1.0" -source = "git+https://github.com/kinode-dao/kit?rev=25b098f#25b098fab136387065d6058162d33c727d277ab8" +source = "git+https://github.com/kinode-dao/kit?rev=0c43430#0c434306fdce55e11d3309959fc4a0fe6ae28def" dependencies = [ "anyhow", "base64 0.21.7", diff --git a/kinode/src/timer.rs b/kinode/src/timer.rs index 12c62eacf..c6ccb0038 100644 --- a/kinode/src/timer.rs +++ b/kinode/src/timer.rs @@ -1,7 +1,7 @@ use anyhow::Result; use lib::types::core::{ Address, KernelMessage, Message, MessageReceiver, MessageSender, PrintSender, Printout, - Response, TIMER_PROCESS_ID, + Response, TIMER_PROCESS_ID, TimerAction, }; use serde::{Deserialize, Serialize}; @@ -11,8 +11,8 @@ use serde::{Deserialize, Serialize}; /// requests made by other nodes. /// /// The interface of the timer module is as follows: -/// One kind of request is accepted: the IPC must be a little-endian byte-representation -/// of an unsigned 64-bit integer, in milliseconds. This request should always expect a Response. +/// One kind of request is accepted: TimerAction::SetTimer(u64), where the u64 is the time to wait +/// in milliseconds. This request should always expect a Response. /// If the request does not expect a Response, the timer will not be set. /// /// A proper Request will trigger the timer module to send a Response. The Response will be @@ -39,44 +39,53 @@ pub async fn timer_service( // we only handle Requests which contain a little-endian u64 as IPC, // except for a special "debug" message, which prints the current state let Message::Request(req) = km.message else { continue }; - if req.body == "debug".as_bytes() { + let Ok(timer_action) = serde_json::from_slice::(&req.body) else { let _ = print_tx.send(Printout { - verbosity: 0, - content: format!("timer service active timers ({}):", timer_map.timers.len()), + verbosity: 1, + content: "timer service received a request with an invalid body".to_string(), }).await; - for (k, v) in timer_map.timers.iter() { + continue + }; + match timer_action { + TimerAction::Debug => { let _ = print_tx.send(Printout { verbosity: 0, - content: format!("{}: {:?}", k, v), + content: format!("timer service active timers ({}):", timer_map.timers.len()), }).await; + for (k, v) in timer_map.timers.iter() { + let _ = print_tx.send(Printout { + verbosity: 0, + content: format!("{}: {:?}", k, v), + }).await; + } + continue + } + TimerAction::SetTimer(timer_millis) => { + // if the timer is set to pop in 0 millis, we immediately respond + // otherwise, store in our persisted map, and spawn a task that + // sleeps for the given time, then sends the response + let now = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .unwrap() + .as_millis() as u64; + let pop_time = now + timer_millis; + if timer_millis == 0 { + send_response(&our, km.id, km.rsvp.unwrap_or(km.source), &kernel_message_sender).await; + continue + } + let _ = print_tx.send(Printout { + verbosity: 1, + content: format!("set timer to pop in {}ms", timer_millis), + }).await; + if !timer_map.contains(pop_time) { + timer_tasks.spawn(async move { + tokio::time::sleep(std::time::Duration::from_millis(timer_millis - 1)).await; + pop_time + }); + } + timer_map.insert(pop_time, km.id, km.rsvp.unwrap_or(km.source)); } - continue - } - let Ok(bytes): Result<[u8; 8], _> = req.body.try_into() else { continue }; - let timer_millis = u64::from_le_bytes(bytes); - // if the timer is set to pop in 0 millis, we immediately respond - // otherwise, store in our persisted map, and spawn a task that - // sleeps for the given time, then sends the response - let now = std::time::SystemTime::now() - .duration_since(std::time::UNIX_EPOCH) - .unwrap() - .as_millis() as u64; - let pop_time = now + timer_millis; - if timer_millis == 0 { - send_response(&our, km.id, km.rsvp.unwrap_or(km.source), &kernel_message_sender).await; - continue - } - let _ = print_tx.send(Printout { - verbosity: 1, - content: format!("set timer to pop in {}ms", timer_millis), - }).await; - if !timer_map.contains(pop_time) { - timer_tasks.spawn(async move { - tokio::time::sleep(std::time::Duration::from_millis(timer_millis - 1)).await; - pop_time - }); } - timer_map.insert(pop_time, km.id, km.rsvp.unwrap_or(km.source)); } Some(Ok(time)) = timer_tasks.join_next() => { // when a timer pops, we send the response to the process(es) that set diff --git a/lib/src/core.rs b/lib/src/core.rs index f4bbdf2d3..d84504468 100644 --- a/lib/src/core.rs +++ b/lib/src/core.rs @@ -1486,3 +1486,9 @@ impl From> for SqliteError { } } } + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub enum TimerAction { + Debug, + SetTimer(u64), +} From 452676cd26881dfdd59f48be935243c001df2adf Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 12 Feb 2024 17:41:39 +0000 Subject: [PATCH 046/171] Format Rust code using rustfmt --- kinode/src/timer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kinode/src/timer.rs b/kinode/src/timer.rs index c6ccb0038..9b93a1c2a 100644 --- a/kinode/src/timer.rs +++ b/kinode/src/timer.rs @@ -1,7 +1,7 @@ use anyhow::Result; use lib::types::core::{ Address, KernelMessage, Message, MessageReceiver, MessageSender, PrintSender, Printout, - Response, TIMER_PROCESS_ID, TimerAction, + Response, TimerAction, TIMER_PROCESS_ID, }; use serde::{Deserialize, Serialize}; From 6806d84d65f1b1075a2414b1fd7299cb3ae7e238 Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Mon, 12 Feb 2024 16:11:10 -0300 Subject: [PATCH 047/171] eth: better types and errors --- Cargo.lock | 9 +- .../kns_indexer/kns_indexer/Cargo.toml | 3 +- .../kns_indexer/kns_indexer/src/lib.rs | 56 ++++------- kinode/src/eth/provider.rs | 92 ++++++++++++------- lib/src/eth.rs | 39 +++++--- 5 files changed, 107 insertions(+), 92 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d78bec65e..dfc45e4f7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -484,7 +484,7 @@ dependencies = [ "alloy-sol-types 0.5.4", "anyhow", "bincode", - "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=1e14a03)", "rand 0.8.5", "serde", "serde_json", @@ -3398,10 +3398,8 @@ name = "kinode_process_lib" version = "0.5.9" source = "git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha#5e705086bbd10fde89e11d3e3671f6a618a875a7" dependencies = [ - "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy.git?rev=3b1c310)", "anyhow", "bincode", - "ethers-core", "http 1.0.0", "mime_guess", "rand 0.8.5", @@ -3449,7 +3447,7 @@ dependencies = [ [[package]] name = "kinode_process_lib" version = "0.6.0" -source = "git+https://github.com/kinode-dao/process_lib?rev=8d58cfb#8d58cfba0302681b6971cac26ea3f7e49d4602ec" +source = "git+https://github.com/kinode-dao/process_lib?rev=1e14a03#1e14a03e3e274f0bc7f16a08d81c7583589b12be" dependencies = [ "alloy-json-rpc", "alloy-primitives 0.6.2", @@ -3500,12 +3498,11 @@ name = "kns_indexer" version = "0.2.0" dependencies = [ "alloy-primitives 0.6.2", - "alloy-rpc-types 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=098ad56)", "alloy-sol-types 0.6.2", "anyhow", "bincode", "hex", - "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=8d58cfb)", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=1e14a03)", "rmp-serde", "serde", "serde_json", diff --git a/kinode/packages/kns_indexer/kns_indexer/Cargo.toml b/kinode/packages/kns_indexer/kns_indexer/Cargo.toml index f7bfb61be..ccc552c5d 100644 --- a/kinode/packages/kns_indexer/kns_indexer/Cargo.toml +++ b/kinode/packages/kns_indexer/kns_indexer/Cargo.toml @@ -7,11 +7,10 @@ edition = "2021" [dependencies] anyhow = "1.0" alloy-primitives = "0.6.2" -alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "098ad56"} alloy-sol-types = "0.6.2" bincode = "1.3.3" hex = "0.4.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "8d58cfb" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "1e14a03" } rmp-serde = "1.1.2" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/kinode/packages/kns_indexer/kns_indexer/src/lib.rs b/kinode/packages/kns_indexer/kns_indexer/src/lib.rs index 9dbf882fe..a8b370910 100644 --- a/kinode/packages/kns_indexer/kns_indexer/src/lib.rs +++ b/kinode/packages/kns_indexer/kns_indexer/src/lib.rs @@ -1,24 +1,19 @@ -use alloy_primitives::Address as EthAddress; -use alloy_rpc_types::{ - pubsub::{Params, SubscriptionKind, SubscriptionResult}, - BlockNumberOrTag, Filter, Log, -}; use alloy_sol_types::{sol, SolEvent}; use kinode_process_lib::{ await_message, - eth::{get_block_number, get_logs, EthResponse}, + eth::{ + get_block_number, get_logs, Address as EthAddress, BlockNumberOrTag, EthAction, EthMessage, + EthResponse, Filter, Log, Params, SubscriptionKind, SubscriptionResult, + }, get_typed_state, print_to_terminal, println, set_state, Address, Message, Request, Response, }; use serde::{Deserialize, Serialize}; -use std::string::FromUtf8Error; -use std::{ - collections::{ - hash_map::{Entry, HashMap}, - BTreeMap, - }, - str::FromStr, +use std::collections::{ + hash_map::{Entry, HashMap}, + BTreeMap, }; +use std::string::FromUtf8Error; wit_bindgen::generate!({ path: "wit", @@ -28,23 +23,6 @@ wit_bindgen::generate!({ }, }); -//TEMP -#[derive(Debug, Serialize, Deserialize)] -pub enum EthAction { - /// Subscribe to logs with a custom filter. ID is to be used to unsubscribe. - SubscribeLogs { - sub_id: u64, - kind: SubscriptionKind, - params: Params, - }, - /// Kill a SubscribeLogs subscription of a given ID, to stop getting updates. - UnsubscribeLogs(u64), - Request { - method: String, - params: serde_json::Value, - }, -} - #[derive(Clone, Debug, Serialize, Deserialize)] struct State { // what contract this state pertains to @@ -221,10 +199,9 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> { Request::new() .target((&our.node, "eth", "distro", "sys")) - .body(serde_json::to_vec(&EthAction::SubscribeLogs { - sub_id: 8, - kind, - params, + .body(serde_json::to_vec(&EthMessage { + id: 8, + action: EthAction::SubscribeLogs { kind, params }, })?) .send()?; @@ -285,17 +262,16 @@ fn handle_eth_message( pending_requests: &mut BTreeMap>, body: &[u8], ) -> anyhow::Result<()> { - let Ok(res) = serde_json::from_slice::(body) else { + let Ok(res) = serde_json::from_slice::(body) else { return Err(anyhow::anyhow!("kns_indexer: got invalid message")); }; - match res { - EthResponse::Sub { id, result } => match result { - SubscriptionResult::Log(log) => { + match res.action { + EthAction::Sub { result } => { + if let SubscriptionResult::Log(log) = result { handle_log(our, state, &log)?; } - _ => {} - }, + } _ => {} } diff --git a/kinode/src/eth/provider.rs b/kinode/src/eth/provider.rs index 6c6a8cb03..8f8639def 100644 --- a/kinode/src/eth/provider.rs +++ b/kinode/src/eth/provider.rs @@ -87,8 +87,10 @@ pub async fn provider( ) .await { - println!("got error: {:?}", e); - } + let _ = send_to_loop + .send(make_error_message(our.to_string(), km, e)) + .await; + }; }); } Err(anyhow::anyhow!("eth: fatal: message receiver closed!")) @@ -104,30 +106,24 @@ async fn handle_request( public: Arc, ) -> Result<(), EthError> { let Message::Request(req) = &km.message else { - return Err(EthError::ProviderError( + return Err(EthError::InvalidMethod( "eth: only accepts requests".to_string(), )); }; if let Some(provider) = provider.as_ref() { - let action = serde_json::from_slice::(&req.body).map_err(|e| { - EthError::ProviderError(format!("eth: failed to deserialize request: {:?}", e)) + let ethmsg = serde_json::from_slice::(&req.body).map_err(|e| { + EthError::InvalidMethod(format!("eth: failed to deserialize request: {:?}", e)) })?; if !*public && km.source.node != our { - return Err(EthError::ProviderError( - "eth: only accepts requests from apps".to_string(), - )); + return Err(EthError::PermissionDenied("not on the list.".to_string())); } // we might want some of these in payloads.. sub items? - let return_body: EthResponse = match action { - EthAction::SubscribeLogs { - sub_id, - kind, - params, - } => { - let sub_id = (km.target.process.clone(), sub_id); + let return_body: EthResponse = match ethmsg.action { + EthAction::SubscribeLogs { kind, params } => { + let sub_id = (km.target.process.clone(), ethmsg.id); let kind = serde_json::to_value(&kind).unwrap(); let params = serde_json::to_value(¶ms).unwrap(); @@ -136,7 +132,7 @@ async fn handle_request( .inner() .prepare("eth_subscribe", [kind, params]) .await - .unwrap(); + .map_err(|e| EthError::TransportError(e.to_string()))?; let target = km.rsvp.clone().unwrap_or_else(|| Address { node: our.to_string(), @@ -155,8 +151,8 @@ async fn handle_request( connections.insert(sub_id, handle); EthResponse::Ok } - EthAction::UnsubscribeLogs(sub_id) => { - let sub_id = (km.target.process.clone(), sub_id); + EthAction::UnsubscribeLogs => { + let sub_id = (km.target.process.clone(), ethmsg.id); let handle = connections .remove(&sub_id) .ok_or(EthError::SubscriptionNotFound)?; @@ -165,16 +161,20 @@ async fn handle_request( EthResponse::Ok } EthAction::Request { method, params } => { - let method = to_static_str(&method).ok_or(EthError::ProviderError(format!( - "eth: method not found: {}", - method - )))?; + let method = to_static_str(&method).ok_or(EthError::InvalidMethod(method))?; - // throw transportErrorKinds straight back to process - let response: serde_json::Value = - provider.inner().prepare(method, params).await.unwrap(); + let response: serde_json::Value = provider + .inner() + .prepare(method, params) + .await + .map_err(|e| EthError::TransportError(e.to_string()))?; - EthResponse::Request(response) + EthResponse::Response { value: response } + } + EthAction::Sub { .. } => { + return Err(EthError::InvalidMethod( + "eth: provider doesn't accept sub resultss".to_string(), + )) } }; @@ -247,11 +247,12 @@ async fn handle_subscription_stream( Err(e) => { println!("got an error from the subscription stream: {:?}", e); // TODO should we stop the subscription here? - // return Err(EthError::ProviderError(format!("{:?}", e))); + // return Err(EthError::TransportError??(format!("{:?}", e))); } Ok(value) => { - let event: SubscriptionResult = serde_json::from_str(value.get()) - .map_err(|e| EthError::ProviderError(format!("{:?}", e)))?; + let event: SubscriptionResult = serde_json::from_str(value.get()).map_err(|_| { + EthError::RpcError("eth: failed to deserialize subscription result".to_string()) + })?; send_to_loop .send(KernelMessage { id: rand::random(), @@ -264,9 +265,9 @@ async fn handle_subscription_stream( message: Message::Request(Request { inherit: false, expects_response: None, - body: serde_json::to_vec(&EthResponse::Sub { + body: serde_json::to_vec(&EthMessage { id: sub_id, - result: event, + action: EthAction::Sub { result: event }, }) .unwrap(), metadata: None, @@ -278,5 +279,32 @@ async fn handle_subscription_stream( .unwrap(); } } - Err(EthError::SubscriptionClosed) + Err(EthError::SubscriptionClosed(sub_id)) +} + +// todo, always send errors or no? general runtime question for other modules too. +fn make_error_message(our_node: String, km: KernelMessage, error: EthError) -> KernelMessage { + let source = km.rsvp.unwrap_or_else(|| Address { + node: our_node.clone(), + process: km.source.process.clone(), + }); + KernelMessage { + id: km.id, + source: Address { + node: our_node, + process: ETH_PROCESS_ID.clone(), + }, + target: source, + rsvp: None, + message: Message::Response(( + Response { + inherit: false, + body: serde_json::to_vec(&EthResponse::Err(error)).unwrap(), + metadata: None, + capabilities: vec![], + }, + None, + )), + lazy_load_blob: None, + } } diff --git a/lib/src/eth.rs b/lib/src/eth.rs index d70fa7378..696af2e97 100644 --- a/lib/src/eth.rs +++ b/lib/src/eth.rs @@ -1,8 +1,17 @@ use alloy_rpc_types::pubsub::{Params, SubscriptionKind, SubscriptionResult}; use serde::{Deserialize, Serialize}; -/// The Request type that can be made to eth:distro:sys. Currently primitive, this -/// enum will expand to support more actions in the future. +/// The Message type that can be made to eth:distro:sys. The id is used to match the response, +/// if you're not doing send_and_await. +/// +/// Will be serialized and deserialized using `serde_json::to_vec` and `serde_json::from_slice`. +#[derive(Debug, Serialize, Deserialize)] +pub struct EthMessage { + pub id: u64, + pub action: EthAction, +} + +/// The Action and Request type that can be made to eth:distro:sys. /// /// Will be serialized and deserialized using `serde_json::to_vec` and `serde_json::from_slice`. #[derive(Debug, Serialize, Deserialize)] @@ -10,38 +19,44 @@ pub enum EthAction { /// Subscribe to logs with a custom filter. ID is to be used to unsubscribe. /// Logs come in as alloy_rpc_types::pubsub::SubscriptionResults SubscribeLogs { - sub_id: u64, kind: SubscriptionKind, params: Params, }, /// Kill a SubscribeLogs subscription of a given ID, to stop getting updates. - UnsubscribeLogs(u64), + UnsubscribeLogs, /// Raw request. Used by kinode_process_lib. Request { method: String, params: serde_json::Value, }, + /// Incoming subscription update. + Sub { result: SubscriptionResult }, } #[derive(Debug, Serialize, Deserialize)] pub enum EthResponse { Ok, - Request(serde_json::Value), + Response { value: serde_json::Value }, Err(EthError), - Sub { id: u64, result: SubscriptionResult }, } -/// The Response type which a process will get from requesting with an [`EthAction`] will be +/// The Response type which a process will get from requesting with an [`EthMessage`] will be /// of the form `Result<(), EthError>`, serialized and deserialized using `serde_json::to_vec` /// and `serde_json::from_slice`. #[derive(Debug, Serialize, Deserialize)] pub enum EthError { - /// The ethers provider threw an error when trying to subscribe - /// (contains ProviderError serialized to debug string) - ProviderError(String), - SubscriptionClosed, + /// Underlying transport error + TransportError(String), + /// Subscription closed + SubscriptionClosed(u64), /// The subscription ID was not found, so we couldn't unsubscribe. SubscriptionNotFound, + /// Invalid method + InvalidMethod(String), + /// Permission denied + PermissionDenied(String), + /// Internal RPC error + RpcError(String), } // @@ -49,7 +64,7 @@ pub enum EthError { // /// For static lifetimes of method strings. -/// Hopefully replaced asap by alloy-rs network abstraction. +/// Replaced soon by alloy-rs network abstraction. pub fn to_static_str(method: &str) -> Option<&'static str> { match method { "eth_getBalance" => Some("eth_getBalance"), From c8367f2ad7b8ef2efe30db912aa68e28492d6358 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Mon, 12 Feb 2024 14:43:16 -0500 Subject: [PATCH 048/171] metadata reformatted --- Cargo.lock | 2 +- .../app_store/app_store/src/http_api.rs | 9 +++-- .../packages/app_store/app_store/src/lib.rs | 33 ++++++++++-------- .../packages/app_store/app_store/src/types.rs | 34 +++++++++---------- kinode/packages/app_store/pkg/metadata.json | 23 ++++++++----- kinode/packages/chess/pkg/metadata.json | 22 ++++++++---- kinode/packages/homepage/pkg/metadata.json | 21 ++++++++---- kinode/packages/kns_indexer/pkg/metadata.json | 21 ++++++++---- kinode/packages/terminal/pkg/metadata.json | 21 ++++++++---- kinode/packages/tester/pkg/metadata.json | 21 ++++++++---- kinode/src/state.rs | 11 +++--- 11 files changed, 132 insertions(+), 86 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 41943ebf7..c7285c74a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3227,7 +3227,7 @@ dependencies = [ [[package]] name = "kit" version = "0.1.0" -source = "git+https://github.com/kinode-dao/kit?rev=25b098f#25b098fab136387065d6058162d33c727d277ab8" +source = "git+https://github.com/kinode-dao/kit?rev=0c43430#0c434306fdce55e11d3309959fc4a0fe6ae28def" dependencies = [ "anyhow", "base64 0.21.7", diff --git a/kinode/packages/app_store/app_store/src/http_api.rs b/kinode/packages/app_store/app_store/src/http_api.rs index 30bb66e89..004e61711 100644 --- a/kinode/packages/app_store/app_store/src/http_api.rs +++ b/kinode/packages/app_store/app_store/src/http_api.rs @@ -241,11 +241,10 @@ fn serve_paths( .ok_or(anyhow::anyhow!("No package"))?; let mirrors: &Vec = pkg_listing .metadata - .as_ref() - .ok_or(anyhow::anyhow!("No metadata for package {package_id}"))? - .mirrors - .as_ref() - .ok_or(anyhow::anyhow!("No mirrors for package {package_id}"))?; + .as_ref() // Convert Option to Option<&Erc721Metadata> + .and_then(|metadata| metadata.properties.as_ref()) // Convert Option to Option<&Erc721Properties> + .map(|properties| &properties.mirrors) // Access &Vec + .expect("Package does not have mirrors information"); // TODO select on FE let download_from = mirrors .first() diff --git a/kinode/packages/app_store/app_store/src/lib.rs b/kinode/packages/app_store/app_store/src/lib.rs index 96bb5901f..3ef222c58 100644 --- a/kinode/packages/app_store/app_store/src/lib.rs +++ b/kinode/packages/app_store/app_store/src/lib.rs @@ -412,26 +412,29 @@ fn handle_receive_download( } } None => { - // check against latest from listing + // check against `metadata.properties.current_version` let Some(package_listing) = state.get_listing(&package_id) else { return Err(anyhow::anyhow!( "app store: downloaded package cannot be found in manager--rejecting download!" )); }; - if let Some(metadata) = &package_listing.metadata { - if let Some(latest_hash) = metadata.versions.clone().unwrap_or(vec![]).last() { - if &download_hash != latest_hash { - return Err(anyhow::anyhow!( - "app store: downloaded package is not latest version--rejecting download!" - )); - } - } else { - return Err(anyhow::anyhow!( - "app store: downloaded package has no versions in manager--rejecting download!" - )); - } - } else { - println!("app store: warning: downloaded package has no listing metadata to check validity against!") + let Some(metadata) = &package_listing.metadata else { + return Err(anyhow::anyhow!( + "app store: downloaded package has no metadata to check validity against!" + )); + }; + let Some(properties) = &metadata.properties else { + return Err(anyhow::anyhow!("app store: warning: downloaded package has insufficient metadata to check validity against!")); + }; + let Some(latest_hash) = properties.code_hashes.get(&properties.current_version) else { + return Err(anyhow::anyhow!( + "app store: downloaded package has no versions in manager--rejecting download!" + )); + }; + if &download_hash != latest_hash { + return Err(anyhow::anyhow!( + "app store: downloaded package is not latest version--rejecting download!" + )); } } } diff --git a/kinode/packages/app_store/app_store/src/types.rs b/kinode/packages/app_store/app_store/src/types.rs index 3e9504f6c..34c225fa3 100644 --- a/kinode/packages/app_store/app_store/src/types.rs +++ b/kinode/packages/app_store/app_store/src/types.rs @@ -49,22 +49,27 @@ pub struct PackageListing { pub name: String, pub publisher: NodeId, pub metadata_hash: String, - pub metadata: Option, + pub metadata: Option, } /// metadata derived from metadata hash in listing event #[derive(Clone, Debug, Serialize, Deserialize)] -pub struct OnchainPackageMetadata { +pub struct Erc721Metadata { pub name: Option, - pub subtitle: Option, pub description: Option, pub image: Option, - pub version: Option, - pub license: Option, - pub website: Option, - pub screenshots: Option>, - pub mirrors: Option>, - pub versions: Option>, + pub external_url: Option, + pub animation_url: Option, + pub properties: Option, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Erc721Properties { + pub package_name: String, + pub publisher: String, + pub current_version: String, + pub mirrors: Vec, + pub code_hashes: HashMap, } #[derive(Debug, Serialize, Deserialize)] @@ -90,7 +95,7 @@ pub struct PackageState { pub mirroring: bool, /// if we get a listing data update, will we try to download it? pub auto_update: bool, - pub metadata: Option, + pub metadata: Option, } /// this process's saved state @@ -538,10 +543,7 @@ fn dnswire_decode(wire_format_bytes: &[u8]) -> Result anyhow::Result { +fn fetch_metadata(metadata_url: &str, metadata_hash: &str) -> anyhow::Result { let url = url::Url::parse(metadata_url)?; let _response = http::send_request_await_response(http::Method::GET, url, None, 5, vec![])?; let Some(body) = get_blob() else { @@ -549,9 +551,7 @@ fn fetch_metadata( }; let hash = generate_metadata_hash(&body.bytes); if &hash == metadata_hash { - Ok(serde_json::from_slice::( - &body.bytes, - )?) + Ok(serde_json::from_slice::(&body.bytes)?) } else { Err(anyhow::anyhow!( "metadata hash mismatch: got {hash}, expected {metadata_hash}" diff --git a/kinode/packages/app_store/pkg/metadata.json b/kinode/packages/app_store/pkg/metadata.json index ec1a13569..52a7e3a3f 100644 --- a/kinode/packages/app_store/pkg/metadata.json +++ b/kinode/packages/app_store/pkg/metadata.json @@ -1,10 +1,17 @@ { - "package": "app_store", - "publisher": "sys", - "version": [ - 0, - 2, - 0 - ], - "description": "A package manager + app store." + "name": "App Store", + "description": "A package manager + app store.", + "image": "", + "properties": { + "package_name": "app_store", + "current_version": "0.2.0", + "publisher": "sys", + "mirrors": [], + "code_hashes": { + "0.2.0": "", + "0.1.0": "" + } + }, + "external_url": "https://kinode.org", + "animation_url": "" } \ No newline at end of file diff --git a/kinode/packages/chess/pkg/metadata.json b/kinode/packages/chess/pkg/metadata.json index 9d9aa6d4d..d531d6b13 100644 --- a/kinode/packages/chess/pkg/metadata.json +++ b/kinode/packages/chess/pkg/metadata.json @@ -1,9 +1,17 @@ { - "package": "chess", - "publisher": "sys", - "version": [ - 0, - 2, - 0 - ] + "name": "Chess by Kinode", + "description": "A peer-to-peer chess game", + "image": "", + "properties": { + "package_name": "chess", + "current_version": "0.2.0", + "publisher": "sys", + "mirrors": [], + "code_hashes": { + "0.2.0": "", + "0.1.0": "" + } + }, + "external_url": "https://kinode.org", + "animation_url": "" } \ No newline at end of file diff --git a/kinode/packages/homepage/pkg/metadata.json b/kinode/packages/homepage/pkg/metadata.json index c38f170a3..de80df723 100644 --- a/kinode/packages/homepage/pkg/metadata.json +++ b/kinode/packages/homepage/pkg/metadata.json @@ -1,9 +1,16 @@ { - "package": "homepage", - "publisher": "sys", - "version": [ - 0, - 1, - 0 - ] + "name": "Homepage", + "description": "Homepage for Kinode OS", + "image": "", + "properties": { + "package_name": "homepage", + "current_version": "0.1.0", + "publisher": "sys", + "mirrors": [], + "code_hashes": { + "0.1.0": "" + } + }, + "external_url": "https://kinode.org", + "animation_url": "" } \ No newline at end of file diff --git a/kinode/packages/kns_indexer/pkg/metadata.json b/kinode/packages/kns_indexer/pkg/metadata.json index d02df5b8d..bc28db53d 100644 --- a/kinode/packages/kns_indexer/pkg/metadata.json +++ b/kinode/packages/kns_indexer/pkg/metadata.json @@ -1,9 +1,16 @@ { - "package": "kns_indexer", - "publisher": "sys", - "version": [ - 0, - 1, - 0 - ] + "name": "KNS Indexer", + "description": "Kinode OS pki indexer", + "image": "", + "properties": { + "package_name": "kns_indexer", + "current_version": "0.1.0", + "publisher": "sys", + "mirrors": [], + "code_hashes": { + "0.1.0": "" + } + }, + "external_url": "https://kinode.org", + "animation_url": "" } \ No newline at end of file diff --git a/kinode/packages/terminal/pkg/metadata.json b/kinode/packages/terminal/pkg/metadata.json index 9fa3ee4c0..20fd80124 100644 --- a/kinode/packages/terminal/pkg/metadata.json +++ b/kinode/packages/terminal/pkg/metadata.json @@ -1,9 +1,16 @@ { - "package": "terminal", - "publisher": "sys", - "version": [ - 0, - 1, - 0 - ] + "name": "Terminal", + "description": "Default script runner for Kinode OS", + "image": "", + "properties": { + "package_name": "terminal", + "current_version": "0.1.0", + "publisher": "sys", + "mirrors": [], + "code_hashes": { + "0.1.0": "" + } + }, + "external_url": "https://kinode.org", + "animation_url": "" } \ No newline at end of file diff --git a/kinode/packages/tester/pkg/metadata.json b/kinode/packages/tester/pkg/metadata.json index 833592595..9bc832b3a 100644 --- a/kinode/packages/tester/pkg/metadata.json +++ b/kinode/packages/tester/pkg/metadata.json @@ -1,9 +1,16 @@ { - "package": "tester", - "publisher": "sys", - "version": [ - 0, - 1, - 0 - ] + "name": "Tester", + "description": "Package for testing other packages", + "image": "", + "properties": { + "package_name": "tester", + "current_version": "0.1.0", + "publisher": "sys", + "mirrors": [], + "code_hashes": { + "0.1.0": "" + } + }, + "external_url": "https://kinode.org", + "animation_url": "" } \ No newline at end of file diff --git a/kinode/src/state.rs b/kinode/src/state.rs index a4dd06323..b5364fdb5 100644 --- a/kinode/src/state.rs +++ b/kinode/src/state.rs @@ -410,16 +410,17 @@ async fn bootstrap( .read_to_end(&mut metadata_content) .unwrap(); drop(package_metadata_zip); + // TODO this should just deserialize to an ERC721Metadata struct let package_metadata: serde_json::Value = serde_json::from_slice(&metadata_content).expect("fs: metadata parse error"); // println!("fs: found package metadata: {:?}\r", package_metadata); - let package_name = package_metadata["package"] + let package_name = package_metadata["properties"]["package_name"] .as_str() .expect("fs: metadata parse error: bad package name"); - let package_publisher = package_metadata["publisher"] + let package_publisher = package_metadata["properties"]["publisher"] .as_str() .expect("fs: metadata parse error: bad publisher name"); @@ -667,16 +668,16 @@ async fn bootstrap( .read_to_end(&mut metadata_content) .unwrap(); drop(package_metadata_zip); + // TODO deserialize to an ERC721Metadata struct let package_metadata: serde_json::Value = serde_json::from_slice(&metadata_content).expect("fs: metadata parse error"); // println!("fs: found package metadata: {:?}\r", package_metadata); - - let package_name = package_metadata["package"] + let package_name = package_metadata["properties"]["package_name"] .as_str() .expect("fs: metadata parse error: bad package name"); - let package_publisher = package_metadata["publisher"] + let package_publisher = package_metadata["properties"]["publisher"] .as_str() .expect("fs: metadata parse error: bad publisher name"); From 4e1a7980112d4fc2547aa3d306a2631e39c5df6c Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Mon, 12 Feb 2024 17:26:38 -0300 Subject: [PATCH 049/171] app_store: update --- .../packages/app_store/app_store/Cargo.toml | 7 +- .../packages/app_store/app_store/src/lib.rs | 93 ++++++++++++++++--- .../packages/app_store/app_store/src/types.rs | 2 +- 3 files changed, 85 insertions(+), 17 deletions(-) diff --git a/kinode/packages/app_store/app_store/Cargo.toml b/kinode/packages/app_store/app_store/Cargo.toml index f8e18d155..5ea0916c1 100644 --- a/kinode/packages/app_store/app_store/Cargo.toml +++ b/kinode/packages/app_store/app_store/Cargo.toml @@ -5,12 +5,11 @@ edition = "2021" [dependencies] -alloy-primitives = "0.5.1" -alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy.git", rev = "3b1c310" } -alloy-sol-types = "0.5.1" +alloy-primitives = "0.6.2" +alloy-sol-types = "0.6.2" anyhow = "1.0" bincode = "1.3.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.5.9-alpha", features = ["eth"] } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "1e14a03" } rand = "0.8" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/kinode/packages/app_store/app_store/src/lib.rs b/kinode/packages/app_store/app_store/src/lib.rs index 96bb5901f..63e1930d8 100644 --- a/kinode/packages/app_store/app_store/src/lib.rs +++ b/kinode/packages/app_store/app_store/src/lib.rs @@ -1,4 +1,6 @@ -use kinode_process_lib::eth::{EthAction, EthAddress, EthSubEvent, SubscribeLogsRequest}; +use kinode_process_lib::eth::{ + get_logs, Address as EthAddress, EthAction, EthMessage, Filter, Params, SubscriptionResult, +}; use kinode_process_lib::http::{bind_http_path, serve_ui, HttpServerRequest}; use kinode_process_lib::kernel_types as kt; use kinode_process_lib::*; @@ -56,7 +58,7 @@ pub enum Req { RemoteRequest(RemoteRequest), FTWorkerCommand(FTWorkerCommand), FTWorkerResult(FTWorkerResult), - Eth(EthSubEvent), + Eth(EthMessage), Http(HttpServerRequest), } @@ -108,14 +110,51 @@ fn init(our: Address) { let mut requested_packages: HashMap = HashMap::new(); - // subscribe to events on the app store contract - SubscribeLogsRequest::new(1) // subscription id 1 + // get past logs, subscribe to new ones. //todotimeout?errors?//future responses? + // // doing manual send also possible + let filter = Filter::new() .address(EthAddress::from_str(&state.contract_address).unwrap()) .from_block(state.last_saved_block - 1) - .events(EVENTS) + .events(EVENTS); + + let logs = get_logs(filter.clone()); + + if let Ok(logs) = logs { + for log in logs { + state.ingest_listings_contract_event(log); + } + } + + // sub for future logs too. + Request::new() + .target((&our.node, "eth", "distro", "sys")) + .body( + serde_json::to_vec(&EthMessage { + id: 1, + action: EthAction::SubscribeLogs { + kind: eth::SubscriptionKind::Logs, + params: Params::Logs(Box::new(filter)), + }, + }) + .unwrap(), + ) .send() .unwrap(); + // Request::new() + // .target(("our", "eth", "distro", "sys")) + // .body( + // serde_json::to_vec(&EthMessage { + // id: 1, + // action: EthAction::Request { + // method: "eth_getLogs".to_string(), + // params: serde_json::to_value((filter,)).unwrap(), + // }, + // }) + // .unwrap(), + // ) + // .send(); + loop { match await_message() { Err(send_error) => { @@ -178,7 +217,9 @@ fn handle_message( if source.node() != our.node() || source.process != "eth:distro:sys" { return Err(anyhow::anyhow!("eth sub event from weird addr: {source}")); } - handle_eth_sub_event(&mut state, e)?; + if let EthAction::Sub { result } = e.action { + handle_eth_sub_event(&mut state, result)?; + } } Req::Http(incoming) => { if source.node() != our.node() @@ -322,13 +363,41 @@ fn handle_local_request( *state = State::new(CONTRACT_ADDRESS.to_string()).unwrap(); // kill our old subscription and build a new one. Request::to(("our", "eth", "distro", "sys")) - .body(serde_json::to_vec(&EthAction::UnsubscribeLogs(1)).unwrap()) + .body( + serde_json::to_vec(&EthMessage { + id: 1, + action: EthAction::UnsubscribeLogs, + }) + .unwrap(), + ) .send() .unwrap(); - SubscribeLogsRequest::new(1) // subscription id 1 + + let filter = Filter::new() .address(EthAddress::from_str(&state.contract_address).unwrap()) .from_block(state.last_saved_block - 1) - .events(EVENTS) + .events(EVENTS); + + let logs = get_logs(filter.clone()); + + if let Ok(logs) = logs { + for log in logs { + state.ingest_listings_contract_event(log); + } + } + + Request::new() + .target((&our.node, "eth", "distro", "sys")) + .body( + serde_json::to_vec(&EthMessage { + id: 1, + action: EthAction::SubscribeLogs { + kind: eth::SubscriptionKind::Logs, + params: Params::Logs(Box::new(filter)), + }, + }) + .unwrap(), + ) .send() .unwrap(); LocalResponse::RebuiltIndex @@ -470,11 +539,11 @@ fn handle_ft_worker_result(body: &[u8], context: &[u8]) -> anyhow::Result<()> { Ok(()) } -fn handle_eth_sub_event(state: &mut State, event: EthSubEvent) -> anyhow::Result<()> { - let EthSubEvent::Log(log) = event else { +fn handle_eth_sub_event(state: &mut State, event: SubscriptionResult) -> anyhow::Result<()> { + let SubscriptionResult::Log(log) = event else { return Err(anyhow::anyhow!("app store: got non-log event")); }; - state.ingest_listings_contract_event(log) + state.ingest_listings_contract_event(*log) } fn fetch_package_manifest(package: &PackageId) -> anyhow::Result> { diff --git a/kinode/packages/app_store/app_store/src/types.rs b/kinode/packages/app_store/app_store/src/types.rs index 3e9504f6c..71abed8db 100644 --- a/kinode/packages/app_store/app_store/src/types.rs +++ b/kinode/packages/app_store/app_store/src/types.rs @@ -1,5 +1,5 @@ -use alloy_rpc_types::Log; use alloy_sol_types::{sol, SolEvent}; +use kinode_process_lib::eth::Log; use kinode_process_lib::kernel_types as kt; use kinode_process_lib::{println, *}; use serde::{Deserialize, Serialize}; From 2449393ca6fee2db3050aa46a102ce60ac1c9582 Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Mon, 12 Feb 2024 18:05:08 -0300 Subject: [PATCH 050/171] remove ethers dep --- kinode/Cargo.toml | 2 -- kinode/src/http/client.rs | 2 +- kinode/src/main.rs | 2 +- kinode/src/net/utils.rs | 14 +++++--- kinode/src/register.rs | 68 --------------------------------------- 5 files changed, 11 insertions(+), 77 deletions(-) diff --git a/kinode/Cargo.toml b/kinode/Cargo.toml index ed140848b..142847354 100644 --- a/kinode/Cargo.toml +++ b/kinode/Cargo.toml @@ -45,8 +45,6 @@ crossterm = { version = "0.26.1", features = ["event-stream", "bracketed-paste"] dashmap = "5.5.3" digest = "0.10" elliptic-curve = { version = "0.13.8", features = ["ecdh"] } -ethers = "2.0.13" -ethers-providers = "2.0.13" flate2 = "1.0" futures = "0.3" generic-array = "0.14" diff --git a/kinode/src/http/client.rs b/kinode/src/http/client.rs index ca8e86a4d..cb693855a 100644 --- a/kinode/src/http/client.rs +++ b/kinode/src/http/client.rs @@ -1,8 +1,8 @@ use anyhow::Result; use dashmap::DashMap; -use ethers_providers::StreamExt; use futures::stream::{SplitSink, SplitStream}; use futures::SinkExt; +use futures::StreamExt; use http::header::{HeaderMap, HeaderName, HeaderValue}; use std::collections::HashMap; use std::sync::Arc; diff --git a/kinode/src/main.rs b/kinode/src/main.rs index cd9c9d4a0..ddb0205d7 100644 --- a/kinode/src/main.rs +++ b/kinode/src/main.rs @@ -24,7 +24,7 @@ mod state; mod terminal; mod timer; mod vfs; - +// const EVENT_LOOP_CHANNEL_CAPACITY: usize = 10_000; const EVENT_LOOP_DEBUG_CHANNEL_CAPACITY: usize = 50; const TERMINAL_CHANNEL_CAPACITY: usize = 32; diff --git a/kinode/src/net/utils.rs b/kinode/src/net/utils.rs index c14036e93..69fbe3c83 100644 --- a/kinode/src/net/utils.rs +++ b/kinode/src/net/utils.rs @@ -273,10 +273,12 @@ pub fn validate_routing_request( &signature::ED25519, hex::decode(strip_0x(&their_id.networking_key))?, ); - their_networking_key.verify( - [&routing_request.target, our_name].concat().as_bytes(), - &routing_request.signature, - )?; + their_networking_key + .verify( + [&routing_request.target, our_name].concat().as_bytes(), + &routing_request.signature, + ) + .map_err(|e| anyhow!("their_networking_key.verify failed: {:?}", e))?; if routing_request.target == routing_request.source { return Err(anyhow!("can't route to self")); } @@ -296,7 +298,9 @@ pub fn validate_handshake( &signature::ED25519, hex::decode(strip_0x(&their_id.networking_key))?, ); - their_networking_key.verify(their_static_key, &handshake.signature)?; + their_networking_key + .verify(their_static_key, &handshake.signature) + .map_err(|e| anyhow!("their_networking_key.verify handshake failed: {:?}", e))?; Ok(()) } diff --git a/kinode/src/register.rs b/kinode/src/register.rs index 09f1e920e..8b5b5d197 100644 --- a/kinode/src/register.rs +++ b/kinode/src/register.rs @@ -1,6 +1,4 @@ use aes_gcm::aead::KeyInit; -use ethers::prelude::{abigen, namehash, Address as EthAddress, Provider, U256}; -use ethers_providers::Ws; use hmac::Hmac; use jwt::SignWithKey; use ring::rand::SystemRandom; @@ -21,14 +19,6 @@ use warp::{ use crate::keygen; use lib::types::core::*; -// Human readable ABI -abigen!( - KNSRegistry, - r"[ - function ws(uint256 node) external view returns (bytes32,uint32,uint16,bytes32[]) -]" -); - type RegistrationSender = mpsc::Sender<(Identity, Keyfile, Vec)>; pub const KNS_SEPOLIA_ADDRESS: &str = "0x3807fBD692Aa5c96F1D8D7c59a1346a885F40B1C"; @@ -557,61 +547,3 @@ async fn success_response( Ok(response) } - -async fn _networking_info_valid(rpc_url: String, ip: String, ws_port: u16, our: &Identity) -> bool { - // check if Identity for this username has correct networking keys, - // if not, prompt user to reset them. - let Ok(ws_rpc) = Provider::::connect(rpc_url.clone()).await else { - return false; - }; - let Ok(kns_address): Result = KNS_SEPOLIA_ADDRESS.parse() else { - return false; - }; - let contract = KNSRegistry::new(kns_address, ws_rpc.into()); - let node_id: U256 = namehash(&our.name).as_bytes().into(); - let Ok((chain_pubkey, chain_ip, chain_port, chain_routers)) = contract.ws(node_id).call().await - else { - return false; - }; - - // double check that routers match on-chain information - let namehashed_routers: Vec<[u8; 32]> = our - .allowed_routers - .clone() - .into_iter() - .map(|name| { - let hash = namehash(&name); - let mut result = [0u8; 32]; - result.copy_from_slice(hash.as_bytes()); - result - }) - .collect(); - - let current_ip = match _ip_to_number(&ip) { - Ok(ip_num) => ip_num, - Err(_) => { - return false; - } - }; - - let Ok(networking_key_bytes) = _hex_string_to_u8_array(&our.networking_key) else { - return false; - }; - - let address_match = chain_ip == current_ip && chain_port == ws_port; - let routers_match = chain_routers == namehashed_routers; - - let routing_match = if chain_ip == 0 { - routers_match - } else { - address_match - }; - let pubkey_match = chain_pubkey == networking_key_bytes; - - // double check that keys match on-chain information - if !routing_match || !pubkey_match { - return false; - } - - true -} From 98b20f5f7a78e320506b38a97e619d298e657f09 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Mon, 12 Feb 2024 16:47:03 -0500 Subject: [PATCH 051/171] Erc721Metadata added to core types --- .../packages/app_store/app_store/src/types.rs | 28 +++---------------- lib/src/core.rs | 24 ++++++++++------ 2 files changed, 20 insertions(+), 32 deletions(-) diff --git a/kinode/packages/app_store/app_store/src/types.rs b/kinode/packages/app_store/app_store/src/types.rs index 34c225fa3..116c7277e 100644 --- a/kinode/packages/app_store/app_store/src/types.rs +++ b/kinode/packages/app_store/app_store/src/types.rs @@ -49,27 +49,7 @@ pub struct PackageListing { pub name: String, pub publisher: NodeId, pub metadata_hash: String, - pub metadata: Option, -} - -/// metadata derived from metadata hash in listing event -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct Erc721Metadata { - pub name: Option, - pub description: Option, - pub image: Option, - pub external_url: Option, - pub animation_url: Option, - pub properties: Option, -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct Erc721Properties { - pub package_name: String, - pub publisher: String, - pub current_version: String, - pub mirrors: Vec, - pub code_hashes: HashMap, + pub metadata: Option, } #[derive(Debug, Serialize, Deserialize)] @@ -95,7 +75,7 @@ pub struct PackageState { pub mirroring: bool, /// if we get a listing data update, will we try to download it? pub auto_update: bool, - pub metadata: Option, + pub metadata: Option, } /// this process's saved state @@ -543,7 +523,7 @@ fn dnswire_decode(wire_format_bytes: &[u8]) -> Result anyhow::Result { +fn fetch_metadata(metadata_url: &str, metadata_hash: &str) -> anyhow::Result { let url = url::Url::parse(metadata_url)?; let _response = http::send_request_await_response(http::Method::GET, url, None, 5, vec![])?; let Some(body) = get_blob() else { @@ -551,7 +531,7 @@ fn fetch_metadata(metadata_url: &str, metadata_hash: &str) -> anyhow::Result(&body.bytes)?) + Ok(serde_json::from_slice::(&body.bytes)?) } else { Err(anyhow::anyhow!( "metadata hash mismatch: got {hash}, expected {metadata_hash}" diff --git a/lib/src/core.rs b/lib/src/core.rs index f4bbdf2d3..29f827b3f 100644 --- a/lib/src/core.rs +++ b/lib/src/core.rs @@ -1042,17 +1042,25 @@ impl std::fmt::Display for PersistedProcess { } } -pub type PackageVersion = (u32, u32, u32); - /// the type that gets deserialized from `metadata.json` in a package -#[derive(Debug, Serialize, Deserialize)] -pub struct PackageMetadata { - pub package: String, +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Erc721Metadata { + pub name: Option, + pub description: Option, + pub image: Option, + pub external_url: Option, + pub animation_url: Option, + pub properties: Option, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Erc721Properties { + pub package_name: String, pub publisher: String, - pub version: PackageVersion, + pub current_version: String, + pub mirrors: Vec, + pub code_hashes: HashMap, pub wit_version: Option<(u32, u32, u32)>, - pub description: Option, - pub website: Option, } /// the type that gets deserialized from each entry in the array in `manifest.json` From a42c63641092663fd41e1bb240d31e79f430c064 Mon Sep 17 00:00:00 2001 From: hosted-fornet Date: Mon, 12 Feb 2024 20:51:02 -0800 Subject: [PATCH 052/171] bump wasm deps --- Cargo.lock | 286 ++++++++---------- kinode/Cargo.toml | 10 +- kinode/build.rs | 132 ++++---- .../packages/app_store/app_store/Cargo.toml | 4 +- kinode/packages/app_store/download/Cargo.toml | 4 +- .../packages/app_store/ft_worker/Cargo.toml | 4 +- kinode/packages/app_store/install/Cargo.toml | 4 +- .../packages/app_store/uninstall/Cargo.toml | 4 +- kinode/packages/chess/chess/Cargo.toml | 4 +- kinode/packages/homepage/homepage/Cargo.toml | 4 +- .../kns_indexer/kns_indexer/Cargo.toml | 4 +- kinode/packages/terminal/alias/Cargo.toml | 4 +- kinode/packages/terminal/cat/Cargo.toml | 4 +- kinode/packages/terminal/echo/Cargo.toml | 4 +- kinode/packages/terminal/hi/Cargo.toml | 4 +- kinode/packages/terminal/m/Cargo.toml | 4 +- kinode/packages/terminal/terminal/Cargo.toml | 4 +- kinode/packages/terminal/top/Cargo.toml | 4 +- kinode/packages/tester/test_runner/Cargo.toml | 4 +- kinode/packages/tester/tester/Cargo.toml | 4 +- kinode/src/kernel/process.rs | 3 +- kinode/wasi_snapshot_preview1.wasm | Bin 97017 -> 96761 bytes lib/Cargo.toml | 2 +- 23 files changed, 233 insertions(+), 268 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c7285c74a..df8a83cbb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -88,7 +88,7 @@ name = "alias" version = "0.1.0" dependencies = [ "anyhow", - "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=12bf9ee)", "serde", "serde_json", "wit-bindgen", @@ -272,7 +272,7 @@ dependencies = [ "alloy-sol-types", "anyhow", "bincode", - "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=12bf9ee)", "rand 0.8.5", "serde", "serde_json", @@ -809,7 +809,7 @@ name = "cat" version = "0.1.0" dependencies = [ "anyhow", - "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=12bf9ee)", "serde", "serde_json", "wit-bindgen", @@ -871,7 +871,7 @@ dependencies = [ "anyhow", "base64 0.13.1", "bincode", - "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=12bf9ee)", "pleco", "serde", "serde_json", @@ -1096,18 +1096,18 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.102.1" +version = "0.104.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e7e56668d2263f92b691cb9e4a2fcb186ca0384941fe420484322fa559c3329" +checksum = "7e7c0d51205b863591dd1e7aaa0fb69c2ea7bed48ffa63d6c4a848b07a35a732" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.102.1" +version = "0.104.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a9ff61938bf11615f55b80361288c68865318025632ea73c65c0b44fa16283c" +checksum = "9ffb467cbc25543e4c20d2ad669bf8275598047b03c89652ad5fe2a0f47fc0e1" dependencies = [ "bumpalo", "cranelift-bforest", @@ -1126,33 +1126,33 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.102.1" +version = "0.104.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50656bf19e3d4a153b404ff835b8b59e924cfa3682ebe0d3df408994f37983f6" +checksum = "bc7e74aed5c2b91e38d090653506afbd2cd3be1ff70593e2aa6bb82b3c6b77ff" dependencies = [ "cranelift-codegen-shared", ] [[package]] name = "cranelift-codegen-shared" -version = "0.102.1" +version = "0.104.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388041deeb26109f1ea73c1812ea26bfd406c94cbce0bb5230aa44277e43b209" +checksum = "9ff2dd24cce0775566da85770cb48aa58fef901cf2bff30275b42e7dbe62cbd5" [[package]] name = "cranelift-control" -version = "0.102.1" +version = "0.104.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39b7c512ffac527e5b5df9beae3d67ab85d07dca6d88942c16195439fedd1d3" +checksum = "e8bcf4d5c73bbca309edf3af2839b5218e5c74cfbf22b0ac492af8a1d11120d9" dependencies = [ "arbitrary", ] [[package]] name = "cranelift-entity" -version = "0.102.1" +version = "0.104.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdb25f573701284fe2bcf88209d405342125df00764b396c923e11eafc94d892" +checksum = "286754159b1a685475d6a0b4710832f950d6f4846a817002e2c23ff001321a65" dependencies = [ "serde", "serde_derive", @@ -1160,9 +1160,9 @@ dependencies = [ [[package]] name = "cranelift-frontend" -version = "0.102.1" +version = "0.104.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e57374fd11d72cf9ffb85ff64506ed831440818318f58d09f45b4185e5e9c376" +checksum = "67150a1fef9857caba710f8c0c8223d640f02c0e5d1ebbfc75ed62912599cb6b" dependencies = [ "cranelift-codegen", "log", @@ -1172,15 +1172,15 @@ dependencies = [ [[package]] name = "cranelift-isle" -version = "0.102.1" +version = "0.104.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae769b235f6ea2f86623a3ff157cc04a4ff131dc9fe782c2ebd35f272043581e" +checksum = "eb7ceea70d3e0d7f69df7657f99de902e32016731c5a8d2788c1df0215f00952" [[package]] name = "cranelift-native" -version = "0.102.1" +version = "0.104.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dc7bfb8f13a0526fe20db338711d9354729b861c336978380bb10f7f17dd207" +checksum = "707e5d9384ce4fa3c40af1abf4c3ec49857745cced5187593385f4a2c0b95445" dependencies = [ "cranelift-codegen", "libc", @@ -1189,9 +1189,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.102.1" +version = "0.104.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c5f41a4af931b756be05af0dd374ce200aae2d52cea16b0beb07e8b52732c35" +checksum = "d4d957e3ff2a14c2f974a66c22bfcedcd2bd0272af8dce4236869c3942f5a471" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -1199,7 +1199,7 @@ dependencies = [ "itertools 0.10.5", "log", "smallvec", - "wasmparser 0.116.1", + "wasmparser 0.118.1", "wasmtime-types", ] @@ -1611,7 +1611,7 @@ name = "download" version = "0.1.0" dependencies = [ "anyhow", - "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=12bf9ee)", "serde", "serde_json", "wit-bindgen", @@ -1642,7 +1642,7 @@ name = "echo" version = "0.1.0" dependencies = [ "anyhow", - "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=12bf9ee)", "serde", "serde_json", "wit-bindgen", @@ -2214,7 +2214,7 @@ version = "0.2.0" dependencies = [ "anyhow", "bincode", - "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=12bf9ee)", "rand 0.8.5", "serde", "serde_json", @@ -2571,7 +2571,7 @@ checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" name = "hi" version = "0.1.0" dependencies = [ - "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=12bf9ee)", "serde", "serde_json", "wit-bindgen", @@ -2610,7 +2610,7 @@ version = "0.1.0" dependencies = [ "anyhow", "bincode", - "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=12bf9ee)", "serde", "serde_json", "wit-bindgen", @@ -2885,7 +2885,7 @@ name = "install" version = "0.1.0" dependencies = [ "anyhow", - "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=12bf9ee)", "serde", "serde_json", "wit-bindgen", @@ -3139,6 +3139,7 @@ dependencies = [ "open", "public-ip", "rand 0.8.5", + "rayon", "reqwest", "ring 0.16.20", "rmp-serde", @@ -3173,8 +3174,8 @@ dependencies = [ [[package]] name = "kinode_process_lib" -version = "0.5.9" -source = "git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha#5e705086bbd10fde89e11d3e3671f6a618a875a7" +version = "0.6.0" +source = "git+https://github.com/kinode-dao/process_lib?rev=12bf9ee#12bf9eefeb9237db5e5165647fa91b437b05e169" dependencies = [ "alloy-rpc-types", "anyhow", @@ -3190,27 +3191,10 @@ dependencies = [ "wit-bindgen", ] -[[package]] -name = "kinode_process_lib" -version = "0.5.9" -source = "git+https://github.com/uqbar-dao/process_lib.git?tag=v0.5.9-alpha#5e705086bbd10fde89e11d3e3671f6a618a875a7" -dependencies = [ - "anyhow", - "bincode", - "http 1.0.0", - "mime_guess", - "rand 0.8.5", - "serde", - "serde_json", - "thiserror", - "url", - "wit-bindgen", -] - [[package]] name = "kinode_process_lib" version = "0.6.0" -source = "git+https://github.com/kinode-dao/process_lib?tag=v0.6.0-alpha#4c49368e1945c041dfcabbe15734322012239d25" +source = "git+https://github.com/uqbar-dao/process_lib.git?rev=12bf9ee#12bf9eefeb9237db5e5165647fa91b437b05e169" dependencies = [ "anyhow", "bincode", @@ -3227,7 +3211,7 @@ dependencies = [ [[package]] name = "kit" version = "0.1.0" -source = "git+https://github.com/kinode-dao/kit?rev=0c43430#0c434306fdce55e11d3309959fc4a0fe6ae28def" +source = "git+https://github.com/kinode-dao/kit?rev=665025c#665025c06f495a826e8a4e0a23e3dce59dcb1832" dependencies = [ "anyhow", "base64 0.21.7", @@ -3236,7 +3220,7 @@ dependencies = [ "futures-util", "git2", "hex", - "kinode_process_lib 0.5.9 (git+https://github.com/uqbar-dao/process_lib.git?tag=v0.5.9-alpha)", + "kinode_process_lib 0.6.0 (git+https://github.com/uqbar-dao/process_lib.git?rev=12bf9ee)", "nix", "regex", "reqwest", @@ -3262,7 +3246,7 @@ dependencies = [ "anyhow", "bincode", "hex", - "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=12bf9ee)", "rmp-serde", "serde", "serde_json", @@ -3471,7 +3455,7 @@ version = "0.1.0" dependencies = [ "anyhow", "clap", - "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=12bf9ee)", "regex", "serde", "serde_json", @@ -5553,7 +5537,7 @@ version = "0.1.0" dependencies = [ "anyhow", "bincode", - "kinode_process_lib 0.6.0", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=12bf9ee)", "rand 0.8.5", "regex", "serde", @@ -5567,7 +5551,7 @@ version = "0.1.0" dependencies = [ "anyhow", "bincode", - "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=12bf9ee)", "serde", "serde_json", "thiserror", @@ -5581,7 +5565,7 @@ dependencies = [ "anyhow", "bincode", "indexmap 2.2.2", - "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=12bf9ee)", "serde", "serde_json", "thiserror", @@ -5822,7 +5806,7 @@ name = "top" version = "0.1.0" dependencies = [ "anyhow", - "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=12bf9ee)", "serde", "serde_json", "wit-bindgen", @@ -6032,7 +6016,7 @@ name = "uninstall" version = "0.1.0" dependencies = [ "anyhow", - "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=12bf9ee)", "serde", "serde_json", "wit-bindgen", @@ -6200,9 +6184,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasi-cap-std-sync" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4328de5cf2a0debfc48216fe9c2747badc64957837641f5836cd8b3d48d73f0" +checksum = "025e842ba390587e523785ff58bd54fbbf1781b8d3072bc9aba4dc0b809f69da" dependencies = [ "anyhow", "async-trait", @@ -6218,14 +6202,14 @@ dependencies = [ "system-interface", "tracing", "wasi-common", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "wasi-common" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84f6774ec9e464b7373f683bc57ff87fcca5fd26a7d6bdb7438fb2f56a545aa6" +checksum = "da4d4023cc65b3615590d38db0afb79234de09b3bb89cb0d8f83bdee9f5c28a8" dependencies = [ "anyhow", "bitflags 2.4.2", @@ -6238,7 +6222,7 @@ dependencies = [ "tracing", "wasmtime", "wiggle", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -6307,15 +6291,6 @@ version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" -[[package]] -name = "wasm-encoder" -version = "0.36.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "822b645bf4f2446b949776ffca47e2af60b167209ffb70814ef8779d299cd421" -dependencies = [ - "leb128", -] - [[package]] name = "wasm-encoder" version = "0.38.1" @@ -6350,16 +6325,6 @@ dependencies = [ "wasmparser 0.121.0", ] -[[package]] -name = "wasmparser" -version = "0.116.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a58e28b80dd8340cb07b8242ae654756161f6fc8d0038123d679b7b99964fa50" -dependencies = [ - "indexmap 2.2.2", - "semver 1.0.21", -] - [[package]] name = "wasmparser" version = "0.118.1" @@ -6393,9 +6358,9 @@ dependencies = [ [[package]] name = "wasmtime" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "642e12d108e800215263e3b95972977f473957923103029d7d617db701d67ba4" +checksum = "8acb6aa966be38f613954c3debe7ba6c7a02ffd0537432be438da0b038955cdf" dependencies = [ "anyhow", "async-trait", @@ -6410,14 +6375,13 @@ dependencies = [ "object", "once_cell", "paste", - "psm", "rayon", "serde", "serde_derive", "serde_json", "target-lexicon", - "wasm-encoder 0.36.2", - "wasmparser 0.116.1", + "wasm-encoder 0.38.1", + "wasmparser 0.118.1", "wasmtime-cache", "wasmtime-component-macro", "wasmtime-component-util", @@ -6428,23 +6392,23 @@ dependencies = [ "wasmtime-runtime", "wasmtime-winch", "wat", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "wasmtime-asm-macros" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beada8bb15df52503de0a4c58de4357bfd2f96d9a44a6e547bad11efdd988b47" +checksum = "c1495ef4d46aec14f967b672e946e391dd8a14a443cda3d5e0779ff67fb6e28d" dependencies = [ "cfg-if", ] [[package]] name = "wasmtime-cache" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aba5bf44d044d25892c03fb3534373936ee204141ff92bac8297787ac7f22318" +checksum = "e2de1b065bdbaca3df9e7e9f70eb129e326a99d971b16d666acd798d98d47635" dependencies = [ "anyhow", "base64 0.21.7", @@ -6456,15 +6420,15 @@ dependencies = [ "serde_derive", "sha2", "toml 0.5.11", - "windows-sys 0.48.0", + "windows-sys 0.52.0", "zstd", ] [[package]] name = "wasmtime-component-macro" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ccba556991465cca68d5a54769684bcf489fb532059da55105f851642d52c1" +checksum = "2f19bcff82f81ba0273c0b68f3909977b0dd54489bc86c630d8aad43dca92f3f" dependencies = [ "anyhow", "proc-macro2", @@ -6477,15 +6441,15 @@ dependencies = [ [[package]] name = "wasmtime-component-util" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05492a177a6006cb73f034d6e9a6fad6da55b23c4398835cb0012b5fa51ecf67" +checksum = "8af072b7ad5ac5583e1f9e4737ebf88923de564fb5d4ace0ca9b4b720bdf95a1" [[package]] name = "wasmtime-cranelift" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe2e7532f1d6adbcc57e69bb6a7c503f0859076d07a9b4b6aabe8021ff8a05fd" +checksum = "df08a8bd9a68732577bee05ac685e4c247238b5e79ad9c062e2dfb4d04dca132" dependencies = [ "anyhow", "cfg-if", @@ -6500,7 +6464,7 @@ dependencies = [ "object", "target-lexicon", "thiserror", - "wasmparser 0.116.1", + "wasmparser 0.118.1", "wasmtime-cranelift-shared", "wasmtime-environ", "wasmtime-versioned-export-macros", @@ -6508,9 +6472,9 @@ dependencies = [ [[package]] name = "wasmtime-cranelift-shared" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c98d5378a856cbf058d36278627dfabf0ed68a888142958c7ae8e6af507dafa" +checksum = "404201c9e669083f189f01337b3ed0aa0eb081157fb4e170bbfe193df9497771" dependencies = [ "anyhow", "cranelift-codegen", @@ -6524,9 +6488,9 @@ dependencies = [ [[package]] name = "wasmtime-environ" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6d33a9f421da810a070cd56add9bc51f852bd66afbb8b920489d6242f15b70e" +checksum = "7e696b4911c9a69c3c2892ec05eb41bb15436d1a46d8830a755c40f5df47546a" dependencies = [ "anyhow", "cranelift-entity", @@ -6538,8 +6502,8 @@ dependencies = [ "serde_derive", "target-lexicon", "thiserror", - "wasm-encoder 0.36.2", - "wasmparser 0.116.1", + "wasm-encoder 0.38.1", + "wasmparser 0.118.1", "wasmprinter", "wasmtime-component-util", "wasmtime-types", @@ -6547,9 +6511,9 @@ dependencies = [ [[package]] name = "wasmtime-fiber" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "404741f4c6d7f4e043be2e8b466406a2aee289ccdba22bf9eba6399921121b97" +checksum = "4a39681c1f6f54d1bf7efe5dc829f8d7fc0e2ca12c346fd7a3efbf726e9681d2" dependencies = [ "anyhow", "cc", @@ -6557,14 +6521,14 @@ dependencies = [ "rustix", "wasmtime-asm-macros", "wasmtime-versioned-export-macros", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "wasmtime-jit" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d0994a86d6dca5f7d9740d7f2bd0568be06d2014a550361dc1c397d289d81ef" +checksum = "2c56519882d936c680bd191d58ac04cff071a470eca2dcc664adcd60f986a731" dependencies = [ "addr2line", "anyhow", @@ -6584,14 +6548,14 @@ dependencies = [ "wasmtime-jit-debug", "wasmtime-jit-icache-coherence", "wasmtime-runtime", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "wasmtime-jit-debug" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e0c4b74e606d1462d648631d5bc328e3d5b14e7f9d3ff93bc6db062fb8c5cd8" +checksum = "babc65e64ab0dd4e1ce65624db64e24ed0fbdebb16148729173fa0da9f70e53c" dependencies = [ "object", "once_cell", @@ -6601,20 +6565,20 @@ dependencies = [ [[package]] name = "wasmtime-jit-icache-coherence" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3090a69ba1476979e090aa7ed4bc759178bafdb65b22f98b9ba24fc6e7e578d5" +checksum = "d7ec5b11c12d9acb09612e7ce04c4c8aea3e8dc79b2591ffdead986a5ce8ec49" dependencies = [ "cfg-if", "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "wasmtime-runtime" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b993ac8380385ed67bf71b51b9553edcf1ab0801b78a805a067de581b9a3e88a" +checksum = "28e1c31bbdf67cb86f149bcead5193749f23f77c93c5244ec9ac8d192f90966c" dependencies = [ "anyhow", "cc", @@ -6627,37 +6591,37 @@ dependencies = [ "memfd", "memoffset", "paste", - "rand 0.8.5", + "psm", "rustix", "sptr", - "wasm-encoder 0.36.2", + "wasm-encoder 0.38.1", "wasmtime-asm-macros", "wasmtime-environ", "wasmtime-fiber", "wasmtime-jit-debug", "wasmtime-versioned-export-macros", "wasmtime-wmemcheck", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "wasmtime-types" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b5778112fcab2dc3d4371f4203ab8facf0c453dd94312b0a88dd662955e64e0" +checksum = "52e799cff634d30fd042db96b417d515e54f903b95f8c1e0ec60e8f604479485" dependencies = [ "cranelift-entity", "serde", "serde_derive", "thiserror", - "wasmparser 0.116.1", + "wasmparser 0.118.1", ] [[package]] name = "wasmtime-versioned-export-macros" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f50f51f8d79bfd2aa8e9d9a0ae7c2d02b45fe412e62ff1b87c0c81b07c738231" +checksum = "e10fe166d4e4c95d5d80c5b47e1e12256af2099ac525ddb9a19b1aeb8896e5e1" dependencies = [ "proc-macro2", "quote", @@ -6666,9 +6630,9 @@ dependencies = [ [[package]] name = "wasmtime-wasi" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eff3f4ad191a5e6d002bb5bffa3e2931a58984da9b30e57b48f353848748cf80" +checksum = "494f99111a165dcddc69aaa5fa23604f49dcfab479a869edd84581abd6ac569b" dependencies = [ "anyhow", "async-trait", @@ -6696,21 +6660,21 @@ dependencies = [ "wasi-common", "wasmtime", "wiggle", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "wasmtime-winch" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d638e7c72447253485fe131523e7465ca318c0455c826eb4f5f612fb67b7de90" +checksum = "d3f5d76d399cb4423e6f178bc154a0e1c314711e28dabaa6e757e56628a083ec" dependencies = [ "anyhow", "cranelift-codegen", "gimli", "object", "target-lexicon", - "wasmparser 0.116.1", + "wasmparser 0.118.1", "wasmtime-cranelift-shared", "wasmtime-environ", "winch-codegen", @@ -6718,9 +6682,9 @@ dependencies = [ [[package]] name = "wasmtime-wit-bindgen" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b804dfd3d0c0d6d37aa21026fe7772ba1a769c89ee4f5c4f13b82d91d75216f" +checksum = "6bb3bc92c031cf4961135bffe055a69c1bd67c253dca20631478189bb05ec27b" dependencies = [ "anyhow", "heck", @@ -6730,9 +6694,9 @@ dependencies = [ [[package]] name = "wasmtime-wmemcheck" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b6060bc082cc32d9a45587c7640e29e3c7b89ada82677ac25d87850aaccb368" +checksum = "5da08ab734954e16f57be38423b90c25a0b13420e51cbd0a2e37b86a468a988c" [[package]] name = "wast" @@ -6783,9 +6747,9 @@ checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "wiggle" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91028b241e692fdf30627ac10ba9d5ac378353ea4119b4f904ac95177057a44" +checksum = "cd5b200b5dd3d5d7cc4093166f4f916d2d2839296cf1b1757b9726635f6425c3" dependencies = [ "anyhow", "async-trait", @@ -6798,9 +6762,9 @@ dependencies = [ [[package]] name = "wiggle-generate" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e8b3d76531994513671b2ec3b29fd342bf041e2282945bb6c52eebe6aa9e7da" +checksum = "a4dc34a2bc1091599de005e9b854cd1a9ea35b16ca51cac2797274c1a2666e06" dependencies = [ "anyhow", "heck", @@ -6813,9 +6777,9 @@ dependencies = [ [[package]] name = "wiggle-macro" -version = "15.0.1" +version = "17.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c189fe00c67f61bb330827f2abab1af9b5925c7929535cd13a68d265ec20b02d" +checksum = "37ba3b37f402a7513b9ed7973a6e907074987b3afdcede98d3d79939b3e76f1b" dependencies = [ "proc-macro2", "quote", @@ -6856,9 +6820,9 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "winch-codegen" -version = "0.13.1" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c792487f4dc42733d182a72e75d718b1a563cedcc1599ff0a9ed683c33e8bb7" +checksum = "8d921185084e134e897e0e202e129a422306d0f1391954ecf4928d36defa897d" dependencies = [ "anyhow", "cranelift-codegen", @@ -6866,7 +6830,7 @@ dependencies = [ "regalloc2", "smallvec", "target-lexicon", - "wasmparser 0.116.1", + "wasmparser 0.118.1", "wasmtime-environ", ] @@ -7042,8 +7006,8 @@ dependencies = [ [[package]] name = "wit-bindgen" -version = "0.16.0" -source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=efcc759#efcc7592cf3277bcb9be1034e48569c6d822b322" +version = "0.17.0" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=21a46c7#21a46c774532da99384f7a1877c1fcfb7a4c72d3" dependencies = [ "bitflags 2.4.2", "wit-bindgen-rust-macro", @@ -7051,8 +7015,8 @@ dependencies = [ [[package]] name = "wit-bindgen-core" -version = "0.16.0" -source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=efcc759#efcc7592cf3277bcb9be1034e48569c6d822b322" +version = "0.17.0" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=21a46c7#21a46c774532da99384f7a1877c1fcfb7a4c72d3" dependencies = [ "anyhow", "wit-component", @@ -7061,8 +7025,8 @@ dependencies = [ [[package]] name = "wit-bindgen-rust" -version = "0.16.0" -source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=efcc759#efcc7592cf3277bcb9be1034e48569c6d822b322" +version = "0.17.0" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=21a46c7#21a46c774532da99384f7a1877c1fcfb7a4c72d3" dependencies = [ "anyhow", "heck", @@ -7073,8 +7037,8 @@ dependencies = [ [[package]] name = "wit-bindgen-rust-macro" -version = "0.16.0" -source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=efcc759#efcc7592cf3277bcb9be1034e48569c6d822b322" +version = "0.17.0" +source = "git+https://github.com/bytecodealliance/wit-bindgen?rev=21a46c7#21a46c774532da99384f7a1877c1fcfb7a4c72d3" dependencies = [ "anyhow", "proc-macro2", @@ -7087,9 +7051,9 @@ dependencies = [ [[package]] name = "wit-component" -version = "0.18.2" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a35a2a9992898c9d27f1664001860595a4bc99d32dd3599d547412e17d7e2" +checksum = "331de496d439010797c17637d8002712b9b69110f1669164c09dfa226ad277bb" dependencies = [ "anyhow", "bitflags 2.4.2", @@ -7098,9 +7062,9 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "wasm-encoder 0.38.1", + "wasm-encoder 0.41.0", "wasm-metadata", - "wasmparser 0.118.1", + "wasmparser 0.121.0", "wit-parser", ] diff --git a/kinode/Cargo.toml b/kinode/Cargo.toml index 7da207a90..dedc20fe6 100644 --- a/kinode/Cargo.toml +++ b/kinode/Cargo.toml @@ -14,10 +14,10 @@ path = "src/main.rs" [build-dependencies] anyhow = "1.0.71" -kit = { git = "https://github.com/kinode-dao/kit", rev = "0c43430" } -reqwest = { version = "0.11.22", features = ["blocking"] } +kit = { git = "https://github.com/kinode-dao/kit", rev = "665025c" } +rayon = "1.8.1" sha2 = "0.10" -tokio = { version = "1.28", features = ["macros"] } +tokio = "1.28" walkdir = "2.4" zip = "0.6" @@ -79,6 +79,6 @@ tokio-tungstenite = "0.20.1" url = "2.4.1" uuid = { version = "1.1.2", features = ["serde", "v4"] } warp = "0.3.5" -wasmtime = "15.0.1" -wasmtime-wasi = "15.0.1" +wasmtime = "17.0.1" +wasmtime-wasi = "17.0.1" zip = "0.6" diff --git a/kinode/build.rs b/kinode/build.rs index 0a051b6f2..a4b561eb4 100644 --- a/kinode/build.rs +++ b/kinode/build.rs @@ -1,90 +1,90 @@ +use rayon::prelude::*; use std::{ - fs, + fs::{self, File}, io::{Cursor, Read, Write}, + path::{Path, PathBuf}, }; +use zip::write::FileOptions; -#[tokio::main] -async fn main() -> anyhow::Result<()> { - if std::env::var("SKIP_BUILD_SCRIPT").is_ok() { - println!("Skipping build script"); - return Ok(()); - } - - let pwd = std::env::current_dir().unwrap(); - let parent_dir = pwd.parent().unwrap(); - - // Build wasm32-wasi apps, zip, and add to bootstrapped_processes.rs - let mut bootstrapped_processes = Vec::new(); - writeln!( - bootstrapped_processes, - "pub static BOOTSTRAPPED_PROCESSES: &[(&str, &[u8])] = &[", - ) - .unwrap(); - let packages_dir = format!("{}/packages", pwd.display()); - eprintln!("{packages_dir:?}"); - for entry in std::fs::read_dir(packages_dir).unwrap() { - let entry_path = entry.unwrap().path(); - let parent_pkg_path = format!("{}/pkg", entry_path.display()); - +// This function is assumed to be synchronous. Adjust as needed. +// Make sure it can be called in parallel without causing issues. +fn build_and_zip_package(entry_path: PathBuf, parent_pkg_path: &str) -> anyhow::Result<(String, Vec)> { + let rt = tokio::runtime::Runtime::new().unwrap(); + rt.block_on(async { kit::build::execute(&entry_path, false, false, false, true).await?; - // After processing all sub-apps, zip the parent's pkg/ directory let mut writer = Cursor::new(Vec::new()); + let options = FileOptions::default() + .compression_method(zip::CompressionMethod::Stored) + .unix_permissions(0o755); { - let options = zip::write::FileOptions::default() - .compression_method(zip::CompressionMethod::Stored) - .unix_permissions(0o755); let mut zip = zip::ZipWriter::new(&mut writer); - for sub_entry in walkdir::WalkDir::new(&parent_pkg_path) { - let sub_entry = sub_entry.unwrap(); + + for sub_entry in walkdir::WalkDir::new(parent_pkg_path) { + let sub_entry = sub_entry?; let path = sub_entry.path(); - let name = path - .strip_prefix(std::path::Path::new(&parent_pkg_path)) - .unwrap(); + let name = path.strip_prefix(Path::new(parent_pkg_path))?; - // Write a directory or file to the ZIP archive if path.is_file() { - zip.start_file(name.to_string_lossy().into_owned(), options) - .unwrap(); - let mut file = std::fs::File::open(path).unwrap(); + zip.start_file(name.to_string_lossy(), options)?; + let mut file = File::open(path)?; let mut buffer = Vec::new(); - file.read_to_end(&mut buffer).unwrap(); - zip.write_all(&buffer).unwrap(); + file.read_to_end(&mut buffer)?; + zip.write_all(&buffer)?; } else if !name.as_os_str().is_empty() { - zip.add_directory(name.to_string_lossy().into_owned(), options) - .unwrap(); + zip.add_directory(name.to_string_lossy(), options)?; } } - zip.finish().unwrap(); + zip.finish()?; } + let zip_contents = writer.into_inner(); - let zip_filename = format!("{}.zip", entry_path.file_name().unwrap().to_str().unwrap(),); - let zip_path = format!("{}/target/{}", parent_dir.display(), zip_filename); - if !std::path::Path::new(&zip_path).exists() { - fs::write(&zip_path, zip_contents)?; - } else { - let existing_zip_contents = fs::read(&zip_path)?; - if zip_contents != existing_zip_contents { - fs::write(&zip_path, zip_contents)?; - } - } + let zip_filename = format!("{}.zip", entry_path.file_name().unwrap().to_str().unwrap()); + Ok((zip_filename, zip_contents)) + }) +} - // Add zip bytes to bootstrapped_processes.rs - writeln!( - bootstrapped_processes, - " (\"{}\", include_bytes!(\"{}\")),", - zip_filename, zip_path, - ) - .unwrap(); - } - writeln!(bootstrapped_processes, "];").unwrap(); - let bootstrapped_processes_path = pwd.join("src/bootstrapped_processes.rs"); - if bootstrapped_processes_path.exists() { - let existing_bootstrapped_processes = fs::read(&bootstrapped_processes_path)?; - if bootstrapped_processes == existing_bootstrapped_processes { - return Ok(()); +fn main() -> anyhow::Result<()> { + let pwd = std::env::current_dir()?; + let parent_dir = pwd.parent().unwrap(); + let packages_dir = pwd.join("packages"); + + let entries: Vec<_> = fs::read_dir(packages_dir)? + .map(|entry| entry.unwrap().path()) + .collect(); + + let results: Vec)>> = entries.par_iter() + .map(|entry_path| { + let parent_pkg_path = entry_path.join("pkg"); + build_and_zip_package(entry_path.clone(), parent_pkg_path.to_str().unwrap()) + }) + .collect(); + + // Process results, e.g., write to `bootstrapped_processes.rs` + // This part remains sequential + let mut bootstrapped_processes = vec![]; + writeln!(bootstrapped_processes, "pub static BOOTSTRAPPED_PROCESSES: &[(&str, &[u8])] = &[")?; + + for result in results { + match result { + Ok((zip_filename, zip_contents)) => { + // Further processing, like saving ZIP files and updating bootstrapped_processes + let zip_path = format!("{}/target/{}", parent_dir.display(), zip_filename); + fs::write(&zip_path, &zip_contents)?; + + writeln!( + bootstrapped_processes, + " (\"{}\", include_bytes!(\"{}\")),", + zip_filename, zip_path, + )?; + }, + Err(e) => return Err(e), } } + + writeln!(bootstrapped_processes, "];")?; + let bootstrapped_processes_path = pwd.join("src/bootstrapped_processes.rs"); fs::write(&bootstrapped_processes_path, bootstrapped_processes)?; + Ok(()) } diff --git a/kinode/packages/app_store/app_store/Cargo.toml b/kinode/packages/app_store/app_store/Cargo.toml index f8e18d155..da1e1a3a0 100644 --- a/kinode/packages/app_store/app_store/Cargo.toml +++ b/kinode/packages/app_store/app_store/Cargo.toml @@ -10,7 +10,7 @@ alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy.git", rev = "3b1c31 alloy-sol-types = "0.5.1" anyhow = "1.0" bincode = "1.3.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.5.9-alpha", features = ["eth"] } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "12bf9ee", features = ["eth"] } rand = "0.8" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" @@ -18,7 +18,7 @@ sha2 = "0.10.8" sha3 = "0.10.8" url = "2.4.1" urlencoding = "2.1.0" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "21a46c7" } zip = { version = "0.6.6", default-features = false } [lib] diff --git a/kinode/packages/app_store/download/Cargo.toml b/kinode/packages/app_store/download/Cargo.toml index 0c0b563b5..07bb716df 100644 --- a/kinode/packages/app_store/download/Cargo.toml +++ b/kinode/packages/app_store/download/Cargo.toml @@ -6,10 +6,10 @@ edition = "2021" [dependencies] anyhow = "1.0" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.5.9-alpha" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "12bf9ee" } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "21a46c7" } [lib] crate-type = ["cdylib"] diff --git a/kinode/packages/app_store/ft_worker/Cargo.toml b/kinode/packages/app_store/ft_worker/Cargo.toml index ace5763d1..3171678b8 100644 --- a/kinode/packages/app_store/ft_worker/Cargo.toml +++ b/kinode/packages/app_store/ft_worker/Cargo.toml @@ -7,11 +7,11 @@ edition = "2021" [dependencies] anyhow = "1.0" bincode = "1.3.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.5.9-alpha" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "12bf9ee" } rand = "0.8" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "21a46c7" } [lib] crate-type = ["cdylib"] diff --git a/kinode/packages/app_store/install/Cargo.toml b/kinode/packages/app_store/install/Cargo.toml index 40642155f..28f5e6e15 100644 --- a/kinode/packages/app_store/install/Cargo.toml +++ b/kinode/packages/app_store/install/Cargo.toml @@ -6,10 +6,10 @@ edition = "2021" [dependencies] anyhow = "1.0" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.5.9-alpha" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "12bf9ee" } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "21a46c7" } [lib] crate-type = ["cdylib"] diff --git a/kinode/packages/app_store/uninstall/Cargo.toml b/kinode/packages/app_store/uninstall/Cargo.toml index e54c0b660..020dc4917 100644 --- a/kinode/packages/app_store/uninstall/Cargo.toml +++ b/kinode/packages/app_store/uninstall/Cargo.toml @@ -6,10 +6,10 @@ edition = "2021" [dependencies] anyhow = "1.0" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.5.9-alpha" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "12bf9ee" } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "21a46c7" } [lib] crate-type = ["cdylib"] diff --git a/kinode/packages/chess/chess/Cargo.toml b/kinode/packages/chess/chess/Cargo.toml index 23f172a89..7150a9706 100644 --- a/kinode/packages/chess/chess/Cargo.toml +++ b/kinode/packages/chess/chess/Cargo.toml @@ -8,12 +8,12 @@ edition = "2021" anyhow = "1.0" base64 = "0.13" bincode = "1.3.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.5.9-alpha" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "12bf9ee" } pleco = "0.5" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" url = "*" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "21a46c7" } [lib] crate-type = ["cdylib"] diff --git a/kinode/packages/homepage/homepage/Cargo.toml b/kinode/packages/homepage/homepage/Cargo.toml index d402e6f87..bb9a8e409 100644 --- a/kinode/packages/homepage/homepage/Cargo.toml +++ b/kinode/packages/homepage/homepage/Cargo.toml @@ -7,10 +7,10 @@ edition = "2021" [dependencies] anyhow = "1.0" bincode = "1.3.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.5.9-alpha" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "12bf9ee" } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "21a46c7" } [lib] crate-type = ["cdylib"] diff --git a/kinode/packages/kns_indexer/kns_indexer/Cargo.toml b/kinode/packages/kns_indexer/kns_indexer/Cargo.toml index 24a7e1197..cdc18ed3e 100644 --- a/kinode/packages/kns_indexer/kns_indexer/Cargo.toml +++ b/kinode/packages/kns_indexer/kns_indexer/Cargo.toml @@ -11,11 +11,11 @@ alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy.git", rev = "3b1c31 alloy-sol-types = "0.5.1" bincode = "1.3.3" hex = "0.4.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.5.9-alpha", features = ["eth"] } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "12bf9ee", features = ["eth"] } rmp-serde = "1.1.2" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "21a46c7" } [lib] crate-type = ["cdylib"] diff --git a/kinode/packages/terminal/alias/Cargo.toml b/kinode/packages/terminal/alias/Cargo.toml index 07ecbf3a9..7213f3e2a 100644 --- a/kinode/packages/terminal/alias/Cargo.toml +++ b/kinode/packages/terminal/alias/Cargo.toml @@ -6,10 +6,10 @@ edition = "2021" [dependencies] anyhow = "1.0" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.5.9-alpha" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "12bf9ee" } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "21a46c7" } [lib] crate-type = ["cdylib"] diff --git a/kinode/packages/terminal/cat/Cargo.toml b/kinode/packages/terminal/cat/Cargo.toml index 6a2ba7f52..f52ebb846 100644 --- a/kinode/packages/terminal/cat/Cargo.toml +++ b/kinode/packages/terminal/cat/Cargo.toml @@ -6,10 +6,10 @@ edition = "2021" [dependencies] anyhow = "1.0" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.5.9-alpha" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "12bf9ee" } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "21a46c7" } [lib] crate-type = ["cdylib"] diff --git a/kinode/packages/terminal/echo/Cargo.toml b/kinode/packages/terminal/echo/Cargo.toml index 9695d17c9..79c526172 100644 --- a/kinode/packages/terminal/echo/Cargo.toml +++ b/kinode/packages/terminal/echo/Cargo.toml @@ -6,10 +6,10 @@ edition = "2021" [dependencies] anyhow = "1.0" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.5.9-alpha" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "12bf9ee" } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "21a46c7" } [lib] crate-type = ["cdylib"] diff --git a/kinode/packages/terminal/hi/Cargo.toml b/kinode/packages/terminal/hi/Cargo.toml index a683aa047..2fcb9145b 100644 --- a/kinode/packages/terminal/hi/Cargo.toml +++ b/kinode/packages/terminal/hi/Cargo.toml @@ -5,10 +5,10 @@ edition = "2021" [dependencies] -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.5.9-alpha" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "12bf9ee" } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "21a46c7" } [lib] crate-type = ["cdylib"] diff --git a/kinode/packages/terminal/m/Cargo.toml b/kinode/packages/terminal/m/Cargo.toml index adda2ca05..a0f3080a8 100644 --- a/kinode/packages/terminal/m/Cargo.toml +++ b/kinode/packages/terminal/m/Cargo.toml @@ -7,11 +7,11 @@ edition = "2021" [dependencies] anyhow = "1.0" clap = "4.4.18" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.5.9-alpha" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "12bf9ee" } regex = "1.10.3" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "21a46c7" } [lib] crate-type = ["cdylib"] diff --git a/kinode/packages/terminal/terminal/Cargo.toml b/kinode/packages/terminal/terminal/Cargo.toml index 43871bdd3..1980a8004 100644 --- a/kinode/packages/terminal/terminal/Cargo.toml +++ b/kinode/packages/terminal/terminal/Cargo.toml @@ -7,12 +7,12 @@ edition = "2021" [dependencies] anyhow = "1.0" bincode = "1.3.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.0-alpha" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "12bf9ee" } rand = "0.8" regex = "1.10.3" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "21a46c7" } [lib] crate-type = ["cdylib"] diff --git a/kinode/packages/terminal/top/Cargo.toml b/kinode/packages/terminal/top/Cargo.toml index 53ed72368..ccf37c9b8 100644 --- a/kinode/packages/terminal/top/Cargo.toml +++ b/kinode/packages/terminal/top/Cargo.toml @@ -6,10 +6,10 @@ edition = "2021" [dependencies] anyhow = "1.0" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.5.9-alpha" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "12bf9ee" } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "21a46c7" } [lib] crate-type = ["cdylib"] diff --git a/kinode/packages/tester/test_runner/Cargo.toml b/kinode/packages/tester/test_runner/Cargo.toml index 95b65d88e..13af06401 100644 --- a/kinode/packages/tester/test_runner/Cargo.toml +++ b/kinode/packages/tester/test_runner/Cargo.toml @@ -7,11 +7,11 @@ edition = "2021" [dependencies] anyhow = "1.0" bincode = "1.3.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.5.9-alpha" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "12bf9ee" } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" thiserror = "1.0" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "21a46c7" } [lib] crate-type = ["cdylib"] diff --git a/kinode/packages/tester/tester/Cargo.toml b/kinode/packages/tester/tester/Cargo.toml index 35efeef3b..49e2095ee 100644 --- a/kinode/packages/tester/tester/Cargo.toml +++ b/kinode/packages/tester/tester/Cargo.toml @@ -8,11 +8,11 @@ edition = "2021" anyhow = "1.0" bincode = "1.3.3" indexmap = "2.1" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.5.9-alpha" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "12bf9ee" } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" thiserror = "1.0" -wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "efcc759" } +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "21a46c7" } [lib] crate-type = ["cdylib"] diff --git a/kinode/src/kernel/process.rs b/kinode/src/kernel/process.rs index 4759e2999..b15af3735 100644 --- a/kinode/src/kernel/process.rs +++ b/kinode/src/kernel/process.rs @@ -11,7 +11,8 @@ use std::sync::Arc; use tokio::task::JoinHandle; use wasmtime::component::*; use wasmtime::{Engine, Store}; -use wasmtime_wasi::preview2::{pipe::MemoryOutputPipe, Table, WasiCtx, WasiCtxBuilder, WasiView}; +use wasmtime::component::ResourceTable as Table; +use wasmtime_wasi::preview2::{pipe::MemoryOutputPipe, WasiCtx, WasiCtxBuilder, WasiView}; const STACK_TRACE_SIZE: usize = 5000; diff --git a/kinode/wasi_snapshot_preview1.wasm b/kinode/wasi_snapshot_preview1.wasm index c8320e0b387374ce478d17546a4a0a442748a8ba..4ee5bc1b8b76548afb70ad74b32c288434538bba 100644 GIT binary patch delta 25025 zcmeHwd3+qjm2lS_nvq75N1BnW)9#Uc$cNlMoVPiVC(xQHSAlp4O*qQC+xDb7egvK-x2IX<~W_MWK<~6CM zFBjC(vUh5noWs2ShNH=Bg)zI`Q@zcaGN^D))(IWE-2poCj>|K+t545w4Hf}m1D%)Z zoXZ5QLQwCH{?0+2bDOBcuB!Qg9m+uG!p`ghy}v)(-zv0(TZG_6Nc~X1syA!>*}jWe z7sr`{-g`et|M+gHlXF(k_dFHTYsUe1_Vx|I%!B>9(!+5KhQ{5~EzU;VH5NCs80jnC z3phF87`U#l9*0TO2h{$~J`k)mH8<3=W9xv1Qd$817b>{6ag zGd?ON)94RNL$FHZjf$Qk6wJV&20F_HOyy?M-q~r1*`>oJ#|3i>0l=NT<`NWIgFAb< zKt(=4cE}oSqlX4AP;U&E04+b6QUP?pWrf#`xo(TCWi;AGB2>#<58=VD!+F9iD`3ef)C%^?b`nmFXOa7%m zDpxe64~Xr^_UXMHX+_Iu+~R=UsCH)ubgQ*30FFW*?6CV#7j*7S`bK%h@RES4q&qwG zoqgH~2LjFDO!6J6uuXGOR+>mcT-J)w9yE^r5joV(-uk>o!9=2dRd;_QyimK{;gWS$S zb_Wr8JGaZc9?*L=?$Q$0KCoqIP|NP<tNold8(qhpJ%^vwaq9?+exqG$Fw zw|~P$oWqSH@E?~v%57~RGuXAG)zRudN=p~cUVRMvc+%u>g&g>Y3psg`bi^Ef_~Y&3 z@y_4nzkfG?;V_;oAl?#=XJd+E4lW5Jiir=~i$YExJrt`Mb|#M>cW#>kjY)nX7ll7> zfA=c~3u2tWleRa$ea)x--=lYYg^zPhaQnfpZomK92M+ur-12by(;wdcsqfzOB6NGyR`NYLXuY{5RqSwEp8!Zjs&X@DHr=BY!v%BcG6u1d|Cc zKY@`DA;YlrUqrDra3!4oPq_RIoc|!U_;|WByteEpi#~_=$Vs3TSVSXEJ5w9JVuVvi>5Wu zpI26qZ_dmf#2}}NZ`i;+~>#vyji_*5)5A$1^9l=0u!Ksamvxw+QSxg|BBQdt4Bi0>JTbf zhm@XQM=gMTh{go))-TEdEMH=?a`Py_59(*<00Pt6nYda&R5wiPv9KLQ;PJeEB4HGo ztZ=>;XmWnF1AN%F(`L9p_RrGa@)2^FHiYiw8O*46aG2h~2fFI(N;*Iz7R6av@52b)PLnCS?=gy%{KF6CgRW z0fd-i?53Gd|8KBVZ`#8+iCFgV-Z*hT58|$&ug>N{&94L5-*Y}ws^{s0^I!bGE zU#KMy(PhFivY*~2?6w$Z21PDIb^GyUwt~A%H|;`Kjtbs!nXP=x*PIMI8D9Uf;ox6S z;Oj9QSP|n#Cjxmff@=O=1UY(f-&9w!&i@dNMvZ)ShW8^oBO^9DPLmy{%?=qE!%hx7 zVJh=Da7&pFyNT!HlA;;snGxs}I|BI|oD0Z^5OQG%3WnTCZ>Yf0nuH|CzZY>fczD+; z$cdc1CnNvxs)zA5RKUBF9JKHSDS&Y#pFi%zA^vM|I!rYn z)a8Z0;*gssII$OFpBZ`<5C_Z-85dU@D)5b&2gV=ey390>FBp@DEv7$?t;v&aE)L(e&F228*0w7D?-XHN@}z4U9RRjp2v_7XP)>Z&eWF}Rr1)y%=_ zv||P6+VOiA)mxiD z2A1F7w`!B*}yTaWHPV?0_sXDl6RkglfP-~H0J=>z)FsWUTY;E za}hV)R9A_i-E<8tXEsi^xhOy`a6K(6Bkf7&V8}z)L~H2vXI_-AXJ+#9+!9Q)%FSa4RJKI^kQd$|600xX|Uj! zVHyPpOek|L?XFR?1c$Ysu088aCQTMmU!h0OLf7!`XDtCb`LoBkhHcByH5_|vjH!&> zVpuE87Vu=?FD;M2#K~=qbk;ey=c~rag5D{{$hTHJ2|nkZl^BzsUfCG@Guu*u>m}Qg zGnbYSSjPSI{gwNGn9_wa=)h#o$Imse+&Z zT7ru+ympL-{L8`rgjv4{{^@h)TWX-W17HeG2%~WS1 zz^fNF!uq@ync>0M?*gNrw{8&9+I!Xw=VN|%J+95-_4eAZ1f!OB+I!9G){j}6lYy_? zkbzmB+<-CjwGF61f7oy~7{-!|l>AvAy9j4}^fUIXY|Xr&5mr)HvT@9;Cjx>A2IrcYq6Y_{{{#1#k@>mLPd~ zxN(IFAweRD5|R` zuM2sQ8dnHh178qxxOi`ghj%{`DgrnN({9MEaB}dgV1gL-U^GlzNw zAOs1S3+HQc6fbQcI0%XjsS+nRXadX2^0h*~kOfXm=g>)mWw)0wmV*t1cP}p~1Poj= zH-}|^^hcM}4)ghA5LdAiW?w*RLO?}+pGj4aC4#S`_+i@oex!LcuLI7^`kD*tYo|e< zRbP{NSAKnMSb+Py0$UT@<`>v_?9MB&RRJdOG7}1HE^`ZQb%XCmu>mYNCPbNEUqh6+ z`r0rnxG|h|fsGBa5amURlQ8lL`4~1SP3EH5CuQUl@-ZCa#;wRFWW?eFJ-8)$R`Hx{ zK^kCPe*PR;#KB4ox4rT6+uz@R)3?8brA`alm%n`fvnw&2o77e*3@Rt%0A=*Mqt_q& z<@5jc`0s#jRIxXYUj6=m-u$^I-h_Kpv3K6So&ML0uYURWqkL6QtW*AGCh*Q`)Vs0*I&e9pkqpZqpyh5CUa0nXTD8COBF>m@eI!nXth+ zmEq~l>wuDf+N?q{Fnvoc{4Uz^D0zauwdDo!7=5bq&fv9dfgwk)N@1LA=Bgpz+uZex zqrpSxZmlQR(`8#*BgB6l!m+?)!g6ialM}}rCl60fc(>m`5ZLb*@Sde5j=eqWEXMCH z%2nMhyLX_U#w0x19cj$V;;SH*nRz0jf^s_&Hp9?u`gHUYsLO$fAf9$@*q9x~ptiq@@Bhs?7XTG)KY;!lB7J9sUy@e#_ z1|}krd+l6v91?nK?+B<0Zt;)N)3P<>L3&{}|3LtqnAVNfS|`i5JR4j*;DTaeoq2b9cWoUNx-<;|F&GkE&2A&koqC z$zq??gQ|J!s9JzbUSTO3sH z*6w&9KW{zR4h@Qg7Wmi=U3;EFkM930h5odMxb5oQyW_K1|Cs#&Tk^3w&FLo8Witm8XH-*@bHiSE0`~(hsggyKA|9Oi3eG zkhTnITtS+isD6C{@NbXIgPDInf_vWSyQ^X5#O@hnH@#$cAGwacw7V8+fxq63MWHEI zVNqzsRag|d{VFU99lvTqQOJsetq?}-qR@(~?V=FdWZGTmt)BnXgrd;o2)ey%ty^*E}`ek$Ox8^+HV@wz=p?@441?q#m;h%zBWt(6tjB>8T9= z)wNi`x$8O<=u_9t4_<|&HWZFla0-FY53f6y5!wi5?X^6C$J~Y@9Xwpa7;pifr?*^R z2bd0CKcnVT43o>o1P;K`NseA}&4jw~snGmavOI9Z8sO%eH=riHdjm3FbmN8OYMQ?B z4v2t%y0MPjPpfa51$xtZ({1CIrqJFF7TQ_JdpFrjQ)pJJSPw2u;^qlUGwEjr!{*n zvzj>kY--o*PCR=qr~ficO=$-q1AK!Sch zGNT^q#U@Pr|1 zHV3}l_UK)2L-4!vZXH}4xo0~02O7F(DqJVv`U^+a!>^Tm-dqZ`>RTVKgykd$qwrhy za1ee+zPKqrJN-BS_UQfN0G^y=3Nyyz7R?2ZgdDJCg}8DHUH8D(W|qR%5T6Zs>@;-r zFS;>rLqVz2OBX+Qu|?qfQ-A}Yx{O6$h7uLo2W9NB0?5x@&0MP$HcR0l!{~(XSQ8f8 z69P%4H2H7GRda!5?J{p^`rvIxu?H@58QdMW+X7xr32A3+=+w{(x63;_MEh2i;w zOD0ht^sE-Z=O1p)0lf8aBRN1zAK7TRf9khVbL(}+A|STN3_dqJa*34@vghAc4+fuO zM=I&cXFRm#(RJ4Q7I%)KVGmddzV(Elw?4XHlE){F^u0$9S+Zbi{7E-$7J+QjKDuec z7eOrSObjOWRfp|xc4BZQRug>6<97HuG5Ax!Ha!{bD6J(&Y=WM}A?CB;V@HN8@%_*i zAB&Ve@aLBJaBSBT_FFB#u)$cC3$>eku#a+Jzp=p>;iFHx>7`HdP3B$|-$h6|{g0q^ z!c$<_941FbT>iVvhX6^J{}K9)CqJ}wVbu~ z9P4sIsQ-l^ZT<4Ij;jeJU!6|pK2<&+cY?*Z0b9rw^LWGFX>5Sn4@5vL0l`ZH(CWe` z6GsN03b@FX^!lgIoQ?Z6NU+#*82|#yE5L1+*~ZY3BncJJx1YY1Tt=_>YBPQKs|_sx z#&&1;NXKu^iePLYLHl%oD=;5R`K}@K{jbL9{I4}s!7zu3-JL(oK`;5*zf64`CDq`J zIf`+chtGO|ZvPE*+1J<5`=7gzzWeq0rh{M@{5R32qY}A^UUIa~eEf~C-1zND4-*j6 zrn(?qer%(qx7VWinriaRV*>r?2@k#R=p|7m*CckLfMH@LboP$nsL-KVuu${F_aJS3 zrh4x;Hdv~b8_SFu$*@#y=Qr-NK=#<^$Ai4}%njo~#!)~4WR^)}4$C+YOEVsz?>tdK zANyxpw@(C4=YR8_@sp0HOMYhGNkES5{nn3&1@mTE&gG5uRX2QlIypjDJljORLbpFV zOwWC`k$(5vBlLr3r;&f6!RPjnr|De4l(D%Mx1@D}j|FH7I!H0Lm0S*ddvHwe~o<$(3 zfsz$8F^A$mgssR4gZXkE4899)!W?EWSg}JqPvyaou`s@5t%DUDz>TnJZENQ_-`)b6 zeQ{>U{{#+)7yO(_$3jkoKj05}{1bCjL21cF6E8JY-i}LI<9{*-`!c*rL+H+zt_xXR z%ojnoXJ1ot2{LH@-Vrb-urS@%eNS*&L+n_0%mwTTsPU-uj9pm=gk{gI)N%+J|M#140+?Wy*;4 z{CxtCvqSNOy~F>(E9V1(<=@Se+{H8$9^fbO-TtqAcLt#R*>`WSLX2TQp>vucrWkM( zn`y|+|8kiXe*I_=e+%z&lnjYXfrO-8D3-QU`IML5-Tw*gK{-qsEWw zovfS8sF|%mXB9ls#}GzVn>OPdXMnz|AS^H?&Las(cOs=cK}lMqVQS3*M*BTOy6OjW z8l9$1#?U%3)Y){KP5~^&x0JsAgL-F@ETtd)U>5wsT{YYRDlWNugoibSk7*DuR*q@l zhqCLKgLvsVuQngK{)Zzj@+d8Q?TYq8C|zGE3__axkFi_s;I~Pon(gU>?~{7r3qJVB zc3~&n^$!lfcZ}8*rwsIzaD?;hgl~W7ORueyKIX$sH|Hw@n)AN%baI?WhLOf9AE_U9 zk;y(o8ewc9VE|4S z=XuQmkrMVVF3!z9>va;RH6!~5Sjl|^?B*Dh7eCKZ(%m`&PV$AT8?=eDaKRPH!IQQ^ zhZA%yHxb9-y_4Si=2oZE{DQI8?Se6m;{0!hNt+wt+_dcVxx0^kb(j56W{ zfe{z7iQg3C_rnd7AVsMLInUeYqHL1w;CC*lbCMH#9=htse3fnMV?T*@6I%D?;>yX6 z0&qL%{Xg5aWHQ5dqUoAW1g@NUhTnt+>>6kI?j!fUxhiM(1u(=lncaK9?wcY`GP&h@ zaoD7`Rfx7VpFe?R6DHWaRHk-MC<0UmUDYk$6vmvX={>Rj^icu+pD|L{{BgTIm@e%fgeYJZkjGIz4dX55V^B_32SyPa5fmA2!Z& z*C9X=b0N)YR@3peth28fKd!|i2{a8p&K|&4`pO@JtxFhVE-t4XV20RK3!%uG1+)lT z>RntOTHqHOrx^>Kq?SxK6kzSk-A>|llwLvHq?Nb^^zKZ63rHiGX}nxOW|JAlhXrKb+L@%2j3S%m;_9rU1}+}bY@S+j zCq%%wEoB6}To;*xvp5(LO}-vwXESg;)IB(`gPUvY@R0e%^K7(D+$`fU4{4b)pKK|& z8=JXC<82RFP~SrOrr3y@3-O!u&HYNxzyhw(#mzL{@sLmuzg{N7=t!V)F6%LF@sgqq zqLWmzqYBIw7+3(5TY;a4We60FazfgQC&-?y#(3GY1z|$31<}?OlBFOpwUEqcaW??Y z60d!V25DQ17(Fg-j4fM>%v7|?J!bXUvI28C6mUq#1fsyqCn`h{HcoSK6SWPVbz`5Y zB}eY~|HBTt`_GHZXTdrR6Q3=)05_W+`}3U2CR^SC_jaXwNFV0Fh~^k&giNKc9rscH zaW9#3r22TH!v&&l#EuH%R|RB>p%F5l%rb5xWb1`vWj?6dGM@qRsVIVb%OXCJ%x4-` zIGD`;*+FKU=bnY;R0Kw5Sr=)mM1IE#_EgMjHofr=zX4CP>yIIayU8#L$zpH{a7Ky4 zJ;yj+NY;=VV@(mMak%Fimlcr^h!$>xt<7-CfMzMzJeQ?+7)z{7*z9s~z7oiW?L4`X z^BCu`Aa&N?gVf)H6e#ZBgVf)H)Zc^D--A^D){o2mK4Fk58Vyp$;)SHTYO<2Zd$U_n`mFFD)dmJBGEaI?%ANVXbv+6VG<5EgO3`_MX+t4{p)< z%+TOazdj$XI|uk4WfwrG-9s97^s0Es*Z`l&_VZfj02ELELwf%%hG3`<3skzsXW*P4AaGzl53C{LY;Q}$eB;s6$@&S*nVaWNz+G-$l!(0- z-`I0zuh~4Y9DBM+jcsqV#S?3Ug=%Z1OkuPEP-q3(g=nIP2w> zuzyGAU~{^&SKF-jHunz=3>FA2qSPXApEe#zl7%gTsE5M|Ev{&?mXK9FBFkDltqD>@ zibtZF9F1kvv?7tWvriJP#|UjF(iAbmPQ8L7oAB>|v9gU+1%!wsB~&q<&?G6WNm`0* zG0M&%bBw!J5U=sYHZpq(v`R`MswoLU%w$C4^)}Ms*8#nzDq&TXqN*fH#;P;Pxl=?f zq3Q`;jK>mUI-WKTok`XOw7Kb{c;S&j%g%odNu62{#rlJ=+7jFgV0 zqv3cW8q+k@C|gR>fpjD+g~JgwoQA2Th?pwsF)_WclvI{y6fqGIGBHJtMWv{e^7Uiq zB132=v;48RD5mAOl2L`IE&;+!JGml|ff-_=poKxqiG-3#mF&PV%ZxLYk!k*PCJs{3 zw2Y(+FJs#K7Vgy!5mQ!VyoAazbo6M*Zw2YvMuECgGYlg5CcDCvkCPw0Z6ilU;Yf|i8eTn-YBX>m0s#^iJ& zoYB*oW|W>o^guMM=yA}KXgDHEax{{vv{--f95^sil43C-o>4NHu%-xUF*S7v31+HP zZ6sHahJdKVwMa&eCiIvr$5bs5pQ#D%=Bx&3Uy){ZWmdI#8nHCnq8AVIg-o&ILM2)_7A{xh6 zk|hB#uBKx#pf!^g60#ts>NcZ&)EfhUl!fq(IgD5_E8 z<<;$>2yL*HS99i{1+2THCX~>m}&K{ zIuCl41n7|v6=fL|TL|l^S(YY#<2=wrDH0W8Nb71ly;42Tgy;o~4M z5PUe*lr`Si4EAvMT2dKEr@=}kH7cv&SX$C!sX0t3mKpx@NnJor#8pj`#SE~M*2G9^ zE*rbr*mFK94Wz?*JQ4>T7nDdu&ZJZGEX;eh5bypANU0yk$_Y)5!@>x%kTIrRKr#U( zl89u&3D9a-1Vs*~nzx&B+SCbK-QU7M&}1~oSts{G?!L^BL zDHaEvm-Vo!q{O?JI);sGJ83a4TTeEWi%M8Zr}bzw5&^x;gi~RITtvb~^#-sgMT#jI zB@xlVM`vJZQjrUpGVb3A5sYFw975>B@|pn%F`6kQkM7!1^SD#p}f4$R~>_5wlW(4ohmUkHN|rFA_OH~i<2 zxd4zT7erZ%YJwV8qTm69cuKbW%8lzblG)|3d~t{#=}aOlLW z4Ei@!1=~n1G!A!>n6YOiDK@$;1`%kw1bz;jTtr(ay)hV<#`}aT|(vrgqW0xX|WjCO+pgWTI!7c z97rh~6Go=Zl4Ly+O(-!b9g!eZ#8QhVIZCqCxUB=wDPcthHx-X2!m4hzhJ_R* z0X(ymTDr`1X7e_Yns7pj$21|M#M5EO3WR8?eX^4)m*ozwJnIaT&;y%Du>j#UozbHZ z<0MrF&y_lR+^Lq!?MHohRN*-mj~{Fz!PTO!D3Mqq0WL$7BM~jNV&aLHE5{yqxoX^b zm#cHfUFvJvOsXzbh<{iH)7Eqm@rTn=Jd-*%|0vA!awlP~%|8h9{ITa?UVx`lTE}AI zd6t=OW%Iy=lb(vXZrq`m!-MM?oPA6t4##Y7!{mo#UX(i{bK|%pGB2L&gv?7u56JAW z&&S-f6yka~jCIhCfnKBj9B^SjNt2pcq9P^Yk+c+vM4}NbqokC)gEZ6o%yb}*fv?^; zO(mO_#B@kXz=6xUg5E(%sriR(ng?vcQJd_1O+0BcV;{7+Id{(H7UOl5L{5`IB_IWg zf`dzIQBg~EPJaAmR~b7LGyhQ0t;Q;iR1I6_Z^G7LYtQIWoV{aD;>=Ed5NBWhIh@@w z`hdpDUVR6I1#n8L2zIAJ6q0pWF<#fna^tmgNl`_73wQ}QaTM})Nd;|AM^jhoXxQxr zL}XtO27@bwd?F4B4a5*dObr`r&LnerEN;rO-XiVB&8po3?RYeG!bQ&*dKAv_laBam^ZDrU)|7E#i%)HSfP z2wgzV#~I;2NUc$YARZ-z)U~7wd0%Eggf0ul;}CRX0+NGKOix`$SkAu8fan|yLbOSM zM+cSHVN;P-Q`eKra5QA?U1UKy#6VSxiQw-Qh<1rY>eI%yF49~MPALZ2Ib`6mbRq+} z#tp`yF4!P|yUxh*Xf!N|vI05djgUVx2iv+8HqnuomH>=;ES`yq@k}Ol6Jg0utpVLZ z;|}w~)r15K)zaO)y{9D{jmdE_B1U832n5Y&LXvMbez28XQ7)z9YDUyz zs-Wu_*HX8b?Q&X%ofG6=u*HY~QK>yHu| zI;c@5wa;vafG4H(w4`acn}X!ycGe!uD6$Coy_k@rax5JdQ~SwFm>AU?wcE&j5Efxe zmm5Iec!4i-xMj{G?;Be|QM8m!$rU`xkfSpH1R@9h|;TQ74)SX1lMe$ky zh=yg*2G|XXnV70Vj{8}%F$chs1rO-DD#3DrwM3P)7FN^o)aQ)dgXF?;$gE*YnFd*f zVYdij`!3_HL9(s|ww16SkQ6}xQ>f1J99T#$pQ4}ulossqEKmVxvobuY*aQOuCegQLB(GI~~g za|b*@RFXmBPz}f=;+hCXbDuGNJ3Kgq#5uzfb4U?jpCP2~H?rHw;&O00kRyXIB8nas zMLqR^adbOr4aQJ~RT&m463wI~CG{XV7w43Wvv!c;palDvFl^*u_YLI+RZTracADLH z?I2Yxv1kM~JCY1rV8}1ik&h9_=gAs#VD(P$cY*@G5;i^>Od5_x6RCfIwP(}z>;#+F zg$yVu?2KYMc$JKl`U1Jg?0#-1sQ|@FfRLhMT2(=yV1i#Hc#M1pJGHx`Z?OL$DPf@+ zPw~e4hmEpbq_XA_0?#1fkZ8~sv2gPjafik z7;uTWB3__ef_%&qTjyT#}ePjnQ}Rt?HicW=8aV@%Mdy z`1?UmRo!#XJ@@SAR^9vQpPiq6;=F$%D!U{Ux9i;-^Sbn|p1#dChM9^#_-t&jsZVX< zSzc)3xF(J*S*s5;Y3+TwI?&VCuJ<#{WaH&ZG-gaTSYe;u-_tob(B9L{FfDj>Uhpdb zkcpx^8-=~QXOq=;q!!d@pz)}-B)d~JKJbYTpI~!Y&7Q1g+-7UE8j7yRHe+Y3gftcoBphQ=YMopGAOOvv>Rhl*i#_4s8^ zc~dr~+8j*n-MxbYP5lFXy3)lkv`02RywnjGnY%k3wIg#EZ}{sZJCipOb-2h`H)hj`ul7VR#)8NI9O%K8Tr{c2x(0(d*v zr%)X(pn&z+fThEL?cMzYO7{R$KpB=p=s07)4^`sBd4*^se!iI((gK^5{`P6@JuSUG zot-n;X1$+ywCGNE5REq!H>#MDtsvDoT05ZjHud+Y>vd45 zsrb-aV{;I_>kgrM<0C&RAIe5lNW|Mepn;!bd_ig~YG-?keop(qNY>&Y4Ga@X147sK z?vWr1EX3{IjITZee4^GfI3ns4CD6?Hrr^Ux<#_LZxpG|y!8)M#b+vaZorG>c4--CI zlsnGe!BJx@-*AaP6; zc<;MldS-CQ0jMmrgq^EJ$iV&BpeAojKJ_uF2ShsKqY0Q>S(IK+6)+ zqA3GP|K@I$Io$(yNsZ7>ah%~Bz9*A2eb<>rse;O0!Ftgk^ zRY4VFnH6NGaU&gbv!)g>Npc9O`ykPrH>ao#`o}cm12YC`hlD-VSz?J31D#!A;^@ zTTi#%lT0#w1-*SeY8$ox{z7`)rw};}xck+0y4JS2UGLPG!NNYJTkGkfqS)vrKB-Mn zRlRp$GP9|G-a?AIkvYe_?$^6DX0wMr?_W1Kp!IC(X3oWJWn(c(heuCc!gz%-+Rp?2)ueupsiC?U)gx`0nH;&!DZR=Jh{xRddoLmGP@xp108~(UE z;>f!luMV{pnjmkNc`wIb2FuZQe56(=rw_jZ{CD3B{MRUrefyYI$Ho5EF!(ujEhmgf z44DtZKp-$VL2g5ghw=V>E4}jGNuIa^_(fH}n-fR%E=9{=%SW;!(52_J00hik{S zSVY-P4$&6Eq1VP@tNZh#cfV}h^f4xpIo&NHap}0_7M7olj%9gZ(kMji3e2HWZUzav zgI$(XKTVE37=UiOIV5bPb4b)qox$=Y(##w0b9J*)bPE_QW{R= zXMuM#Pd5h!xGZo>UJp8u9p8W0?*JQ1&C%2F*ta~p|85Lf9DN2jT7y?l4ggoTOm2kV zJ0|b?c1J(Be(HGi&tR;j!a0n^KW?6g?!rf#$G{Z7Xr6?g!4q3v_;#m+>$%0~03P73 zgI^E72}ZtzpM+k-_wu#qR{S(S7wyJn!nRy09H!E`!2P*Q_i(P5YifGbeYwCd0x4ve@9#-j4|Vuy@K}bo8wR(m=Pd_v z4Ap}hhRAc6Ssy~<>9uVpwWcN0Lk+f>Fq4nIw0AVvm;f`!!@%uRa2vA2gP;S(XC!EG z;2E*Xao&!A&HD<$7C;R)f6x{{KpwgF1{m)T@T(O&GpF>@G%}@e(^6AHriG)FLwK$- zYf8rhKc0l19*zCO5_*0#kml(`LQAF-3C$m@0i8?^j>8A1*MnZ(Ik+`*R>}!vR^Cln zvvN^RP(kh7m^G_3xTz!nN7aWgj(}T&GF*7aiQ|EUz$xSNEmi&cv9vgyK%7ksMR`k74e(Pc8;y^z1 z@e=XY2H~=asgmPpAea|tf=rPUZ#`*+K#7R|!jY-qHJ}GInG{lm2UJxsu=jJ^KBE>` zbIFV;@Oxl}l54nDw6U;|xc=!$DTYyhG>jjgd(tt6`%SvXXU<1^@KrM}wq4@HzIX#L zk$AONuokaBVHe?VhzU3sfo3~^e73VA!~ip750k}B!oQF+ZkrEq&N!OmL2mp&{N_>S z={!-2ZTgjUp9LnIaJ%`73sxU#Syl|OTT?SN_$x>Y#gPiVw z6I45xM{TK{&Y1(hFV1NP zt&Yu2WSV{Nyb3V;$L5Og`|(_Vz9l>ypS#imqkcIDEG=UgYBzpk-Ym+!Nn>6#scf)0 zf@Zi0*r)@hkwHD>WElUBQ?lGn>5qupDOr$ZMcH8}laAwoFIyl0DUWZc$M-GRovUBp zByRp+hTXnXAF4B%;ULU#LZp8RLf_=!Gfzm7lv_Yi)Hi$zH9NLSrR>yaP-g_DULdcXRe}ssUv@ONtPq; z{o3FUk@VICFFk##m4%It{n26YmrtKHnJN}gkwpyAU?{Ny&K6V?L`8Pcci_N`GZbq= zm*%C1{5lib{&m1#ICFlu`8Fed$}7>@?H=G0Riz%uPFo(|>9x z#{<`v*MoGY?l#ABKsY?Od;rq#h807ZqaIj6gn0GJ)Tq>P)k4~06&)ojvxIm&@Yhx* zVbl}Pnq(;@)h8QB1JWEzpMJ(b^0w`)Q@})@JL{Oh=S*d+qzf%*7p@{@*0xoo%sT(Z zV?y0mcUZN02A)&x#m_D(!9QC)rOeC%hJQgMOQzR59iR>`;@Y#v48_50yeW_DTI9*6 z@qak#k!*mv;UJ<(HQc&7yf+as2OKTPKZLqBaBoWM!pA1?~XyzDaxo*n|su2j=I^@i+r0 z;GFNtqhvwC)0m>iW`=j08Qx*$fsT-kgae2(_nr^o29_ZL2qr|vD9Xo3T=D4V6H`DbCj5Wx&d}pFz_ZZ@|%d^zGe$-gD(s4}Zu+pi-g0ZZp+{8=8L7 zXI9lTWR61I(D6nI0P;T_-hTHx&;7>(e*)xHaR0l*7ytRMSM7c9cW_Sz|M30Y_-`+~ z@yK6>2d^G^a55S=wF07eg}`xJ2FG{hk46ptIwj!luk4<=j5Sq6j=iH03G0x8ZGiA3BQvqA!9D zCnq=MYLjLAQQC_-i(e;Gj*JEXtAz-ve(h+k<7;*Q!`kIQ$*gs1-9akkvW`G0m}1%b zP+6cj0RQLJh7c6IPp-QUJ%Ib#pGW_SXLj7^r@0f!oT_99yYROf;?9R1PmU#Kng@@l zpW7NBMItGifl1yD@1^*a^)uu7-tUpIs2!RZ7|6OD#O}f90zt^y5Evh1Ku+%-0tw+C zk~=W@`2B3hY>y3}-<4Xd+g*^ZPUwnZ6^sT+AgL@K?<5ZP<4#|Rm6HMbCdNhSti+SM z%BI;Pc2|IDMI@tS;^V;w5ps$B6PHG=#(>bKG2{vo2dfpTFbCe)b+#q7v=v&#Nd^Uf z>6&U%kj@Iv>q@zfv{@b7?ZNI@W;ggP>e&kF1l3>2tp3a@8$7Q+BSC~J8ywy(_|=}Q zI{SE`bhOB8<@z~++A@RB@r@fuuK)Ok$xutZ3)j1FVP9Rn?6HGi9?s>dr_VP%Yd-O; z4mXbV_1M1LithryzZ<{bcTAA9@=Nd*Fj*?Y4d)RV?(Zi-^3n5-(e$tGaQ?vUKxlUH z-U=iClL~h$fy*h}@$ya98ljac&?uRm%+pli(57266PDv8=CD{{fzvc84Q^^7Xg&4c zbcJeo`QU>*s31?O9^-{|ovf4%A6y+C$^$zCj~2}H{)Fbyf3;VCIL77XMKL665 zx`&_-DwfX3nNWTU+R8%ohw$qN!mvSnqIR(PgJ@@ZB z2QkKx5o6M8cEx;`2E$E6To0n>ycIHHr%zl z9-lWvR=aK<$|^h4>x`N2Lx$HGM_ra21^m=)Q()xxw0gXETYhaia-IN1z0)k<8*EX? zU~j{Rwv9(y@!Q*a>#QI`76(ZA?j+^A4+4oF;P&7R7n1UQ_l2Zu~t0i?XWubgwCJ!HI)Au&Kcg6&f5ci8K@gmsK6!{rKi9CxYJm?8>azs$4}x zHsk74T2^4z<)jN;Bsg?cmb*@a*P9Z~0Z*BKK@(F7OxkrdnZWO_CaccHJBS@l+OeeO zVw2@&C6otqBI_MZj2AjwyW>Q3F@9-B4G{X?4)Qjt{F=_(tTNB65~^Tv*vgRhUy~v~ z&m^C=kgReEJ|@q&0)^7SOQ z8hd?~y5<0+S1aFeAR9iqlCDUDvvxvW4(ki-4Mauf-9VN;cHOWwSMR=hCF7edeWVlV zlHKGrWj2@V@iX85Cx$BP#Z1l%H_KFCuEV$Aw4n7$YLm`@6B01nKq%i!ADF)(SHRT) z&eF9gP+&fpM;9z$*&;qBSO|-CHuCOTy!m|yPQiUT82hFB##P@=Q9>>=Q})=*wGg%= z;08V)+BXjU@Zg*9YsGF@EkjY zX?A4U(E-cw5SN_+m-kBipSM0ykPq>fti>1Om$iyQ;+|ZgykdJHK62Y?i>CiB28=*x zDfNUD3yB+Kf(vga)kM$jvDrHa6GCKV4a&<_Wa0$8WC=I@wg581fQyEg^oy>1yDguj ze^8?lguhH7Y%md$@CAhmL@E=BW46a(Vb3R27vNcVX^(d|;Zral|L~4_RE(d!qYmZc|8vK+7OQuYPG2S6UB?5UYtSYJ{_c}U z&@j5DZ31}iX-WeuzNa1;c;KE@mNU4v#46K~8H5U9J)qDm@jkleY|D?+O3G>>K}fxK z(3;5g&>g>ggm|jI-rF+5>T^9_cHjLLFxBaFePrRzsgKCpc?&$doH{Nzov?}hq5D$- zY;^3DfhPFifmFa69sFT3(c{s+>w!V*%YvV$*qZZR4o^Cm0(mV3LZhS`g1_})*^kp8 zZ>KUBC} zN*mJO)N9e152sQNhNK);3z7Erhu?8rgCM?q_;ek<=8>{`N8CZyo9VkB7rjET&f$Pn z=q85o-a|AWD^K{5^WY1Q_#EgQ{MNtD3WoBa6oACkT&sq~D4KlJd+0TdL3qJq*PucC zo5z}LA%qJb4^1#3Y~V9Y2%sr|$fA!8jMiM@a}VK_k4J1F8{YYN$ZK|RraRzgAAc26 zuA84Ihl=Z=CzhZmaOpEk@#;fU&A>_Fy;tDfhr;Lz{OqAIrshHQ9rxl}51(%-;;Zlp zAmMRM+O^m+))?If5JK=a*pEvOud>8XdeCT*EB-4Ev$)_VZrpVw<;*B@(}I3? zZ;%nqhYSC0*9Z@vygc)vDgRHNOc6}Gn-6#VbYCW!`N2fzHcU!}s=Z@lT@|Mv57 z=t2DBr|!Uqo~kEHj86^W#M5KZV|d%sJ8<5iWq9o~0dxp&e`cxYB47l3S{b0P>+v6+ ziL_>}8^EdoykLOki>$z4vmv5u4Yn%p0kT$5V%=OzZrtu&c;<6ec-gbQ@qib_gVv`M z1VzX}mmlJY>LILS+1z-`a}^Hq0PlQu$`E`N5Ok1kpsS#Ju<}WkK!F5UK?L7URvci3 z;#x~i003~c-m9tOhWB+$zz*;L=q$3qUEDPt(Wp<<&(w74MkMgg>4-FXP2GgI z6K?|b+}EHSK3&-I+`v!@U&eS8Z|-<*G9Z1WXc`ktg*-8*>Y`J1NVXz#sxC4Ea2-(O zWlhy}%v5Vk$lQ4_?(6dL^cN-!kyV-LXgdpkVYS!$2$2wsX>VfgXG0En(*q3;vcw;F z@2AqU0RJTm(3u7JKqla$S%7&tfD>UjxA!3e1KEZ>Zkxt%@cPFgPh$db3$LN7;5Hv` zd!eBc6Cu`kAEv>7^iq{zWe( z(O&%UOXI*Dz4lU=wXmc302qY_6dgKU2iar+S>3h=T#{`U8z2P1LIeG-ZTib+0)m|{ zCp~+q!jiXsMEVK~ZGqMi;feNGjTycP8B#h3qkeZeh=dH~x@ z?0vmz6W4qRg$6sMSdjxbRJXXqe(a zUt=ed6DVMuh60(rHhFbFo%LrtYj%;m<^5p>fP<#$9{9vxNZ8(>5$P<6RIeL6mKtLNx zOBc14kil(u@gMh?yFzpE+HukEPcl`J&!H$ot59nL!IP^LowBK*i_637KMeCN*FbFldDH`q>Upqt~&&3pYV-TJ_$p1$=XS})O# z{Co?-(##V4AODz&IGp!I{aHE8BRY~_NNt^Nc&4}Qy-kXy!3L~;)LKCZv}IVL-89Y; z2a_7b;zX%Y+JOA1%-C6k{)k$PArA^J$QjND_-(G##$Ga5DGX-LD>Y{7sYOClQt4{% z+>Bb68rL{bZE`e0WYb7x;Rmu)W5FIdGLtN_UF1orgUOgbSPXesZj?GvE$q(Q|9QnD zvz(9wdppn&a-*5Z(XV$Veau8-n}{lE+j}=kO+DQ}-y}5CX0|yuDxHJ+kWo^I#<+(8 z8jK_P(7(~x$)QFx$ynq6^1 zbj*~f<197SG=U^2^?8&NRmPGqnvHm)rU;EcF$ZroYMnGQcT38YK^1wF zr*xcyzxu*uD;+}4VHO1(%oqdSUHj^WnGnq75>sv*ZA29T*i+Xu3>HEi=z>gK^}9bp z4ZxRbgl3dafYwc!trHy}4>FQ5gka*62&e0emMN&-(coa}&8GJd$a<24nPlGjK+0te zs2vRx+?XQRSO|tZVKQ1*ih7G+u&HD)Q@T^!UCKF4U>k#-1O1zrCgXe?np)DFLNbK` zB$JIH8wysZH>gAUvaT!z!2+ot+fYj#hk8p=SlI%yRdH>f($&v1Fq;X+M^jPA3me~% zFx;`x=&_?_hiC^z?6;$eTm`8C1t}^V)KV7p4HTr-*x5uCWTgX*&vim$j6ejPgv>qc zxs7$k=N_~KH5jKBqng~tu|`KRkxqBiSUUeGVvT5W)W1y^Lc6lDTD2je-Gp3z@mOrxK zM0A;%l=C+jiiYMIKR+2&dBe$=mXIPmj2`9rBx`(lGD>)3d@LD_ zDy*a^F;UT3Ly=L!Cjv>~gqF|~f+j^1Nx87g9KCKfswiWlET<=;oXW*SR*lK-KGHbd z*g6|c^olW^RrOdRtSCu75mk(bXQK;zybxBRY$O_EIpDe;lRcYApSi}>bI@3CEDGFL zVgeV@B{grG`12Lvyfi@xXMcr_Ulb(K$u94|(avbWPDjhl!3 zWyx?j8q>oHuW3S(6=QO#!L5cxC+|`a+`f5ed{tBsqr4X7*@P%bLR2m@P}|B=InFpb z3$+?!PeCV@MY)KevN}js(qo*W$i56D|8fed_l03<8VhZaM2wB`g6y|AEzJi`voLcp ztcSIjlHfT_FwUNjbYBD%4rUKzCABbgk}E70j9q}n`UF-Id0@H};S#{Ygj_jDrqxI^ zs@mAO0EGZVlvFOMbBfAFMUj)M2GStYd;&*Mz;P&1&N4QUAq`1oXuPfC$+MBr5s zxG2}3YqlO(f`UFtVijFWa3ZH@g1|-P@l>j(8IjXau`d=*a#3E4C0RWz3Lv2gmdy8^ zhN^)5yea|PlY*AeVo^?>XsKn{>BtXCD}W-f5=bzjiNMxLR_j*Ms)=Ame3DD(s-g%n zRc`1ZRLwCyI2~2`*l1GcRX)lp5sB4fQMr+7#$02~8EA}8OM+3w6ktwR@06Md0Lm{$`5FA6bUNvNtUE+b?&8Z9ee&M{FE!(1Z5 zMFowGfLe!Fo2}bdp!zbE*Q7)w364Wkl8O?Mr8Huf@!<+Ea4iB@V>-B6j*Z45nj8W3 zA=u}wM3J(j5LPvX7a^WV2^HK@)L1hg2zzWLij|4sumn9NR!!&;Ue)DTy0OfdbrzcB z19g|cTmeWB*;qIsPfMD}Q)%e0?Go)pYqJ8b2uF8snaR|^1T`9#1P%l$&pL@vU2BxLA)hZQBqbOl z0xHjoU@7v+bIsPJZD5k$qs=nIoN-wv-;1*03!1w6x_T9+tL(o|RU!GJRCq zSve=A;ltkYiq*sCq@A5QCarC@DZHO5sAjA}!eWx+6*daeRRwuX#u;jg@wtL7k&{tY zO7by@gY-ZG&nG7`k5)6!Q-hP$=y7V~csM1r>*s79k#aNn6uXU zGLKs8A3kYqAmgC5!OU~kHf9{Nwkh+JHS1ipzHxBK+UDUi*3Qj7V(mQB;;MyieG_Or zXt}6@w+H75*|aXm=NoG@bf#B`s*n;w*h(s4E(($UYz@sfygDi>6T%{-ir{F&QW(-$ zN#0`Y)X}_ZSYy-xV>F?V3=WWqETn)*d5APG_J@-~Oh|$jLl6K5t;$=GN~A%1tz|XRx9uAA50K>=^rZ7M-b^8Ss5-6P%4O}uR zKwP`XYOafrqw(650iX`NB?nfeaEcCrQ;o_OlfqzypW|4_NtJ}8gIkS)=eY!R5bEX{ z5K&8Da3u^Gf(|hl1`t$HlfQ>(&OO(Fpjrk1kfuwqa4eb>A+1;NKwe*^W*ym2sdQd3~Zp;+_VT2rH^Ug?t%GyZ&n9SM3m?pqNNP-2i?L zA~Pq+mqR{Go#Xlrh16^LdrwFUq*Oco*{uR?;Pf{-AF%gvpg z8@rk%PJ|SI#9J{YLHQGt!dDuP!)uySUV_v<0+|*kfZ$kNHXiFhTgpUEQlYR&@==8c zk?Qi*6ueA?5CUntE`sZn!eK$)VSLevE-d3fTN08)_{)nLM9ypIb1w%eQv~J$5m5z$ z4;!C%qDxAkW`eXv(bPx;vRl=-rVCvRSwTdDxEtk!h!h6LCSwydBvd*S0Bk~l&?|xN z?xN4j0bhiTay%r{5^zM4ccT|+hEuzz7u`}08GJ+sV>d%YeCHBP#Mk?y9kn)53ZH z*cdCyx1w`0U|!jXs+u90;-S6>C&G|_Dtz=S7;+n0lF@tNCU8Ls5vnVQy$MqCfQyoE zH&ukLOw<_rHxXVWR7HwFxu62IESr>nh|bEu^Tj4Os8`g%B}X(a0m~DLAVlOl5IGmx zJf*b_a-}b-^ls!QVAfHp>BsjVj@Hy9i?dc>_`ZQy zqNk^`t+PEjP)SlDUKArS5DOIIP%&xpy(nzldk(7Evl%(6)ZWbi6ASYZaP|~pMxg(A(%qFB!Wh2F$l6T`A5Tj3!~tLpu}LI&ek;ns#y7cM9#+tLJuHUTU!^r vf^8QbK>6^jt7oHrkha2rM(bwOQ!O^Lfrbbyq<{shu|WD1eZhEUGiv!CfcPnL diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 24de5a927..f27eb4233 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -24,4 +24,4 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" thiserror = "1.0" tokio = { version = "1.28" } -wasmtime = { version = "15.0.1", features = ["component-model"] } +wasmtime = { version = "17.0.1", features = ["component-model"] } From c7e47cbae04919d7c49c98b897c096f2b7e0a5df Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 13 Feb 2024 04:51:53 +0000 Subject: [PATCH 053/171] Format Rust code using rustfmt --- kinode/build.rs | 15 +++++++++++---- kinode/src/kernel/process.rs | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/kinode/build.rs b/kinode/build.rs index a4b561eb4..a1efcdaff 100644 --- a/kinode/build.rs +++ b/kinode/build.rs @@ -8,7 +8,10 @@ use zip::write::FileOptions; // This function is assumed to be synchronous. Adjust as needed. // Make sure it can be called in parallel without causing issues. -fn build_and_zip_package(entry_path: PathBuf, parent_pkg_path: &str) -> anyhow::Result<(String, Vec)> { +fn build_and_zip_package( + entry_path: PathBuf, + parent_pkg_path: &str, +) -> anyhow::Result<(String, Vec)> { let rt = tokio::runtime::Runtime::new().unwrap(); rt.block_on(async { kit::build::execute(&entry_path, false, false, false, true).await?; @@ -53,7 +56,8 @@ fn main() -> anyhow::Result<()> { .map(|entry| entry.unwrap().path()) .collect(); - let results: Vec)>> = entries.par_iter() + let results: Vec)>> = entries + .par_iter() .map(|entry_path| { let parent_pkg_path = entry_path.join("pkg"); build_and_zip_package(entry_path.clone(), parent_pkg_path.to_str().unwrap()) @@ -63,7 +67,10 @@ fn main() -> anyhow::Result<()> { // Process results, e.g., write to `bootstrapped_processes.rs` // This part remains sequential let mut bootstrapped_processes = vec![]; - writeln!(bootstrapped_processes, "pub static BOOTSTRAPPED_PROCESSES: &[(&str, &[u8])] = &[")?; + writeln!( + bootstrapped_processes, + "pub static BOOTSTRAPPED_PROCESSES: &[(&str, &[u8])] = &[" + )?; for result in results { match result { @@ -77,7 +84,7 @@ fn main() -> anyhow::Result<()> { " (\"{}\", include_bytes!(\"{}\")),", zip_filename, zip_path, )?; - }, + } Err(e) => return Err(e), } } diff --git a/kinode/src/kernel/process.rs b/kinode/src/kernel/process.rs index b15af3735..2d2cdd29b 100644 --- a/kinode/src/kernel/process.rs +++ b/kinode/src/kernel/process.rs @@ -9,9 +9,9 @@ use ring::signature::{self, KeyPair}; use std::collections::{HashMap, VecDeque}; use std::sync::Arc; use tokio::task::JoinHandle; +use wasmtime::component::ResourceTable as Table; use wasmtime::component::*; use wasmtime::{Engine, Store}; -use wasmtime::component::ResourceTable as Table; use wasmtime_wasi::preview2::{pipe::MemoryOutputPipe, WasiCtx, WasiCtxBuilder, WasiView}; const STACK_TRACE_SIZE: usize = 5000; From 2780785e6cae1cf578291fd3c845e3c1b3be28d9 Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Tue, 13 Feb 2024 12:06:10 -0300 Subject: [PATCH 054/171] kns & app_store: refactor eth subs --- .../packages/app_store/app_store/Cargo.toml | 2 +- .../packages/app_store/app_store/src/lib.rs | 66 +++---------------- .../kns_indexer/kns_indexer/Cargo.toml | 2 +- .../kns_indexer/kns_indexer/src/lib.rs | 19 ++---- 4 files changed, 15 insertions(+), 74 deletions(-) diff --git a/kinode/packages/app_store/app_store/Cargo.toml b/kinode/packages/app_store/app_store/Cargo.toml index 5ea0916c1..106e8fe64 100644 --- a/kinode/packages/app_store/app_store/Cargo.toml +++ b/kinode/packages/app_store/app_store/Cargo.toml @@ -9,7 +9,7 @@ alloy-primitives = "0.6.2" alloy-sol-types = "0.6.2" anyhow = "1.0" bincode = "1.3.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "1e14a03" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "1d60995" } rand = "0.8" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/kinode/packages/app_store/app_store/src/lib.rs b/kinode/packages/app_store/app_store/src/lib.rs index 63e1930d8..8342896ac 100644 --- a/kinode/packages/app_store/app_store/src/lib.rs +++ b/kinode/packages/app_store/app_store/src/lib.rs @@ -1,5 +1,6 @@ use kinode_process_lib::eth::{ - get_logs, Address as EthAddress, EthAction, EthMessage, Filter, Params, SubscriptionResult, + get_logs, subscribe, unsubscribe, Address as EthAddress, EthAction, EthMessage, Filter, Params, + SubscriptionResult, }; use kinode_process_lib::http::{bind_http_path, serve_ui, HttpServerRequest}; use kinode_process_lib::kernel_types as kt; @@ -110,14 +111,13 @@ fn init(our: Address) { let mut requested_packages: HashMap = HashMap::new(); - // get past logs, subscribe to new ones. //todotimeout?errors?//future responses? - // // doing manual send also possible + // get past logs, subscribe to new ones. let filter = Filter::new() .address(EthAddress::from_str(&state.contract_address).unwrap()) .from_block(state.last_saved_block - 1) .events(EVENTS); - let logs = get_logs(filter.clone()); + let logs = get_logs(&filter); if let Ok(logs) = logs { for log in logs { @@ -125,35 +125,7 @@ fn init(our: Address) { } } - // sub for future logs too. - Request::new() - .target((&our.node, "eth", "distro", "sys")) - .body( - serde_json::to_vec(&EthMessage { - id: 1, - action: EthAction::SubscribeLogs { - kind: eth::SubscriptionKind::Logs, - params: Params::Logs(Box::new(filter)), - }, - }) - .unwrap(), - ) - .send() - .unwrap(); - - // Request::new() - // .target(("our", "eth", "distro", "sys")) - // .body( - // serde_json::to_vec(&EthMessage { - // id: 1, - // action: EthAction::Request { - // method: "eth_getLogs".to_string(), - // params: serde_json::to_value((filter,)).unwrap(), - // }, - // }) - // .unwrap(), - // ) - // .send(); + subscribe(1, filter).unwrap(); loop { match await_message() { @@ -362,44 +334,22 @@ fn handle_local_request( LocalRequest::RebuildIndex => { *state = State::new(CONTRACT_ADDRESS.to_string()).unwrap(); // kill our old subscription and build a new one. - Request::to(("our", "eth", "distro", "sys")) - .body( - serde_json::to_vec(&EthMessage { - id: 1, - action: EthAction::UnsubscribeLogs, - }) - .unwrap(), - ) - .send() - .unwrap(); + unsubscribe(1).unwrap(); let filter = Filter::new() .address(EthAddress::from_str(&state.contract_address).unwrap()) .from_block(state.last_saved_block - 1) .events(EVENTS); - let logs = get_logs(filter.clone()); + let logs = get_logs(&filter); if let Ok(logs) = logs { for log in logs { state.ingest_listings_contract_event(log); } } + subscribe(1, filter).unwrap(); - Request::new() - .target((&our.node, "eth", "distro", "sys")) - .body( - serde_json::to_vec(&EthMessage { - id: 1, - action: EthAction::SubscribeLogs { - kind: eth::SubscriptionKind::Logs, - params: Params::Logs(Box::new(filter)), - }, - }) - .unwrap(), - ) - .send() - .unwrap(); LocalResponse::RebuiltIndex } } diff --git a/kinode/packages/kns_indexer/kns_indexer/Cargo.toml b/kinode/packages/kns_indexer/kns_indexer/Cargo.toml index ccc552c5d..706531256 100644 --- a/kinode/packages/kns_indexer/kns_indexer/Cargo.toml +++ b/kinode/packages/kns_indexer/kns_indexer/Cargo.toml @@ -10,7 +10,7 @@ alloy-primitives = "0.6.2" alloy-sol-types = "0.6.2" bincode = "1.3.3" hex = "0.4.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "1e14a03" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "1d60995" } rmp-serde = "1.1.2" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/kinode/packages/kns_indexer/kns_indexer/src/lib.rs b/kinode/packages/kns_indexer/kns_indexer/src/lib.rs index a8b370910..389384da6 100644 --- a/kinode/packages/kns_indexer/kns_indexer/src/lib.rs +++ b/kinode/packages/kns_indexer/kns_indexer/src/lib.rs @@ -3,8 +3,8 @@ use alloy_sol_types::{sol, SolEvent}; use kinode_process_lib::{ await_message, eth::{ - get_block_number, get_logs, Address as EthAddress, BlockNumberOrTag, EthAction, EthMessage, - EthResponse, Filter, Log, Params, SubscriptionKind, SubscriptionResult, + get_block_number, get_logs, subscribe, Address as EthAddress, BlockNumberOrTag, EthAction, + EthMessage, EthResponse, Filter, Log, Params, SubscriptionKind, SubscriptionResult, }, get_typed_state, print_to_terminal, println, set_state, Address, Message, Request, Response, }; @@ -176,10 +176,10 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> { "WsUpdate(bytes32,uint16)", "RoutingUpdate(bytes32,bytes32[])", ]); - // std::thread::sleep(std::time::Duration::from_secs(10)); + // if block in state is < current_block, get logs from that part. if state.block < get_block_number()? { - let logs = get_logs(filter.clone())?; + let logs = get_logs(&filter)?; for log in logs { handle_log(&our, &mut state, &log)?; } @@ -194,16 +194,7 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> { set_state(&bincode::serialize(&state)?); - let params = Params::Logs(Box::new(filter)); - let kind = SubscriptionKind::Logs; - - Request::new() - .target((&our.node, "eth", "distro", "sys")) - .body(serde_json::to_vec(&EthMessage { - id: 8, - action: EthAction::SubscribeLogs { kind, params }, - })?) - .send()?; + subscribe(1, filter)?; let mut pending_requests: BTreeMap> = BTreeMap::new(); From d9a6fa8380cfa8d3430fbe57023b455bba2bdd6e Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Tue, 13 Feb 2024 14:41:01 -0300 Subject: [PATCH 055/171] move routers into default json file --- kinode/src/kernel/mod.rs | 72 ++-------------------------------------- kinode/src/main.rs | 24 +++++++++++++- kinode/src/net/mod.rs | 2 +- 3 files changed, 26 insertions(+), 72 deletions(-) diff --git a/kinode/src/kernel/mod.rs b/kinode/src/kernel/mod.rs index 23fd5fe4e..8ca9f6025 100644 --- a/kinode/src/kernel/mod.rs +++ b/kinode/src/kernel/mod.rs @@ -9,24 +9,6 @@ use tokio::sync::mpsc; use tokio::task::JoinHandle; use wasmtime::{Config, Engine, WasmBacktraceDetails}; -/// TEMP IMPORT, crate::net::????? -/// Must be parsed from message pack vector. -#[derive(Clone, Debug, Serialize, Deserialize)] -pub enum NetActions { - KnsUpdate(KnsUpdate), - KnsBatchUpdate(Vec), -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct KnsUpdate { - pub name: String, // actual username / domain name - pub owner: String, - pub node: String, // hex namehash of node - pub public_key: String, - pub ip: String, - pub port: u16, - pub routers: Vec, -} use lib::types::core::{self as t, STATE_PROCESS_ID, VFS_PROCESS_ID}; /// Manipulate a single process. @@ -690,6 +672,7 @@ pub async fn kernel( home_directory_path: String, contract_address: String, runtime_extensions: Vec<(t::ProcessId, t::MessageSender, bool)>, + routers: Vec, ) -> Result<()> { let mut config = Config::new(); config.cache_config_load_default().unwrap(); @@ -846,57 +829,6 @@ pub async fn kernel( .await .expect("fatal: kernel event loop died"); // sending hard coded routers into networking for bootstrapped rpc - let kns_updates = vec![ - KnsUpdate { - name: "default-router-1.os".to_string(), - owner: "who?".to_string(), - node: "0x".to_string(), - public_key: "0xb1b1cf23c89f651aac3e5fd4decb04aa177ab0ec8ce5f1d3877b90bb6f5779db" - .to_string(), - ip: "147.135.114.167".to_string(), - port: 9002, - routers: vec![], - }, - KnsUpdate { - name: "default-router-2.os".to_string(), - owner: "who?".to_string(), - node: "0x".to_string(), - public_key: "0xab9f1a996db3a4e1dbcd31d765daedeb3af9af4f570c0968463b5be3a7d1e992" - .to_string(), - ip: "147.135.114.167".to_string(), - port: 9003, - routers: vec![], - }, - KnsUpdate { - name: "default-router-3.os".to_string(), - owner: "who?".to_string(), - node: "0x".to_string(), - public_key: "0x536e30785e64dd0349a697285af365b5ed7c4d300010139261cfc4dbdd5b254b" - .to_string(), - ip: "147.135.114.167".to_string(), - port: 9004, - routers: vec![], - }, - // I want to use ben.eth - // --rpc-node ben.eth - // first index and then change - // no-rpc - // settings -> rpc from router-01 -> ben.eth - KnsUpdate { - name: "jugodenaranja.os".to_string(), - owner: "who?".to_string(), - node: "0x".to_string(), - public_key: "0xf8a3e9667756306a0a25894a8cfe053dc9e7f34e6a61b8d65e92b79f77e05dff" - .to_string(), - ip: "this should not be parsed.".to_string(), - port: 0, - routers: vec![ - "0xb35eb347deb896bc3fb6132a07fca1601f83462385ed11e835c24c33ba4ef73d".to_string(), - "0xd827ae579fafa604af79fbed977e8abe048497f10885c6473dfd343a3b7b4458".to_string(), - "0x96e36331c8f0882f2c0c46c13b15d812def04fe8606d503bc0e2be39db26486a".to_string(), - ], - }, - ]; send_to_loop .send(t::KernelMessage { id: rand::random(), @@ -912,7 +844,7 @@ pub async fn kernel( message: t::Message::Request(t::Request { inherit: false, expects_response: None, - body: rmp_serde::to_vec(&NetActions::KnsBatchUpdate(kns_updates)).unwrap(), + body: rmp_serde::to_vec(&crate::net::NetActions::KnsBatchUpdate(routers)).unwrap(), metadata: None, capabilities: vec![], }), diff --git a/kinode/src/main.rs b/kinode/src/main.rs index ddb0205d7..a0feb761c 100644 --- a/kinode/src/main.rs +++ b/kinode/src/main.rs @@ -24,7 +24,7 @@ mod state; mod terminal; mod timer; mod vfs; -// + const EVENT_LOOP_CHANNEL_CAPACITY: usize = 10_000; const EVENT_LOOP_DEBUG_CHANNEL_CAPACITY: usize = 50; const TERMINAL_CHANNEL_CAPACITY: usize = 32; @@ -45,6 +45,9 @@ const VERSION: &str = env!("CARGO_PKG_VERSION"); #[cfg(not(feature = "simulation-mode"))] const REVEAL_IP: bool = true; +/// default routers as a fallbac +const DEFAULT_ROUTERS: &str = include_str!("../default_routers.json"); + async fn serve_register_fe( home_directory_path: &str, our_ip: String, @@ -384,6 +387,24 @@ async fn main() { } }; + // read in default routers .json file + type KnsUpdate = crate::net::KnsUpdate; + let routers: Vec = + match fs::read_to_string(format!("{}/.routers", home_directory_path)).await { + Ok(contents) => serde_json::from_str(&contents).unwrap(), + Err(_) => { + let routers: Vec = serde_json::from_str(DEFAULT_ROUTERS).unwrap(); + // should we dump them into a .routers file? + // fs::write( + // format!("{}/.routers", home_directory_path), + // serde_json::to_string(&routers).unwrap(), + // ) + // .await + // .unwrap(); + routers + } + }; + // the boolean flag determines whether the runtime module is *public* or not, // where public means that any process can always message it. #[allow(unused_mut)] @@ -464,6 +485,7 @@ async fn main() { home_directory_path.clone(), contract_address.to_string(), runtime_extensions, + routers, )); #[cfg(not(feature = "simulation-mode"))] tasks.spawn(net::networking( diff --git a/kinode/src/net/mod.rs b/kinode/src/net/mod.rs index 6e7339035..a565759c0 100644 --- a/kinode/src/net/mod.rs +++ b/kinode/src/net/mod.rs @@ -19,7 +19,7 @@ mod types; #[cfg(not(feature = "simulation-mode"))] mod utils; #[cfg(not(feature = "simulation-mode"))] -use crate::net::{types::*, utils::*}; +pub use crate::net::{types::*, utils::*}; #[cfg(not(feature = "simulation-mode"))] use lib::types::core::*; From 1d7043600ebf6516db939b00f18d7b9a056c8a64 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Tue, 13 Feb 2024 14:46:51 -0300 Subject: [PATCH 056/171] kernel: adjust message queueing to only ingest responses/errors for which we have an outstanding request in context map --- Cargo.lock | 2 +- kinode/src/kernel/process.rs | 230 +++++++++++++++++++---------------- 2 files changed, 128 insertions(+), 104 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 41943ebf7..c7285c74a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3227,7 +3227,7 @@ dependencies = [ [[package]] name = "kit" version = "0.1.0" -source = "git+https://github.com/kinode-dao/kit?rev=25b098f#25b098fab136387065d6058162d33c727d277ab8" +source = "git+https://github.com/kinode-dao/kit?rev=0c43430#0c434306fdce55e11d3309959fc4a0fe6ae28def" dependencies = [ "anyhow", "base64 0.21.7", diff --git a/kinode/src/kernel/process.rs b/kinode/src/kernel/process.rs index 4759e2999..1edc104f5 100644 --- a/kinode/src/kernel/process.rs +++ b/kinode/src/kernel/process.rs @@ -112,11 +112,7 @@ impl ProcessState { ) -> Result<(wit::Address, wit::Message), (wit::SendError, Option)> { let res = match self.message_queue.pop_front() { Some(message_from_queue) => message_from_queue, - None => self - .recv_in_process - .recv() - .await - .expect("fatal: process couldn't receive next message"), + None => self.ingest_message().await, }; self.kernel_message_to_process_receive(res) } @@ -138,11 +134,7 @@ impl ProcessState { } // next, wait for the awaited message to arrive loop { - let res = self - .recv_in_process - .recv() - .await - .expect("fatal: process couldn't receive next message"); + let res = self.ingest_message().await; let id = match &res { Ok(km) => km.id, Err(e) => e.id, @@ -155,6 +147,131 @@ impl ProcessState { } } + /// ingest next valid message from kernel. + /// cancel any timeout task associated with this message. + /// if the message is a response, only enqueue if we have an outstanding request for it. + async fn ingest_message(&mut self) -> Result { + loop { + let message = self + .recv_in_process + .recv() + .await + .expect("fatal: process couldn't receive next message"); + + match &message { + Ok(km) => match &km.message { + t::Message::Response(_) => { + if let Some((_context, timeout_handle)) = self.contexts.get_mut(&km.id) { + timeout_handle.abort(); + return message; + } + } + _ => { + return message; + } + }, + Err(e) => { + if let Some((_context, timeout_handle)) = self.contexts.get_mut(&e.id) { + timeout_handle.abort(); + return message; + } + } + } + } + } + + /// Convert a message from the main event loop into a result for the process to receive. + /// If the message is a response or error, get context if we have one. + fn kernel_message_to_process_receive( + &mut self, + incoming: Result, + ) -> Result<(wit::Address, wit::Message), (wit::SendError, Option)> { + let (mut km, context) = match incoming { + Ok(mut km) => match km.message { + t::Message::Request(_) => { + self.last_blob = km.lazy_load_blob; + km.lazy_load_blob = None; + self.prompting_message = Some(km.clone()); + (km, None) + } + t::Message::Response(_) => match self.contexts.remove(&km.id) { + Some((context, _timeout_handle)) => { + self.last_blob = km.lazy_load_blob; + km.lazy_load_blob = None; + self.prompting_message = context.prompting_message; + (km, context.context) + } + None => { + self.last_blob = km.lazy_load_blob; + km.lazy_load_blob = None; + self.prompting_message = Some(km.clone()); + (km, None) + } + }, + }, + Err(e) => match self.contexts.remove(&e.id) { + None => return Err((t::en_wit_send_error(e.error), None)), + Some((context, _timeout_handle)) => { + self.prompting_message = context.prompting_message; + return Err((t::en_wit_send_error(e.error), context.context)); + } + }, + }; + + let pk = signature::UnparsedPublicKey::new( + &signature::ED25519, + self.keypair.as_ref().public_key(), + ); + + // prune any invalid capabilities before handing to process + // where invalid = supposedly issued by us, but not signed properly by us + match &mut km.message { + t::Message::Request(request) => { + request.capabilities.retain(|(cap, sig)| { + // The only time we verify a cap's signature is when a foreign node + // sends us a cap that we (allegedly) issued + if km.source.node != self.metadata.our.node + && cap.issuer.node == self.metadata.our.node + { + match pk.verify(&rmp_serde::to_vec(&cap).unwrap_or_default(), sig) { + Ok(_) => true, + Err(_) => false, + } + } else { + return true; + } + }); + } + t::Message::Response((response, _)) => { + response.capabilities.retain(|(cap, sig)| { + // The only time we verify a cap's signature is when a foreign node + // sends us a cap that we (allegedly) issued + if km.source.node != self.metadata.our.node + && cap.issuer.node == self.metadata.our.node + { + match pk.verify(&rmp_serde::to_vec(&cap).unwrap_or_default(), sig) { + Ok(_) => true, + Err(_) => false, + } + } else { + return true; + } + }); + } + }; + + Ok(( + km.source.en_wit(), + match km.message { + t::Message::Request(request) => wit::Message::Request(t::en_wit_request(request)), + // NOTE: we throw away whatever context came from the sender, that's not ours + t::Message::Response((response, _sent_context)) => { + wit::Message::Response((t::en_wit_response(response), context)) + } + }, + )) + } + /// takes Request generated by a process and sends it to the main event loop. /// will only fail if process does not have capability to send to target. /// if the request has a timeout (expects response), start a task to track @@ -362,99 +479,6 @@ impl ProcessState { .await .expect("fatal: kernel couldn't send response"); } - - /// Convert a message from the main event loop into a result for the process to receive. - /// If the message is a response or error, get context if we have one. - fn kernel_message_to_process_receive( - &mut self, - incoming: Result, - ) -> Result<(wit::Address, wit::Message), (wit::SendError, Option)> { - let (mut km, context) = match incoming { - Ok(mut km) => match km.message { - t::Message::Request(_) => { - self.last_blob = km.lazy_load_blob; - km.lazy_load_blob = None; - self.prompting_message = Some(km.clone()); - (km, None) - } - t::Message::Response(_) => { - if let Some((context, timeout_handle)) = self.contexts.remove(&km.id) { - timeout_handle.abort(); - self.last_blob = km.lazy_load_blob; - km.lazy_load_blob = None; - self.prompting_message = context.prompting_message; - (km, context.context) - } else { - self.last_blob = km.lazy_load_blob; - km.lazy_load_blob = None; - self.prompting_message = Some(km.clone()); - (km, None) - } - } - }, - Err(e) => match self.contexts.remove(&e.id) { - None => return Err((t::en_wit_send_error(e.error), None)), - Some((context, timeout_handle)) => { - timeout_handle.abort(); - self.prompting_message = context.prompting_message; - return Err((t::en_wit_send_error(e.error), context.context)); - } - }, - }; - - let pk = signature::UnparsedPublicKey::new( - &signature::ED25519, - self.keypair.as_ref().public_key(), - ); - - // prune any invalid capabilities before handing to process - // where invalid = supposedly issued by us, but not signed properly by us - match &mut km.message { - t::Message::Request(request) => { - request.capabilities.retain(|(cap, sig)| { - // The only time we verify a cap's signature is when a foreign node - // sends us a cap that we (allegedly) issued - if km.source.node != self.metadata.our.node - && cap.issuer.node == self.metadata.our.node - { - match pk.verify(&rmp_serde::to_vec(&cap).unwrap_or_default(), sig) { - Ok(_) => true, - Err(_) => false, - } - } else { - return true; - } - }); - } - t::Message::Response((response, _)) => { - response.capabilities.retain(|(cap, sig)| { - // The only time we verify a cap's signature is when a foreign node - // sends us a cap that we (allegedly) issued - if km.source.node != self.metadata.our.node - && cap.issuer.node == self.metadata.our.node - { - match pk.verify(&rmp_serde::to_vec(&cap).unwrap_or_default(), sig) { - Ok(_) => true, - Err(_) => false, - } - } else { - return true; - } - }); - } - }; - - Ok(( - km.source.en_wit(), - match km.message { - t::Message::Request(request) => wit::Message::Request(t::en_wit_request(request)), - // NOTE: we throw away whatever context came from the sender, that's not ours - t::Message::Response((response, _sent_context)) => { - wit::Message::Response((t::en_wit_response(response), context)) - } - }, - )) - } } /// create a specific process, and generate a task that will run it. From a1373d2f965b5b218f3778519fdcc4d41c50d997 Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Tue, 13 Feb 2024 15:22:43 -0300 Subject: [PATCH 057/171] eth types slight update --- .../packages/app_store/app_store/Cargo.toml | 2 +- .../packages/app_store/app_store/src/lib.rs | 10 +++---- .../kns_indexer/kns_indexer/Cargo.toml | 2 +- .../kns_indexer/kns_indexer/src/lib.rs | 15 ++++------- kinode/src/eth/provider.rs | 25 +++++++++-------- lib/src/eth.rs | 27 ++++++++----------- 6 files changed, 34 insertions(+), 47 deletions(-) diff --git a/kinode/packages/app_store/app_store/Cargo.toml b/kinode/packages/app_store/app_store/Cargo.toml index 106e8fe64..d8e4d8664 100644 --- a/kinode/packages/app_store/app_store/Cargo.toml +++ b/kinode/packages/app_store/app_store/Cargo.toml @@ -9,7 +9,7 @@ alloy-primitives = "0.6.2" alloy-sol-types = "0.6.2" anyhow = "1.0" bincode = "1.3.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "1d60995" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "9231881" } rand = "0.8" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/kinode/packages/app_store/app_store/src/lib.rs b/kinode/packages/app_store/app_store/src/lib.rs index 8342896ac..b923d5d65 100644 --- a/kinode/packages/app_store/app_store/src/lib.rs +++ b/kinode/packages/app_store/app_store/src/lib.rs @@ -1,5 +1,5 @@ use kinode_process_lib::eth::{ - get_logs, subscribe, unsubscribe, Address as EthAddress, EthAction, EthMessage, Filter, Params, + get_logs, subscribe, unsubscribe, Address as EthAddress, EthAction, EthSub, Filter, Params, SubscriptionResult, }; use kinode_process_lib::http::{bind_http_path, serve_ui, HttpServerRequest}; @@ -59,7 +59,7 @@ pub enum Req { RemoteRequest(RemoteRequest), FTWorkerCommand(FTWorkerCommand), FTWorkerResult(FTWorkerResult), - Eth(EthMessage), + Eth(EthSub), Http(HttpServerRequest), } @@ -185,13 +185,11 @@ fn handle_message( Req::FTWorkerResult(r) => { println!("app store: got weird ft_worker result: {r:?}"); } - Req::Eth(e) => { + Req::Eth(sub) => { if source.node() != our.node() || source.process != "eth:distro:sys" { return Err(anyhow::anyhow!("eth sub event from weird addr: {source}")); } - if let EthAction::Sub { result } = e.action { - handle_eth_sub_event(&mut state, result)?; - } + handle_eth_sub_event(&mut state, sub.result)?; } Req::Http(incoming) => { if source.node() != our.node() diff --git a/kinode/packages/kns_indexer/kns_indexer/Cargo.toml b/kinode/packages/kns_indexer/kns_indexer/Cargo.toml index 706531256..664b7df33 100644 --- a/kinode/packages/kns_indexer/kns_indexer/Cargo.toml +++ b/kinode/packages/kns_indexer/kns_indexer/Cargo.toml @@ -10,7 +10,7 @@ alloy-primitives = "0.6.2" alloy-sol-types = "0.6.2" bincode = "1.3.3" hex = "0.4.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "1d60995" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "9231881" } rmp-serde = "1.1.2" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/kinode/packages/kns_indexer/kns_indexer/src/lib.rs b/kinode/packages/kns_indexer/kns_indexer/src/lib.rs index 389384da6..19898f865 100644 --- a/kinode/packages/kns_indexer/kns_indexer/src/lib.rs +++ b/kinode/packages/kns_indexer/kns_indexer/src/lib.rs @@ -3,8 +3,8 @@ use alloy_sol_types::{sol, SolEvent}; use kinode_process_lib::{ await_message, eth::{ - get_block_number, get_logs, subscribe, Address as EthAddress, BlockNumberOrTag, EthAction, - EthMessage, EthResponse, Filter, Log, Params, SubscriptionKind, SubscriptionResult, + get_block_number, get_logs, subscribe, Address as EthAddress, BlockNumberOrTag, EthSub, + Filter, Log, SubscriptionResult, }, get_typed_state, print_to_terminal, println, set_state, Address, Message, Request, Response, }; @@ -253,17 +253,12 @@ fn handle_eth_message( pending_requests: &mut BTreeMap>, body: &[u8], ) -> anyhow::Result<()> { - let Ok(res) = serde_json::from_slice::(body) else { + let Ok(res) = serde_json::from_slice::(body) else { return Err(anyhow::anyhow!("kns_indexer: got invalid message")); }; - match res.action { - EthAction::Sub { result } => { - if let SubscriptionResult::Log(log) = result { - handle_log(our, state, &log)?; - } - } - _ => {} + if let SubscriptionResult::Log(log) = res.result { + handle_log(our, state, &log)?; } // check the pending_requests btreemap to see if there are any requests that diff --git a/kinode/src/eth/provider.rs b/kinode/src/eth/provider.rs index 8f8639def..d4c50acb6 100644 --- a/kinode/src/eth/provider.rs +++ b/kinode/src/eth/provider.rs @@ -112,7 +112,7 @@ async fn handle_request( }; if let Some(provider) = provider.as_ref() { - let ethmsg = serde_json::from_slice::(&req.body).map_err(|e| { + let action = serde_json::from_slice::(&req.body).map_err(|e| { EthError::InvalidMethod(format!("eth: failed to deserialize request: {:?}", e)) })?; @@ -121,9 +121,13 @@ async fn handle_request( } // we might want some of these in payloads.. sub items? - let return_body: EthResponse = match ethmsg.action { - EthAction::SubscribeLogs { kind, params } => { - let sub_id = (km.target.process.clone(), ethmsg.id); + let return_body: EthResponse = match action { + EthAction::SubscribeLogs { + sub_id, + kind, + params, + } => { + let sub_id = (km.target.process.clone(), sub_id); let kind = serde_json::to_value(&kind).unwrap(); let params = serde_json::to_value(¶ms).unwrap(); @@ -151,8 +155,8 @@ async fn handle_request( connections.insert(sub_id, handle); EthResponse::Ok } - EthAction::UnsubscribeLogs => { - let sub_id = (km.target.process.clone(), ethmsg.id); + EthAction::UnsubscribeLogs(sub_id) => { + let sub_id = (km.target.process.clone(), sub_id); let handle = connections .remove(&sub_id) .ok_or(EthError::SubscriptionNotFound)?; @@ -171,11 +175,6 @@ async fn handle_request( EthResponse::Response { value: response } } - EthAction::Sub { .. } => { - return Err(EthError::InvalidMethod( - "eth: provider doesn't accept sub resultss".to_string(), - )) - } }; // todo: fix km.clone() and metadata.clone() @@ -265,9 +264,9 @@ async fn handle_subscription_stream( message: Message::Request(Request { inherit: false, expects_response: None, - body: serde_json::to_vec(&EthMessage { + body: serde_json::to_vec(&EthSub { id: sub_id, - action: EthAction::Sub { result: event }, + result: event, }) .unwrap(), metadata: None, diff --git a/lib/src/eth.rs b/lib/src/eth.rs index 696af2e97..b91af0f56 100644 --- a/lib/src/eth.rs +++ b/lib/src/eth.rs @@ -1,16 +1,6 @@ use alloy_rpc_types::pubsub::{Params, SubscriptionKind, SubscriptionResult}; use serde::{Deserialize, Serialize}; -/// The Message type that can be made to eth:distro:sys. The id is used to match the response, -/// if you're not doing send_and_await. -/// -/// Will be serialized and deserialized using `serde_json::to_vec` and `serde_json::from_slice`. -#[derive(Debug, Serialize, Deserialize)] -pub struct EthMessage { - pub id: u64, - pub action: EthAction, -} - /// The Action and Request type that can be made to eth:distro:sys. /// /// Will be serialized and deserialized using `serde_json::to_vec` and `serde_json::from_slice`. @@ -19,20 +9,28 @@ pub enum EthAction { /// Subscribe to logs with a custom filter. ID is to be used to unsubscribe. /// Logs come in as alloy_rpc_types::pubsub::SubscriptionResults SubscribeLogs { + sub_id: u64, kind: SubscriptionKind, params: Params, }, /// Kill a SubscribeLogs subscription of a given ID, to stop getting updates. - UnsubscribeLogs, + UnsubscribeLogs(u64), /// Raw request. Used by kinode_process_lib. Request { method: String, params: serde_json::Value, }, - /// Incoming subscription update. - Sub { result: SubscriptionResult }, +} +/// Incoming subscription update. +#[derive(Debug, Serialize, Deserialize)] +pub struct EthSub { + pub id: u64, + pub result: SubscriptionResult, } +/// The Response type which a process will get from requesting with an [`EthAction`] will be +/// of the form `Result<(), EthError>`, serialized and deserialized using `serde_json::to_vec` +/// and `serde_json::from_slice`. #[derive(Debug, Serialize, Deserialize)] pub enum EthResponse { Ok, @@ -40,9 +38,6 @@ pub enum EthResponse { Err(EthError), } -/// The Response type which a process will get from requesting with an [`EthMessage`] will be -/// of the form `Result<(), EthError>`, serialized and deserialized using `serde_json::to_vec` -/// and `serde_json::from_slice`. #[derive(Debug, Serialize, Deserialize)] pub enum EthError { /// Underlying transport error From 1989a3b93b986f6b13fe90308e0bdaca45a28d2e Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Tue, 13 Feb 2024 13:32:38 -0500 Subject: [PATCH 058/171] bootstrap sequence uses new metadata --- kinode/build.rs | 7 +- .../app_store/{pkg => }/metadata.json | 0 kinode/packages/chess/{pkg => }/metadata.json | 0 .../packages/homepage/{pkg => }/metadata.json | 0 .../kns_indexer/{pkg => }/metadata.json | 0 .../packages/terminal/{pkg => }/metadata.json | 0 .../packages/tester/{pkg => }/metadata.json | 0 kinode/src/state.rs | 74 ++++--------------- lib/src/core.rs | 2 +- 9 files changed, 21 insertions(+), 62 deletions(-) rename kinode/packages/app_store/{pkg => }/metadata.json (100%) rename kinode/packages/chess/{pkg => }/metadata.json (100%) rename kinode/packages/homepage/{pkg => }/metadata.json (100%) rename kinode/packages/kns_indexer/{pkg => }/metadata.json (100%) rename kinode/packages/terminal/{pkg => }/metadata.json (100%) rename kinode/packages/tester/{pkg => }/metadata.json (100%) diff --git a/kinode/build.rs b/kinode/build.rs index 0a051b6f2..e85ab2fe2 100644 --- a/kinode/build.rs +++ b/kinode/build.rs @@ -17,13 +17,14 @@ async fn main() -> anyhow::Result<()> { let mut bootstrapped_processes = Vec::new(); writeln!( bootstrapped_processes, - "pub static BOOTSTRAPPED_PROCESSES: &[(&str, &[u8])] = &[", + "pub static BOOTSTRAPPED_PROCESSES: &[(&str, &[u8], &[u8])] = &[", ) .unwrap(); let packages_dir = format!("{}/packages", pwd.display()); eprintln!("{packages_dir:?}"); for entry in std::fs::read_dir(packages_dir).unwrap() { let entry_path = entry.unwrap().path(); + let metadata_path = format!("{}/metadata.json", entry_path.display()); let parent_pkg_path = format!("{}/pkg", entry_path.display()); kit::build::execute(&entry_path, false, false, false, true).await?; @@ -72,8 +73,8 @@ async fn main() -> anyhow::Result<()> { // Add zip bytes to bootstrapped_processes.rs writeln!( bootstrapped_processes, - " (\"{}\", include_bytes!(\"{}\")),", - zip_filename, zip_path, + " (\"{}\", include_bytes!(\"{}\"), include_bytes!(\"{}\")),", + zip_filename, metadata_path, zip_path, ) .unwrap(); } diff --git a/kinode/packages/app_store/pkg/metadata.json b/kinode/packages/app_store/metadata.json similarity index 100% rename from kinode/packages/app_store/pkg/metadata.json rename to kinode/packages/app_store/metadata.json diff --git a/kinode/packages/chess/pkg/metadata.json b/kinode/packages/chess/metadata.json similarity index 100% rename from kinode/packages/chess/pkg/metadata.json rename to kinode/packages/chess/metadata.json diff --git a/kinode/packages/homepage/pkg/metadata.json b/kinode/packages/homepage/metadata.json similarity index 100% rename from kinode/packages/homepage/pkg/metadata.json rename to kinode/packages/homepage/metadata.json diff --git a/kinode/packages/kns_indexer/pkg/metadata.json b/kinode/packages/kns_indexer/metadata.json similarity index 100% rename from kinode/packages/kns_indexer/pkg/metadata.json rename to kinode/packages/kns_indexer/metadata.json diff --git a/kinode/packages/terminal/pkg/metadata.json b/kinode/packages/terminal/metadata.json similarity index 100% rename from kinode/packages/terminal/pkg/metadata.json rename to kinode/packages/terminal/metadata.json diff --git a/kinode/packages/tester/pkg/metadata.json b/kinode/packages/tester/metadata.json similarity index 100% rename from kinode/packages/tester/pkg/metadata.json rename to kinode/packages/tester/metadata.json diff --git a/kinode/src/state.rs b/kinode/src/state.rs index b5364fdb5..3459b916b 100644 --- a/kinode/src/state.rs +++ b/kinode/src/state.rs @@ -389,7 +389,8 @@ async fn bootstrap( let packages = get_zipped_packages().await; - for (package_name, mut package) in packages.clone() { + for (package_metadata, mut package) in packages.clone() { + let package_name = package_metadata.properties.package_name.as_str(); // special case tester: only load it in if in simulation mode if package_name == "tester" { #[cfg(not(feature = "simulation-mode"))] @@ -397,32 +398,7 @@ async fn bootstrap( } println!("fs: handling package {package_name}...\r"); - // get and read metadata.json - let Ok(mut package_metadata_zip) = package.by_name("metadata.json") else { - println!( - "fs: missing metadata for package {}, skipping", - package_name - ); - continue; - }; - let mut metadata_content = Vec::new(); - package_metadata_zip - .read_to_end(&mut metadata_content) - .unwrap(); - drop(package_metadata_zip); - // TODO this should just deserialize to an ERC721Metadata struct - let package_metadata: serde_json::Value = - serde_json::from_slice(&metadata_content).expect("fs: metadata parse error"); - - // println!("fs: found package metadata: {:?}\r", package_metadata); - - let package_name = package_metadata["properties"]["package_name"] - .as_str() - .expect("fs: metadata parse error: bad package name"); - - let package_publisher = package_metadata["properties"]["publisher"] - .as_str() - .expect("fs: metadata parse error: bad publisher name"); + let package_publisher = package_metadata.properties.publisher.as_str(); // create a new package in VFS let our_drive_name = [package_name, package_publisher].join(":"); @@ -631,7 +607,8 @@ async fn bootstrap( } // second loop: go and grant_capabilities to processes // can't do this in first loop because we need to have all processes in the map first - for (package_name, mut package) in packages { + for (package_metadata, mut package) in packages { + let package_name = package_metadata.properties.package_name.as_str(); // special case tester: only load it in if in simulation mode if package_name == "tester" { #[cfg(not(feature = "simulation-mode"))] @@ -655,31 +632,7 @@ async fn bootstrap( let package_manifest = serde_json::from_str::>(&package_manifest) .expect("fs: manifest parse error"); - // get and read metadata.json - let Ok(mut package_metadata_zip) = package.by_name("metadata.json") else { - println!( - "fs: missing metadata for package {}, skipping", - package_name - ); - continue; - }; - let mut metadata_content = Vec::new(); - package_metadata_zip - .read_to_end(&mut metadata_content) - .unwrap(); - drop(package_metadata_zip); - // TODO deserialize to an ERC721Metadata struct - let package_metadata: serde_json::Value = - serde_json::from_slice(&metadata_content).expect("fs: metadata parse error"); - - // println!("fs: found package metadata: {:?}\r", package_metadata); - let package_name = package_metadata["properties"]["package_name"] - .as_str() - .expect("fs: metadata parse error: bad package name"); - - let package_publisher = package_metadata["properties"]["publisher"] - .as_str() - .expect("fs: metadata parse error: bad publisher name"); + let package_publisher = package_metadata.properties.publisher.as_str(); // for each process-entry in manifest.json: for entry in package_manifest { @@ -760,16 +713,21 @@ fn sign_cap(cap: Capability, keypair: Arc) -> Vec } /// read in `include!()`ed .zip package files -async fn get_zipped_packages() -> Vec<(String, zip::ZipArchive>)> { +async fn get_zipped_packages() -> Vec<(Erc721Metadata, zip::ZipArchive>)> { // println!("fs: reading distro packages...\r"); let mut packages = Vec::new(); - for (package_name, bytes) in BOOTSTRAPPED_PROCESSES.iter() { + for (package_name, metadata_bytes, bytes) in BOOTSTRAPPED_PROCESSES.iter() { if let Ok(zip) = zip::ZipArchive::new(std::io::Cursor::new(*bytes)) { - // add to list of packages - // println!("fs: found package: {}\r", package_name); - packages.push((package_name.to_string(), zip)); + if let Ok(metadata) = serde_json::from_slice::(metadata_bytes) { + packages.push(( + metadata, + zip + )); + } else { + println!("fs: metadata for package {} is not valid Erc721Metadata", package_name); + } } } diff --git a/lib/src/core.rs b/lib/src/core.rs index 29f827b3f..2a997e77c 100644 --- a/lib/src/core.rs +++ b/lib/src/core.rs @@ -1050,7 +1050,7 @@ pub struct Erc721Metadata { pub image: Option, pub external_url: Option, pub animation_url: Option, - pub properties: Option, + pub properties: Erc721Properties, } #[derive(Clone, Debug, Serialize, Deserialize)] From 3b2188adfd5f0563d61929c722be69a7622f47b8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 13 Feb 2024 18:33:07 +0000 Subject: [PATCH 059/171] Format Rust code using rustfmt --- kinode/src/state.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/kinode/src/state.rs b/kinode/src/state.rs index 3459b916b..f7f1992a2 100644 --- a/kinode/src/state.rs +++ b/kinode/src/state.rs @@ -713,20 +713,23 @@ fn sign_cap(cap: Capability, keypair: Arc) -> Vec } /// read in `include!()`ed .zip package files -async fn get_zipped_packages() -> Vec<(Erc721Metadata, zip::ZipArchive>)> { +async fn get_zipped_packages() -> Vec<( + Erc721Metadata, + zip::ZipArchive>, +)> { // println!("fs: reading distro packages...\r"); let mut packages = Vec::new(); for (package_name, metadata_bytes, bytes) in BOOTSTRAPPED_PROCESSES.iter() { if let Ok(zip) = zip::ZipArchive::new(std::io::Cursor::new(*bytes)) { - if let Ok(metadata) = serde_json::from_slice::(metadata_bytes) { - packages.push(( - metadata, - zip - )); + if let Ok(metadata) = serde_json::from_slice::(metadata_bytes) { + packages.push((metadata, zip)); } else { - println!("fs: metadata for package {} is not valid Erc721Metadata", package_name); + println!( + "fs: metadata for package {} is not valid Erc721Metadata", + package_name + ); } } } From 9045ca8ed68cb026b05ee3edbf808127a335e6c5 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Tue, 13 Feb 2024 15:32:05 -0500 Subject: [PATCH 060/171] fetching metadata working --- Cargo.lock | 22 +++++++++++++++++-- .../packages/app_store/app_store/Cargo.toml | 4 +++- .../packages/app_store/app_store/src/api.rs | 2 ++ .../app_store/app_store/src/http_api.rs | 12 +++++----- .../packages/app_store/app_store/src/lib.rs | 11 +++++----- .../packages/app_store/app_store/src/types.rs | 15 +++++++------ 6 files changed, 46 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c7285c74a..17c80aa40 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -272,7 +272,7 @@ dependencies = [ "alloy-sol-types", "anyhow", "bincode", - "kinode_process_lib 0.5.9 (git+https://github.com/kinode-dao/process_lib?tag=v0.5.9-alpha)", + "kinode_process_lib 0.6.0", "rand 0.8.5", "serde", "serde_json", @@ -3207,6 +3207,24 @@ dependencies = [ "wit-bindgen", ] +[[package]] +name = "kinode_process_lib" +version = "0.6.0" +dependencies = [ + "alloy-rpc-types", + "anyhow", + "bincode", + "ethers-core", + "http 1.0.0", + "mime_guess", + "rand 0.8.5", + "serde", + "serde_json", + "thiserror", + "url", + "wit-bindgen", +] + [[package]] name = "kinode_process_lib" version = "0.6.0" @@ -5553,7 +5571,7 @@ version = "0.1.0" dependencies = [ "anyhow", "bincode", - "kinode_process_lib 0.6.0", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0-alpha)", "rand 0.8.5", "regex", "serde", diff --git a/kinode/packages/app_store/app_store/Cargo.toml b/kinode/packages/app_store/app_store/Cargo.toml index f8e18d155..c68fb00a3 100644 --- a/kinode/packages/app_store/app_store/Cargo.toml +++ b/kinode/packages/app_store/app_store/Cargo.toml @@ -10,7 +10,9 @@ alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy.git", rev = "3b1c31 alloy-sol-types = "0.5.1" anyhow = "1.0" bincode = "1.3.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.5.9-alpha", features = ["eth"] } +kinode_process_lib = { path = "../../../../../kinode_process_lib", features = [ + "eth", +] } rand = "0.8" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/kinode/packages/app_store/app_store/src/api.rs b/kinode/packages/app_store/app_store/src/api.rs index f63021bf4..f5ea8a901 100644 --- a/kinode/packages/app_store/app_store/src/api.rs +++ b/kinode/packages/app_store/app_store/src/api.rs @@ -34,6 +34,7 @@ pub enum LocalRequest { /// /// If requested, will return a NewPackageResponse indicating success/failure. /// This is used for locally installing a package. + /// TODO could switch this to Erc721Metadata NewPackage { package: PackageId, /// Sets whether we will mirror this package for others @@ -52,6 +53,7 @@ pub enum LocalRequest { /// when a new version is posted to the listings contract auto_update: bool, /// The version hash we're looking for. If None, will download the latest. + /// TODO could switch this to more friendly version numbers e.g 1.0.1 given new metadata structure desired_version_hash: Option, }, /// Select a downloaded package and install it. Will only succeed if the diff --git a/kinode/packages/app_store/app_store/src/http_api.rs b/kinode/packages/app_store/app_store/src/http_api.rs index 004e61711..3b4f6c40f 100644 --- a/kinode/packages/app_store/app_store/src/http_api.rs +++ b/kinode/packages/app_store/app_store/src/http_api.rs @@ -30,7 +30,7 @@ pub fn handle_http_request( req: &IncomingHttpRequest, ) -> anyhow::Result<()> { match serve_paths(our, state, requested_packages, req) { - Ok((status_code, headers, body)) => send_response( + Ok((status_code, _headers, body)) => send_response( status_code, Some(HashMap::from([( String::from("Content-Type"), @@ -241,10 +241,12 @@ fn serve_paths( .ok_or(anyhow::anyhow!("No package"))?; let mirrors: &Vec = pkg_listing .metadata - .as_ref() // Convert Option to Option<&Erc721Metadata> - .and_then(|metadata| metadata.properties.as_ref()) // Convert Option to Option<&Erc721Properties> - .map(|properties| &properties.mirrors) // Access &Vec - .expect("Package does not have mirrors information"); + .as_ref() + // TODO better error handling - this will be common! + .expect("Package does not have metadata") + .properties + .mirrors + .as_ref(); // TODO select on FE let download_from = mirrors .first() diff --git a/kinode/packages/app_store/app_store/src/lib.rs b/kinode/packages/app_store/app_store/src/lib.rs index 3ef222c58..e90f3ec30 100644 --- a/kinode/packages/app_store/app_store/src/lib.rs +++ b/kinode/packages/app_store/app_store/src/lib.rs @@ -376,7 +376,7 @@ pub fn start_download( } fn handle_receive_download( - our: &Address, + _our: &Address, state: &mut State, package_name: &str, requested_packages: &mut HashMap, @@ -423,10 +423,11 @@ fn handle_receive_download( "app store: downloaded package has no metadata to check validity against!" )); }; - let Some(properties) = &metadata.properties else { - return Err(anyhow::anyhow!("app store: warning: downloaded package has insufficient metadata to check validity against!")); - }; - let Some(latest_hash) = properties.code_hashes.get(&properties.current_version) else { + let Some(latest_hash) = metadata + .properties + .code_hashes + .get(&metadata.properties.current_version) + else { return Err(anyhow::anyhow!( "app store: downloaded package has no versions in manager--rejecting download!" )); diff --git a/kinode/packages/app_store/app_store/src/types.rs b/kinode/packages/app_store/app_store/src/types.rs index 116c7277e..e802dd350 100644 --- a/kinode/packages/app_store/app_store/src/types.rs +++ b/kinode/packages/app_store/app_store/src/types.rs @@ -530,13 +530,14 @@ fn fetch_metadata(metadata_url: &str, metadata_hash: &str) -> anyhow::Result(&body.bytes)?) - } else { - Err(anyhow::anyhow!( - "metadata hash mismatch: got {hash}, expected {metadata_hash}" - )) - } + // TODO fix this for later + // if &hash == metadata_hash { + Ok(serde_json::from_slice::(&body.bytes)?) + // } else { + // Err(anyhow::anyhow!( + // "metadata hash mismatch: got {hash}, expected {metadata_hash}" + // )) + // } } /// generate a Keccak-256 hash of the metadata bytes From d1fbd097c41122fdcc3fbc068129399af994a7b6 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Tue, 13 Feb 2024 15:39:41 -0500 Subject: [PATCH 061/171] properties updtated --- lib/src/core.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/src/core.rs b/lib/src/core.rs index 2a997e77c..54cfabdca 100644 --- a/lib/src/core.rs +++ b/lib/src/core.rs @@ -1060,6 +1060,8 @@ pub struct Erc721Properties { pub current_version: String, pub mirrors: Vec, pub code_hashes: HashMap, + pub license: Option, + pub screenshots: Option>, pub wit_version: Option<(u32, u32, u32)>, } From 8521538c9efcd7a45e407cfef4daa355e47caaaa Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Wed, 14 Feb 2024 10:55:43 -0500 Subject: [PATCH 062/171] throw error if metadata mismatch --- .../packages/app_store/app_store/src/types.rs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/kinode/packages/app_store/app_store/src/types.rs b/kinode/packages/app_store/app_store/src/types.rs index e802dd350..81cd296e3 100644 --- a/kinode/packages/app_store/app_store/src/types.rs +++ b/kinode/packages/app_store/app_store/src/types.rs @@ -388,6 +388,15 @@ impl State { let metadata = fetch_metadata(&metadata_url, &metadata_hash).ok(); + if let Some(metadata) = &metadata { + if metadata.properties.publisher != publisher_name { + return Err(anyhow::anyhow!(format!( + "app store: metadata publisher name mismatch: got {}, expected {}", + metadata.properties.publisher, publisher_name + ))); + } + } + let listing = match self.get_listing_with_hash_mut(&package_hash) { Some(current_listing) => { current_listing.name = package_name; @@ -427,7 +436,15 @@ impl State { ))?; let metadata = match fetch_metadata(&metadata_url, &metadata_hash) { - Ok(metadata) => Some(metadata), + Ok(metadata) => { + if metadata.properties.publisher != current_listing.publisher { + return Err(anyhow::anyhow!(format!( + "app store: metadata publisher name mismatch: got {}, expected {}", + metadata.properties.publisher, current_listing.publisher + ))); + } + Some(metadata) + } Err(e) => { crate::print_to_terminal( 1, From 2eea02e34af946bb4e4543b5c63fd22d4b74d01b Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Wed, 14 Feb 2024 13:39:00 -0300 Subject: [PATCH 063/171] eth: passthrough through local --- kinode/src/eth/provider.rs | 280 ++++++++++++++++++++++++++++--------- kinode/src/main.rs | 7 - 2 files changed, 211 insertions(+), 76 deletions(-) diff --git a/kinode/src/eth/provider.rs b/kinode/src/eth/provider.rs index d4c50acb6..d83aa8ebb 100644 --- a/kinode/src/eth/provider.rs +++ b/kinode/src/eth/provider.rs @@ -1,3 +1,4 @@ +use alloy_providers::provider::Provider; use alloy_pubsub::{PubSubFrontend, RawSubscription}; use alloy_rpc_client::ClientBuilder; use alloy_rpc_types::pubsub::SubscriptionResult; @@ -6,6 +7,7 @@ use anyhow::Result; use dashmap::DashMap; use lib::types::core::*; use lib::types::eth::*; +use std::str::FromStr; use std::sync::Arc; use tokio::task::JoinHandle; use url::Url; @@ -48,7 +50,7 @@ pub async fn provider( }; let client = ClientBuilder::default().ws(connector).await?; - Some(alloy_providers::provider::Provider::new_with_client(client)) + Some(Provider::new_with_client(client)) } else { None }; @@ -59,10 +61,6 @@ pub async fn provider( let connections: DashMap<(ProcessId, u64), JoinHandle>> = DashMap::new(); let connections = Arc::new(connections); - // passthrough responses - let responses: DashMap = DashMap::new(); - let responses = Arc::new(responses); - // add whitelist, logic in provider middleware? let public = Arc::new(public); @@ -72,17 +70,15 @@ pub async fn provider( let send_to_loop = send_to_loop.clone(); let provider = provider.clone(); let connections = connections.clone(); - let responses = responses.clone(); let public = public.clone(); tokio::spawn(async move { - if let Err(e) = handle_request( + if let Err(e) = handle_message( &our, &km, &send_to_loop, provider.clone(), connections.clone(), - responses.clone(), public.clone(), ) .await @@ -96,13 +92,171 @@ pub async fn provider( Err(anyhow::anyhow!("eth: fatal: message receiver closed!")) } -async fn handle_request( +async fn handle_message( + our: &str, + km: &KernelMessage, + send_to_loop: &MessageSender, + provider: Arc>>, + connections: Arc>>>, + public: Arc, +) -> Result<(), EthError> { + match &km.message { + Message::Request(req) => { + if km.source.node == our { + if let Some(provider) = provider.as_ref() { + handle_local_request(our, km, send_to_loop, provider, connections, public) + .await? + } else { + // we have no provider, let's send this request to someone who has one. + let request = KernelMessage { + id: km.id, + source: Address { + node: our.to_string(), + process: ETH_PROCESS_ID.clone(), + }, + target: Address { + node: "jugodenaranja.os".to_string(), + process: ETH_PROCESS_ID.clone(), + }, + rsvp: Some(km.source.clone()), + message: Message::Request(req.clone()), + lazy_load_blob: None, + }; + + let _ = send_to_loop.send(request).await; + } + } else { + // either someone asking us for rpc, or we are passing through a sub event. + handle_remote_request(our, km, send_to_loop, provider, connections, public).await? + } + } + Message::Response(_) => { + // handle passthrough responses, send to rsvp. + if km.source.process == ProcessId::from_str("eth:distro:sys").unwrap() { + if let Some(rsvp) = &km.rsvp { + let _ = send_to_loop + .send(KernelMessage { + id: rand::random(), + source: Address { + node: our.to_string(), + process: ETH_PROCESS_ID.clone(), + }, + target: rsvp.clone(), + rsvp: None, + message: km.message.clone(), + lazy_load_blob: None, + }) + .await; + } + } + } + } + Ok(()) +} + +async fn handle_local_request( + our: &str, + km: &KernelMessage, + send_to_loop: &MessageSender, + provider: &Provider, + connections: Arc>>>, + public: Arc, +) -> Result<(), EthError> { + let Message::Request(req) = &km.message else { + return Err(EthError::InvalidMethod( + "eth: only accepts requests".to_string(), + )); + }; + let action = serde_json::from_slice::(&req.body).map_err(|e| { + EthError::InvalidMethod(format!("eth: failed to deserialize request: {:?}", e)) + })?; + + // we might want some of these in payloads.. sub items? + let return_body: EthResponse = match action { + EthAction::SubscribeLogs { + sub_id, + kind, + params, + } => { + let sub_id = (km.target.process.clone(), sub_id); + + let kind = serde_json::to_value(&kind).unwrap(); + let params = serde_json::to_value(¶ms).unwrap(); + + let id = provider + .inner() + .prepare("eth_subscribe", [kind, params]) + .await + .map_err(|e| EthError::TransportError(e.to_string()))?; + + let rx = provider.inner().get_raw_subscription(id).await; + let handle = tokio::spawn(handle_subscription_stream( + our.to_string(), + sub_id.1.clone(), + rx, + km.source.clone(), + km.rsvp.clone(), + send_to_loop.clone(), + )); + + connections.insert(sub_id, handle); + EthResponse::Ok + } + EthAction::UnsubscribeLogs(sub_id) => { + let sub_id = (km.target.process.clone(), sub_id); + let handle = connections + .remove(&sub_id) + .ok_or(EthError::SubscriptionNotFound)?; + + handle.1.abort(); + EthResponse::Ok + } + EthAction::Request { method, params } => { + let method = to_static_str(&method).ok_or(EthError::InvalidMethod(method))?; + + let response: serde_json::Value = provider + .inner() + .prepare(method, params) + .await + .map_err(|e| EthError::TransportError(e.to_string()))?; + println!("got a normal request! "); + EthResponse::Response { value: response } + } + }; + + let response = KernelMessage { + id: km.id, + source: Address { + node: our.to_string(), + process: ETH_PROCESS_ID.clone(), + }, + target: km.source.clone(), + rsvp: None, + message: Message::Response(( + Response { + inherit: false, + body: serde_json::to_vec(&return_body).unwrap(), + metadata: req.metadata.clone(), + capabilities: vec![], + }, + None, + )), + lazy_load_blob: None, + }; + + let _ = send_to_loop.send(response).await; + + Ok(()) +} + +// here we are either processing another nodes request. +// or we are passing through an ethSub Request.. +async fn handle_remote_request( our: &str, km: &KernelMessage, send_to_loop: &MessageSender, - provider: Arc>>, + provider: Arc>>, connections: Arc>>>, - responses: Arc>, public: Arc, ) -> Result<(), EthError> { let Message::Request(req) = &km.message else { @@ -112,15 +266,17 @@ async fn handle_request( }; if let Some(provider) = provider.as_ref() { + // we need some sort of agreement perhaps on rpc providing. + // even with an agreement, fake ethsubevents could be sent to us. + // light clients could verify blocks perhaps... + if !*public { + return Err(EthError::PermissionDenied("not on the list.".to_string())); + } + let action = serde_json::from_slice::(&req.body).map_err(|e| { EthError::InvalidMethod(format!("eth: failed to deserialize request: {:?}", e)) })?; - if !*public && km.source.node != our { - return Err(EthError::PermissionDenied("not on the list.".to_string())); - } - - // we might want some of these in payloads.. sub items? let return_body: EthResponse = match action { EthAction::SubscribeLogs { sub_id, @@ -138,17 +294,13 @@ async fn handle_request( .await .map_err(|e| EthError::TransportError(e.to_string()))?; - let target = km.rsvp.clone().unwrap_or_else(|| Address { - node: our.to_string(), - process: km.source.process.clone(), - }); - let rx = provider.inner().get_raw_subscription(id).await; let handle = tokio::spawn(handle_subscription_stream( our.to_string(), sub_id.1.clone(), rx, - target, + km.target.clone(), + km.rsvp.clone(), send_to_loop.clone(), )); @@ -177,58 +329,48 @@ async fn handle_request( } }; - // todo: fix km.clone() and metadata.clone() - if let Some(target) = km.clone().rsvp.or_else(|| { - req.expects_response.map(|_| Address { - node: our.to_string(), - process: km.source.process.clone(), - }) - }) { - let response = KernelMessage { - id: km.id, - source: Address { - node: our.to_string(), - process: ETH_PROCESS_ID.clone(), - }, - target: target.clone(), - rsvp: None, - message: Message::Response(( - Response { - inherit: false, - body: serde_json::to_vec(&return_body).unwrap(), - metadata: req.metadata.clone(), - capabilities: vec![], - }, - None, - )), - lazy_load_blob: None, - }; - - // Send the response, handling potential errors appropriately - let _ = send_to_loop.send(response).await; - }; - } else { - // passthrough - // if node == our, forward to provider - // hoping that rsvp can fix the rest. - let request = KernelMessage { + let response = KernelMessage { id: km.id, source: Address { node: our.to_string(), process: ETH_PROCESS_ID.clone(), }, - target: Address { - node: "jugodenaranja.os".to_string(), - process: ETH_PROCESS_ID.clone(), - }, - rsvp: Some(km.source.clone()), - message: Message::Request(req.clone()), + target: km.source.clone(), + rsvp: km.rsvp.clone(), + message: Message::Response(( + Response { + inherit: false, + body: serde_json::to_vec(&return_body).unwrap(), + metadata: req.metadata.clone(), + capabilities: vec![], + }, + None, + )), lazy_load_blob: None, }; - let _ = send_to_loop.send(request).await; + let _ = send_to_loop.send(response).await; + } else { + // We do not have a provider, this is a reply for a request made by us. + if let Ok(eth_sub) = serde_json::from_slice::(&req.body) { + // forward... + if let Some(target) = km.rsvp.clone() { + let _ = send_to_loop + .send(KernelMessage { + id: rand::random(), + source: Address { + node: our.to_string(), + process: ETH_PROCESS_ID.clone(), + }, + target: target, + rsvp: None, + message: Message::Request(req.clone()), + lazy_load_blob: None, + }) + .await; + } + } } - Ok(()) } @@ -240,15 +382,15 @@ async fn handle_subscription_stream( sub_id: u64, mut rx: RawSubscription, target: Address, + rsvp: Option
, send_to_loop: MessageSender, ) -> Result<(), EthError> { match rx.recv().await { Err(e) => { - println!("got an error from the subscription stream: {:?}", e); - // TODO should we stop the subscription here? - // return Err(EthError::TransportError??(format!("{:?}", e))); + return Err(EthError::SubscriptionClosed(sub_id))?; } Ok(value) => { + // this should not return in case of one failed event? let event: SubscriptionResult = serde_json::from_str(value.get()).map_err(|_| { EthError::RpcError("eth: failed to deserialize subscription result".to_string()) })?; @@ -260,7 +402,7 @@ async fn handle_subscription_stream( process: ETH_PROCESS_ID.clone(), }, target: target.clone(), - rsvp: None, + rsvp: rsvp.clone(), message: Message::Request(Request { inherit: false, expects_response: None, diff --git a/kinode/src/main.rs b/kinode/src/main.rs index a0feb761c..c960bab3d 100644 --- a/kinode/src/main.rs +++ b/kinode/src/main.rs @@ -394,13 +394,6 @@ async fn main() { Ok(contents) => serde_json::from_str(&contents).unwrap(), Err(_) => { let routers: Vec = serde_json::from_str(DEFAULT_ROUTERS).unwrap(); - // should we dump them into a .routers file? - // fs::write( - // format!("{}/.routers", home_directory_path), - // serde_json::to_string(&routers).unwrap(), - // ) - // .await - // .unwrap(); routers } }; From eeb3537bc503f7eefc6671fc4708d55c52c60ddc Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Wed, 14 Feb 2024 12:55:17 -0500 Subject: [PATCH 064/171] process_lib updated --- Cargo.lock | 9 +++++---- kinode/packages/app_store/app_store/Cargo.toml | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 17c80aa40..0a4ed028e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -272,7 +272,7 @@ dependencies = [ "alloy-sol-types", "anyhow", "bincode", - "kinode_process_lib 0.6.0", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=7f409e4)", "rand 0.8.5", "serde", "serde_json", @@ -3210,11 +3210,10 @@ dependencies = [ [[package]] name = "kinode_process_lib" version = "0.6.0" +source = "git+https://github.com/kinode-dao/process_lib?tag=v0.6.0-alpha#4c49368e1945c041dfcabbe15734322012239d25" dependencies = [ - "alloy-rpc-types", "anyhow", "bincode", - "ethers-core", "http 1.0.0", "mime_guess", "rand 0.8.5", @@ -3228,10 +3227,12 @@ dependencies = [ [[package]] name = "kinode_process_lib" version = "0.6.0" -source = "git+https://github.com/kinode-dao/process_lib?tag=v0.6.0-alpha#4c49368e1945c041dfcabbe15734322012239d25" +source = "git+https://github.com/kinode-dao/process_lib?rev=7f409e4#7f409e4e4f72c277b5a2eddbeebe7e9719db33dc" dependencies = [ + "alloy-rpc-types", "anyhow", "bincode", + "ethers-core", "http 1.0.0", "mime_guess", "rand 0.8.5", diff --git a/kinode/packages/app_store/app_store/Cargo.toml b/kinode/packages/app_store/app_store/Cargo.toml index c68fb00a3..09fe1409b 100644 --- a/kinode/packages/app_store/app_store/Cargo.toml +++ b/kinode/packages/app_store/app_store/Cargo.toml @@ -10,7 +10,7 @@ alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy.git", rev = "3b1c31 alloy-sol-types = "0.5.1" anyhow = "1.0" bincode = "1.3.3" -kinode_process_lib = { path = "../../../../../kinode_process_lib", features = [ +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "7f409e4", features = [ "eth", ] } rand = "0.8" From 091ca7fc8368566782047be1316ded04b6312b43 Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Wed, 14 Feb 2024 16:04:05 -0300 Subject: [PATCH 065/171] eth: add --rpcnode flag and handlers --- kinode/default_routers.json | 42 ++++++++++++ kinode/src/eth/provider.rs | 131 +++++++++++++++++++++--------------- kinode/src/main.rs | 72 ++++++++++++++------ lib/src/eth.rs | 5 ++ 4 files changed, 175 insertions(+), 75 deletions(-) create mode 100644 kinode/default_routers.json diff --git a/kinode/default_routers.json b/kinode/default_routers.json new file mode 100644 index 000000000..bfaaba15b --- /dev/null +++ b/kinode/default_routers.json @@ -0,0 +1,42 @@ +[ + { + "name": "default-router-1.os", + "owner": "dr. who", + "node": "0x", + "public_key": "0xb1b1cf23c89f651aac3e5fd4decb04aa177ab0ec8ce5f1d3877b90bb6f5779db", + "ip": "147.135.114.167", + "port": 9002, + "routers": [] + }, + { + "name": "default-router-2.os", + "owner": "foo", + "node": "0x", + "public_key": "0xab9f1a996db3a4e1dbcd31d765daedeb3af9af4f570c0968463b5be3a7d1e992", + "ip": "147.135.114.167", + "port": 9003, + "routers": [] + }, + { + "name": "default-router-s3.os", + "owner": "bar", + "node": "0x", + "public_key": "0x536e30785e64dd0349a697285af365b5ed7c4d300010139261cfc4dbdd5b254b", + "ip": "147.135.114.167", + "port": 9004, + "routers": [] + }, + { + "name": "jugodenaranja.os", + "owner": "ass", + "node": "0x", + "public_key": "0xf8a3e9667756306a0a25894a8cfe053dc9e7f34e6a61b8d65e92b79f77e05dff", + "ip": "0.0.0.0", + "port": 0, + "routers": [ + "0xb35eb347deb896bc3fb6132a07fca1601f83462385ed11e835c24c33ba4ef73d", + "0xd827ae579fafa604af79fbed977e8abe048497f10885c6473dfd343a3b7b4458", + "0x96e36331c8f0882f2c0c46c13b15d812def04fe8606d503bc0e2be39db26486a" + ] + } +] \ No newline at end of file diff --git a/kinode/src/eth/provider.rs b/kinode/src/eth/provider.rs index d83aa8ebb..fc00a2495 100644 --- a/kinode/src/eth/provider.rs +++ b/kinode/src/eth/provider.rs @@ -12,14 +12,21 @@ use std::sync::Arc; use tokio::task::JoinHandle; use url::Url; +/// Provider config. Can currently be a node or a ws provider instance. +/// Future: add chainId configs, several nodes and fallbacks. +pub enum ProviderConfig { + Node(String), + Provider(Provider), +} + /// The ETH provider runtime process is responsible for connecting to one or more ETH RPC providers /// and using them to service indexing requests from other apps. This could also be done by a wasm /// app, but in the future, this process will hopefully expand in scope to perform more complex /// indexing and ETH node responsibilities. pub async fn provider( our: String, - rpc_url: Option, // if None, bootstrap from router, can set settings later? - public: bool, // todo, whitelists etc. + provider_node: ProviderInput, + public: bool, send_to_loop: MessageSender, mut recv_in_client: MessageReceiver, _print_tx: PrintSender, @@ -28,34 +35,32 @@ pub async fn provider( // Initialize the provider conditionally based on rpc_url // Todo: make provider support multiple transports, one direct and another passthrough. - let provider = if let Some(rpc_url) = rpc_url { - // If rpc_url is Some, proceed with URL parsing and client setup - match Url::parse(&rpc_url)?.scheme() { - "http" | "https" => { - return Err(anyhow::anyhow!( - "eth: you provided a `http(s)://` Ethereum RPC, but only `ws(s)://` is supported. Please try again with a `ws(s)://` provider" - )); - } - "ws" | "wss" => {} - s => { - return Err(anyhow::anyhow!( - "eth: you provided a `{s:?}` Ethereum RPC, but only `ws(s)://` is supported. Please try again with a `ws(s)://` provider" - )); + let provider_config = match provider_node { + ProviderInput::WS(rpc_url) => { + // Validate and parse the WebSocket URL + match Url::parse(&rpc_url)?.scheme() { + "ws" | "wss" => { + let connector = WsConnect { + url: rpc_url, + auth: None, + }; + let client = ClientBuilder::default().ws(connector).await?; + ProviderConfig::Provider(Provider::new_with_client(client)) + } + _ => { + return Err(anyhow::anyhow!( + "Only `ws://` or `wss://` URLs are supported." + )) + } } } - - let connector = WsConnect { - url: rpc_url, - auth: None, - }; - - let client = ClientBuilder::default().ws(connector).await?; - Some(Provider::new_with_client(client)) - } else { - None + ProviderInput::Node(node_id) => { + // Directly use the node ID + ProviderConfig::Node(node_id) + } }; - let provider = Arc::new(provider); + let provider_config = Arc::new(provider_config); // handles of longrunning subscriptions. let connections: DashMap<(ProcessId, u64), JoinHandle>> = DashMap::new(); @@ -68,7 +73,7 @@ pub async fn provider( // clone Arcs let our = our.clone(); let send_to_loop = send_to_loop.clone(); - let provider = provider.clone(); + let provider_config = provider_config.clone(); let connections = connections.clone(); let public = public.clone(); @@ -77,7 +82,7 @@ pub async fn provider( &our, &km, &send_to_loop, - provider.clone(), + provider_config.clone(), connections.clone(), public.clone(), ) @@ -96,38 +101,54 @@ async fn handle_message( our: &str, km: &KernelMessage, send_to_loop: &MessageSender, - provider: Arc>>, + provider_config: Arc, connections: Arc>>>, public: Arc, ) -> Result<(), EthError> { match &km.message { Message::Request(req) => { - if km.source.node == our { - if let Some(provider) = provider.as_ref() { - handle_local_request(our, km, send_to_loop, provider, connections, public) + match &*provider_config { + ProviderConfig::Node(node) => { + if km.source.node == our { + // we have no provider, let's send this request to someone who has one. + let request = KernelMessage { + id: km.id, + source: Address { + node: our.to_string(), + process: ETH_PROCESS_ID.clone(), + }, + target: Address { + node: "jugodenaranja.os".to_string(), + process: ETH_PROCESS_ID.clone(), + }, + rsvp: Some(km.source.clone()), + message: Message::Request(req.clone()), + lazy_load_blob: None, + }; + + let _ = send_to_loop.send(request).await; + } else { + // either someone asking us for rpc, or we are passing through a sub event. + handle_remote_request(our, km, send_to_loop, None, connections, public) + .await? + } + } + ProviderConfig::Provider(provider) => { + if km.source.node == our { + handle_local_request(our, km, send_to_loop, &provider, connections, public) + .await? + } else { + handle_remote_request( + our, + km, + send_to_loop, + Some(provider), + connections, + public, + ) .await? - } else { - // we have no provider, let's send this request to someone who has one. - let request = KernelMessage { - id: km.id, - source: Address { - node: our.to_string(), - process: ETH_PROCESS_ID.clone(), - }, - target: Address { - node: "jugodenaranja.os".to_string(), - process: ETH_PROCESS_ID.clone(), - }, - rsvp: Some(km.source.clone()), - message: Message::Request(req.clone()), - lazy_load_blob: None, - }; - - let _ = send_to_loop.send(request).await; + } } - } else { - // either someone asking us for rpc, or we are passing through a sub event. - handle_remote_request(our, km, send_to_loop, provider, connections, public).await? } } Message::Response(_) => { @@ -255,7 +276,7 @@ async fn handle_remote_request( our: &str, km: &KernelMessage, send_to_loop: &MessageSender, - provider: Arc>>, + provider: Option<&Provider>, connections: Arc>>>, public: Arc, ) -> Result<(), EthError> { @@ -265,7 +286,7 @@ async fn handle_remote_request( )); }; - if let Some(provider) = provider.as_ref() { + if let Some(provider) = provider { // we need some sort of agreement perhaps on rpc providing. // even with an agreement, fake ethsubevents could be sent to us. // light clients could verify blocks perhaps... diff --git a/kinode/src/main.rs b/kinode/src/main.rs index c960bab3d..aaa37515e 100644 --- a/kinode/src/main.rs +++ b/kinode/src/main.rs @@ -2,6 +2,7 @@ use anyhow::Result; use clap::{arg, value_parser, Command}; +use rand::seq::SliceRandom; use std::env; use std::sync::Arc; use tokio::sync::{mpsc, oneshot}; @@ -111,14 +112,14 @@ async fn main() { ); #[cfg(not(feature = "simulation-mode"))] - let app = - app.arg(arg!(--rpc "Ethereum RPC endpoint (must be wss://)").required(false)); - - let app = app.arg( - arg!(--public "If set, allow rpc passthrough") - .default_value("false") - .value_parser(value_parser!(bool)), - ); + let app = app + .arg(arg!(--rpc "Ethereum RPC endpoint (must be wss://)").required(false)) + .arg(arg!(--rpcnode "RPC node provider must be a valid address").required(false)) + .arg( + arg!(--public "If set, allow rpc passthrough") + .default_value("false") + .value_parser(value_parser!(bool)), + ); #[cfg(feature = "simulation-mode")] let app = app @@ -177,8 +178,50 @@ async fn main() { } } + // default routers + type KnsUpdate = crate::net::KnsUpdate; + let routers: Vec = + match fs::read_to_string(format!("{}/.routers", home_directory_path)).await { + Ok(contents) => serde_json::from_str(&contents).unwrap(), + Err(_) => { + let routers: Vec = serde_json::from_str(DEFAULT_ROUTERS).unwrap(); + routers + } + }; + + println!("wtf here are the matches: {:?}", matches); #[cfg(not(feature = "simulation-mode"))] let (rpc_url, is_detached) = (matches.get_one::("rpc").cloned(), false); + #[cfg(not(feature = "simulation-mode"))] + let (rpc_node, _is_detached) = (matches.get_one::("rpcnode").cloned(), false); + + type ProviderInput = lib::eth::ProviderInput; + let eth_provider: ProviderInput; + + match (rpc_url, rpc_node) { + (Some(url), Some(_)) => { + println!("passed both node and url for rpc, using url."); + eth_provider = ProviderInput::WS(url); + } + (Some(url), None) => { + eth_provider = ProviderInput::WS(url); + } + (None, Some(node)) => { + println!("trying to use node for rpc: {}", node); + eth_provider = ProviderInput::Node(node); + } + (None, None) => { + let random_router = routers.choose(&mut rand::thread_rng()).unwrap(); + let default_router = random_router.name.clone(); + + println!( + "no rpc provided, using a default router: {}", + default_router + ); + + eth_provider = ProviderInput::Node(default_router); + } + } #[cfg(feature = "simulation-mode")] let (rpc_url, password, network_router_port, fake_node_name, is_detached) = ( @@ -387,17 +430,6 @@ async fn main() { } }; - // read in default routers .json file - type KnsUpdate = crate::net::KnsUpdate; - let routers: Vec = - match fs::read_to_string(format!("{}/.routers", home_directory_path)).await { - Ok(contents) => serde_json::from_str(&contents).unwrap(), - Err(_) => { - let routers: Vec = serde_json::from_str(DEFAULT_ROUTERS).unwrap(); - routers - } - }; - // the boolean flag determines whether the runtime module is *public* or not, // where public means that any process can always message it. #[allow(unused_mut)] @@ -550,7 +582,7 @@ async fn main() { #[cfg(not(feature = "simulation-mode"))] tasks.spawn(eth::provider::provider( our.name.clone(), - rpc_url.clone(), + eth_provider, public, kernel_message_sender.clone(), eth_provider_receiver, diff --git a/lib/src/eth.rs b/lib/src/eth.rs index b91af0f56..041bfec2b 100644 --- a/lib/src/eth.rs +++ b/lib/src/eth.rs @@ -90,3 +90,8 @@ pub fn to_static_str(method: &str) -> Option<&'static str> { _ => None, } } + +pub enum ProviderInput { + WS(String), + Node(String), +} From b2b8e5d8ccc15d758d055bb9af586dd45136a39b Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Wed, 14 Feb 2024 16:21:47 -0300 Subject: [PATCH 066/171] print remove --- kinode/packages/app_store/app_store/src/types.rs | 1 + kinode/src/eth/provider.rs | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/kinode/packages/app_store/app_store/src/types.rs b/kinode/packages/app_store/app_store/src/types.rs index c76d61918..18ca512b4 100644 --- a/kinode/packages/app_store/app_store/src/types.rs +++ b/kinode/packages/app_store/app_store/src/types.rs @@ -1,3 +1,4 @@ +use crate::LocalRequest; use alloy_sol_types::{sol, SolEvent}; use kinode_process_lib::eth::Log; use kinode_process_lib::kernel_types as kt; diff --git a/kinode/src/eth/provider.rs b/kinode/src/eth/provider.rs index fc00a2495..f05ea9896 100644 --- a/kinode/src/eth/provider.rs +++ b/kinode/src/eth/provider.rs @@ -240,7 +240,6 @@ async fn handle_local_request( .prepare(method, params) .await .map_err(|e| EthError::TransportError(e.to_string()))?; - println!("got a normal request! "); EthResponse::Response { value: response } } }; From 0148e8d36a64fc4f59f68defae6da363a00da0d3 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Wed, 14 Feb 2024 15:17:13 -0500 Subject: [PATCH 067/171] app-store-ui udpated to 8d74de6 --- .../app_store/pkg/ui/assets/index-BQDGz1Dy.js | 90 +++++++++++++++++++ .../app_store/pkg/ui/assets/index-pkTLhk2L.js | 90 ------------------- kinode/packages/app_store/pkg/ui/index.html | 2 +- 3 files changed, 91 insertions(+), 91 deletions(-) create mode 100644 kinode/packages/app_store/pkg/ui/assets/index-BQDGz1Dy.js delete mode 100644 kinode/packages/app_store/pkg/ui/assets/index-pkTLhk2L.js diff --git a/kinode/packages/app_store/pkg/ui/assets/index-BQDGz1Dy.js b/kinode/packages/app_store/pkg/ui/assets/index-BQDGz1Dy.js new file mode 100644 index 000000000..65adcd4f5 --- /dev/null +++ b/kinode/packages/app_store/pkg/ui/assets/index-BQDGz1Dy.js @@ -0,0 +1,90 @@ +var nw=Object.defineProperty;var iw=(t,e,r)=>e in t?nw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var zh=(t,e,r)=>(iw(t,typeof e!="symbol"?e+"":e,r),r);function ow(t,e){for(var r=0;rn[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=r(i);fetch(i.href,o)}})();var Fe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Uo(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Bm={exports:{}},du={},Dm={exports:{}},ye={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var dl=Symbol.for("react.element"),sw=Symbol.for("react.portal"),lw=Symbol.for("react.fragment"),aw=Symbol.for("react.strict_mode"),uw=Symbol.for("react.profiler"),cw=Symbol.for("react.provider"),fw=Symbol.for("react.context"),dw=Symbol.for("react.forward_ref"),hw=Symbol.for("react.suspense"),pw=Symbol.for("react.memo"),mw=Symbol.for("react.lazy"),$h=Symbol.iterator;function gw(t){return t===null||typeof t!="object"?null:(t=$h&&t[$h]||t["@@iterator"],typeof t=="function"?t:null)}var jm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Um=Object.assign,Fm={};function Fo(t,e,r){this.props=t,this.context=e,this.refs=Fm,this.updater=r||jm}Fo.prototype.isReactComponent={};Fo.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Fo.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function zm(){}zm.prototype=Fo.prototype;function Sd(t,e,r){this.props=t,this.context=e,this.refs=Fm,this.updater=r||jm}var kd=Sd.prototype=new zm;kd.constructor=Sd;Um(kd,Fo.prototype);kd.isPureReactComponent=!0;var Hh=Array.isArray,$m=Object.prototype.hasOwnProperty,Nd={current:null},Hm={key:!0,ref:!0,__self:!0,__source:!0};function qm(t,e,r){var n,i={},o=null,s=null;if(e!=null)for(n in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(o=""+e.key),e)$m.call(e,n)&&!Hm.hasOwnProperty(n)&&(i[n]=e[n]);var l=arguments.length-2;if(l===1)i.children=r;else if(1>>1,h=b[k];if(0>>1;ki(y,R))Di(U,y)?(b[k]=U,b[D]=R,k=D):(b[k]=y,b[ee]=R,k=ee);else if(Di(U,R))b[k]=U,b[D]=R,k=D;else break e}}return M}function i(b,M){var R=b.sortIndex-M.sortIndex;return R!==0?R:b.id-M.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,l=s.now();t.unstable_now=function(){return s.now()-l}}var a=[],u=[],c=1,d=null,p=3,v=!1,g=!1,x=!1,S=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(b){for(var M=r(u);M!==null;){if(M.callback===null)n(u);else if(M.startTime<=b)n(u),M.sortIndex=M.expirationTime,e(a,M);else break;M=r(u)}}function O(b){if(x=!1,_(b),!g)if(r(a)!==null)g=!0,A(B);else{var M=r(u);M!==null&&N(O,M.startTime-b)}}function B(b,M){g=!1,x&&(x=!1,E(q),q=-1),v=!0;var R=p;try{for(_(M),d=r(a);d!==null&&(!(d.expirationTime>M)||b&&!H());){var k=d.callback;if(typeof k=="function"){d.callback=null,p=d.priorityLevel;var h=k(d.expirationTime<=M);M=t.unstable_now(),typeof h=="function"?d.callback=h:d===r(a)&&n(a),_(M)}else n(a);d=r(a)}if(d!==null)var P=!0;else{var ee=r(u);ee!==null&&N(O,ee.startTime-M),P=!1}return P}finally{d=null,p=R,v=!1}}var j=!1,$=null,q=-1,ne=5,K=-1;function H(){return!(t.unstable_now()-Kb||125k?(b.sortIndex=R,e(u,b),r(a)===null&&b===r(u)&&(x?(E(q),q=-1):x=!0,N(O,R-k))):(b.sortIndex=h,e(a,b),g||v||(g=!0,A(B))),b},t.unstable_shouldYield=H,t.unstable_wrapCallback=function(b){var M=p;return function(){var R=p;p=M;try{return b.apply(this,arguments)}finally{p=R}}}})(Km);Vm.exports=Km;var Pw=Vm.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Qm=L,pr=Pw;function W(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ff=Object.prototype.hasOwnProperty,Cw=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Wh={},Gh={};function Mw(t){return ff.call(Gh,t)?!0:ff.call(Wh,t)?!1:Cw.test(t)?Gh[t]=!0:(Wh[t]=!0,!1)}function Iw(t,e,r,n){if(r!==null&&r.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function Rw(t,e,r,n){if(e===null||typeof e>"u"||Iw(t,e,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Vt(t,e,r,n,i,o,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=s}var Tt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Tt[t]=new Vt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Tt[e]=new Vt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Tt[t]=new Vt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Tt[t]=new Vt(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Tt[t]=new Vt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Tt[t]=new Vt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Tt[t]=new Vt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Tt[t]=new Vt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Tt[t]=new Vt(t,5,!1,t.toLowerCase(),null,!1,!1)});var Cd=/[\-:]([a-z])/g;function Md(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Cd,Md);Tt[e]=new Vt(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Cd,Md);Tt[e]=new Vt(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Cd,Md);Tt[e]=new Vt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Tt[t]=new Vt(t,1,!1,t.toLowerCase(),null,!1,!1)});Tt.xlinkHref=new Vt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Tt[t]=new Vt(t,1,!1,t.toLowerCase(),null,!0,!0)});function Id(t,e,r,n){var i=Tt.hasOwnProperty(e)?Tt[e]:null;(i!==null?i.type!==0:n||!(2l||i[s]!==o[l]){var a=` +`+i[s].replace(" at new "," at ");return t.displayName&&a.includes("")&&(a=a.replace("",t.displayName)),a}while(1<=s&&0<=l);break}}}finally{hc=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?fs(t):""}function Tw(t){switch(t.tag){case 5:return fs(t.type);case 16:return fs("Lazy");case 13:return fs("Suspense");case 19:return fs("SuspenseList");case 0:case 2:case 15:return t=pc(t.type,!1),t;case 11:return t=pc(t.type.render,!1),t;case 1:return t=pc(t.type,!0),t;default:return""}}function mf(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Zi:return"Fragment";case Xi:return"Portal";case df:return"Profiler";case Rd:return"StrictMode";case hf:return"Suspense";case pf:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Xm:return(t.displayName||"Context")+".Consumer";case Ym:return(t._context.displayName||"Context")+".Provider";case Td:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Od:return e=t.displayName||null,e!==null?e:mf(t.type)||"Memo";case Jn:e=t._payload,t=t._init;try{return mf(t(e))}catch{}}return null}function Ow(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return mf(e);case 8:return e===Rd?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function pi(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function eg(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Lw(t){var e=eg(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,o=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){n=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(s){n=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function kl(t){t._valueTracker||(t._valueTracker=Lw(t))}function tg(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=eg(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function Sa(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function gf(t,e){var r=e.checked;return ft({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function Kh(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=pi(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function rg(t,e){e=e.checked,e!=null&&Id(t,"checked",e,!1)}function vf(t,e){rg(t,e);var r=pi(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?yf(t,e.type,r):e.hasOwnProperty("defaultValue")&&yf(t,e.type,pi(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Qh(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function yf(t,e,r){(e!=="number"||Sa(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var ds=Array.isArray;function go(t,e,r,n){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Nl.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ts(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var ws={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Bw=["Webkit","ms","Moz","O"];Object.keys(ws).forEach(function(t){Bw.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ws[e]=ws[t]})});function sg(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||ws.hasOwnProperty(t)&&ws[t]?(""+e).trim():e+"px"}function lg(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=sg(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,i):t[r]=i}}var Dw=ft({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function xf(t,e){if(e){if(Dw[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(W(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(W(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(W(61))}if(e.style!=null&&typeof e.style!="object")throw Error(W(62))}}function Af(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var bf=null;function Ld(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var _f=null,vo=null,yo=null;function Xh(t){if(t=ml(t)){if(typeof _f!="function")throw Error(W(280));var e=t.stateNode;e&&(e=vu(e),_f(t.stateNode,t.type,e))}}function ag(t){vo?yo?yo.push(t):yo=[t]:vo=t}function ug(){if(vo){var t=vo,e=yo;if(yo=vo=null,Xh(t),e)for(t=0;t>>=0,t===0?32:31-(Kw(t)/Qw|0)|0}var Pl=64,Cl=4194304;function hs(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Ca(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,i=t.suspendedLanes,o=t.pingedLanes,s=r&268435455;if(s!==0){var l=s&~i;l!==0?n=hs(l):(o&=s,o!==0&&(n=hs(o)))}else s=r&~i,s!==0?n=hs(s):o!==0&&(n=hs(o));if(n===0)return 0;if(e!==0&&e!==n&&!(e&i)&&(i=n&-n,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0r;r++)e.push(t);return e}function hl(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Wr(e),t[e]=r}function Zw(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0=xs),l0=" ",a0=!1;function Cg(t,e){switch(t){case"keyup":return N2.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Mg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var eo=!1;function C2(t,e){switch(t){case"compositionend":return Mg(e);case"keypress":return e.which!==32?null:(a0=!0,l0);case"textInput":return t=e.data,t===l0&&a0?null:t;default:return null}}function M2(t,e){if(eo)return t==="compositionend"||!Hd&&Cg(t,e)?(t=Ng(),na=Fd=ri=null,eo=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=d0(r)}}function Og(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Og(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Lg(){for(var t=window,e=Sa();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=Sa(t.document)}return e}function qd(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function U2(t){var e=Lg(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&Og(r.ownerDocument.documentElement,r)){if(n!==null&&qd(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=r.textContent.length,o=Math.min(n.start,i);n=n.end===void 0?o:Math.min(n.end,i),!t.extend&&o>n&&(i=n,n=o,o=i),i=h0(r,o);var s=h0(r,n);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>n?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,to=null,Mf=null,bs=null,If=!1;function p0(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;If||to==null||to!==Sa(n)||(n=to,"selectionStart"in n&&qd(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),bs&&Us(bs,n)||(bs=n,n=Ra(Mf,"onSelect"),0io||(t.current=Df[io],Df[io]=null,io--)}function Qe(t,e){io++,Df[io]=t.current,t.current=e}var mi={},zt=wi(mi),er=wi(!1),Ri=mi;function ko(t,e){var r=t.type.contextTypes;if(!r)return mi;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in r)i[o]=e[o];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function tr(t){return t=t.childContextTypes,t!=null}function Oa(){tt(er),tt(zt)}function x0(t,e,r){if(zt.current!==mi)throw Error(W(168));Qe(zt,e),Qe(er,r)}function qg(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in e))throw Error(W(108,Ow(t)||"Unknown",i));return ft({},r,n)}function La(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||mi,Ri=zt.current,Qe(zt,t),Qe(er,er.current),!0}function A0(t,e,r){var n=t.stateNode;if(!n)throw Error(W(169));r?(t=qg(t,e,Ri),n.__reactInternalMemoizedMergedChildContext=t,tt(er),tt(zt),Qe(zt,t)):tt(er),Qe(er,r)}var An=null,yu=!1,Pc=!1;function Wg(t){An===null?An=[t]:An.push(t)}function Y2(t){yu=!0,Wg(t)}function Ei(){if(!Pc&&An!==null){Pc=!0;var t=0,e=Re;try{var r=An;for(Re=1;t>=s,i-=s,Sn=1<<32-Wr(e)+i|r<q?(ne=$,$=null):ne=$.sibling;var K=p(E,$,_[q],O);if(K===null){$===null&&($=ne);break}t&&$&&K.alternate===null&&e(E,$),w=o(K,w,q),j===null?B=K:j.sibling=K,j=K,$=ne}if(q===_.length)return r(E,$),nt&&bi(E,q),B;if($===null){for(;q<_.length;q++)$=d(E,_[q],O),$!==null&&(w=o($,w,q),j===null?B=$:j.sibling=$,j=$);return nt&&bi(E,q),B}for($=n(E,$);q<_.length;q++)ne=v($,E,q,_[q],O),ne!==null&&(t&&ne.alternate!==null&&$.delete(ne.key===null?q:ne.key),w=o(ne,w,q),j===null?B=ne:j.sibling=ne,j=ne);return t&&$.forEach(function(H){return e(E,H)}),nt&&bi(E,q),B}function x(E,w,_,O){var B=Jo(_);if(typeof B!="function")throw Error(W(150));if(_=B.call(_),_==null)throw Error(W(151));for(var j=B=null,$=w,q=w=0,ne=null,K=_.next();$!==null&&!K.done;q++,K=_.next()){$.index>q?(ne=$,$=null):ne=$.sibling;var H=p(E,$,K.value,O);if(H===null){$===null&&($=ne);break}t&&$&&H.alternate===null&&e(E,$),w=o(H,w,q),j===null?B=H:j.sibling=H,j=H,$=ne}if(K.done)return r(E,$),nt&&bi(E,q),B;if($===null){for(;!K.done;q++,K=_.next())K=d(E,K.value,O),K!==null&&(w=o(K,w,q),j===null?B=K:j.sibling=K,j=K);return nt&&bi(E,q),B}for($=n(E,$);!K.done;q++,K=_.next())K=v($,E,q,K.value,O),K!==null&&(t&&K.alternate!==null&&$.delete(K.key===null?q:K.key),w=o(K,w,q),j===null?B=K:j.sibling=K,j=K);return t&&$.forEach(function(se){return e(E,se)}),nt&&bi(E,q),B}function S(E,w,_,O){if(typeof _=="object"&&_!==null&&_.type===Zi&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case Sl:e:{for(var B=_.key,j=w;j!==null;){if(j.key===B){if(B=_.type,B===Zi){if(j.tag===7){r(E,j.sibling),w=i(j,_.props.children),w.return=E,E=w;break e}}else if(j.elementType===B||typeof B=="object"&&B!==null&&B.$$typeof===Jn&&C0(B)===j.type){r(E,j.sibling),w=i(j,_.props),w.ref=ts(E,j,_),w.return=E,E=w;break e}r(E,j);break}else e(E,j);j=j.sibling}_.type===Zi?(w=Mi(_.props.children,E.mode,O,_.key),w.return=E,E=w):(O=fa(_.type,_.key,_.props,null,E.mode,O),O.ref=ts(E,w,_),O.return=E,E=O)}return s(E);case Xi:e:{for(j=_.key;w!==null;){if(w.key===j)if(w.tag===4&&w.stateNode.containerInfo===_.containerInfo&&w.stateNode.implementation===_.implementation){r(E,w.sibling),w=i(w,_.children||[]),w.return=E,E=w;break e}else{r(E,w);break}else e(E,w);w=w.sibling}w=Bc(_,E.mode,O),w.return=E,E=w}return s(E);case Jn:return j=_._init,S(E,w,j(_._payload),O)}if(ds(_))return g(E,w,_,O);if(Jo(_))return x(E,w,_,O);Bl(E,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,w!==null&&w.tag===6?(r(E,w.sibling),w=i(w,_),w.return=E,E=w):(r(E,w),w=Lc(_,E.mode,O),w.return=E,E=w),s(E)):r(E,w)}return S}var Po=Zg(!0),ev=Zg(!1),gl={},an=wi(gl),Hs=wi(gl),qs=wi(gl);function Pi(t){if(t===gl)throw Error(W(174));return t}function Zd(t,e){switch(Qe(qs,e),Qe(Hs,t),Qe(an,gl),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Ef(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Ef(e,t)}tt(an),Qe(an,e)}function Co(){tt(an),tt(Hs),tt(qs)}function tv(t){Pi(qs.current);var e=Pi(an.current),r=Ef(e,t.type);e!==r&&(Qe(Hs,t),Qe(an,r))}function eh(t){Hs.current===t&&(tt(an),tt(Hs))}var at=wi(0);function za(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Cc=[];function th(){for(var t=0;tr?r:4,t(!0);var n=Mc.transition;Mc.transition={};try{t(!1),e()}finally{Re=r,Mc.transition=n}}function vv(){return Pr().memoizedState}function tE(t,e,r){var n=di(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},yv(t))wv(e,r);else if(r=Qg(t,e,r,n),r!==null){var i=Wt();Gr(r,t,n,i),Ev(r,e,n)}}function rE(t,e,r){var n=di(t),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(yv(t))wv(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,l=o(s,r);if(i.hasEagerState=!0,i.eagerState=l,Vr(l,s)){var a=e.interleaved;a===null?(i.next=i,Yd(e)):(i.next=a.next,a.next=i),e.interleaved=i;return}}catch{}finally{}r=Qg(t,e,i,n),r!==null&&(i=Wt(),Gr(r,t,n,i),Ev(r,e,n))}}function yv(t){var e=t.alternate;return t===ct||e!==null&&e===ct}function wv(t,e){_s=$a=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function Ev(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,Dd(t,r)}}var Ha={readContext:Nr,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useInsertionEffect:Lt,useLayoutEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useMutableSource:Lt,useSyncExternalStore:Lt,useId:Lt,unstable_isNewReconciler:!1},nE={readContext:Nr,useCallback:function(t,e){return Zr().memoizedState=[t,e===void 0?null:e],t},useContext:Nr,useEffect:I0,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,la(4194308,4,dv.bind(null,e,t),r)},useLayoutEffect:function(t,e){return la(4194308,4,t,e)},useInsertionEffect:function(t,e){return la(4,2,t,e)},useMemo:function(t,e){var r=Zr();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=Zr();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=tE.bind(null,ct,t),[n.memoizedState,t]},useRef:function(t){var e=Zr();return t={current:t},e.memoizedState=t},useState:M0,useDebugValue:sh,useDeferredValue:function(t){return Zr().memoizedState=t},useTransition:function(){var t=M0(!1),e=t[0];return t=eE.bind(null,t[1]),Zr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=ct,i=Zr();if(nt){if(r===void 0)throw Error(W(407));r=r()}else{if(r=e(),Nt===null)throw Error(W(349));Oi&30||iv(n,e,r)}i.memoizedState=r;var o={value:r,getSnapshot:e};return i.queue=o,I0(sv.bind(null,n,o,t),[t]),n.flags|=2048,Vs(9,ov.bind(null,n,o,r,e),void 0,null),r},useId:function(){var t=Zr(),e=Nt.identifierPrefix;if(nt){var r=kn,n=Sn;r=(n&~(1<<32-Wr(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=Ws++,0<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=s.createElement(r,{is:n.is}):(t=s.createElement(r),r==="select"&&(s=t,n.multiple?s.multiple=!0:n.size&&(s.size=n.size))):t=s.createElementNS(t,r),t[nn]=e,t[$s]=n,Cv(t,e,!1,!1),e.stateNode=t;e:{switch(s=Af(r,n),r){case"dialog":et("cancel",t),et("close",t),i=n;break;case"iframe":case"object":case"embed":et("load",t),i=n;break;case"video":case"audio":for(i=0;iIo&&(e.flags|=128,n=!0,rs(o,!1),e.lanes=4194304)}else{if(!n)if(t=za(s),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),rs(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!nt)return Bt(e),null}else 2*vt()-o.renderingStartTime>Io&&r!==1073741824&&(e.flags|=128,n=!0,rs(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(r=o.last,r!==null?r.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=vt(),e.sibling=null,r=at.current,Qe(at,n?r&1|2:r&1),e):(Bt(e),null);case 22:case 23:return dh(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?lr&1073741824&&(Bt(e),e.subtreeFlags&6&&(e.flags|=8192)):Bt(e),null;case 24:return null;case 25:return null}throw Error(W(156,e.tag))}function fE(t,e){switch(Gd(e),e.tag){case 1:return tr(e.type)&&Oa(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Co(),tt(er),tt(zt),th(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return eh(e),null;case 13:if(tt(at),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(W(340));No()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return tt(at),null;case 4:return Co(),null;case 10:return Jd(e.type._context),null;case 22:case 23:return dh(),null;case 24:return null;default:return null}}var jl=!1,Dt=!1,dE=typeof WeakSet=="function"?WeakSet:Set,X=null;function ao(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){ht(t,e,n)}else r.current=null}function Qf(t,e,r){try{r()}catch(n){ht(t,e,n)}}var F0=!1;function hE(t,e){if(Rf=Ma,t=Lg(),qd(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break e}var s=0,l=-1,a=-1,u=0,c=0,d=t,p=null;t:for(;;){for(var v;d!==r||i!==0&&d.nodeType!==3||(l=s+i),d!==o||n!==0&&d.nodeType!==3||(a=s+n),d.nodeType===3&&(s+=d.nodeValue.length),(v=d.firstChild)!==null;)p=d,d=v;for(;;){if(d===t)break t;if(p===r&&++u===i&&(l=s),p===o&&++c===n&&(a=s),(v=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=v}r=l===-1||a===-1?null:{start:l,end:a}}else r=null}r=r||{start:0,end:0}}else r=null;for(Tf={focusedElem:t,selectionRange:r},Ma=!1,X=e;X!==null;)if(e=X,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,X=t;else for(;X!==null;){e=X;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var x=g.memoizedProps,S=g.memoizedState,E=e.stateNode,w=E.getSnapshotBeforeUpdate(e.elementType===e.type?x:jr(e.type,x),S);E.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var _=e.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(W(163))}}catch(O){ht(e,e.return,O)}if(t=e.sibling,t!==null){t.return=e.return,X=t;break}X=e.return}return g=F0,F0=!1,g}function Ss(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&Qf(e,r,o)}i=i.next}while(i!==n)}}function xu(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function Jf(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function Rv(t){var e=t.alternate;e!==null&&(t.alternate=null,Rv(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[nn],delete e[$s],delete e[Bf],delete e[Q2],delete e[J2])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Tv(t){return t.tag===5||t.tag===3||t.tag===4}function z0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Tv(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Yf(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=Ta));else if(n!==4&&(t=t.child,t!==null))for(Yf(t,e,r),t=t.sibling;t!==null;)Yf(t,e,r),t=t.sibling}function Xf(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(Xf(t,e,r),t=t.sibling;t!==null;)Xf(t,e,r),t=t.sibling}var Mt=null,Fr=!1;function Vn(t,e,r){for(r=r.child;r!==null;)Ov(t,e,r),r=r.sibling}function Ov(t,e,r){if(ln&&typeof ln.onCommitFiberUnmount=="function")try{ln.onCommitFiberUnmount(hu,r)}catch{}switch(r.tag){case 5:Dt||ao(r,e);case 6:var n=Mt,i=Fr;Mt=null,Vn(t,e,r),Mt=n,Fr=i,Mt!==null&&(Fr?(t=Mt,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Mt.removeChild(r.stateNode));break;case 18:Mt!==null&&(Fr?(t=Mt,r=r.stateNode,t.nodeType===8?Nc(t.parentNode,r):t.nodeType===1&&Nc(t,r),Ds(t)):Nc(Mt,r.stateNode));break;case 4:n=Mt,i=Fr,Mt=r.stateNode.containerInfo,Fr=!0,Vn(t,e,r),Mt=n,Fr=i;break;case 0:case 11:case 14:case 15:if(!Dt&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&Qf(r,e,s),i=i.next}while(i!==n)}Vn(t,e,r);break;case 1:if(!Dt&&(ao(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){ht(r,e,l)}Vn(t,e,r);break;case 21:Vn(t,e,r);break;case 22:r.mode&1?(Dt=(n=Dt)||r.memoizedState!==null,Vn(t,e,r),Dt=n):Vn(t,e,r);break;default:Vn(t,e,r)}}function $0(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new dE),e.forEach(function(n){var i=AE.bind(null,t,n);r.has(n)||(r.add(n),n.then(i,i))})}}function Tr(t,e){var r=e.deletions;if(r!==null)for(var n=0;ni&&(i=s),n&=~o}if(n=i,n=vt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*mE(n/1960))-n,10t?16:t,ni===null)var n=!1;else{if(t=ni,ni=null,Ga=0,Ae&6)throw Error(W(331));var i=Ae;for(Ae|=4,X=t.current;X!==null;){var o=X,s=o.child;if(X.flags&16){var l=o.deletions;if(l!==null){for(var a=0;avt()-ch?Ci(t,0):uh|=r),rr(t,e)}function $v(t,e){e===0&&(t.mode&1?(e=Cl,Cl<<=1,!(Cl&130023424)&&(Cl=4194304)):e=1);var r=Wt();t=Rn(t,e),t!==null&&(hl(t,e,r),rr(t,r))}function xE(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),$v(t,r)}function AE(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,i=t.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(W(314))}n!==null&&n.delete(e),$v(t,r)}var Hv;Hv=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||er.current)Zt=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return Zt=!1,uE(t,e,r);Zt=!!(t.flags&131072)}else Zt=!1,nt&&e.flags&1048576&&Gg(e,Da,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;aa(t,e),t=e.pendingProps;var i=ko(e,zt.current);Eo(e,r),i=nh(null,e,n,t,i,r);var o=ih();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,tr(n)?(o=!0,La(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Xd(e),i.updater=wu,e.stateNode=i,i._reactInternals=e,$f(e,n,t,r),e=Wf(null,e,n,!0,o,r)):(e.tag=0,nt&&o&&Wd(e),qt(null,e,i,r),e=e.child),e;case 16:n=e.elementType;e:{switch(aa(t,e),t=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=_E(n),t=jr(n,t),i){case 0:e=qf(null,e,n,t,r);break e;case 1:e=D0(null,e,n,t,r);break e;case 11:e=L0(null,e,n,t,r);break e;case 14:e=B0(null,e,n,jr(n.type,t),r);break e}throw Error(W(306,n,""))}return e;case 0:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),qf(t,e,n,i,r);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),D0(t,e,n,i,r);case 3:e:{if(kv(e),t===null)throw Error(W(387));n=e.pendingProps,o=e.memoizedState,i=o.element,Jg(t,e),Fa(e,n,null,r);var s=e.memoizedState;if(n=s.element,o.isDehydrated)if(o={element:n,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=Mo(Error(W(423)),e),e=j0(t,e,n,r,i);break e}else if(n!==i){i=Mo(Error(W(424)),e),e=j0(t,e,n,r,i);break e}else for(cr=ui(e.stateNode.containerInfo.firstChild),dr=e,nt=!0,zr=null,r=ev(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(No(),n===i){e=Tn(t,e,r);break e}qt(t,e,n,r)}e=e.child}return e;case 5:return tv(e),t===null&&Uf(e),n=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,Of(n,i)?s=null:o!==null&&Of(n,o)&&(e.flags|=32),Sv(t,e),qt(t,e,s,r),e.child;case 6:return t===null&&Uf(e),null;case 13:return Nv(t,e,r);case 4:return Zd(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Po(e,null,n,r):qt(t,e,n,r),e.child;case 11:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),L0(t,e,n,i,r);case 7:return qt(t,e,e.pendingProps,r),e.child;case 8:return qt(t,e,e.pendingProps.children,r),e.child;case 12:return qt(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,Qe(ja,n._currentValue),n._currentValue=s,o!==null)if(Vr(o.value,s)){if(o.children===i.children&&!er.current){e=Tn(t,e,r);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var l=o.dependencies;if(l!==null){s=o.child;for(var a=l.firstContext;a!==null;){if(a.context===n){if(o.tag===1){a=Pn(-1,r&-r),a.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}o.lanes|=r,a=o.alternate,a!==null&&(a.lanes|=r),Ff(o.return,r,e),l.lanes|=r;break}a=a.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(W(341));s.lanes|=r,l=s.alternate,l!==null&&(l.lanes|=r),Ff(s,r,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}qt(t,e,i.children,r),e=e.child}return e;case 9:return i=e.type,n=e.pendingProps.children,Eo(e,r),i=Nr(i),n=n(i),e.flags|=1,qt(t,e,n,r),e.child;case 14:return n=e.type,i=jr(n,e.pendingProps),i=jr(n.type,i),B0(t,e,n,i,r);case 15:return bv(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),aa(t,e),e.tag=1,tr(n)?(t=!0,La(e)):t=!1,Eo(e,r),Xg(e,n,i),$f(e,n,i,r),Wf(null,e,n,!0,t,r);case 19:return Pv(t,e,r);case 22:return _v(t,e,r)}throw Error(W(156,e.tag))};function qv(t,e){return gg(t,e)}function bE(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sr(t,e,r,n){return new bE(t,e,r,n)}function ph(t){return t=t.prototype,!(!t||!t.isReactComponent)}function _E(t){if(typeof t=="function")return ph(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Td)return 11;if(t===Od)return 14}return 2}function hi(t,e){var r=t.alternate;return r===null?(r=Sr(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function fa(t,e,r,n,i,o){var s=2;if(n=t,typeof t=="function")ph(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case Zi:return Mi(r.children,i,o,e);case Rd:s=8,i|=8;break;case df:return t=Sr(12,r,e,i|2),t.elementType=df,t.lanes=o,t;case hf:return t=Sr(13,r,e,i),t.elementType=hf,t.lanes=o,t;case pf:return t=Sr(19,r,e,i),t.elementType=pf,t.lanes=o,t;case Zm:return bu(r,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Ym:s=10;break e;case Xm:s=9;break e;case Td:s=11;break e;case Od:s=14;break e;case Jn:s=16,n=null;break e}throw Error(W(130,t==null?t:typeof t,""))}return e=Sr(s,r,e,i),e.elementType=t,e.type=n,e.lanes=o,e}function Mi(t,e,r,n){return t=Sr(7,t,n,e),t.lanes=r,t}function bu(t,e,r,n){return t=Sr(22,t,n,e),t.elementType=Zm,t.lanes=r,t.stateNode={isHidden:!1},t}function Lc(t,e,r){return t=Sr(6,t,null,e),t.lanes=r,t}function Bc(t,e,r){return e=Sr(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function SE(t,e,r,n,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=gc(0),this.expirationTimes=gc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gc(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function mh(t,e,r,n,i,o,s,l,a){return t=new SE(t,e,r,l,a),e===1?(e=1,o===!0&&(e|=8)):e=0,o=Sr(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xd(o),t}function kE(t,e,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Kv)}catch(t){console.error(t)}}Kv(),Gm.exports=gr;var Qs=Gm.exports,J0=Qs;cf.createRoot=J0.createRoot,cf.hydrateRoot=J0.hydrateRoot;/** + * @remix-run/router v1.14.2 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Js(){return Js=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function wh(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function RE(){return Math.random().toString(36).substr(2,8)}function X0(t,e){return{usr:t.state,key:t.key,idx:e}}function nd(t,e,r,n){return r===void 0&&(r=null),Js({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Ho(e):e,{state:r,key:e&&e.key||n||RE()})}function Qv(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Ho(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function TE(t,e,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:o=!1}=n,s=i.history,l=ii.Pop,a=null,u=c();u==null&&(u=0,s.replaceState(Js({},s.state,{idx:u}),""));function c(){return(s.state||{idx:null}).idx}function d(){l=ii.Pop;let S=c(),E=S==null?null:S-u;u=S,a&&a({action:l,location:x.location,delta:E})}function p(S,E){l=ii.Push;let w=nd(x.location,S,E);r&&r(w,S),u=c()+1;let _=X0(w,u),O=x.createHref(w);try{s.pushState(_,"",O)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;i.location.assign(O)}o&&a&&a({action:l,location:x.location,delta:1})}function v(S,E){l=ii.Replace;let w=nd(x.location,S,E);r&&r(w,S),u=c();let _=X0(w,u),O=x.createHref(w);s.replaceState(_,"",O),o&&a&&a({action:l,location:x.location,delta:0})}function g(S){let E=i.location.origin!=="null"?i.location.origin:i.location.href,w=typeof S=="string"?S:Qv(S);return _t(E,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,E)}let x={get action(){return l},get location(){return t(i,s)},listen(S){if(a)throw new Error("A history only accepts one active listener");return i.addEventListener(Y0,d),a=S,()=>{i.removeEventListener(Y0,d),a=null}},createHref(S){return e(i,S)},createURL:g,encodeLocation(S){let E=g(S);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:p,replace:v,go(S){return s.go(S)}};return x}var Z0;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Z0||(Z0={}));function OE(t,e,r){r===void 0&&(r="/");let n=typeof e=="string"?Ho(e):e,i=Xv(n.pathname||"/",r);if(i==null)return null;let o=Jv(t);LE(o);let s=null;for(let l=0;s==null&&l{let a={relativePath:l===void 0?o.path||"":l,caseSensitive:o.caseSensitive===!0,childrenIndex:s,route:o};a.relativePath.startsWith("/")&&(_t(a.relativePath.startsWith(n),'Absolute route path "'+a.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),a.relativePath=a.relativePath.slice(n.length));let u=Ii([n,a.relativePath]),c=r.concat(a);o.children&&o.children.length>0&&(_t(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Jv(o.children,e,c,u)),!(o.path==null&&!o.index)&&e.push({path:u,score:$E(u,o.index),routesMeta:c})};return t.forEach((o,s)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))i(o,s);else for(let a of Yv(o.path))i(o,s,a)}),e}function Yv(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,i=r.endsWith("?"),o=r.replace(/\?$/,"");if(n.length===0)return i?[o,""]:[o];let s=Yv(n.join("/")),l=[];return l.push(...s.map(a=>a===""?o:[o,a].join("/"))),i&&l.push(...s),l.map(a=>t.startsWith("/")&&a===""?"/":a)}function LE(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:HE(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const BE=/^:[\w-]+$/,DE=3,jE=2,UE=1,FE=10,zE=-2,ep=t=>t==="*";function $E(t,e){let r=t.split("/"),n=r.length;return r.some(ep)&&(n+=zE),e&&(n+=jE),r.filter(i=>!ep(i)).reduce((i,o)=>i+(BE.test(o)?DE:o===""?UE:FE),n)}function HE(t,e){return t.length===e.length&&t.slice(0,-1).every((n,i)=>n===e[i])?t[t.length-1]-e[e.length-1]:0}function qE(t,e){let{routesMeta:r}=t,n={},i="/",o=[];for(let s=0;s{let{paramName:p,isOptional:v}=c;if(p==="*"){let x=l[d]||"";s=o.slice(0,o.length-x.length).replace(/(.)\/+$/,"$1")}const g=l[d];return v&&!g?u[p]=void 0:u[p]=KE(g||"",p),u},{}),pathname:o,pathnameBase:s,pattern:t}}function GE(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),wh(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,l,a)=>(n.push({paramName:l,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),n]}function VE(t){try{return decodeURI(t)}catch(e){return wh(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function KE(t,e){try{return decodeURIComponent(t)}catch(r){return wh(!1,'The value for the URL param "'+e+'" will not be decoded because'+(' the string "'+t+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+r+").")),t}}function Xv(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function QE(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:i=""}=typeof t=="string"?Ho(t):t;return{pathname:r?r.startsWith("/")?r:JE(r,e):e,search:tx(n),hash:rx(i)}}function JE(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function Dc(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function YE(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function XE(t,e){let r=YE(t);return e?r.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function ZE(t,e,r,n){n===void 0&&(n=!1);let i;typeof t=="string"?i=Ho(t):(i=Js({},t),_t(!i.pathname||!i.pathname.includes("?"),Dc("?","pathname","search",i)),_t(!i.pathname||!i.pathname.includes("#"),Dc("#","pathname","hash",i)),_t(!i.search||!i.search.includes("#"),Dc("#","search","hash",i)));let o=t===""||i.pathname==="",s=o?"/":i.pathname,l;if(s==null)l=r;else{let d=e.length-1;if(!n&&s.startsWith("..")){let p=s.split("/");for(;p[0]==="..";)p.shift(),d-=1;i.pathname=p.join("/")}l=d>=0?e[d]:"/"}let a=QE(i,l),u=s&&s!=="/"&&s.endsWith("/"),c=(o||s===".")&&r.endsWith("/");return!a.pathname.endsWith("/")&&(u||c)&&(a.pathname+="/"),a}const Ii=t=>t.join("/").replace(/\/\/+/g,"/"),ex=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),tx=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,rx=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function nx(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Zv=["post","put","patch","delete"];new Set(Zv);const ix=["get",...Zv];new Set(ix);/** + * React Router v6.21.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Ys(){return Ys=Object.assign?Object.assign.bind():function(t){for(var e=1;e{l.current=!0}),L.useCallback(function(u,c){if(c===void 0&&(c={}),!l.current)return;if(typeof u=="number"){n.go(u);return}let d=ZE(u,JSON.parse(s),o,c.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:Ii([e,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[e,n,s,o,t])}function lx(){let{matches:t}=L.useContext($i),e=t[t.length-1];return e?e.params:{}}function ax(t,e){return ux(t,e)}function ux(t,e,r,n){Mu()||_t(!1);let{navigator:i}=L.useContext(Pu),{matches:o}=L.useContext($i),s=o[o.length-1],l=s?s.params:{};s&&s.pathname;let a=s?s.pathnameBase:"/";s&&s.route;let u=xh(),c;if(e){var d;let S=typeof e=="string"?Ho(e):e;a==="/"||(d=S.pathname)!=null&&d.startsWith(a)||_t(!1),c=S}else c=u;let p=c.pathname||"/",v=a==="/"?p:p.slice(a.length)||"/",g=OE(t,{pathname:v}),x=px(g&&g.map(S=>Object.assign({},S,{params:Object.assign({},l,S.params),pathname:Ii([a,i.encodeLocation?i.encodeLocation(S.pathname).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?a:Ii([a,i.encodeLocation?i.encodeLocation(S.pathnameBase).pathname:S.pathnameBase])})),o,r,n);return e&&x?L.createElement(Cu.Provider,{value:{location:Ys({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:ii.Pop}},x):x}function cx(){let t=yx(),e=nx(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},o=null;return L.createElement(L.Fragment,null,L.createElement("h2",null,"Unexpected Application Error!"),L.createElement("h3",{style:{fontStyle:"italic"}},e),r?L.createElement("pre",{style:i},r):null,o)}const fx=L.createElement(cx,null);class dx extends L.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?L.createElement($i.Provider,{value:this.props.routeContext},L.createElement(ey.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function hx(t){let{routeContext:e,match:r,children:n}=t,i=L.useContext(Eh);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),L.createElement($i.Provider,{value:e},n)}function px(t,e,r,n){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var o;if((o=r)!=null&&o.errors)t=r.matches;else return null}let s=t,l=(i=r)==null?void 0:i.errors;if(l!=null){let c=s.findIndex(d=>d.route.id&&(l==null?void 0:l[d.route.id]));c>=0||_t(!1),s=s.slice(0,Math.min(s.length,c+1))}let a=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let c=0;c=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((c,d,p)=>{let v,g=!1,x=null,S=null;r&&(v=l&&d.route.id?l[d.route.id]:void 0,x=d.route.errorElement||fx,a&&(u<0&&p===0?(Ex("route-fallback",!1),g=!0,S=null):u===p&&(g=!0,S=d.route.hydrateFallbackElement||null)));let E=e.concat(s.slice(0,p+1)),w=()=>{let _;return v?_=x:g?_=S:d.route.Component?_=L.createElement(d.route.Component,null):d.route.element?_=d.route.element:_=c,L.createElement(hx,{match:d,routeContext:{outlet:c,matches:E,isDataRoute:r!=null},children:_})};return r&&(d.route.ErrorBoundary||d.route.errorElement||p===0)?L.createElement(dx,{location:r.location,revalidation:r.revalidation,component:x,error:v,children:w(),routeContext:{outlet:null,matches:E,isDataRoute:!0}}):w()},null)}var ry=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(ry||{}),Qa=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Qa||{});function mx(t){let e=L.useContext(Eh);return e||_t(!1),e}function gx(t){let e=L.useContext(ox);return e||_t(!1),e}function vx(t){let e=L.useContext($i);return e||_t(!1),e}function ny(t){let e=vx(),r=e.matches[e.matches.length-1];return r.route.id||_t(!1),r.route.id}function yx(){var t;let e=L.useContext(ey),r=gx(Qa.UseRouteError),n=ny(Qa.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function wx(){let{router:t}=mx(ry.UseNavigateStable),e=ny(Qa.UseNavigateStable),r=L.useRef(!1);return ty(()=>{r.current=!0}),L.useCallback(function(i,o){o===void 0&&(o={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Ys({fromRouteId:e},o)))},[t,e])}const tp={};function Ex(t,e,r){!e&&!tp[t]&&(tp[t]=!0)}function ms(t){_t(!1)}function xx(t){let{basename:e="/",children:r=null,location:n,navigationType:i=ii.Pop,navigator:o,static:s=!1,future:l}=t;Mu()&&_t(!1);let a=e.replace(/^\/*/,"/"),u=L.useMemo(()=>({basename:a,navigator:o,static:s,future:Ys({v7_relativeSplatPath:!1},l)}),[a,l,o,s]);typeof n=="string"&&(n=Ho(n));let{pathname:c="/",search:d="",hash:p="",state:v=null,key:g="default"}=n,x=L.useMemo(()=>{let S=Xv(c,a);return S==null?null:{location:{pathname:S,search:d,hash:p,state:v,key:g},navigationType:i}},[a,c,d,p,v,g,i]);return x==null?null:L.createElement(Pu.Provider,{value:u},L.createElement(Cu.Provider,{children:r,value:x}))}function Ax(t){let{children:e,location:r}=t;return ax(id(e),r)}new Promise(()=>{});function id(t,e){e===void 0&&(e=[]);let r=[];return L.Children.forEach(t,(n,i)=>{if(!L.isValidElement(n))return;let o=[...e,i];if(n.type===L.Fragment){r.push.apply(r,id(n.props.children,o));return}n.type!==ms&&_t(!1),!n.props.index||!n.props.children||_t(!1);let s={id:n.props.id||o.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(s.children=id(n.props.children,o)),r.push(s)}),r}/** + * React Router DOM v6.21.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */const bx="startTransition",rp=xw[bx];function _x(t){let{basename:e,children:r,future:n,window:i}=t,o=L.useRef();o.current==null&&(o.current=IE({window:i,v5Compat:!0}));let s=o.current,[l,a]=L.useState({action:s.action,location:s.location}),{v7_startTransition:u}=n||{},c=L.useCallback(d=>{u&&rp?rp(()=>a(d)):a(d)},[a,u]);return L.useLayoutEffect(()=>s.listen(c),[s,c]),L.createElement(xx,{basename:e,children:r,location:l.location,navigationType:l.action,navigator:s,future:n})}var np;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(np||(np={}));var ip;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(ip||(ip={}));var Ah={exports:{}};const Sx={},kx=Object.freeze(Object.defineProperty({__proto__:null,default:Sx},Symbol.toStringTag,{value:"Module"})),Nx=Uo(kx);Ah.exports;(function(t){(function(e,r){function n(C,f){if(!C)throw new Error(f||"Assertion failed")}function i(C,f){C.super_=f;var m=function(){};m.prototype=f.prototype,C.prototype=new m,C.prototype.constructor=C}function o(C,f,m){if(o.isBN(C))return C;this.negative=0,this.words=null,this.length=0,this.red=null,C!==null&&((f==="le"||f==="be")&&(m=f,f=10),this._init(C||0,f||10,m||"be"))}typeof e=="object"?e.exports=o:r.BN=o,o.BN=o,o.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=Nx.Buffer}catch{}o.isBN=function(f){return f instanceof o?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===o.wordSize&&Array.isArray(f.words)},o.max=function(f,m){return f.cmp(m)>0?f:m},o.min=function(f,m){return f.cmp(m)<0?f:m},o.prototype._init=function(f,m,A){if(typeof f=="number")return this._initNumber(f,m,A);if(typeof f=="object")return this._initArray(f,m,A);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),f=f.toString().replace(/\s+/g,"");var N=0;f[0]==="-"&&(N++,this.negative=1),N=0;N-=3)M=f[N]|f[N-1]<<8|f[N-2]<<16,this.words[b]|=M<>>26-R&67108863,R+=24,R>=26&&(R-=26,b++);else if(A==="le")for(N=0,b=0;N>>26-R&67108863,R+=24,R>=26&&(R-=26,b++);return this._strip()};function l(C,f){var m=C.charCodeAt(f);if(m>=48&&m<=57)return m-48;if(m>=65&&m<=70)return m-55;if(m>=97&&m<=102)return m-87;n(!1,"Invalid character in "+C)}function a(C,f,m){var A=l(C,m);return m-1>=f&&(A|=l(C,m-1)<<4),A}o.prototype._parseHex=function(f,m,A){this.length=Math.ceil((f.length-m)/6),this.words=new Array(this.length);for(var N=0;N=m;N-=2)R=a(f,m,N)<=18?(b-=18,M+=1,this.words[M]|=R>>>26):b+=8;else{var k=f.length-m;for(N=k%2===0?m+1:m;N=18?(b-=18,M+=1,this.words[M]|=R>>>26):b+=8}this._strip()};function u(C,f,m,A){for(var N=0,b=0,M=Math.min(C.length,m),R=f;R=49?b=k-49+10:k>=17?b=k-17+10:b=k,n(k>=0&&b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch{o.prototype.inspect=d}else o.prototype.inspect=d;function d(){return(this.red?""}var p=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],v=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],g=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(f,m){f=f||10,m=m|0||1;var A;if(f===16||f==="hex"){A="";for(var N=0,b=0,M=0;M>>24-N&16777215,N+=2,N>=26&&(N-=26,M--),b!==0||M!==this.length-1?A=p[6-k.length]+k+A:A=k+A}for(b!==0&&(A=b.toString(16)+A);A.length%m!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}if(f===(f|0)&&f>=2&&f<=36){var h=v[f],P=g[f];A="";var ee=this.clone();for(ee.negative=0;!ee.isZero();){var y=ee.modrn(P).toString(f);ee=ee.idivn(P),ee.isZero()?A=y+A:A=p[h-y.length]+y+A}for(this.isZero()&&(A="0"+A);A.length%m!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(f,m){return this.toArrayLike(s,f,m)}),o.prototype.toArray=function(f,m){return this.toArrayLike(Array,f,m)};var x=function(f,m){return f.allocUnsafe?f.allocUnsafe(m):new f(m)};o.prototype.toArrayLike=function(f,m,A){this._strip();var N=this.byteLength(),b=A||Math.max(1,N);n(N<=b,"byte array longer than desired length"),n(b>0,"Requested array length <= 0");var M=x(f,b),R=m==="le"?"LE":"BE";return this["_toArrayLike"+R](M,N),M},o.prototype._toArrayLikeLE=function(f,m){for(var A=0,N=0,b=0,M=0;b>8&255),A>16&255),M===6?(A>24&255),N=0,M=0):(N=R>>>24,M+=2)}if(A=0&&(f[A--]=R>>8&255),A>=0&&(f[A--]=R>>16&255),M===6?(A>=0&&(f[A--]=R>>24&255),N=0,M=0):(N=R>>>24,M+=2)}if(A>=0)for(f[A--]=N;A>=0;)f[A--]=0},Math.clz32?o.prototype._countBits=function(f){return 32-Math.clz32(f)}:o.prototype._countBits=function(f){var m=f,A=0;return m>=4096&&(A+=13,m>>>=13),m>=64&&(A+=7,m>>>=7),m>=8&&(A+=4,m>>>=4),m>=2&&(A+=2,m>>>=2),A+m},o.prototype._zeroBits=function(f){if(f===0)return 26;var m=f,A=0;return m&8191||(A+=13,m>>>=13),m&127||(A+=7,m>>>=7),m&15||(A+=4,m>>>=4),m&3||(A+=2,m>>>=2),m&1||A++,A},o.prototype.bitLength=function(){var f=this.words[this.length-1],m=this._countBits(f);return(this.length-1)*26+m};function S(C){for(var f=new Array(C.bitLength()),m=0;m>>N&1}return f}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,m=0;mf.length?this.clone().ior(f):f.clone().ior(this)},o.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},o.prototype.iuand=function(f){var m;this.length>f.length?m=f:m=this;for(var A=0;Af.length?this.clone().iand(f):f.clone().iand(this)},o.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},o.prototype.iuxor=function(f){var m,A;this.length>f.length?(m=this,A=f):(m=f,A=this);for(var N=0;Nf.length?this.clone().ixor(f):f.clone().ixor(this)},o.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},o.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var m=Math.ceil(f/26)|0,A=f%26;this._expand(m),A>0&&m--;for(var N=0;N0&&(this.words[N]=~this.words[N]&67108863>>26-A),this._strip()},o.prototype.notn=function(f){return this.clone().inotn(f)},o.prototype.setn=function(f,m){n(typeof f=="number"&&f>=0);var A=f/26|0,N=f%26;return this._expand(A+1),m?this.words[A]=this.words[A]|1<f.length?(A=this,N=f):(A=f,N=this);for(var b=0,M=0;M>>26;for(;b!==0&&M>>26;if(this.length=A.length,b!==0)this.words[this.length]=b,this.length++;else if(A!==this)for(;Mf.length?this.clone().iadd(f):f.clone().iadd(this)},o.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var m=this.iadd(f);return f.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var A=this.cmp(f);if(A===0)return this.negative=0,this.length=1,this.words[0]=0,this;var N,b;A>0?(N=this,b=f):(N=f,b=this);for(var M=0,R=0;R>26,this.words[R]=m&67108863;for(;M!==0&&R>26,this.words[R]=m&67108863;if(M===0&&R>>26,ee=k&67108863,y=Math.min(h,f.length-1),D=Math.max(0,h-C.length+1);D<=y;D++){var U=h-D|0;N=C.words[U]|0,b=f.words[D]|0,M=N*b+ee,P+=M/67108864|0,ee=M&67108863}m.words[h]=ee|0,k=P|0}return k!==0?m.words[h]=k|0:m.length--,m._strip()}var w=function(f,m,A){var N=f.words,b=m.words,M=A.words,R=0,k,h,P,ee=N[0]|0,y=ee&8191,D=ee>>>13,U=N[1]|0,F=U&8191,G=U>>>13,ie=N[2]|0,Y=ie&8191,Q=ie>>>13,Je=N[3]|0,J=Je&8191,le=Je>>>13,Qr=N[4]|0,Te=Qr&8191,Ne=Qr>>>13,Jr=N[5]|0,Pe=Jr&8191,ce=Jr>>>13,wr=N[6]|0,fe=wr&8191,Oe=wr>>>13,Yr=N[7]|0,me=Yr&8191,ze=Yr>>>13,gn=N[8]|0,$e=gn&8191,He=gn>>>13,Ht=N[9]|0,Le=Ht&8191,qe=Ht>>>13,Rr=b[0]|0,Ce=Rr&8191,We=Rr>>>13,vn=b[1]|0,Be=vn&8191,Ge=vn>>>13,yn=b[2]|0,De=yn&8191,re=yn>>>13,ot=b[3]|0,ge=ot&8191,de=ot>>>13,rt=b[4]|0,be=rt&8191,_e=rt>>>13,Ct=b[5]|0,Me=Ct&8191,je=Ct>>>13,Kt=b[6]|0,Ve=Kt&8191,Ke=Kt>>>13,Qt=b[7]|0,Ie=Qt&8191,Ue=Qt>>>13,Er=b[8]|0,ke=Er&8191,Ye=Er>>>13,Ai=b[9]|0,Xe=Ai&8191,Ze=Ai>>>13;A.negative=f.negative^m.negative,A.length=19,k=Math.imul(y,Ce),h=Math.imul(y,We),h=h+Math.imul(D,Ce)|0,P=Math.imul(D,We);var $n=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+($n>>>26)|0,$n&=67108863,k=Math.imul(F,Ce),h=Math.imul(F,We),h=h+Math.imul(G,Ce)|0,P=Math.imul(G,We),k=k+Math.imul(y,Be)|0,h=h+Math.imul(y,Ge)|0,h=h+Math.imul(D,Be)|0,P=P+Math.imul(D,Ge)|0;var Hn=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Hn>>>26)|0,Hn&=67108863,k=Math.imul(Y,Ce),h=Math.imul(Y,We),h=h+Math.imul(Q,Ce)|0,P=Math.imul(Q,We),k=k+Math.imul(F,Be)|0,h=h+Math.imul(F,Ge)|0,h=h+Math.imul(G,Be)|0,P=P+Math.imul(G,Ge)|0,k=k+Math.imul(y,De)|0,h=h+Math.imul(y,re)|0,h=h+Math.imul(D,De)|0,P=P+Math.imul(D,re)|0;var qn=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(qn>>>26)|0,qn&=67108863,k=Math.imul(J,Ce),h=Math.imul(J,We),h=h+Math.imul(le,Ce)|0,P=Math.imul(le,We),k=k+Math.imul(Y,Be)|0,h=h+Math.imul(Y,Ge)|0,h=h+Math.imul(Q,Be)|0,P=P+Math.imul(Q,Ge)|0,k=k+Math.imul(F,De)|0,h=h+Math.imul(F,re)|0,h=h+Math.imul(G,De)|0,P=P+Math.imul(G,re)|0,k=k+Math.imul(y,ge)|0,h=h+Math.imul(y,de)|0,h=h+Math.imul(D,ge)|0,P=P+Math.imul(D,de)|0;var Wn=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,k=Math.imul(Te,Ce),h=Math.imul(Te,We),h=h+Math.imul(Ne,Ce)|0,P=Math.imul(Ne,We),k=k+Math.imul(J,Be)|0,h=h+Math.imul(J,Ge)|0,h=h+Math.imul(le,Be)|0,P=P+Math.imul(le,Ge)|0,k=k+Math.imul(Y,De)|0,h=h+Math.imul(Y,re)|0,h=h+Math.imul(Q,De)|0,P=P+Math.imul(Q,re)|0,k=k+Math.imul(F,ge)|0,h=h+Math.imul(F,de)|0,h=h+Math.imul(G,ge)|0,P=P+Math.imul(G,de)|0,k=k+Math.imul(y,be)|0,h=h+Math.imul(y,_e)|0,h=h+Math.imul(D,be)|0,P=P+Math.imul(D,_e)|0;var Gn=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Gn>>>26)|0,Gn&=67108863,k=Math.imul(Pe,Ce),h=Math.imul(Pe,We),h=h+Math.imul(ce,Ce)|0,P=Math.imul(ce,We),k=k+Math.imul(Te,Be)|0,h=h+Math.imul(Te,Ge)|0,h=h+Math.imul(Ne,Be)|0,P=P+Math.imul(Ne,Ge)|0,k=k+Math.imul(J,De)|0,h=h+Math.imul(J,re)|0,h=h+Math.imul(le,De)|0,P=P+Math.imul(le,re)|0,k=k+Math.imul(Y,ge)|0,h=h+Math.imul(Y,de)|0,h=h+Math.imul(Q,ge)|0,P=P+Math.imul(Q,de)|0,k=k+Math.imul(F,be)|0,h=h+Math.imul(F,_e)|0,h=h+Math.imul(G,be)|0,P=P+Math.imul(G,_e)|0,k=k+Math.imul(y,Me)|0,h=h+Math.imul(y,je)|0,h=h+Math.imul(D,Me)|0,P=P+Math.imul(D,je)|0;var Yu=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Yu>>>26)|0,Yu&=67108863,k=Math.imul(fe,Ce),h=Math.imul(fe,We),h=h+Math.imul(Oe,Ce)|0,P=Math.imul(Oe,We),k=k+Math.imul(Pe,Be)|0,h=h+Math.imul(Pe,Ge)|0,h=h+Math.imul(ce,Be)|0,P=P+Math.imul(ce,Ge)|0,k=k+Math.imul(Te,De)|0,h=h+Math.imul(Te,re)|0,h=h+Math.imul(Ne,De)|0,P=P+Math.imul(Ne,re)|0,k=k+Math.imul(J,ge)|0,h=h+Math.imul(J,de)|0,h=h+Math.imul(le,ge)|0,P=P+Math.imul(le,de)|0,k=k+Math.imul(Y,be)|0,h=h+Math.imul(Y,_e)|0,h=h+Math.imul(Q,be)|0,P=P+Math.imul(Q,_e)|0,k=k+Math.imul(F,Me)|0,h=h+Math.imul(F,je)|0,h=h+Math.imul(G,Me)|0,P=P+Math.imul(G,je)|0,k=k+Math.imul(y,Ve)|0,h=h+Math.imul(y,Ke)|0,h=h+Math.imul(D,Ve)|0,P=P+Math.imul(D,Ke)|0;var Xu=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,k=Math.imul(me,Ce),h=Math.imul(me,We),h=h+Math.imul(ze,Ce)|0,P=Math.imul(ze,We),k=k+Math.imul(fe,Be)|0,h=h+Math.imul(fe,Ge)|0,h=h+Math.imul(Oe,Be)|0,P=P+Math.imul(Oe,Ge)|0,k=k+Math.imul(Pe,De)|0,h=h+Math.imul(Pe,re)|0,h=h+Math.imul(ce,De)|0,P=P+Math.imul(ce,re)|0,k=k+Math.imul(Te,ge)|0,h=h+Math.imul(Te,de)|0,h=h+Math.imul(Ne,ge)|0,P=P+Math.imul(Ne,de)|0,k=k+Math.imul(J,be)|0,h=h+Math.imul(J,_e)|0,h=h+Math.imul(le,be)|0,P=P+Math.imul(le,_e)|0,k=k+Math.imul(Y,Me)|0,h=h+Math.imul(Y,je)|0,h=h+Math.imul(Q,Me)|0,P=P+Math.imul(Q,je)|0,k=k+Math.imul(F,Ve)|0,h=h+Math.imul(F,Ke)|0,h=h+Math.imul(G,Ve)|0,P=P+Math.imul(G,Ke)|0,k=k+Math.imul(y,Ie)|0,h=h+Math.imul(y,Ue)|0,h=h+Math.imul(D,Ie)|0,P=P+Math.imul(D,Ue)|0;var Zu=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Zu>>>26)|0,Zu&=67108863,k=Math.imul($e,Ce),h=Math.imul($e,We),h=h+Math.imul(He,Ce)|0,P=Math.imul(He,We),k=k+Math.imul(me,Be)|0,h=h+Math.imul(me,Ge)|0,h=h+Math.imul(ze,Be)|0,P=P+Math.imul(ze,Ge)|0,k=k+Math.imul(fe,De)|0,h=h+Math.imul(fe,re)|0,h=h+Math.imul(Oe,De)|0,P=P+Math.imul(Oe,re)|0,k=k+Math.imul(Pe,ge)|0,h=h+Math.imul(Pe,de)|0,h=h+Math.imul(ce,ge)|0,P=P+Math.imul(ce,de)|0,k=k+Math.imul(Te,be)|0,h=h+Math.imul(Te,_e)|0,h=h+Math.imul(Ne,be)|0,P=P+Math.imul(Ne,_e)|0,k=k+Math.imul(J,Me)|0,h=h+Math.imul(J,je)|0,h=h+Math.imul(le,Me)|0,P=P+Math.imul(le,je)|0,k=k+Math.imul(Y,Ve)|0,h=h+Math.imul(Y,Ke)|0,h=h+Math.imul(Q,Ve)|0,P=P+Math.imul(Q,Ke)|0,k=k+Math.imul(F,Ie)|0,h=h+Math.imul(F,Ue)|0,h=h+Math.imul(G,Ie)|0,P=P+Math.imul(G,Ue)|0,k=k+Math.imul(y,ke)|0,h=h+Math.imul(y,Ye)|0,h=h+Math.imul(D,ke)|0,P=P+Math.imul(D,Ye)|0;var ec=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ec>>>26)|0,ec&=67108863,k=Math.imul(Le,Ce),h=Math.imul(Le,We),h=h+Math.imul(qe,Ce)|0,P=Math.imul(qe,We),k=k+Math.imul($e,Be)|0,h=h+Math.imul($e,Ge)|0,h=h+Math.imul(He,Be)|0,P=P+Math.imul(He,Ge)|0,k=k+Math.imul(me,De)|0,h=h+Math.imul(me,re)|0,h=h+Math.imul(ze,De)|0,P=P+Math.imul(ze,re)|0,k=k+Math.imul(fe,ge)|0,h=h+Math.imul(fe,de)|0,h=h+Math.imul(Oe,ge)|0,P=P+Math.imul(Oe,de)|0,k=k+Math.imul(Pe,be)|0,h=h+Math.imul(Pe,_e)|0,h=h+Math.imul(ce,be)|0,P=P+Math.imul(ce,_e)|0,k=k+Math.imul(Te,Me)|0,h=h+Math.imul(Te,je)|0,h=h+Math.imul(Ne,Me)|0,P=P+Math.imul(Ne,je)|0,k=k+Math.imul(J,Ve)|0,h=h+Math.imul(J,Ke)|0,h=h+Math.imul(le,Ve)|0,P=P+Math.imul(le,Ke)|0,k=k+Math.imul(Y,Ie)|0,h=h+Math.imul(Y,Ue)|0,h=h+Math.imul(Q,Ie)|0,P=P+Math.imul(Q,Ue)|0,k=k+Math.imul(F,ke)|0,h=h+Math.imul(F,Ye)|0,h=h+Math.imul(G,ke)|0,P=P+Math.imul(G,Ye)|0,k=k+Math.imul(y,Xe)|0,h=h+Math.imul(y,Ze)|0,h=h+Math.imul(D,Xe)|0,P=P+Math.imul(D,Ze)|0;var tc=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(tc>>>26)|0,tc&=67108863,k=Math.imul(Le,Be),h=Math.imul(Le,Ge),h=h+Math.imul(qe,Be)|0,P=Math.imul(qe,Ge),k=k+Math.imul($e,De)|0,h=h+Math.imul($e,re)|0,h=h+Math.imul(He,De)|0,P=P+Math.imul(He,re)|0,k=k+Math.imul(me,ge)|0,h=h+Math.imul(me,de)|0,h=h+Math.imul(ze,ge)|0,P=P+Math.imul(ze,de)|0,k=k+Math.imul(fe,be)|0,h=h+Math.imul(fe,_e)|0,h=h+Math.imul(Oe,be)|0,P=P+Math.imul(Oe,_e)|0,k=k+Math.imul(Pe,Me)|0,h=h+Math.imul(Pe,je)|0,h=h+Math.imul(ce,Me)|0,P=P+Math.imul(ce,je)|0,k=k+Math.imul(Te,Ve)|0,h=h+Math.imul(Te,Ke)|0,h=h+Math.imul(Ne,Ve)|0,P=P+Math.imul(Ne,Ke)|0,k=k+Math.imul(J,Ie)|0,h=h+Math.imul(J,Ue)|0,h=h+Math.imul(le,Ie)|0,P=P+Math.imul(le,Ue)|0,k=k+Math.imul(Y,ke)|0,h=h+Math.imul(Y,Ye)|0,h=h+Math.imul(Q,ke)|0,P=P+Math.imul(Q,Ye)|0,k=k+Math.imul(F,Xe)|0,h=h+Math.imul(F,Ze)|0,h=h+Math.imul(G,Xe)|0,P=P+Math.imul(G,Ze)|0;var rc=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(rc>>>26)|0,rc&=67108863,k=Math.imul(Le,De),h=Math.imul(Le,re),h=h+Math.imul(qe,De)|0,P=Math.imul(qe,re),k=k+Math.imul($e,ge)|0,h=h+Math.imul($e,de)|0,h=h+Math.imul(He,ge)|0,P=P+Math.imul(He,de)|0,k=k+Math.imul(me,be)|0,h=h+Math.imul(me,_e)|0,h=h+Math.imul(ze,be)|0,P=P+Math.imul(ze,_e)|0,k=k+Math.imul(fe,Me)|0,h=h+Math.imul(fe,je)|0,h=h+Math.imul(Oe,Me)|0,P=P+Math.imul(Oe,je)|0,k=k+Math.imul(Pe,Ve)|0,h=h+Math.imul(Pe,Ke)|0,h=h+Math.imul(ce,Ve)|0,P=P+Math.imul(ce,Ke)|0,k=k+Math.imul(Te,Ie)|0,h=h+Math.imul(Te,Ue)|0,h=h+Math.imul(Ne,Ie)|0,P=P+Math.imul(Ne,Ue)|0,k=k+Math.imul(J,ke)|0,h=h+Math.imul(J,Ye)|0,h=h+Math.imul(le,ke)|0,P=P+Math.imul(le,Ye)|0,k=k+Math.imul(Y,Xe)|0,h=h+Math.imul(Y,Ze)|0,h=h+Math.imul(Q,Xe)|0,P=P+Math.imul(Q,Ze)|0;var nc=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(nc>>>26)|0,nc&=67108863,k=Math.imul(Le,ge),h=Math.imul(Le,de),h=h+Math.imul(qe,ge)|0,P=Math.imul(qe,de),k=k+Math.imul($e,be)|0,h=h+Math.imul($e,_e)|0,h=h+Math.imul(He,be)|0,P=P+Math.imul(He,_e)|0,k=k+Math.imul(me,Me)|0,h=h+Math.imul(me,je)|0,h=h+Math.imul(ze,Me)|0,P=P+Math.imul(ze,je)|0,k=k+Math.imul(fe,Ve)|0,h=h+Math.imul(fe,Ke)|0,h=h+Math.imul(Oe,Ve)|0,P=P+Math.imul(Oe,Ke)|0,k=k+Math.imul(Pe,Ie)|0,h=h+Math.imul(Pe,Ue)|0,h=h+Math.imul(ce,Ie)|0,P=P+Math.imul(ce,Ue)|0,k=k+Math.imul(Te,ke)|0,h=h+Math.imul(Te,Ye)|0,h=h+Math.imul(Ne,ke)|0,P=P+Math.imul(Ne,Ye)|0,k=k+Math.imul(J,Xe)|0,h=h+Math.imul(J,Ze)|0,h=h+Math.imul(le,Xe)|0,P=P+Math.imul(le,Ze)|0;var ic=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ic>>>26)|0,ic&=67108863,k=Math.imul(Le,be),h=Math.imul(Le,_e),h=h+Math.imul(qe,be)|0,P=Math.imul(qe,_e),k=k+Math.imul($e,Me)|0,h=h+Math.imul($e,je)|0,h=h+Math.imul(He,Me)|0,P=P+Math.imul(He,je)|0,k=k+Math.imul(me,Ve)|0,h=h+Math.imul(me,Ke)|0,h=h+Math.imul(ze,Ve)|0,P=P+Math.imul(ze,Ke)|0,k=k+Math.imul(fe,Ie)|0,h=h+Math.imul(fe,Ue)|0,h=h+Math.imul(Oe,Ie)|0,P=P+Math.imul(Oe,Ue)|0,k=k+Math.imul(Pe,ke)|0,h=h+Math.imul(Pe,Ye)|0,h=h+Math.imul(ce,ke)|0,P=P+Math.imul(ce,Ye)|0,k=k+Math.imul(Te,Xe)|0,h=h+Math.imul(Te,Ze)|0,h=h+Math.imul(Ne,Xe)|0,P=P+Math.imul(Ne,Ze)|0;var oc=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(oc>>>26)|0,oc&=67108863,k=Math.imul(Le,Me),h=Math.imul(Le,je),h=h+Math.imul(qe,Me)|0,P=Math.imul(qe,je),k=k+Math.imul($e,Ve)|0,h=h+Math.imul($e,Ke)|0,h=h+Math.imul(He,Ve)|0,P=P+Math.imul(He,Ke)|0,k=k+Math.imul(me,Ie)|0,h=h+Math.imul(me,Ue)|0,h=h+Math.imul(ze,Ie)|0,P=P+Math.imul(ze,Ue)|0,k=k+Math.imul(fe,ke)|0,h=h+Math.imul(fe,Ye)|0,h=h+Math.imul(Oe,ke)|0,P=P+Math.imul(Oe,Ye)|0,k=k+Math.imul(Pe,Xe)|0,h=h+Math.imul(Pe,Ze)|0,h=h+Math.imul(ce,Xe)|0,P=P+Math.imul(ce,Ze)|0;var sc=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(sc>>>26)|0,sc&=67108863,k=Math.imul(Le,Ve),h=Math.imul(Le,Ke),h=h+Math.imul(qe,Ve)|0,P=Math.imul(qe,Ke),k=k+Math.imul($e,Ie)|0,h=h+Math.imul($e,Ue)|0,h=h+Math.imul(He,Ie)|0,P=P+Math.imul(He,Ue)|0,k=k+Math.imul(me,ke)|0,h=h+Math.imul(me,Ye)|0,h=h+Math.imul(ze,ke)|0,P=P+Math.imul(ze,Ye)|0,k=k+Math.imul(fe,Xe)|0,h=h+Math.imul(fe,Ze)|0,h=h+Math.imul(Oe,Xe)|0,P=P+Math.imul(Oe,Ze)|0;var lc=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(lc>>>26)|0,lc&=67108863,k=Math.imul(Le,Ie),h=Math.imul(Le,Ue),h=h+Math.imul(qe,Ie)|0,P=Math.imul(qe,Ue),k=k+Math.imul($e,ke)|0,h=h+Math.imul($e,Ye)|0,h=h+Math.imul(He,ke)|0,P=P+Math.imul(He,Ye)|0,k=k+Math.imul(me,Xe)|0,h=h+Math.imul(me,Ze)|0,h=h+Math.imul(ze,Xe)|0,P=P+Math.imul(ze,Ze)|0;var ac=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ac>>>26)|0,ac&=67108863,k=Math.imul(Le,ke),h=Math.imul(Le,Ye),h=h+Math.imul(qe,ke)|0,P=Math.imul(qe,Ye),k=k+Math.imul($e,Xe)|0,h=h+Math.imul($e,Ze)|0,h=h+Math.imul(He,Xe)|0,P=P+Math.imul(He,Ze)|0;var uc=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(uc>>>26)|0,uc&=67108863,k=Math.imul(Le,Xe),h=Math.imul(Le,Ze),h=h+Math.imul(qe,Xe)|0,P=Math.imul(qe,Ze);var cc=(R+k|0)+((h&8191)<<13)|0;return R=(P+(h>>>13)|0)+(cc>>>26)|0,cc&=67108863,M[0]=$n,M[1]=Hn,M[2]=qn,M[3]=Wn,M[4]=Gn,M[5]=Yu,M[6]=Xu,M[7]=Zu,M[8]=ec,M[9]=tc,M[10]=rc,M[11]=nc,M[12]=ic,M[13]=oc,M[14]=sc,M[15]=lc,M[16]=ac,M[17]=uc,M[18]=cc,R!==0&&(M[19]=R,A.length++),A};Math.imul||(w=E);function _(C,f,m){m.negative=f.negative^C.negative,m.length=C.length+f.length;for(var A=0,N=0,b=0;b>>26)|0,N+=M>>>26,M&=67108863}m.words[b]=R,A=M,M=N}return A!==0?m.words[b]=A:m.length--,m._strip()}function O(C,f,m){return _(C,f,m)}o.prototype.mulTo=function(f,m){var A,N=this.length+f.length;return this.length===10&&f.length===10?A=w(this,f,m):N<63?A=E(this,f,m):N<1024?A=_(this,f,m):A=O(this,f,m),A},o.prototype.mul=function(f){var m=new o(null);return m.words=new Array(this.length+f.length),this.mulTo(f,m)},o.prototype.mulf=function(f){var m=new o(null);return m.words=new Array(this.length+f.length),O(this,f,m)},o.prototype.imul=function(f){return this.clone().mulTo(f,this)},o.prototype.imuln=function(f){var m=f<0;m&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var A=0,N=0;N>=26,A+=b/67108864|0,A+=M>>>26,this.words[N]=M&67108863}return A!==0&&(this.words[N]=A,this.length++),m?this.ineg():this},o.prototype.muln=function(f){return this.clone().imuln(f)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(f){var m=S(f);if(m.length===0)return new o(1);for(var A=this,N=0;N=0);var m=f%26,A=(f-m)/26,N=67108863>>>26-m<<26-m,b;if(m!==0){var M=0;for(b=0;b>>26-m}M&&(this.words[b]=M,this.length++)}if(A!==0){for(b=this.length-1;b>=0;b--)this.words[b+A]=this.words[b];for(b=0;b=0);var N;m?N=(m-m%26)/26:N=0;var b=f%26,M=Math.min((f-b)/26,this.length),R=67108863^67108863>>>b<M)for(this.length-=M,h=0;h=0&&(P!==0||h>=N);h--){var ee=this.words[h]|0;this.words[h]=P<<26-b|ee>>>b,P=ee&R}return k&&P!==0&&(k.words[k.length++]=P),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(f,m,A){return n(this.negative===0),this.iushrn(f,m,A)},o.prototype.shln=function(f){return this.clone().ishln(f)},o.prototype.ushln=function(f){return this.clone().iushln(f)},o.prototype.shrn=function(f){return this.clone().ishrn(f)},o.prototype.ushrn=function(f){return this.clone().iushrn(f)},o.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var m=f%26,A=(f-m)/26,N=1<=0);var m=f%26,A=(f-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=A)return this;if(m!==0&&A++,this.length=Math.min(A,this.length),m!==0){var N=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},o.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(k/67108864|0),this.words[b+A]=M&67108863}for(;b>26,this.words[b+A]=M&67108863;if(R===0)return this._strip();for(n(R===-1),R=0,b=0;b>26,this.words[b]=M&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(f,m){var A=this.length-f.length,N=this.clone(),b=f,M=b.words[b.length-1]|0,R=this._countBits(M);A=26-R,A!==0&&(b=b.ushln(A),N.iushln(A),M=b.words[b.length-1]|0);var k=N.length-b.length,h;if(m!=="mod"){h=new o(null),h.length=k+1,h.words=new Array(h.length);for(var P=0;P=0;y--){var D=(N.words[b.length+y]|0)*67108864+(N.words[b.length+y-1]|0);for(D=Math.min(D/M|0,67108863),N._ishlnsubmul(b,D,y);N.negative!==0;)D--,N.negative=0,N._ishlnsubmul(b,1,y),N.isZero()||(N.negative^=1);h&&(h.words[y]=D)}return h&&h._strip(),N._strip(),m!=="div"&&A!==0&&N.iushrn(A),{div:h||null,mod:N}},o.prototype.divmod=function(f,m,A){if(n(!f.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var N,b,M;return this.negative!==0&&f.negative===0?(M=this.neg().divmod(f,m),m!=="mod"&&(N=M.div.neg()),m!=="div"&&(b=M.mod.neg(),A&&b.negative!==0&&b.iadd(f)),{div:N,mod:b}):this.negative===0&&f.negative!==0?(M=this.divmod(f.neg(),m),m!=="mod"&&(N=M.div.neg()),{div:N,mod:M.mod}):this.negative&f.negative?(M=this.neg().divmod(f.neg(),m),m!=="div"&&(b=M.mod.neg(),A&&b.negative!==0&&b.isub(f)),{div:M.div,mod:b}):f.length>this.length||this.cmp(f)<0?{div:new o(0),mod:this}:f.length===1?m==="div"?{div:this.divn(f.words[0]),mod:null}:m==="mod"?{div:null,mod:new o(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new o(this.modrn(f.words[0]))}:this._wordDiv(f,m)},o.prototype.div=function(f){return this.divmod(f,"div",!1).div},o.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},o.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},o.prototype.divRound=function(f){var m=this.divmod(f);if(m.mod.isZero())return m.div;var A=m.div.negative!==0?m.mod.isub(f):m.mod,N=f.ushrn(1),b=f.andln(1),M=A.cmp(N);return M<0||b===1&&M===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},o.prototype.modrn=function(f){var m=f<0;m&&(f=-f),n(f<=67108863);for(var A=(1<<26)%f,N=0,b=this.length-1;b>=0;b--)N=(A*N+(this.words[b]|0))%f;return m?-N:N},o.prototype.modn=function(f){return this.modrn(f)},o.prototype.idivn=function(f){var m=f<0;m&&(f=-f),n(f<=67108863);for(var A=0,N=this.length-1;N>=0;N--){var b=(this.words[N]|0)+A*67108864;this.words[N]=b/f|0,A=b%f}return this._strip(),m?this.ineg():this},o.prototype.divn=function(f){return this.clone().idivn(f)},o.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var m=this,A=f.clone();m.negative!==0?m=m.umod(f):m=m.clone();for(var N=new o(1),b=new o(0),M=new o(0),R=new o(1),k=0;m.isEven()&&A.isEven();)m.iushrn(1),A.iushrn(1),++k;for(var h=A.clone(),P=m.clone();!m.isZero();){for(var ee=0,y=1;!(m.words[0]&y)&&ee<26;++ee,y<<=1);if(ee>0)for(m.iushrn(ee);ee-- >0;)(N.isOdd()||b.isOdd())&&(N.iadd(h),b.isub(P)),N.iushrn(1),b.iushrn(1);for(var D=0,U=1;!(A.words[0]&U)&&D<26;++D,U<<=1);if(D>0)for(A.iushrn(D);D-- >0;)(M.isOdd()||R.isOdd())&&(M.iadd(h),R.isub(P)),M.iushrn(1),R.iushrn(1);m.cmp(A)>=0?(m.isub(A),N.isub(M),b.isub(R)):(A.isub(m),M.isub(N),R.isub(b))}return{a:M,b:R,gcd:A.iushln(k)}},o.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var m=this,A=f.clone();m.negative!==0?m=m.umod(f):m=m.clone();for(var N=new o(1),b=new o(0),M=A.clone();m.cmpn(1)>0&&A.cmpn(1)>0;){for(var R=0,k=1;!(m.words[0]&k)&&R<26;++R,k<<=1);if(R>0)for(m.iushrn(R);R-- >0;)N.isOdd()&&N.iadd(M),N.iushrn(1);for(var h=0,P=1;!(A.words[0]&P)&&h<26;++h,P<<=1);if(h>0)for(A.iushrn(h);h-- >0;)b.isOdd()&&b.iadd(M),b.iushrn(1);m.cmp(A)>=0?(m.isub(A),N.isub(b)):(A.isub(m),b.isub(N))}var ee;return m.cmpn(1)===0?ee=N:ee=b,ee.cmpn(0)<0&&ee.iadd(f),ee},o.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var m=this.clone(),A=f.clone();m.negative=0,A.negative=0;for(var N=0;m.isEven()&&A.isEven();N++)m.iushrn(1),A.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;A.isEven();)A.iushrn(1);var b=m.cmp(A);if(b<0){var M=m;m=A,A=M}else if(b===0||A.cmpn(1)===0)break;m.isub(A)}while(!0);return A.iushln(N)},o.prototype.invm=function(f){return this.egcd(f).a.umod(f)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(f){return this.words[0]&f},o.prototype.bincn=function(f){n(typeof f=="number");var m=f%26,A=(f-m)/26,N=1<>>26,R&=67108863,this.words[M]=R}return b!==0&&(this.words[M]=b,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(f){var m=f<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this._strip();var A;if(this.length>1)A=1;else{m&&(f=-f),n(f<=67108863,"Number is too big");var N=this.words[0]|0;A=N===f?0:Nf.length)return 1;if(this.length=0;A--){var N=this.words[A]|0,b=f.words[A]|0;if(N!==b){Nb&&(m=1);break}}return m},o.prototype.gtn=function(f){return this.cmpn(f)===1},o.prototype.gt=function(f){return this.cmp(f)===1},o.prototype.gten=function(f){return this.cmpn(f)>=0},o.prototype.gte=function(f){return this.cmp(f)>=0},o.prototype.ltn=function(f){return this.cmpn(f)===-1},o.prototype.lt=function(f){return this.cmp(f)===-1},o.prototype.lten=function(f){return this.cmpn(f)<=0},o.prototype.lte=function(f){return this.cmp(f)<=0},o.prototype.eqn=function(f){return this.cmpn(f)===0},o.prototype.eq=function(f){return this.cmp(f)===0},o.red=function(f){return new H(f)},o.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(f){return this.red=f,this},o.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},o.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},o.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},o.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},o.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},o.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},o.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},o.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var B={k256:null,p224:null,p192:null,p25519:null};function j(C,f){this.name=C,this.p=new o(f,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}j.prototype._tmp=function(){var f=new o(null);return f.words=new Array(Math.ceil(this.n/13)),f},j.prototype.ireduce=function(f){var m=f,A;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),A=m.bitLength();while(A>this.n);var N=A0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},j.prototype.split=function(f,m){f.iushrn(this.n,0,m)},j.prototype.imulK=function(f){return f.imul(this.k)};function $(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i($,j),$.prototype.split=function(f,m){for(var A=4194303,N=Math.min(f.length,9),b=0;b>>22,M=R}M>>>=22,f.words[b-10]=M,M===0&&f.length>10?f.length-=10:f.length-=9},$.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var m=0,A=0;A>>=26,f.words[A]=b,m=N}return m!==0&&(f.words[f.length++]=m),f},o._prime=function(f){if(B[f])return B[f];var m;if(f==="k256")m=new $;else if(f==="p224")m=new q;else if(f==="p192")m=new ne;else if(f==="p25519")m=new K;else throw new Error("Unknown prime "+f);return B[f]=m,m};function H(C){if(typeof C=="string"){var f=o._prime(C);this.m=f.p,this.prime=f}else n(C.gtn(1),"modulus must be greater than 1"),this.m=C,this.prime=null}H.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},H.prototype._verify2=function(f,m){n((f.negative|m.negative)===0,"red works only with positives"),n(f.red&&f.red===m.red,"red works only with red numbers")},H.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(c(f,f.umod(this.m)._forceRed(this)),f)},H.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},H.prototype.add=function(f,m){this._verify2(f,m);var A=f.add(m);return A.cmp(this.m)>=0&&A.isub(this.m),A._forceRed(this)},H.prototype.iadd=function(f,m){this._verify2(f,m);var A=f.iadd(m);return A.cmp(this.m)>=0&&A.isub(this.m),A},H.prototype.sub=function(f,m){this._verify2(f,m);var A=f.sub(m);return A.cmpn(0)<0&&A.iadd(this.m),A._forceRed(this)},H.prototype.isub=function(f,m){this._verify2(f,m);var A=f.isub(m);return A.cmpn(0)<0&&A.iadd(this.m),A},H.prototype.shl=function(f,m){return this._verify1(f),this.imod(f.ushln(m))},H.prototype.imul=function(f,m){return this._verify2(f,m),this.imod(f.imul(m))},H.prototype.mul=function(f,m){return this._verify2(f,m),this.imod(f.mul(m))},H.prototype.isqr=function(f){return this.imul(f,f.clone())},H.prototype.sqr=function(f){return this.mul(f,f)},H.prototype.sqrt=function(f){if(f.isZero())return f.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var A=this.m.add(new o(1)).iushrn(2);return this.pow(f,A)}for(var N=this.m.subn(1),b=0;!N.isZero()&&N.andln(1)===0;)b++,N.iushrn(1);n(!N.isZero());var M=new o(1).toRed(this),R=M.redNeg(),k=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);this.pow(h,k).cmp(R)!==0;)h.redIAdd(R);for(var P=this.pow(h,N),ee=this.pow(f,N.addn(1).iushrn(1)),y=this.pow(f,N),D=b;y.cmp(M)!==0;){for(var U=y,F=0;U.cmp(M)!==0;F++)U=U.redSqr();n(F=0;b--){for(var P=m.words[b],ee=h-1;ee>=0;ee--){var y=P>>ee&1;if(M!==N[0]&&(M=this.sqr(M)),y===0&&R===0){k=0;continue}R<<=1,R|=y,k++,!(k!==A&&(b!==0||ee!==0))&&(M=this.mul(M,N[R]),k=0,R=0)}h=26}return M},H.prototype.convertTo=function(f){var m=f.umod(this.m);return m===f?m.clone():m},H.prototype.convertFrom=function(f){var m=f.clone();return m.red=null,m},o.mont=function(f){return new se(f)};function se(C){H.call(this,C),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(se,H),se.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},se.prototype.convertFrom=function(f){var m=this.imod(f.mul(this.rinv));return m.red=null,m},se.prototype.imul=function(f,m){if(f.isZero()||m.isZero())return f.words[0]=0,f.length=1,f;var A=f.imul(m),N=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=A.isub(N).iushrn(this.shift),M=b;return b.cmp(this.m)>=0?M=b.isub(this.m):b.cmpn(0)<0&&(M=b.iadd(this.m)),M._forceRed(this)},se.prototype.mul=function(f,m){if(f.isZero()||m.isZero())return new o(0)._forceRed(this);var A=f.mul(m),N=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=A.isub(N).iushrn(this.shift),M=b;return b.cmp(this.m)>=0?M=b.isub(this.m):b.cmpn(0)<0&&(M=b.iadd(this.m)),M._forceRed(this)},se.prototype.invm=function(f){var m=this.imod(f._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,Fe)})(Ah);var Px=Ah.exports;const ue=jo(Px),Cx="logger/5.7.0";let op=!1,sp=!1;const da={debug:1,default:2,info:2,warning:3,error:4,off:5};let lp=da.default,jc=null;function Mx(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const ap=Mx();var od;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(od||(od={}));var Ur;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(Ur||(Ur={}));const up="0123456789abcdef";class T{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();da[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(lp>da[n])&&console.log.apply(console,r)}debug(...e){this._log(T.levels.DEBUG,e)}info(...e){this._log(T.levels.INFO,e)}warn(...e){this._log(T.levels.WARNING,e)}makeError(e,r,n){if(sp)return this.makeError("censored error",r,{});r||(r=T.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(a=>{const u=n[a];try{if(u instanceof Uint8Array){let c="";for(let d=0;d>4],c+=up[u[d]&15];i.push(a+"=Uint8Array(0x"+c+")")}else i.push(a+"="+JSON.stringify(u))}catch{i.push(a+"="+JSON.stringify(n[a].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const o=e;let s="";switch(r){case Ur.NUMERIC_FAULT:{s="NUMERIC_FAULT";const a=e;switch(a){case"overflow":case"underflow":case"division-by-zero":s+="-"+a;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result";break}break}case Ur.CALL_EXCEPTION:case Ur.INSUFFICIENT_FUNDS:case Ur.MISSING_NEW:case Ur.NONCE_EXPIRED:case Ur.REPLACEMENT_UNDERPRICED:case Ur.TRANSACTION_REPLACED:case Ur.UNPREDICTABLE_GAS_LIMIT:s=r;break}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const l=new Error(e);return l.reason=o,l.code=r,Object.keys(n).forEach(function(a){l[a]=n[a]}),l}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,T.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){ap&&this.throwError("platform missing String.prototype.normalize",T.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ap})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,T.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,T.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,T.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",T.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",T.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",T.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return jc||(jc=new T(Cx)),jc}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",T.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),op){if(!e)return;this.globalLogger().throwError("error censorship permanent",T.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}sp=!!e,op=!!r}static setLogLevel(e){const r=da[e.toLowerCase()];if(r==null){T.globalLogger().warn("invalid log level - "+e);return}lp=r}static from(e){return new T(e)}}T.errors=Ur;T.levels=od;const Ix="bytes/5.7.0",dt=new T(Ix);function iy(t){return!!t.toHexString}function Ao(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Ao(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function bh(t){return pe(t)&&!(t.length%2)||Ru(t)}function cp(t){return typeof t=="number"&&t==t&&t%1===0}function Ru(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!cp(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function oe(t,e){if(e||(e={}),typeof t=="number"){dt.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Ao(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),iy(t)&&(t=t.toHexString()),pe(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":dt.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ioe(i)),r=e.reduce((i,o)=>i+o.length,0),n=new Uint8Array(r);return e.reduce((i,o)=>(n.set(o,i),i+o.length),0),Ao(n)}function Ro(t){let e=oe(t);if(e.length===0)return e;let r=0;for(;re&&dt.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),Ao(r)}function pe(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const Uc="0123456789abcdef";function te(t,e){if(e||(e={}),typeof t=="number"){dt.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=Uc[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),iy(t))return t.toHexString();if(pe(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":dt.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Ru(t)){let r="0x";for(let n=0;n>4]+Uc[i&15]}return r}return dt.throwArgumentError("invalid hexlify value","value",t)}function On(t){if(typeof t!="string")t=te(t);else if(!pe(t)||t.length%2)return null;return(t.length-2)/2}function It(t,e,r){return typeof t!="string"?t=te(t):(!pe(t)||t.length%2)&&dt.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Xt(t){let e="0x";return t.forEach(r=>{e+=te(r).substring(2)}),e}function Tu(t){const e=Rx(te(t,{hexPad:"left"}));return e==="0x"?"0x0":e}function Rx(t){typeof t!="string"&&(t=te(t)),pe(t)||dt.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e2*e+2&&dt.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Ou(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(bh(t)){let r=oe(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=te(r.slice(0,32)),e.s=te(r.slice(32,64))):r.length===65?(e.r=te(r.slice(0,32)),e.s=te(r.slice(32,64)),e.v=r[64]):dt.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:dt.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=te(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=ha(oe(e._vs),32);e._vs=te(i);const o=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=o:e.recoveryParam!==o&&dt.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const s=te(i);e.s==null?e.s=s:e.s!==s&&dt.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?dt.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&dt.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!pe(e.r)?dt.throwArgumentError("signature missing or invalid r","signature",t):e.r=pt(e.r,32),e.s==null||!pe(e.s)?dt.throwArgumentError("signature missing or invalid s","signature",t):e.s=pt(e.s,32);const r=oe(e.s);r[0]>=128&&dt.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=te(r);e._vs&&(pe(e._vs)||dt.throwArgumentError("signature invalid _vs","signature",t),e._vs=pt(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&dt.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const Tx="bignumber/5.7.0";var Xs=ue.BN;const En=new T(Tx),Fc={},fp=9007199254740991;let dp=!1;class V{constructor(e,r){e!==Fc&&En.throwError("cannot call constructor directly; use BigNumber.from",T.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Jt(ve(this).fromTwos(e))}toTwos(e){return Jt(ve(this).toTwos(e))}abs(){return this._hex[0]==="-"?V.from(this._hex.substring(1)):this}add(e){return Jt(ve(this).add(ve(e)))}sub(e){return Jt(ve(this).sub(ve(e)))}div(e){return V.from(e).isZero()&&xr("division-by-zero","div"),Jt(ve(this).div(ve(e)))}mul(e){return Jt(ve(this).mul(ve(e)))}mod(e){const r=ve(e);return r.isNeg()&&xr("division-by-zero","mod"),Jt(ve(this).umod(r))}pow(e){const r=ve(e);return r.isNeg()&&xr("negative-power","pow"),Jt(ve(this).pow(r))}and(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","and"),Jt(ve(this).and(r))}or(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","or"),Jt(ve(this).or(r))}xor(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","xor"),Jt(ve(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&xr("negative-width","mask"),Jt(ve(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&xr("negative-width","shl"),Jt(ve(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&xr("negative-width","shr"),Jt(ve(this).shrn(e))}eq(e){return ve(this).eq(ve(e))}lt(e){return ve(this).lt(ve(e))}lte(e){return ve(this).lte(ve(e))}gt(e){return ve(this).gt(ve(e))}gte(e){return ve(this).gte(ve(e))}isNegative(){return this._hex[0]==="-"}isZero(){return ve(this).isZero()}toNumber(){try{return ve(this).toNumber()}catch{xr("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return En.throwError("this platform does not support BigInt",T.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?dp||(dp=!0,En.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?En.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",T.errors.UNEXPECTED_ARGUMENT,{}):En.throwError("BigNumber.toString does not accept parameters",T.errors.UNEXPECTED_ARGUMENT,{})),ve(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof V)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new V(Fc,Zs(e)):e.match(/^-?[0-9]+$/)?new V(Fc,Zs(new Xs(e))):En.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&xr("underflow","BigNumber.from",e),(e>=fp||e<=-fp)&&xr("overflow","BigNumber.from",e),V.from(String(e));const r=e;if(typeof r=="bigint")return V.from(r.toString());if(Ru(r))return V.from(te(r));if(r)if(r.toHexString){const n=r.toHexString();if(typeof n=="string")return V.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(pe(n)||n[0]==="-"&&pe(n.substring(1))))return V.from(n)}return En.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function Zs(t){if(typeof t!="string")return Zs(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&En.throwArgumentError("invalid hex","value",t),t=Zs(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function Jt(t){return V.from(Zs(t))}function ve(t){const e=V.from(t).toHexString();return e[0]==="-"?new Xs("-"+e.substring(3),16):new Xs(e.substring(2),16)}function xr(t,e,r){const n={fault:t,operation:e};return r!=null&&(n.value=r),En.throwError(t,T.errors.NUMERIC_FAULT,n)}function Ox(t){return new Xs(t,36).toString(16)}function Lx(t){return new Xs(t,16).toString(36)}const Bx="properties/5.7.0";var Dx=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Ja=new T(Bx);function z(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function fr(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||typeof t.prototype!="object")break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function yt(t){return Dx(this,void 0,void 0,function*(){const e=Object.keys(t).map(n=>{const i=t[n];return Promise.resolve(i).then(o=>({key:n,value:o}))});return(yield Promise.all(e)).reduce((n,i)=>(n[i.key]=i.value,n),{})})}function jx(t,e){(!t||typeof t!="object")&&Ja.throwArgumentError("invalid object","object",t),Object.keys(t).forEach(r=>{e[r]||Ja.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)})}function it(t){const e={};for(const r in t)e[r]=t[r];return e}const Ux={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function oy(t){if(t==null||Ux[typeof t])return!0;if(Array.isArray(t)||typeof t=="object"){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;rnr(e)));if(typeof t=="object"){const e={};for(const r in t){const n=t[r];n!==void 0&&z(e,r,nr(n))}return e}return Ja.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function nr(t){return Fx(t)}class vl{constructor(e){for(const r in e)this[r]=nr(e[r])}}const yl="abi/5.7.0",Ee=new T(yl),Di={};let hp={calldata:!0,memory:!0,storage:!0},zx={calldata:!0,memory:!0};function zl(t,e){if(t==="bytes"||t==="string"){if(hp[e])return!0}else if(t==="address"){if(e==="payable")return!0}else if((t.indexOf("[")>=0||t==="tuple")&&zx[e])return!0;return(hp[e]||e==="payable")&&Ee.throwArgumentError("invalid modifier","name",e),!1}function $x(t,e){let r=t;function n(l){Ee.throwArgumentError(`unexpected character at position ${l}`,"param",t)}t=t.replace(/\s/g," ");function i(l){let a={type:"",name:"",parent:l,state:{allowType:!0}};return e&&(a.indexed=!1),a}let o={type:"",name:"",state:{allowType:!0}},s=o;for(let l=0;lJSON.parse(i.format(e)))),JSON.stringify(n)}let r="";return this.baseType==="array"?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==Se.sighash&&(r+=this.type),r+="("+this.components.map(n=>n.format(e)).join(e===Se.full?", ":",")+")"):r+=this.type,e!==Se.sighash&&(this.indexed===!0&&(r+=" indexed"),e===Se.full&&this.name&&(r+=" "+this.name)),r}static from(e,r){return typeof e=="string"?kt.fromString(e,r):kt.fromObject(e)}static fromObject(e){return kt.isParamType(e)?e:new kt(Di,{name:e.name||null,type:Ji(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(kt.fromObject):null})}static fromString(e,r){function n(i){return kt.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return n($x(e,!!r))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function el(t,e){return Wx(t).map(r=>kt.fromString(r,e))}class Nn{constructor(e,r){e!==Di&&Ee.throwError("use a static from method",T.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),pa(this,r),this._isFragment=!0,Object.freeze(this)}static from(e){return Nn.isFragment(e)?e:typeof e=="string"?Nn.fromString(e):Nn.fromObject(e)}static fromObject(e){if(Nn.isFragment(e))return e;switch(e.type){case"function":return sn.fromObject(e);case"event":return _n.fromObject(e);case"constructor":return on.fromObject(e);case"error":return ei.fromObject(e);case"fallback":case"receive":return null}return Ee.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?_n.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?sn.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?on.fromString(e.trim()):e.split(" ")[0]==="error"?ei.fromString(e.substring(5).trim()):Ee.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class _n extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",e!==Se.sighash&&this.anonymous&&(r+="anonymous "),r.trim()}static from(e){return typeof e=="string"?_n.fromString(e):_n.fromObject(e)}static fromObject(e){if(_n.isEventFragment(e))return e;e.type!=="event"&&Ee.throwArgumentError("invalid event object","value",e);const r={name:tl(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(kt.fromObject):[],type:"event"};return new _n(Di,r)}static fromString(e){let r=e.match(rl);r||Ee.throwArgumentError("invalid event string","value",e);let n=!1;return r[3].split(" ").forEach(i=>{switch(i.trim()){case"anonymous":n=!0;break;case"":break;default:Ee.warn("unknown modifier: "+i)}}),_n.fromObject({name:r[1].trim(),anonymous:n,inputs:el(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function sy(t,e){e.gas=null;let r=t.split("@");return r.length!==1?(r.length>2&&Ee.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||Ee.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=V.from(r[1]),r[0]):t}function ly(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach(r=>{switch(r.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+r)}})}function ay(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return t.stateMutability!=null?(e.stateMutability=t.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",t.constant!=null&&!!t.constant!==e.constant&&Ee.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable=e.stateMutability==="payable",t.payable!=null&&!!t.payable!==e.payable&&Ee.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):t.payable!=null?(e.payable=!!t.payable,t.constant==null&&!e.payable&&t.type!=="constructor"&&Ee.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Ee.throwArgumentError("cannot have constant payable function","value",t)):t.constant!=null?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):t.type!=="constructor"&&Ee.throwArgumentError("unable to determine stateMutability","value",t),e}class on extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});e===Se.sighash&&Ee.throwError("cannot format a constructor for sighash",T.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let r="constructor("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "),r.trim()}static from(e){return typeof e=="string"?on.fromString(e):on.fromObject(e)}static fromObject(e){if(on.isConstructorFragment(e))return e;e.type!=="constructor"&&Ee.throwArgumentError("invalid constructor object","value",e);let r=ay(e);r.constant&&Ee.throwArgumentError("constructor cannot be constant","value",e);const n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(kt.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?V.from(e.gas):null};return new on(Di,n)}static fromString(e){let r={type:"constructor"};e=sy(e,r);let n=e.match(rl);return(!n||n[1].trim()!=="constructor")&&Ee.throwArgumentError("invalid constructor string","value",e),r.inputs=el(n[2].trim(),!1),ly(n[3].trim(),r),on.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class sn extends on{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e))),outputs:this.outputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",e!==Se.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "):this.constant&&(r+="view "),this.outputs&&this.outputs.length&&(r+="returns ("+this.outputs.map(n=>n.format(e)).join(", ")+") "),this.gas!=null&&(r+="@"+this.gas.toString()+" ")),r.trim()}static from(e){return typeof e=="string"?sn.fromString(e):sn.fromObject(e)}static fromObject(e){if(sn.isFunctionFragment(e))return e;e.type!=="function"&&Ee.throwArgumentError("invalid function object","value",e);let r=ay(e);const n={type:e.type,name:tl(e.name),constant:r.constant,inputs:e.inputs?e.inputs.map(kt.fromObject):[],outputs:e.outputs?e.outputs.map(kt.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?V.from(e.gas):null};return new sn(Di,n)}static fromString(e){let r={type:"function"};e=sy(e,r);let n=e.split(" returns ");n.length>2&&Ee.throwArgumentError("invalid function string","value",e);let i=n[0].match(rl);if(i||Ee.throwArgumentError("invalid function signature","value",e),r.name=i[1].trim(),r.name&&tl(r.name),r.inputs=el(i[2],!1),ly(i[3].trim(),r),n.length>1){let o=n[1].match(rl);(o[1].trim()!=""||o[3].trim()!="")&&Ee.throwArgumentError("unexpected tokens","value",e),r.outputs=el(o[2],!1)}else r.outputs=[];return sn.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function pp(t){const e=t.format();return(e==="Error(string)"||e==="Panic(uint256)")&&Ee.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class ei extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",r.trim()}static from(e){return typeof e=="string"?ei.fromString(e):ei.fromObject(e)}static fromObject(e){if(ei.isErrorFragment(e))return e;e.type!=="error"&&Ee.throwArgumentError("invalid error object","value",e);const r={type:e.type,name:tl(e.name),inputs:e.inputs?e.inputs.map(kt.fromObject):[]};return pp(new ei(Di,r))}static fromString(e){let r={type:"error"},n=e.match(rl);return n||Ee.throwArgumentError("invalid error signature","value",e),r.name=n[1].trim(),r.name&&tl(r.name),r.inputs=el(n[2],!1),pp(ei.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function Ji(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const qx=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function tl(t){return(!t||!t.match(qx))&&Ee.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const rl=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function Wx(t){t=t.trim();let e=[],r="",n=0;for(let i=0;ithis.wordSize&&_h.throwError("value out-of-bounds",T.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=Ut([this._padding.slice(r.length%this.wordSize),r])),r}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,r=>{this._data[e]=this._getValue(r)}}}class Ya{constructor(e,r,n,i){z(this,"_data",oe(e)),z(this,"wordSize",r||32),z(this,"_coerceFunc",n),z(this,"allowLoose",i),this._offset=0}get data(){return te(this._data)}get consumed(){return this._offset}static coerce(e,r){let n=e.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(r=r.toNumber()),r}coerce(e,r){return this._coerceFunc?this._coerceFunc(e,r):Ya.coerce(e,r)}_peekBytes(e,r,n){let i=Math.ceil(r/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&n&&this._offset+r<=this._data.length?i=r:_h.throwError("data out-of-bounds",T.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new Ya(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,r){let n=this._peekBytes(0,e,!!r);return this._offset+=n.length,n.slice(0,e)}readValue(){return V.from(this.readBytes(this.wordSize))}}var uy={exports:{}};/** + * [js-sha3]{@link https://github.com/emn178/js-sha3} + * + * @version 0.8.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2018 + * @license MIT + */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&typeof self=="object",s=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;s?i=Fe:o&&(i=self);var l=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,a=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),c=[31,7936,2031616,520093696],d=[4,1024,262144,67108864],p=[1,256,65536,16777216],v=[6,1536,393216,100663296],g=[0,8,16,24],x=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],S=[224,256,384,512],E=[128,256],w=["hex","buffer","arrayBuffer","array","digest"],_={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(y){return Object.prototype.toString.call(y)==="[object Array]"}),a&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(y){return typeof y=="object"&&y.buffer&&y.buffer.constructor===ArrayBuffer});for(var O=function(y,D,U){return function(F){return new h(y,D,y).update(F)[U]()}},B=function(y,D,U){return function(F,G){return new h(y,D,G).update(F)[U]()}},j=function(y,D,U){return function(F,G,ie,Y){return f["cshake"+y].update(F,G,ie,Y)[U]()}},$=function(y,D,U){return function(F,G,ie,Y){return f["kmac"+y].update(F,G,ie,Y)[U]()}},q=function(y,D,U,F){for(var G=0;G>5,this.byteCount=this.blockCount<<2,this.outputBlocks=U>>5,this.extraBytes=(U&31)>>3;for(var F=0;F<50;++F)this.s[F]=0}h.prototype.update=function(y){if(this.finalized)throw new Error(r);var D,U=typeof y;if(U!=="string"){if(U==="object"){if(y===null)throw new Error(e);if(a&&y.constructor===ArrayBuffer)y=new Uint8Array(y);else if(!Array.isArray(y)&&(!a||!ArrayBuffer.isView(y)))throw new Error(e)}else throw new Error(e);D=!0}for(var F=this.blocks,G=this.byteCount,ie=y.length,Y=this.blockCount,Q=0,Je=this.s,J,le;Q>2]|=y[Q]<>2]|=le<>2]|=(192|le>>6)<>2]|=(128|le&63)<=57344?(F[J>>2]|=(224|le>>12)<>2]|=(128|le>>6&63)<>2]|=(128|le&63)<>2]|=(240|le>>18)<>2]|=(128|le>>12&63)<>2]|=(128|le>>6&63)<>2]|=(128|le&63)<=G){for(this.start=J-G,this.block=F[Y],J=0;J>8,U=y&255;U>0;)G.unshift(U),y=y>>8,U=y&255,++F;return D?G.push(F):G.unshift(F),this.update(G),G.length},h.prototype.encodeString=function(y){var D,U=typeof y;if(U!=="string"){if(U==="object"){if(y===null)throw new Error(e);if(a&&y.constructor===ArrayBuffer)y=new Uint8Array(y);else if(!Array.isArray(y)&&(!a||!ArrayBuffer.isView(y)))throw new Error(e)}else throw new Error(e);D=!0}var F=0,G=y.length;if(D)F=G;else for(var ie=0;ie=57344?F+=3:(Y=65536+((Y&1023)<<10|y.charCodeAt(++ie)&1023),F+=4)}return F+=this.encode(F*8),this.update(y),F},h.prototype.bytepad=function(y,D){for(var U=this.encode(D),F=0;F>2]|=this.padding[D&3],this.lastByteIndex===this.byteCount)for(y[0]=y[U],D=1;D>4&15]+u[Q&15]+u[Q>>12&15]+u[Q>>8&15]+u[Q>>20&15]+u[Q>>16&15]+u[Q>>28&15]+u[Q>>24&15];ie%y===0&&(ee(D),G=0)}return F&&(Q=D[G],Y+=u[Q>>4&15]+u[Q&15],F>1&&(Y+=u[Q>>12&15]+u[Q>>8&15]),F>2&&(Y+=u[Q>>20&15]+u[Q>>16&15])),Y},h.prototype.arrayBuffer=function(){this.finalize();var y=this.blockCount,D=this.s,U=this.outputBlocks,F=this.extraBytes,G=0,ie=0,Y=this.outputBits>>3,Q;F?Q=new ArrayBuffer(U+1<<2):Q=new ArrayBuffer(Y);for(var Je=new Uint32Array(Q);ie>8&255,Y[Q+2]=Je>>16&255,Y[Q+3]=Je>>24&255;ie%y===0&&ee(D)}return F&&(Q=ie<<2,Je=D[G],Y[Q]=Je&255,F>1&&(Y[Q+1]=Je>>8&255),F>2&&(Y[Q+2]=Je>>16&255)),Y};function P(y,D,U){h.call(this,y,D,U)}P.prototype=new h,P.prototype.finalize=function(){return this.encode(this.outputBits,!0),h.prototype.finalize.call(this)};var ee=function(y){var D,U,F,G,ie,Y,Q,Je,J,le,Qr,Te,Ne,Jr,Pe,ce,wr,fe,Oe,Yr,me,ze,gn,$e,He,Ht,Le,qe,Rr,Ce,We,vn,Be,Ge,yn,De,re,ot,ge,de,rt,be,_e,Ct,Me,je,Kt,Ve,Ke,Qt,Ie,Ue,Er,ke,Ye,Ai,Xe,Ze,$n,Hn,qn,Wn,Gn;for(F=0;F<48;F+=2)G=y[0]^y[10]^y[20]^y[30]^y[40],ie=y[1]^y[11]^y[21]^y[31]^y[41],Y=y[2]^y[12]^y[22]^y[32]^y[42],Q=y[3]^y[13]^y[23]^y[33]^y[43],Je=y[4]^y[14]^y[24]^y[34]^y[44],J=y[5]^y[15]^y[25]^y[35]^y[45],le=y[6]^y[16]^y[26]^y[36]^y[46],Qr=y[7]^y[17]^y[27]^y[37]^y[47],Te=y[8]^y[18]^y[28]^y[38]^y[48],Ne=y[9]^y[19]^y[29]^y[39]^y[49],D=Te^(Y<<1|Q>>>31),U=Ne^(Q<<1|Y>>>31),y[0]^=D,y[1]^=U,y[10]^=D,y[11]^=U,y[20]^=D,y[21]^=U,y[30]^=D,y[31]^=U,y[40]^=D,y[41]^=U,D=G^(Je<<1|J>>>31),U=ie^(J<<1|Je>>>31),y[2]^=D,y[3]^=U,y[12]^=D,y[13]^=U,y[22]^=D,y[23]^=U,y[32]^=D,y[33]^=U,y[42]^=D,y[43]^=U,D=Y^(le<<1|Qr>>>31),U=Q^(Qr<<1|le>>>31),y[4]^=D,y[5]^=U,y[14]^=D,y[15]^=U,y[24]^=D,y[25]^=U,y[34]^=D,y[35]^=U,y[44]^=D,y[45]^=U,D=Je^(Te<<1|Ne>>>31),U=J^(Ne<<1|Te>>>31),y[6]^=D,y[7]^=U,y[16]^=D,y[17]^=U,y[26]^=D,y[27]^=U,y[36]^=D,y[37]^=U,y[46]^=D,y[47]^=U,D=le^(G<<1|ie>>>31),U=Qr^(ie<<1|G>>>31),y[8]^=D,y[9]^=U,y[18]^=D,y[19]^=U,y[28]^=D,y[29]^=U,y[38]^=D,y[39]^=U,y[48]^=D,y[49]^=U,Jr=y[0],Pe=y[1],je=y[11]<<4|y[10]>>>28,Kt=y[10]<<4|y[11]>>>28,qe=y[20]<<3|y[21]>>>29,Rr=y[21]<<3|y[20]>>>29,Hn=y[31]<<9|y[30]>>>23,qn=y[30]<<9|y[31]>>>23,be=y[40]<<18|y[41]>>>14,_e=y[41]<<18|y[40]>>>14,Ge=y[2]<<1|y[3]>>>31,yn=y[3]<<1|y[2]>>>31,ce=y[13]<<12|y[12]>>>20,wr=y[12]<<12|y[13]>>>20,Ve=y[22]<<10|y[23]>>>22,Ke=y[23]<<10|y[22]>>>22,Ce=y[33]<<13|y[32]>>>19,We=y[32]<<13|y[33]>>>19,Wn=y[42]<<2|y[43]>>>30,Gn=y[43]<<2|y[42]>>>30,ke=y[5]<<30|y[4]>>>2,Ye=y[4]<<30|y[5]>>>2,De=y[14]<<6|y[15]>>>26,re=y[15]<<6|y[14]>>>26,fe=y[25]<<11|y[24]>>>21,Oe=y[24]<<11|y[25]>>>21,Qt=y[34]<<15|y[35]>>>17,Ie=y[35]<<15|y[34]>>>17,vn=y[45]<<29|y[44]>>>3,Be=y[44]<<29|y[45]>>>3,$e=y[6]<<28|y[7]>>>4,He=y[7]<<28|y[6]>>>4,Ai=y[17]<<23|y[16]>>>9,Xe=y[16]<<23|y[17]>>>9,ot=y[26]<<25|y[27]>>>7,ge=y[27]<<25|y[26]>>>7,Yr=y[36]<<21|y[37]>>>11,me=y[37]<<21|y[36]>>>11,Ue=y[47]<<24|y[46]>>>8,Er=y[46]<<24|y[47]>>>8,Ct=y[8]<<27|y[9]>>>5,Me=y[9]<<27|y[8]>>>5,Ht=y[18]<<20|y[19]>>>12,Le=y[19]<<20|y[18]>>>12,Ze=y[29]<<7|y[28]>>>25,$n=y[28]<<7|y[29]>>>25,de=y[38]<<8|y[39]>>>24,rt=y[39]<<8|y[38]>>>24,ze=y[48]<<14|y[49]>>>18,gn=y[49]<<14|y[48]>>>18,y[0]=Jr^~ce&fe,y[1]=Pe^~wr&Oe,y[10]=$e^~Ht&qe,y[11]=He^~Le&Rr,y[20]=Ge^~De&ot,y[21]=yn^~re&ge,y[30]=Ct^~je&Ve,y[31]=Me^~Kt&Ke,y[40]=ke^~Ai&Ze,y[41]=Ye^~Xe&$n,y[2]=ce^~fe&Yr,y[3]=wr^~Oe&me,y[12]=Ht^~qe&Ce,y[13]=Le^~Rr&We,y[22]=De^~ot&de,y[23]=re^~ge&rt,y[32]=je^~Ve&Qt,y[33]=Kt^~Ke&Ie,y[42]=Ai^~Ze&Hn,y[43]=Xe^~$n&qn,y[4]=fe^~Yr&ze,y[5]=Oe^~me&gn,y[14]=qe^~Ce&vn,y[15]=Rr^~We&Be,y[24]=ot^~de&be,y[25]=ge^~rt&_e,y[34]=Ve^~Qt&Ue,y[35]=Ke^~Ie&Er,y[44]=Ze^~Hn&Wn,y[45]=$n^~qn&Gn,y[6]=Yr^~ze&Jr,y[7]=me^~gn&Pe,y[16]=Ce^~vn&$e,y[17]=We^~Be&He,y[26]=de^~be&Ge,y[27]=rt^~_e&yn,y[36]=Qt^~Ue&Ct,y[37]=Ie^~Er&Me,y[46]=Hn^~Wn&ke,y[47]=qn^~Gn&Ye,y[8]=ze^~Jr&ce,y[9]=gn^~Pe&wr,y[18]=vn^~$e&Ht,y[19]=Be^~He&Le,y[28]=be^~Ge&De,y[29]=_e^~yn&re,y[38]=Ue^~Ct&je,y[39]=Er^~Me&Kt,y[48]=Wn^~ke&Ai,y[49]=Gn^~Ye&Xe,y[0]^=x[F],y[1]^=x[F+1]};if(l)t.exports=f;else for(A=0;A>=8;return e}function gp(t,e,r){let n=0;for(let i=0;ie+1+n&&tn.throwError("child data too short",T.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function fy(t,e){if(t.length===0&&tn.throwError("data too short",T.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&tn.throwError("data short segment too short",T.errors.BUFFER_OVERRUN,{});const n=gp(t,e+1,r);return e+1+r+n>t.length&&tn.throwError("data long segment too short",T.errors.BUFFER_OVERRUN,{}),vp(t,e,e+1+r,r+n)}else if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{}),vp(t,e,e+1,r)}else if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{});const n=gp(t,e+1,r);e+1+r+n>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{});const i=te(t.slice(e+1+r,e+1+r+n));return{consumed:1+r+n,result:i}}else if(t[e]>=128){const r=t[e]-128;e+1+r>t.length&&tn.throwError("data too short",T.errors.BUFFER_OVERRUN,{});const n=te(t.slice(e+1,e+1+r));return{consumed:1+r,result:n}}return{consumed:1,result:te(t[e])}}function Sh(t){const e=oe(t),r=fy(e,0);return r.consumed!==e.length&&tn.throwArgumentError("invalid rlp data","data",t),r.result}const Jx="address/5.7.0",oi=new T(Jx);function yp(t){pe(t,20)||oi.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=oe(ut(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const Yx=9007199254740991;function Xx(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const kh={};for(let t=0;t<10;t++)kh[String(t)]=String(t);for(let t=0;t<26;t++)kh[String.fromCharCode(65+t)]=String(10+t);const wp=Math.floor(Xx(Yx));function dy(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>kh[n]).join("");for(;e.length>=wp;){let n=e.substring(0,wp);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function mt(t){let e=null;if(typeof t!="string"&&oi.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=yp(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&oi.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==dy(t)&&oi.throwArgumentError("bad icap checksum","address",t),e=Ox(t.substring(4));e.length<40;)e="0"+e;e=yp("0x"+e)}else oi.throwArgumentError("invalid address","address",t);return e}function Zx(t){try{return mt(t),!0}catch{}return!1}function eA(t){let e=Lx(mt(t).substring(2)).toUpperCase();for(;e.length<30;)e="0"+e;return"XE"+dy("XE00"+e)+e}function Nh(t){let e=null;try{e=mt(t.from)}catch{oi.throwArgumentError("missing from address","transaction",t)}const r=Ro(oe(V.from(t.nonce).toHexString()));return mt(It(ut(Lu([e,r])),12))}function tA(t,e,r){return On(e)!==32&&oi.throwArgumentError("salt must be 32 bytes","salt",e),On(r)!==32&&oi.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),mt(It(ut(Ut(["0xff",mt(t),e,r])),12))}const rA=Object.freeze(Object.defineProperty({__proto__:null,getAddress:mt,getContractAddress:Nh,getCreate2Address:tA,getIcapAddress:eA,isAddress:Zx},Symbol.toStringTag,{value:"Module"}));class nA extends jn{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){try{r=mt(r)}catch(n){this._throwError(n.message,r)}return e.writeValue(r)}decode(e){return mt(pt(e.readValue().toHexString(),20))}}class iA extends jn{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,r){return this.coder.encode(e,r)}decode(e){return this.coder.decode(e)}}const co=new T(yl);function hy(t,e,r){let n=null;if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let a={};n=e.map(u=>{const c=u.localName;return c||co.throwError("cannot encode object for signature with missing names",T.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),a[c]&&co.throwError("cannot encode object for signature with duplicate names",T.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),a[c]=!0,r[c]})}else co.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&co.throwArgumentError("types/value length mismatch","tuple",r);let i=new sd(t.wordSize),o=new sd(t.wordSize),s=[];e.forEach((a,u)=>{let c=n[u];if(a.dynamic){let d=o.length;a.encode(o,c);let p=i.writeUpdatableValue();s.push(v=>{p(v+d)})}else a.encode(i,c)}),s.forEach(a=>{a(i.length)});let l=t.appendWriter(i);return l+=t.appendWriter(o),l}function py(t,e){let r=[],n=t.subReader(0);e.forEach(o=>{let s=null;if(o.dynamic){let l=t.readValue(),a=n.subReader(l.toNumber());try{s=o.decode(a)}catch(u){if(u.code===T.errors.BUFFER_OVERRUN)throw u;s=u,s.baseType=o.name,s.name=o.localName,s.type=o.type}}else try{s=o.decode(t)}catch(l){if(l.code===T.errors.BUFFER_OVERRUN)throw l;s=l,s.baseType=o.name,s.name=o.localName,s.type=o.type}s!=null&&r.push(s)});const i=e.reduce((o,s)=>{const l=s.localName;return l&&(o[l]||(o[l]=0),o[l]++),o},{});e.forEach((o,s)=>{let l=o.localName;if(!l||i[l]!==1||(l==="length"&&(l="_length"),r[l]!=null))return;const a=r[s];a instanceof Error?Object.defineProperty(r,l,{enumerable:!0,get:()=>{throw a}}):r[l]=a});for(let o=0;o{throw s}})}return Object.freeze(r)}class oA extends jn{constructor(e,r,n){const i=e.type+"["+(r>=0?r:"")+"]",o=r===-1||e.dynamic;super("array",i,n,o),this.coder=e,this.length=r}defaultValue(){const e=this.coder.defaultValue(),r=[];for(let n=0;ne._data.length&&co.throwError("insufficient data length",T.errors.BUFFER_OVERRUN,{length:e._data.length,count:r}));let n=[];for(let i=0;i>6===2;s++)o++;return o}return t===ar.OVERRUN?r.length-e-1:0}function yA(t,e,r,n,i){return t===ar.OVERLONG?(n.push(i),0):(n.push(65533),yy(t,e,r))}const wA=Object.freeze({error:vA,ignore:yy,replace:yA});function wy(t,e){e==null&&(e=wA.error),t=oe(t);const r=[];let n=0;for(;n>7)){r.push(i);continue}let o=null,s=null;if((i&224)===192)o=1,s=127;else if((i&240)===224)o=2,s=2047;else if((i&248)===240)o=3,s=65535;else{(i&192)===128?n+=e(ar.UNEXPECTED_CONTINUE,n-1,t,r):n+=e(ar.BAD_PREFIX,n-1,t,r);continue}if(n-1+o>=t.length){n+=e(ar.OVERRUN,n-1,t,r);continue}let l=i&(1<<8-o-1)-1;for(let a=0;a1114111){n+=e(ar.OUT_OF_RANGE,n-1-o,t,r,l);continue}if(l>=55296&&l<=57343){n+=e(ar.UTF16_SURROGATE,n-1-o,t,r,l);continue}if(l<=s){n+=e(ar.OVERLONG,n-1-o,t,r,l);continue}r.push(l)}}return r}function mr(t,e=nl.current){e!=nl.current&&(vy.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const o=t.charCodeAt(n);if(n>=t.length||(o&64512)!==56320)throw new Error("invalid utf-8 string");const s=65536+((i&1023)<<10)+(o&1023);r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return oe(r)}function EA(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function wl(t,e){return EA(wy(t,e))}function xA(t,e=nl.current){return wy(mr(t,e))}class AA extends my{constructor(e){super("string",e)}defaultValue(){return""}encode(e,r){return super.encode(e,mr(r))}decode(e){return wl(super.decode(e))}}class $l extends jn{constructor(e,r){let n=!1;const i=[];e.forEach(s=>{s.dynamic&&(n=!0),i.push(s.type)});const o="tuple("+i.join(",")+")";super("tuple",o,r,n),this.coders=e}defaultValue(){const e=[];this.coders.forEach(n=>{e.push(n.defaultValue())});const r=this.coders.reduce((n,i)=>{const o=i.localName;return o&&(n[o]||(n[o]=0),n[o]++),n},{});return this.coders.forEach((n,i)=>{let o=n.localName;!o||r[o]!==1||(o==="length"&&(o="_length"),e[o]==null&&(e[o]=e[i]))}),Object.freeze(e)}encode(e,r){return hy(e,this.coders,r)}decode(e){return e.coerce(this.name,py(e,this.coders))}}const Hl=new T(yl),bA=new RegExp(/^bytes([0-9]*)$/),_A=new RegExp(/^(u?int)([0-9]*)$/);class SA{constructor(e){z(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new nA(e.name);case"bool":return new sA(e.name);case"string":return new AA(e.name);case"bytes":return new lA(e.name);case"array":return new oA(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new $l((e.components||[]).map(n=>this._getCoder(n)),e.name);case"":return new uA(e.name)}let r=e.type.match(_A);if(r){let n=parseInt(r[2]||"256");return(n===0||n>256||n%8!==0)&&Hl.throwArgumentError("invalid "+r[1]+" bit length","param",e),new mA(n/8,r[1]==="int",e.name)}if(r=e.type.match(bA),r){let n=parseInt(r[1]);return(n===0||n>32)&&Hl.throwArgumentError("invalid bytes length","param",e),new aA(n,e.name)}return Hl.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,r){return new Ya(e,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new sd(this._getWordSize())}getDefaultValue(e){const r=e.map(i=>this._getCoder(kt.from(i)));return new $l(r,"_").defaultValue()}encode(e,r){e.length!==r.length&&Hl.throwError("types/values length mismatch",T.errors.INVALID_ARGUMENT,{count:{types:e.length,values:r.length},value:{types:e,values:r}});const n=e.map(s=>this._getCoder(kt.from(s))),i=new $l(n,"_"),o=this._getWriter();return i.encode(o,r),o.data}decode(e,r,n){const i=e.map(s=>this._getCoder(kt.from(s)));return new $l(i,"_").decode(this._getReader(oe(r),n))}}const kA=new SA;function fo(t){return ut(mr(t))}const Ey="hash/5.7.0";function xy(t){t=atob(t);const e=[];for(let r=0;r0&&Array.isArray(l)?i(l,s-1):r.push(l)})};return i(t,e),r}function NA(t){const e={};for(let r=0;r>--a&1}const d=31,p=Math.pow(2,d),v=p>>>1,g=v>>1,x=p-1;let S=0;for(let B=0;B1;){let K=j+$>>>1;B>>1|c(),q=q<<1^v,ne=(ne^v)<<1|v|1;w=q,_=1+ne-q}let O=n-4;return E.map(B=>{switch(B-O){case 3:return O+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return O+256+(t[l++]<<8|t[l++]);case 1:return O+t[l++];default:return B-1}})}function CA(t){let e=0;return()=>t[e++]}function MA(t){return CA(PA(t))}function IA(t){return t&1?~t>>1:t>>1}function RA(t,e){let r=Array(t);for(let n=0;ne[s]):r}function OA(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(BA(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(DA(r,t))}return NA(by(e))}function LA(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function _y(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;in[s].push(o));return n}function BA(t,e){let r=1+e(),n=e(),i=LA(e),o=_y(i.length,1+t,e);return by(o.map((s,l)=>{const a=s[0],u=s.slice(1);return Array(i[l]).fill(void 0).map((c,d)=>{let p=d*n;return[a+d*r,u.map(v=>v+p)]})}))}function DA(t,e){let r=1+e();return _y(r,1+t,e).map(i=>[i[0],i.slice(1)])}function jA(t){let e=Xa(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let u=Xa(t,e);if(u.length==0)break;n.push({set:new Set(u),node:r()})}n.sort((u,c)=>c.set.size-u.set.size);let i=t(),o=i%3;i=i/3|0;let s=!!(i&1);i>>=1;let l=i==1,a=i==2;return{branches:n,valid:o,fe0f:s,save:l,check:a}}}function UA(){return MA(xy("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const Bu=UA(),FA=new Set(Xa(Bu)),zA=new Set(Xa(Bu)),$A=OA(Bu),HA=jA(Bu),xp=45,Ap=95;function Sy(t){return xA(t)}function qA(t){return t.filter(e=>e!=65039)}function ky(t){for(let e of t.split(".")){let r=Sy(e);try{for(let n=r.lastIndexOf(Ap)-1;n>=0;n--)if(r[n]!==Ap)throw new Error("underscore only allowed at start");if(r.length>=4&&r.every(n=>n<128)&&r[2]===xp&&r[3]===xp)throw new Error("invalid label extension")}catch(n){throw new Error(`Invalid label "${e}": ${n.message}`)}}return t}function WA(t){return ky(GA(t,qA))}function GA(t,e){let r=Sy(t).reverse(),n=[];for(;r.length;){let i=KA(r);if(i){n.push(...e(i));continue}let o=r.pop();if(FA.has(o)){n.push(o);continue}if(zA.has(o))continue;let s=$A[o];if(s){n.push(...s);continue}throw new Error(`Disallowed codepoint: 0x${o.toString(16).toUpperCase()}`)}return ky(VA(String.fromCodePoint(...n)))}function VA(t){return t.normalize("NFC")}function KA(t,e){var r;let n=HA,i,o,s=[],l=t.length;for(e&&(e.length=0);l;){let a=t[--l];if(n=(r=n.branches.find(u=>u.set.has(a)))===null||r===void 0?void 0:r.node,!n)break;if(n.save)o=a;else if(n.check&&a===o)break;s.push(a),n.fe0f&&(s.push(65039),l>0&&t[l-1]==65039&&l--),n.valid&&(i=s.slice(),n.valid==2&&i.splice(1,1),e&&e.push(...t.slice(l).reverse()),t.length=l)}return i}const QA=new T(Ey),Ny=new Uint8Array(32);Ny.fill(0);function bp(t){if(t.length===0)throw new Error("invalid ENS name; empty component");return t}function Py(t){const e=mr(WA(t)),r=[];if(t.length===0)return r;let n=0;for(let i=0;i=e.length)throw new Error("invalid ENS name; empty component");return r.push(bp(e.slice(n))),r}function ma(t){typeof t!="string"&&QA.throwArgumentError("invalid ENS name; not a string","name",t);let e=Ny;const r=Py(t);for(;r.length;)e=ut(Ut([e,ut(r.pop())]));return te(e)}function JA(t){return te(Ut(Py(t).map(e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const r=new Uint8Array(e.length+1);return r.set(e,1),r[0]=r.length-1,r})))+"00"}var YA=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const lt=new T(Ey),Cy=new Uint8Array(32);Cy.fill(0);const XA=V.from(-1),My=V.from(0),Iy=V.from(1),ZA=V.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function eb(t){const e=oe(t),r=e.length%32;return r?Xt([e,Cy.slice(r)]):te(e)}const tb=pt(Iy.toHexString(),32),rb=pt(My.toHexString(),32),_p={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},zc=["name","version","chainId","verifyingContract","salt"];function Sp(t){return function(e){return typeof e!="string"&<.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const nb={name:Sp("name"),version:Sp("version"),chainId:function(t){try{return V.from(t).toString()}catch{}return lt.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return mt(t).toLowerCase()}catch{}return lt.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=oe(t);if(e.length!==32)throw new Error("bad length");return te(e)}catch{}return lt.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function $c(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=e[1]==="",n=parseInt(e[2]||"256");(n%8!==0||n>256||e[2]&&e[2]!==String(n))&<.throwArgumentError("invalid numeric width","type",t);const i=ZA.mask(r?n-1:n),o=r?i.add(Iy).mul(XA):My;return function(s){const l=V.from(s);return(l.lt(o)||l.gt(i))&<.throwArgumentError(`value out-of-bounds for ${t}`,"value",s),pt(l.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(r===0||r>32||e[1]!==String(r))&<.throwArgumentError("invalid bytes width","type",t),function(n){return oe(n).length!==r&<.throwArgumentError(`invalid length for ${t}`,"value",n),eb(n)}}}switch(t){case"address":return function(e){return pt(mt(e),32)};case"bool":return function(e){return e?tb:rb};case"bytes":return function(e){return ut(e)};case"string":return function(e){return fo(e)}}return null}function kp(t,e){return`${t}(${e.map(({name:r,type:n})=>n+" "+r).join(",")})`}class sr{constructor(e){z(this,"types",Object.freeze(nr(e))),z(this,"_encoderCache",{}),z(this,"_types",{});const r={},n={},i={};Object.keys(e).forEach(l=>{r[l]={},n[l]=[],i[l]={}});for(const l in e){const a={};e[l].forEach(u=>{a[u.name]&<.throwArgumentError(`duplicate variable name ${JSON.stringify(u.name)} in ${JSON.stringify(l)}`,"types",e),a[u.name]=!0;const c=u.type.match(/^([^\x5b]*)(\x5b|$)/)[1];c===l&<.throwArgumentError(`circular type reference to ${JSON.stringify(c)}`,"types",e),!$c(c)&&(n[c]||lt.throwArgumentError(`unknown type ${JSON.stringify(c)}`,"types",e),n[c].push(l),r[l][c]=!0)})}const o=Object.keys(n).filter(l=>n[l].length===0);o.length===0?lt.throwArgumentError("missing primary type","types",e):o.length>1&<.throwArgumentError(`ambiguous primary types or unused types: ${o.map(l=>JSON.stringify(l)).join(", ")}`,"types",e),z(this,"primaryType",o[0]);function s(l,a){a[l]&<.throwArgumentError(`circular type reference to ${JSON.stringify(l)}`,"types",e),a[l]=!0,Object.keys(r[l]).forEach(u=>{n[u]&&(s(u,a),Object.keys(a).forEach(c=>{i[c][u]=!0}))}),delete a[l]}s(this.primaryType,{});for(const l in i){const a=Object.keys(i[l]);a.sort(),this._types[l]=kp(l,e[l])+a.map(u=>kp(u,e[u])).join("")}}getEncoder(e){let r=this._encoderCache[e];return r||(r=this._encoderCache[e]=this._getEncoder(e)),r}_getEncoder(e){{const i=$c(e);if(i)return i}const r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const i=r[1],o=this.getEncoder(i),s=parseInt(r[3]);return l=>{s>=0&&l.length!==s&<.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",l);let a=l.map(o);return this._types[i]&&(a=a.map(ut)),ut(Xt(a))}}const n=this.types[e];if(n){const i=fo(this._types[e]);return o=>{const s=n.map(({name:l,type:a})=>{const u=this.getEncoder(a)(o[l]);return this._types[a]?ut(u):u});return s.unshift(i),Xt(s)}}return lt.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const r=this._types[e];return r||lt.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return ut(this.encodeData(e,r))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,r,n){if($c(e))return n(e,r);const i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const s=i[1],l=parseInt(i[3]);return l>=0&&r.length!==l&<.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map(a=>this._visit(s,a,n))}const o=this.types[e];return o?o.reduce((s,{name:l,type:a})=>(s[l]=this._visit(a,r[l],n),s),{}):lt.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new sr(e)}static getPrimaryType(e){return sr.from(e).primaryType}static hashStruct(e,r,n){return sr.from(r).hashStruct(e,n)}static hashDomain(e){const r=[];for(const n in e){const i=_p[n];i||lt.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),r.push({name:n,type:i})}return r.sort((n,i)=>zc.indexOf(n.name)-zc.indexOf(i.name)),sr.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,n){return Xt(["0x1901",sr.hashDomain(e),sr.from(r).hash(n)])}static hash(e,r,n){return ut(sr.encode(e,r,n))}static resolveNames(e,r,n,i){return YA(this,void 0,void 0,function*(){e=it(e);const o={};e.verifyingContract&&!pe(e.verifyingContract,20)&&(o[e.verifyingContract]="0x");const s=sr.from(r);s.visit(n,(l,a)=>(l==="address"&&!pe(a,20)&&(o[a]="0x"),a));for(const l in o)o[l]=yield i(l);return e.verifyingContract&&o[e.verifyingContract]&&(e.verifyingContract=o[e.verifyingContract]),n=s.visit(n,(l,a)=>l==="address"&&o[a]?o[a]:a),{domain:e,value:n}})}static getPayload(e,r,n){sr.hashDomain(e);const i={},o=[];zc.forEach(a=>{const u=e[a];u!=null&&(i[a]=nb[a](u),o.push({name:a,type:_p[a]}))});const s=sr.from(r),l=it(r);return l.EIP712Domain?lt.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):l.EIP712Domain=o,s.encode(n),{types:l,domain:i,primaryType:s.primaryType,message:s.visit(n,(a,u)=>{if(a.match(/^bytes(\d*)/))return te(oe(u));if(a.match(/^u?int/))return V.from(u).toString();switch(a){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return typeof u!="string"&<.throwArgumentError("invalid string","value",u),u}return lt.throwArgumentError("unsupported type","type",a)})}}}const st=new T(yl);class ib extends vl{}class ob extends vl{}class sb extends vl{}class ld extends vl{static isIndexed(e){return!!(e&&e._isIndexed)}}const lb={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Np(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class ad{constructor(e){let r=[];typeof e=="string"?r=JSON.parse(e):r=e,z(this,"fragments",r.map(n=>Nn.from(n)).filter(n=>n!=null)),z(this,"_abiCoder",fr(new.target,"getAbiCoder")()),z(this,"functions",{}),z(this,"errors",{}),z(this,"events",{}),z(this,"structs",{}),this.fragments.forEach(n=>{let i=null;switch(n.type){case"constructor":if(this.deploy){st.warn("duplicate definition - constructor");return}z(this,"deploy",n);return;case"function":i=this.functions;break;case"event":i=this.events;break;case"error":i=this.errors;break;default:return}let o=n.format();if(i[o]){st.warn("duplicate definition - "+o);return}i[o]=n}),this.deploy||z(this,"deploy",on.from({payable:!1,type:"constructor"})),z(this,"_isInterface",!0)}format(e){e||(e=Se.full),e===Se.sighash&&st.throwArgumentError("interface does not support formatting sighash","format",e);const r=this.fragments.map(n=>n.format(e));return e===Se.json?JSON.stringify(r.map(n=>JSON.parse(n))):r}static getAbiCoder(){return kA}static getAddress(e){return mt(e)}static getSighash(e){return It(fo(e.format()),0,4)}static getEventTopic(e){return fo(e.format())}getFunction(e){if(pe(e)){for(const n in this.functions)if(e===this.getSighash(n))return this.functions[n];st.throwArgumentError("no matching function","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.functions).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching function","name",n):i.length>1&&st.throwArgumentError("multiple matching functions","name",n),this.functions[i[0]]}const r=this.functions[sn.fromString(e).format()];return r||st.throwArgumentError("no matching function","signature",e),r}getEvent(e){if(pe(e)){const n=e.toLowerCase();for(const i in this.events)if(n===this.getEventTopic(i))return this.events[i];st.throwArgumentError("no matching event","topichash",n)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.events).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching event","name",n):i.length>1&&st.throwArgumentError("multiple matching events","name",n),this.events[i[0]]}const r=this.events[_n.fromString(e).format()];return r||st.throwArgumentError("no matching event","signature",e),r}getError(e){if(pe(e)){const n=fr(this.constructor,"getSighash");for(const i in this.errors){const o=this.errors[i];if(e===n(o))return this.errors[i]}st.throwArgumentError("no matching error","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.errors).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching error","name",n):i.length>1&&st.throwArgumentError("multiple matching errors","name",n),this.errors[i[0]]}const r=this.errors[sn.fromString(e).format()];return r||st.throwArgumentError("no matching error","signature",e),r}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e)}catch(r){try{e=this.getError(e)}catch{throw r}}return fr(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),fr(this.constructor,"getEventTopic")(e)}_decodeParams(e,r){return this._abiCoder.decode(e,r)}_encodeParams(e,r){return this._abiCoder.encode(e,r)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,r){typeof e=="string"&&(e=this.getError(e));const n=oe(r);return te(n.slice(0,4))!==this.getSighash(e)&&st.throwArgumentError(`data signature does not match error ${e.name}.`,"data",te(n)),this._decodeParams(e.inputs,n.slice(4))}encodeErrorResult(e,r){return typeof e=="string"&&(e=this.getError(e)),te(Ut([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionData(e,r){typeof e=="string"&&(e=this.getFunction(e));const n=oe(r);return te(n.slice(0,4))!==this.getSighash(e)&&st.throwArgumentError(`data signature does not match function ${e.name}.`,"data",te(n)),this._decodeParams(e.inputs,n.slice(4))}encodeFunctionData(e,r){return typeof e=="string"&&(e=this.getFunction(e)),te(Ut([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionResult(e,r){typeof e=="string"&&(e=this.getFunction(e));let n=oe(r),i=null,o="",s=null,l=null,a=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,n)}catch{}break;case 4:{const u=te(n.slice(0,4)),c=lb[u];if(c)s=this._abiCoder.decode(c.inputs,n.slice(4)),l=c.name,a=c.signature,c.reason&&(i=s[0]),l==="Error"?o=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(s[0])}`:l==="Panic"&&(o=`; VM Exception while processing transaction: reverted with panic code ${s[0]}`);else try{const d=this.getError(u);s=this._abiCoder.decode(d.inputs,n.slice(4)),l=d.name,a=d.format()}catch{}break}}return st.throwError("call revert exception"+o,T.errors.CALL_EXCEPTION,{method:e.format(),data:te(r),errorArgs:s,errorName:l,errorSignature:a,reason:i})}encodeFunctionResult(e,r){return typeof e=="string"&&(e=this.getFunction(e)),te(this._abiCoder.encode(e.outputs,r||[]))}encodeFilterTopics(e,r){typeof e=="string"&&(e=this.getEvent(e)),r.length>e.inputs.length&&st.throwError("too many arguments for "+e.format(),T.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:r});let n=[];e.anonymous||n.push(this.getEventTopic(e));const i=(o,s)=>o.type==="string"?fo(s):o.type==="bytes"?ut(te(s)):(o.type==="bool"&&typeof s=="boolean"&&(s=s?"0x01":"0x00"),o.type.match(/^u?int/)&&(s=V.from(s).toHexString()),o.type==="address"&&this._abiCoder.encode(["address"],[s]),pt(te(s),32));for(r.forEach((o,s)=>{let l=e.inputs[s];if(!l.indexed){o!=null&&st.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+l.name,o);return}o==null?n.push(null):l.baseType==="array"||l.baseType==="tuple"?st.throwArgumentError("filtering with tuples or arrays not supported","contract."+l.name,o):Array.isArray(o)?n.push(o.map(a=>i(l,a))):n.push(i(l,o))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,r){typeof e=="string"&&(e=this.getEvent(e));const n=[],i=[],o=[];return e.anonymous||n.push(this.getEventTopic(e)),r.length!==e.inputs.length&&st.throwArgumentError("event arguments/values mismatch","values",r),e.inputs.forEach((s,l)=>{const a=r[l];if(s.indexed)if(s.type==="string")n.push(fo(a));else if(s.type==="bytes")n.push(ut(a));else{if(s.baseType==="tuple"||s.baseType==="array")throw new Error("not implemented");n.push(this._abiCoder.encode([s.type],[a]))}else i.push(s),o.push(a)}),{data:this._abiCoder.encode(i,o),topics:n}}decodeEventLog(e,r,n){if(typeof e=="string"&&(e=this.getEvent(e)),n!=null&&!e.anonymous){let p=this.getEventTopic(e);(!pe(n[0],32)||n[0].toLowerCase()!==p)&&st.throwError("fragment/topic mismatch",T.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:p,value:n[0]}),n=n.slice(1)}let i=[],o=[],s=[];e.inputs.forEach((p,v)=>{p.indexed?p.type==="string"||p.type==="bytes"||p.baseType==="tuple"||p.baseType==="array"?(i.push(kt.fromObject({type:"bytes32",name:p.name})),s.push(!0)):(i.push(p),s.push(!1)):(o.push(p),s.push(!1))});let l=n!=null?this._abiCoder.decode(i,Ut(n)):null,a=this._abiCoder.decode(o,r,!0),u=[],c=0,d=0;e.inputs.forEach((p,v)=>{if(p.indexed)if(l==null)u[v]=new ld({_isIndexed:!0,hash:null});else if(s[v])u[v]=new ld({_isIndexed:!0,hash:l[d++]});else try{u[v]=l[d++]}catch(g){u[v]=g}else try{u[v]=a[c++]}catch(g){u[v]=g}if(p.name&&u[p.name]==null){const g=u[v];g instanceof Error?Object.defineProperty(u,p.name,{enumerable:!0,get:()=>{throw Np(`property ${JSON.stringify(p.name)}`,g)}}):u[p.name]=g}});for(let p=0;p{throw Np(`index ${p}`,v)}})}return Object.freeze(u)}parseTransaction(e){let r=this.getFunction(e.data.substring(0,10).toLowerCase());return r?new ob({args:this._abiCoder.decode(r.inputs,"0x"+e.data.substring(10)),functionFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r),value:V.from(e.value||"0")}):null}parseLog(e){let r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new ib({eventFragment:r,name:r.name,signature:r.format(),topic:this.getEventTopic(r),args:this.decodeEventLog(r,e.data,e.topics)})}parseError(e){const r=te(e);let n=this.getError(r.substring(0,10).toLowerCase());return n?new sb({args:this._abiCoder.decode(n.inputs,"0x"+r.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(e){return!!(e&&e._isInterface)}}const ab="abstract-provider/5.7.0";var ub=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const cb=new T(ab);class fb extends vl{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class qo{constructor(){cb.checkAbstract(new.target,qo),z(this,"_isProvider",!0)}getFeeData(){return ub(this,void 0,void 0,function*(){const{block:e,gasPrice:r}=yield yt({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(s=>null)});let n=null,i=null,o=null;return e&&e.baseFeePerGas&&(n=e.baseFeePerGas,o=V.from("1500000000"),i=e.baseFeePerGas.mul(2).add(o)),{lastBaseFeePerGas:n,maxFeePerGas:i,maxPriorityFeePerGas:o,gasPrice:r}})}addListener(e,r){return this.on(e,r)}removeListener(e,r){return this.off(e,r)}static isProvider(e){return!!(e&&e._isProvider)}}const db="abstract-signer/5.7.0";var Or=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Ar=new T(db),hb=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],pb=[T.errors.INSUFFICIENT_FUNDS,T.errors.NONCE_EXPIRED,T.errors.REPLACEMENT_UNDERPRICED];class El{constructor(){Ar.checkAbstract(new.target,El),z(this,"_isSigner",!0)}getBalance(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return Or(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const r=yield yt(this.checkTransaction(e));return yield this.provider.estimateGas(r)})}call(e,r){return Or(this,void 0,void 0,function*(){this._checkProvider("call");const n=yield yt(this.checkTransaction(e));return yield this.provider.call(n,r)})}sendTransaction(e){return Or(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const r=yield this.populateTransaction(e),n=yield this.signTransaction(r);return yield this.provider.sendTransaction(n)})}getChainId(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const n in e)hb.indexOf(n)===-1&&Ar.throwArgumentError("invalid transaction key: "+n,"transaction",e);const r=it(e);return r.from==null?r.from=this.getAddress():r.from=Promise.all([Promise.resolve(r.from),this.getAddress()]).then(n=>(n[0].toLowerCase()!==n[1].toLowerCase()&&Ar.throwArgumentError("from address mismatch","transaction",e),n[0])),r}populateTransaction(e){return Or(this,void 0,void 0,function*(){const r=yield yt(this.checkTransaction(e));r.to!=null&&(r.to=Promise.resolve(r.to).then(i=>Or(this,void 0,void 0,function*(){if(i==null)return null;const o=yield this.resolveName(i);return o==null&&Ar.throwArgumentError("provided ENS name resolves to null","tx.to",i),o})),r.to.catch(i=>{}));const n=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||n)?Ar.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(r.type===0||r.type===1)&&n&&Ar.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1)r.gasPrice==null&&(r.gasPrice=this.getGasPrice());else{const i=yield this.getFeeData();if(r.type==null)if(i.maxFeePerGas!=null&&i.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){const o=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=o,r.maxPriorityFeePerGas=o}else r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas);else i.gasPrice!=null?(n&&Ar.throwError("network does not support EIP-1559",T.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=i.gasPrice),r.type=0):Ar.throwError("failed to get consistent fee data",T.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else r.type===2&&(r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas))}return r.nonce==null&&(r.nonce=this.getTransactionCount("pending")),r.gasLimit==null&&(r.gasLimit=this.estimateGas(r).catch(i=>{if(pb.indexOf(i.code)>=0)throw i;return Ar.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:i,tx:r})})),r.chainId==null?r.chainId=this.getChainId():r.chainId=Promise.all([Promise.resolve(r.chainId),this.getChainId()]).then(i=>(i[1]!==0&&i[0]!==i[1]&&Ar.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield yt(r)})}_checkProvider(e){this.provider||Ar.throwError("missing provider",T.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class Ph extends El{constructor(e,r){super(),z(this,"address",e),z(this,"provider",r||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,r){return Promise.resolve().then(()=>{Ar.throwError(e,T.errors.UNSUPPORTED_OPERATION,{operation:r})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,r,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new Ph(this.address,e)}}var Ry={},we={},xl=Ty;function Ty(t,e){if(!t)throw new Error(e||"Assertion failed")}Ty.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var ud={exports:{}};typeof Object.create=="function"?ud.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ud.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var mb=ud.exports,gb=xl,vb=mb;we.inherits=vb;function yb(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function wb(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=o&63|128):yb(t,i)?(o=65536+((o&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=o&63|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=o&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}we.htonl=Oy;function xb(t,e){for(var r="",n=0;n>>0}return o}we.join32=Ab;function bb(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=o&255):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=o&255)}return r}we.split32=bb;function _b(t,e){return t>>>e|t<<32-e}we.rotr32=_b;function Sb(t,e){return t<>>32-e}we.rotl32=Sb;function kb(t,e){return t+e>>>0}we.sum32=kb;function Nb(t,e,r){return t+e+r>>>0}we.sum32_3=Nb;function Pb(t,e,r,n){return t+e+r+n>>>0}we.sum32_4=Pb;function Cb(t,e,r,n,i){return t+e+r+n+i>>>0}we.sum32_5=Cb;function Mb(t,e,r,n){var i=t[e],o=t[e+1],s=n+o>>>0,l=(s>>0,t[e+1]=s}we.sum64=Mb;function Ib(t,e,r,n){var i=e+n>>>0,o=(i>>0}we.sum64_hi=Ib;function Rb(t,e,r,n){var i=e+n;return i>>>0}we.sum64_lo=Rb;function Tb(t,e,r,n,i,o,s,l){var a=0,u=e;u=u+n>>>0,a+=u>>0,a+=u>>0,a+=u>>0}we.sum64_4_hi=Tb;function Ob(t,e,r,n,i,o,s,l){var a=e+n+o+l;return a>>>0}we.sum64_4_lo=Ob;function Lb(t,e,r,n,i,o,s,l,a,u){var c=0,d=e;d=d+n>>>0,c+=d>>0,c+=d>>0,c+=d>>0,c+=d>>0}we.sum64_5_hi=Lb;function Bb(t,e,r,n,i,o,s,l,a,u){var c=e+n+o+l+u;return c>>>0}we.sum64_5_lo=Bb;function Db(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}we.rotr64_hi=Db;function jb(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}we.rotr64_lo=jb;function Ub(t,e,r){return t>>>r}we.shr64_hi=Ub;function Fb(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}we.shr64_lo=Fb;var Wo={},Pp=we,zb=xl;function Du(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Wo.BlockHash=Du;Du.prototype.update=function(e,r){if(e=Pp.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Pp.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[o++]=e>>>16&255,i[o++]=e>>>8&255,i[o++]=e&255}else for(i[o++]=e&255,i[o++]=e>>>8&255,i[o++]=e>>>16&255,i[o++]=e>>>24&255,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,s=8;s>>3}mn.g0_256=Gb;function Vb(t){return un(t,17)^un(t,19)^t>>>10}mn.g1_256=Vb;var To=we,Kb=Wo,Qb=mn,Hc=To.rotl32,is=To.sum32,Jb=To.sum32_5,Yb=Qb.ft_1,Fy=Kb.BlockHash,Xb=[1518500249,1859775393,2400959708,3395469782];function dn(){if(!(this instanceof dn))return new dn;Fy.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}To.inherits(dn,Fy);var Zb=dn;dn.blockSize=512;dn.outSize=160;dn.hmacStrength=80;dn.padLength=64;dn.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),F_(e.length<=this.blockSize);for(var r=e.length;r>8,p=c&255;d?a.push(d,p):a.push(p)}return a}r.toArray=n;function i(s){return s.length===1?"0"+s:s}r.zero2=i;function o(s){for(var l="",a=0;a(p>>1)-1?x=(p>>1)-S:x=S,v.isubn(x)):x=0,d[g]=x,v.iushrn(1)}return d}r.getNAF=n;function i(a,u){var c=[[],[]];a=a.clone(),u=u.clone();for(var d=0,p=0,v;a.cmpn(-d)>0||u.cmpn(-p)>0;){var g=a.andln(3)+d&3,x=u.andln(3)+p&3;g===3&&(g=-1),x===3&&(x=-1);var S;g&1?(v=a.andln(7)+d&7,(v===3||v===5)&&x===2?S=-g:S=g):S=0,c[0].push(S);var E;x&1?(v=u.andln(7)+p&7,(v===3||v===5)&&g===2?E=-x:E=x):E=0,c[1].push(E),2*d===S+1&&(d=1-d),2*p===E+1&&(p=1-p),a.iushrn(1),u.iushrn(1)}return c}r.getJSF=i;function o(a,u,c){var d="_"+u;a.prototype[u]=function(){return this[d]!==void 0?this[d]:this[d]=c.call(this)}}r.cachedProperty=o;function s(a){return typeof a=="string"?r.toArray(a,"hex"):a}r.parseBytes=s;function l(a){return new ue(a,"hex","le")}r.intFromLE=l}),Za=yr.getNAF,H_=yr.getJSF,eu=yr.assert;function xi(t,e){this.type=t,this.p=new ue(e.p,16),this.red=e.prime?ue.red(e.prime):ue.mont(this.p),this.zero=new ue(0).toRed(this.red),this.one=new ue(1).toRed(this.red),this.two=new ue(2).toRed(this.red),this.n=e.n&&new ue(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Hi=xi;xi.prototype.point=function(){throw new Error("Not implemented")};xi.prototype.validate=function(){throw new Error("Not implemented")};xi.prototype._fixedNafMul=function(e,r){eu(e.precomputed);var n=e._getDoubles(),i=Za(r,1,this._bitLength),o=(1<=l;u--)a=(a<<1)+i[u];s.push(a)}for(var c=this.jpoint(null,null,null),d=this.jpoint(null,null,null),p=o;p>0;p--){for(l=0;l=0;a--){for(var u=0;a>=0&&s[a]===0;a--)u++;if(a>=0&&u++,l=l.dblp(u),a<0)break;var c=s[a];eu(c!==0),e.type==="affine"?c>0?l=l.mixedAdd(o[c-1>>1]):l=l.mixedAdd(o[-c-1>>1].neg()):c>0?l=l.add(o[c-1>>1]):l=l.add(o[-c-1>>1].neg())}return e.type==="affine"?l.toP():l};xi.prototype._wnafMulAdd=function(e,r,n,i,o){var s=this._wnafT1,l=this._wnafT2,a=this._wnafT3,u=0,c,d,p;for(c=0;c=1;c-=2){var g=c-1,x=c;if(s[g]!==1||s[x]!==1){a[g]=Za(n[g],s[g],this._bitLength),a[x]=Za(n[x],s[x],this._bitLength),u=Math.max(a[g].length,u),u=Math.max(a[x].length,u);continue}var S=[r[g],null,null,r[x]];r[g].y.cmp(r[x].y)===0?(S[1]=r[g].add(r[x]),S[2]=r[g].toJ().mixedAdd(r[x].neg())):r[g].y.cmp(r[x].y.redNeg())===0?(S[1]=r[g].toJ().mixedAdd(r[x]),S[2]=r[g].add(r[x].neg())):(S[1]=r[g].toJ().mixedAdd(r[x]),S[2]=r[g].toJ().mixedAdd(r[x].neg()));var E=[-3,-1,-5,-7,0,7,5,1,3],w=H_(n[g],n[x]);for(u=Math.max(w[0].length,u),a[g]=new Array(u),a[x]=new Array(u),d=0;d=0;c--){for(var $=0;c>=0;){var q=!0;for(d=0;d=0&&$++,B=B.dblp($),c<0)break;for(d=0;d0?p=l[d][ne-1>>1]:ne<0&&(p=l[d][-ne-1>>1].neg()),p.type==="affine"?B=B.mixedAdd(p):B=B.add(p))}}for(c=0;c=Math.ceil((e.bitLength()+1)/r.step):!1};Mr.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,o=0;o=0&&(v=u,g=c),d.negative&&(d=d.neg(),p=p.neg()),v.negative&&(v=v.neg(),g=g.neg()),[{a:d,b:p},{a:v,b:g}]};Ir.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],o=i.b.mul(e).divRound(this.n),s=n.b.neg().mul(e).divRound(this.n),l=o.mul(n.a),a=s.mul(i.a),u=o.mul(n.b),c=s.mul(i.b),d=e.sub(l).sub(a),p=u.add(c).neg();return{k1:d,k2:p}};Ir.prototype.pointFromX=function(e,r){e=new ue(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var o=i.fromRed().isOdd();return(r&&!o||!r&&o)&&(i=i.redNeg()),this.point(e,i)};Ir.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),o=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(o).cmpn(0)===0};Ir.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,o=this._endoWnafT2,s=0;s":""};Pt.prototype.isInfinity=function(){return this.inf};Pt.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};Pt.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),s=o.redSqr().redISub(this.x.redAdd(this.x)),l=o.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,l)};Pt.prototype.getX=function(){return this.x.fromRed()};Pt.prototype.getY=function(){return this.y.fromRed()};Pt.prototype.mul=function(e){return e=new ue(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Pt.prototype.mulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o):this.curve._wnafMulAdd(1,i,o,2)};Pt.prototype.jmulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o,!0):this.curve._wnafMulAdd(1,i,o,2,!0)};Pt.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Pt.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(o){return o.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};Pt.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Ot(t,e,r,n){Hi.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new ue(0)):(this.x=new ue(e,16),this.y=new ue(r,16),this.z=new ue(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Mh(Ot,Hi.BasePoint);Ir.prototype.jpoint=function(e,r,n){return new Ot(this,e,r,n)};Ot.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};Ot.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Ot.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),o=e.x.redMul(n),s=this.y.redMul(r.redMul(e.z)),l=e.y.redMul(n.redMul(this.z)),a=i.redSub(o),u=s.redSub(l);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),d=c.redMul(a),p=i.redMul(c),v=u.redSqr().redIAdd(d).redISub(p).redISub(p),g=u.redMul(p.redISub(v)).redISub(s.redMul(d)),x=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(v,g,x)};Ot.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),o=this.y,s=e.y.redMul(r).redMul(this.z),l=n.redSub(i),a=o.redSub(s);if(l.cmpn(0)===0)return a.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=l.redSqr(),c=u.redMul(l),d=n.redMul(u),p=a.redSqr().redIAdd(c).redISub(d).redISub(d),v=a.redMul(d.redISub(p)).redISub(o.redMul(c)),g=this.z.redMul(l);return this.curve.jpoint(p,v,g)};Ot.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(o),this.x.cmp(n)===0)return!0}};Ot.prototype.inspect=function(){return this.isInfinity()?"":""};Ot.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var ga=Ko(function(t,e){var r=e;r.base=Hi,r.short=W_,r.mont=null,r.edwards=null}),va=Ko(function(t,e){var r=e,n=yr.assert;function i(l){l.type==="short"?this.curve=new ga.short(l):l.type==="edwards"?this.curve=new ga.edwards(l):this.curve=new ga.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function o(l,a){Object.defineProperty(r,l,{configurable:!0,enumerable:!0,get:function(){var u=new i(a);return Object.defineProperty(r,l,{configurable:!0,enumerable:!0,value:u}),u}})}o("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:en.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:en.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:en.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:en.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),o("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:en.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:en.sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:en.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var s;try{s=null.crash()}catch{s=void 0}o("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:en.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",s]})});function gi(t){if(!(this instanceof gi))return new gi(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Hr.toArray(t.entropy,t.entropyEnc||"hex"),r=Hr.toArray(t.nonce,t.nonceEnc||"hex"),n=Hr.toArray(t.pers,t.persEnc||"hex");Ch(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Xy=gi;gi.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};gi.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Hr.toArray(n,i||"hex"),this._update(n));for(var o=[];o.length"};var G_=yr.assert;function ju(t,e){if(t instanceof ju)return t;this._importDER(t,e)||(G_(t.r&&t.s,"Signature without r or s"),this.r=new ue(t.r,16),this.s=new ue(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Uu=ju;function V_(){this.place=0}function Gc(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,o=0,s=e.place;o>>=0;return i<=127?!1:(e.place=s,i)}function Rp(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}ju.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=Rp(r),n=Rp(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Vc(i,r.length),i=i.concat(r),i.push(2),Vc(i,n.length);var o=i.concat(n),s=[48];return Vc(s,o.length),s=s.concat(o),yr.encode(s,e)};var K_=function(){throw new Error("unsupported")},Zy=yr.assert;function Cr(t){if(!(this instanceof Cr))return new Cr(t);typeof t=="string"&&(Zy(Object.prototype.hasOwnProperty.call(va,t),"Unknown curve "+t),t=va[t]),t instanceof va.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Q_=Cr;Cr.prototype.keyPair=function(e){return new Ih(this,e)};Cr.prototype.keyFromPrivate=function(e,r){return Ih.fromPrivate(this,e,r)};Cr.prototype.keyFromPublic=function(e,r){return Ih.fromPublic(this,e,r)};Cr.prototype.genKeyPair=function(e){e||(e={});for(var r=new Xy({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||K_(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new ue(2));;){var o=new ue(r.generate(n));if(!(o.cmp(i)>0))return o.iaddn(1),this.keyFromPrivate(o)}};Cr.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};Cr.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new ue(e,16));for(var o=this.n.byteLength(),s=r.getPrivate().toArray("be",o),l=e.toArray("be",o),a=new Xy({hash:this.hash,entropy:s,nonce:l,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new ue(1)),c=0;;c++){var d=i.k?i.k(c):new ue(a.generate(this.n.byteLength()));if(d=this._truncateToN(d,!0),!(d.cmpn(1)<=0||d.cmp(u)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var v=p.getX(),g=v.umod(this.n);if(g.cmpn(0)!==0){var x=d.invm(this.n).mul(g.mul(r.getPrivate()).iadd(e));if(x=x.umod(this.n),x.cmpn(0)!==0){var S=(p.getY().isOdd()?1:0)|(v.cmp(g)!==0?2:0);return i.canonical&&x.cmp(this.nh)>0&&(x=this.n.sub(x),S^=1),new Uu({r:g,s:x,recoveryParam:S})}}}}}};Cr.prototype.verify=function(e,r,n,i){e=this._truncateToN(new ue(e,16)),n=this.keyFromPublic(n,i),r=new Uu(r,"hex");var o=r.r,s=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var l=s.invm(this.n),a=l.mul(e).umod(this.n),u=l.mul(o).umod(this.n),c;return this.curve._maxwellTrick?(c=this.g.jmulAdd(a,n.getPublic(),u),c.isInfinity()?!1:c.eqXToP(o)):(c=this.g.mulAdd(a,n.getPublic(),u),c.isInfinity()?!1:c.getX().umod(this.n).cmp(o)===0)};Cr.prototype.recoverPubKey=function(t,e,r,n){Zy((3&r)===r,"The recovery param is more than two bits"),e=new Uu(e,n);var i=this.n,o=new ue(t),s=e.r,l=e.s,a=r&1,u=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?s=this.curve.pointFromX(s.add(this.curve.n),a):s=this.curve.pointFromX(s,a);var c=e.r.invm(i),d=i.sub(o).mul(c).umod(i),p=l.mul(c).umod(i);return this.g.mulAdd(d,s,p)};Cr.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Uu(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch{continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var J_=Ko(function(t,e){var r=e;r.version="6.5.4",r.utils=yr,r.rand=function(){throw new Error("unsupported")},r.curve=ga,r.curves=va,r.ec=Q_,r.eddsa=null}),Y_=J_.ec;const X_="signing-key/5.7.0",hd=new T(X_);let Kc=null;function rn(){return Kc||(Kc=new Y_("secp256k1")),Kc}class Z_{constructor(e){z(this,"curve","secp256k1"),z(this,"privateKey",te(e)),On(this.privateKey)!==32&&hd.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=rn().keyFromPrivate(oe(this.privateKey));z(this,"publicKey","0x"+r.getPublic(!1,"hex")),z(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),z(this,"_isSigningKey",!0)}_addPoint(e){const r=rn().keyFromPublic(oe(this.publicKey)),n=rn().keyFromPublic(oe(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=rn().keyFromPrivate(oe(this.privateKey)),n=oe(e);n.length!==32&&hd.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Ou({recoveryParam:i.recoveryParam,r:pt("0x"+i.r.toString(16),32),s:pt("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=rn().keyFromPrivate(oe(this.privateKey)),n=rn().keyFromPublic(oe(e1(e)));return pt("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function e3(t,e){const r=Ou(e),n={r:oe(r.r),s:oe(r.s)};return"0x"+rn().recoverPubKey(oe(t),n,r.recoveryParam).encode("hex",!1)}function e1(t,e){const r=oe(t);if(r.length===32){const n=new Z_(r);return e?"0x"+rn().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return e?te(r):"0x"+rn().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+rn().keyFromPublic(r).getPublic(!0,"hex"):te(r)}return hd.throwArgumentError("invalid public or private key","key","[REDACTED]")}const t3="transactions/5.7.0",Un=new T(t3);var Tp;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(Tp||(Tp={}));function Rh(t){return t==="0x"?null:mt(t)}function jt(t){return t==="0x"?gy:V.from(t)}function r3(t){const e=e1(t);return mt(It(ut(It(e,1)),12))}function t1(t,e){return r3(e3(oe(t),e))}function ur(t,e){const r=Ro(V.from(t).toHexString());return r.length>32&&Un.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function Qc(t,e){return{address:mt(t),storageKeys:(e||[]).map((r,n)=>(On(r)!==32&&Un.throwArgumentError("invalid access list storageKey",`accessList[${t}:${n}]`,r),r.toLowerCase()))}}function qi(t){if(Array.isArray(t))return t.map((r,n)=>Array.isArray(r)?(r.length>2&&Un.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${n}]`,r),Qc(r[0],r[1])):Qc(r.address,r.storageKeys));const e=Object.keys(t).map(r=>{const n=t[r].reduce((i,o)=>(i[o]=!0,i),{});return Qc(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function r1(t){return qi(t).map(e=>[e.address,e.storageKeys])}function n3(t,e){if(t.gasPrice!=null){const n=V.from(t.gasPrice),i=V.from(t.maxFeePerGas||0);n.eq(i)||Un.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:n,maxFeePerGas:i})}const r=[ur(t.chainId||0,"chainId"),ur(t.nonce||0,"nonce"),ur(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ur(t.maxFeePerGas||0,"maxFeePerGas"),ur(t.gasLimit||0,"gasLimit"),t.to!=null?mt(t.to):"0x",ur(t.value||0,"value"),t.data||"0x",r1(t.accessList||[])];if(e){const n=Ou(e);r.push(ur(n.recoveryParam,"recoveryParam")),r.push(Ro(n.r)),r.push(Ro(n.s))}return Xt(["0x02",Lu(r)])}function i3(t,e){const r=[ur(t.chainId||0,"chainId"),ur(t.nonce||0,"nonce"),ur(t.gasPrice||0,"gasPrice"),ur(t.gasLimit||0,"gasLimit"),t.to!=null?mt(t.to):"0x",ur(t.value||0,"value"),t.data||"0x",r1(t.accessList||[])];if(e){const n=Ou(e);r.push(ur(n.recoveryParam,"recoveryParam")),r.push(Ro(n.r)),r.push(Ro(n.s))}return Xt(["0x01",Lu(r)])}function n1(t,e,r){try{const n=jt(e[0]).toNumber();if(n!==0&&n!==1)throw new Error("bad recid");t.v=n}catch{Un.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=pt(e[1],32),t.s=pt(e[2],32);try{const n=ut(r(t));t.from=t1(n,{r:t.r,s:t.s,recoveryParam:t.v})}catch{}}function o3(t){const e=Sh(t.slice(1));e.length!==9&&e.length!==12&&Un.throwArgumentError("invalid component count for transaction type: 2","payload",te(t));const r=jt(e[2]),n=jt(e[3]),i={type:2,chainId:jt(e[0]).toNumber(),nonce:jt(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:jt(e[4]),to:Rh(e[5]),value:jt(e[6]),data:e[7],accessList:qi(e[8])};return e.length===9||(i.hash=ut(t),n1(i,e.slice(9),n3)),i}function s3(t){const e=Sh(t.slice(1));e.length!==8&&e.length!==11&&Un.throwArgumentError("invalid component count for transaction type: 1","payload",te(t));const r={type:1,chainId:jt(e[0]).toNumber(),nonce:jt(e[1]).toNumber(),gasPrice:jt(e[2]),gasLimit:jt(e[3]),to:Rh(e[4]),value:jt(e[5]),data:e[6],accessList:qi(e[7])};return e.length===8||(r.hash=ut(t),n1(r,e.slice(8),i3)),r}function l3(t){const e=Sh(t);e.length!==9&&e.length!==6&&Un.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:jt(e[0]).toNumber(),gasPrice:jt(e[1]),gasLimit:jt(e[2]),to:Rh(e[3]),value:jt(e[4]),data:e[5],chainId:0};if(e.length===6)return r;try{r.v=V.from(e[6]).toNumber()}catch{return r}if(r.r=pt(e[7],32),r.s=pt(e[8],32),V.from(r.r).isZero()&&V.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=e.slice(0,6);r.chainId!==0&&(i.push(te(r.chainId)),i.push("0x"),i.push("0x"),n-=r.chainId*2+8);const o=ut(Lu(i));try{r.from=t1(o,{r:te(r.r),s:te(r.s),recoveryParam:n})}catch{}r.hash=ut(t)}return r.type=null,r}function a3(t){const e=oe(t);if(e[0]>127)return l3(e);switch(e[0]){case 1:return s3(e);case 2:return o3(e)}return Un.throwError(`unsupported transaction type: ${e[0]}`,T.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const u3="contracts/5.7.0";var Ui=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const gt=new T(u3);function tu(t,e){return Ui(this,void 0,void 0,function*(){const r=yield e;typeof r!="string"&>.throwArgumentError("invalid address or ENS name","name",r);try{return mt(r)}catch{}t||gt.throwError("a provider or signer is needed to resolve ENS names",T.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield t.resolveName(r);return n==null&>.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n})}function ya(t,e,r){return Ui(this,void 0,void 0,function*(){return Array.isArray(r)?yield Promise.all(r.map((n,i)=>ya(t,Array.isArray(e)?e[i]:e[n.name],n))):r.type==="address"?yield tu(t,e):r.type==="tuple"?yield ya(t,e,r.components):r.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(n=>ya(t,n,r.arrayChildren))):Promise.reject(gt.makeError("invalid value for array",T.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function Fu(t,e,r){return Ui(this,void 0,void 0,function*(){let n={};r.length===e.inputs.length+1&&typeof r[r.length-1]=="object"&&(n=it(r.pop())),gt.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?n.from?n.from=yt({override:tu(t.signer,n.from),signer:t.signer.getAddress()}).then(u=>Ui(this,void 0,void 0,function*(){return mt(u.signer)!==u.override&>.throwError("Contract with a Signer cannot override from",T.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),u.override})):n.from=t.signer.getAddress():n.from&&(n.from=tu(t.provider,n.from));const i=yield yt({args:ya(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:yt(n)||{}}),o=t.interface.encodeFunctionData(e,i.args),s={data:o,to:i.address},l=i.overrides;if(l.nonce!=null&&(s.nonce=V.from(l.nonce).toNumber()),l.gasLimit!=null&&(s.gasLimit=V.from(l.gasLimit)),l.gasPrice!=null&&(s.gasPrice=V.from(l.gasPrice)),l.maxFeePerGas!=null&&(s.maxFeePerGas=V.from(l.maxFeePerGas)),l.maxPriorityFeePerGas!=null&&(s.maxPriorityFeePerGas=V.from(l.maxPriorityFeePerGas)),l.from!=null&&(s.from=l.from),l.type!=null&&(s.type=l.type),l.accessList!=null&&(s.accessList=qi(l.accessList)),s.gasLimit==null&&e.gas!=null){let u=21e3;const c=oe(o);for(let d=0;dn[u]!=null);return a.length&>.throwError(`cannot override ${a.map(u=>JSON.stringify(u)).join(",")}`,T.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:a}),s})}function c3(t,e){return function(...r){return Fu(t,e,r)}}function f3(t,e){const r=t.signer||t.provider;return function(...n){return Ui(this,void 0,void 0,function*(){r||gt.throwError("estimate require a provider or signer",T.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield Fu(t,e,n);return yield r.estimateGas(i)})}}function d3(t,e){const r=e.wait.bind(e);e.wait=n=>r(n).then(i=>(i.events=i.logs.map(o=>{let s=nr(o),l=null;try{l=t.interface.parseLog(o)}catch{}return l&&(s.args=l.args,s.decode=(a,u)=>t.interface.decodeEventLog(l.eventFragment,a,u),s.event=l.name,s.eventSignature=l.signature),s.removeListener=()=>t.provider,s.getBlock=()=>t.provider.getBlock(i.blockHash),s.getTransaction=()=>t.provider.getTransaction(i.transactionHash),s.getTransactionReceipt=()=>Promise.resolve(i),s}),i))}function i1(t,e,r){const n=t.signer||t.provider;return function(...i){return Ui(this,void 0,void 0,function*(){let o;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const a=it(i.pop());a.blockTag!=null&&(o=yield a.blockTag),delete a.blockTag,i.push(a)}t.deployTransaction!=null&&(yield t._deployed(o));const s=yield Fu(t,e,i),l=yield n.call(s,o);try{let a=t.interface.decodeFunctionResult(e,l);return r&&e.outputs.length===1&&(a=a[0]),a}catch(a){throw a.code===T.errors.CALL_EXCEPTION&&(a.address=t.address,a.args=i,a.transaction=s),a}})}}function h3(t,e){return function(...r){return Ui(this,void 0,void 0,function*(){t.signer||gt.throwError("sending a transaction requires a signer",T.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),t.deployTransaction!=null&&(yield t._deployed());const n=yield Fu(t,e,r),i=yield t.signer.sendTransaction(n);return d3(t,i),i})}}function Op(t,e,r){return e.constant?i1(t,e,r):h3(t,e)}function o1(t){return t.address&&(t.topics==null||t.topics.length===0)?"*":(t.address||"*")+"@"+(t.topics?t.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):"")}class il{constructor(e,r){z(this,"tag",e),z(this,"filter",r),this._listeners=[]}addListener(e,r){this._listeners.push({listener:e,once:r})}removeListener(e){let r=!1;this._listeners=this._listeners.filter(n=>r||n.listener!==e?!0:(r=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){const r=this.listenerCount();return this._listeners=this._listeners.filter(n=>{const i=e.slice();return setTimeout(()=>{n.listener.apply(this,i)},0),!n.once}),r}prepareEvent(e){}getEmit(e){return[e]}}class p3 extends il{constructor(){super("error",null)}}class Lp extends il{constructor(e,r,n,i){const o={address:e};let s=r.getEventTopic(n);i?(s!==i[0]&>.throwArgumentError("topic mismatch","topics",i),o.topics=i.slice()):o.topics=[s],super(o1(o),o),z(this,"address",e),z(this,"interface",r),z(this,"fragment",n)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(r,n)=>this.interface.decodeEventLog(this.fragment,r,n);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(r){e.args=null,e.decodeError=r}}getEmit(e){const r=Gx(e.args);if(r.length)throw r[0].error;const n=(e.args||[]).slice();return n.push(e),n}}class Bp extends il{constructor(e,r){super("*",{address:e}),z(this,"address",e),z(this,"interface",r)}prepareEvent(e){super.prepareEvent(e);try{const r=this.interface.parseLog(e);e.event=r.name,e.eventSignature=r.signature,e.decode=(n,i)=>this.interface.decodeEventLog(r.eventFragment,n,i),e.args=r.args}catch{}}}class m3{constructor(e,r,n){z(this,"interface",fr(new.target,"getInterface")(r)),n==null?(z(this,"provider",null),z(this,"signer",null)):El.isSigner(n)?(z(this,"provider",n.provider||null),z(this,"signer",n)):qo.isProvider(n)?(z(this,"provider",n),z(this,"signer",null)):gt.throwArgumentError("invalid signer or provider","signerOrProvider",n),z(this,"callStatic",{}),z(this,"estimateGas",{}),z(this,"functions",{}),z(this,"populateTransaction",{}),z(this,"filters",{});{const s={};Object.keys(this.interface.events).forEach(l=>{const a=this.interface.events[l];z(this.filters,l,(...u)=>({address:this.address,topics:this.interface.encodeFilterTopics(a,u)})),s[a.name]||(s[a.name]=[]),s[a.name].push(l)}),Object.keys(s).forEach(l=>{const a=s[l];a.length===1?z(this.filters,l,this.filters[a[0]]):gt.warn(`Duplicate definition of ${l} (${a.join(", ")})`)})}if(z(this,"_runningEvents",{}),z(this,"_wrappedEmits",{}),e==null&>.throwArgumentError("invalid contract address or ENS name","addressOrName",e),z(this,"address",e),this.provider)z(this,"resolvedAddress",tu(this.provider,e));else try{z(this,"resolvedAddress",Promise.resolve(mt(e)))}catch{gt.throwError("provider is required to use ENS name as contract address",T.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(s=>{});const i={},o={};Object.keys(this.interface.functions).forEach(s=>{const l=this.interface.functions[s];if(o[s]){gt.warn(`Duplicate ABI entry for ${JSON.stringify(s)}`);return}o[s]=!0;{const a=l.name;i[`%${a}`]||(i[`%${a}`]=[]),i[`%${a}`].push(s)}this[s]==null&&z(this,s,Op(this,l,!0)),this.functions[s]==null&&z(this.functions,s,Op(this,l,!1)),this.callStatic[s]==null&&z(this.callStatic,s,i1(this,l,!0)),this.populateTransaction[s]==null&&z(this.populateTransaction,s,c3(this,l)),this.estimateGas[s]==null&&z(this.estimateGas,s,f3(this,l))}),Object.keys(i).forEach(s=>{const l=i[s];if(l.length>1)return;s=s.substring(1);const a=l[0];try{this[s]==null&&z(this,s,this[a])}catch{}this.functions[s]==null&&z(this.functions,s,this.functions[a]),this.callStatic[s]==null&&z(this.callStatic,s,this.callStatic[a]),this.populateTransaction[s]==null&&z(this.populateTransaction,s,this.populateTransaction[a]),this.estimateGas[s]==null&&z(this.estimateGas,s,this.estimateGas[a])})}static getContractAddress(e){return Nh(e)}static getInterface(e){return ad.isInterface(e)?e:new ad(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(r=>(r==="0x"&>.throwError("contract not deployed",T.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||gt.throwError("sending a transactions require a signer",T.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const r=it(e||{});return["from","to"].forEach(function(n){r[n]!=null&>.throwError("cannot override "+n,T.errors.UNSUPPORTED_OPERATION,{operation:n})}),r.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(r))}connect(e){typeof e=="string"&&(e=new Ph(e,this.provider));const r=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&z(r,"deployTransaction",this.deployTransaction),r}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return ld.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if(typeof e=="string"){if(e==="error")return this._normalizeRunningEvent(new p3);if(e==="event")return this._normalizeRunningEvent(new il("event",null));if(e==="*")return this._normalizeRunningEvent(new Bp(this.address,this.interface));const r=this.interface.getEvent(e);return this._normalizeRunningEvent(new Lp(this.address,this.interface,r))}if(e.topics&&e.topics.length>0){try{const n=e.topics[0];if(typeof n!="string")throw new Error("invalid topic");const i=this.interface.getEvent(n);return this._normalizeRunningEvent(new Lp(this.address,this.interface,i,e.topics))}catch{}const r={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new il(o1(r),r))}return this._normalizeRunningEvent(new Bp(this.address,this.interface))}_checkRunningEvents(e){if(e.listenerCount()===0){delete this._runningEvents[e.tag];const r=this._wrappedEmits[e.tag];r&&e.filter&&(this.provider.off(e.filter,r),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,r,n){const i=nr(r);return i.removeListener=()=>{n&&(e.removeListener(n),this._checkRunningEvents(e))},i.getBlock=()=>this.provider.getBlock(r.blockHash),i.getTransaction=()=>this.provider.getTransaction(r.transactionHash),i.getTransactionReceipt=()=>this.provider.getTransactionReceipt(r.transactionHash),e.prepareEvent(i),i}_addEventListener(e,r,n){if(this.provider||gt.throwError("events require a provider or a signer with a provider",T.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(r,n),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const i=o=>{let s=this._wrapEvent(e,o,r);if(s.decodeError==null)try{const l=e.getEmit(s);this.emit(e.filter,...l)}catch(l){s.decodeError=l.error}e.filter!=null&&this.emit("event",s),s.decodeError!=null&&this.emit("error",s.decodeError,s)};this._wrappedEmits[e.tag]=i,e.filter!=null&&this.provider.on(e.filter,i)}}queryFilter(e,r,n){const i=this._getRunningEvent(e),o=it(i.filter);return typeof r=="string"&&pe(r,32)?(n!=null&>.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),o.blockHash=r):(o.fromBlock=r??0,o.toBlock=n??"latest"),this.provider.getLogs(o).then(s=>s.map(l=>this._wrapEvent(i,l,null)))}on(e,r){return this._addEventListener(this._getRunningEvent(e),r,!1),this}once(e,r){return this._addEventListener(this._getRunningEvent(e),r,!0),this}emit(e,...r){if(!this.provider)return!1;const n=this._getRunningEvent(e),i=n.run(r)>0;return this._checkRunningEvents(n),i}listenerCount(e){return this.provider?e==null?Object.keys(this._runningEvents).reduce((r,n)=>r+this._runningEvents[n].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(e==null){const r=[];for(let n in this._runningEvents)this._runningEvents[n].listeners().forEach(i=>{r.push(i)});return r}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(e==null){for(const n in this._runningEvents){const i=this._runningEvents[n];i.removeAllListeners(),this._checkRunningEvents(i)}return this}const r=this._getRunningEvent(e);return r.removeAllListeners(),this._checkRunningEvents(r),this}off(e,r){if(!this.provider)return this;const n=this._getRunningEvent(e);return n.removeListener(r),this._checkRunningEvents(n),this}removeListener(e,r){return this.off(e,r)}}class g3 extends m3{}class s1{constructor(e){z(this,"alphabet",e),z(this,"base",e.length),z(this,"_alphabetMap",{}),z(this,"_leader",e.charAt(0));for(let r=0;r0;)n.push(s%this.base),s=s/this.base|0}let i="";for(let o=0;r[o]===0&&o=0;--o)i+=this.alphabet[n[o]];return i}decode(e){if(typeof e!="string")throw new TypeError("Expected String");let r=[];if(e.length===0)return new Uint8Array(r);r.push(0);for(let n=0;n>=8;for(;o>0;)r.push(o&255),o>>=8}for(let n=0;e[n]===this._leader&&n0;e--){const r=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[r],t[r]=n}return t}const y3="networks/5.7.1",jp=new T(y3);function w3(t){return t&&typeof t.renetwork=="function"}function bn(t){const e=function(r,n){n==null&&(n={});const i=[];if(r.InfuraProvider&&n.infura!=="-")try{i.push(new r.InfuraProvider(t,n.infura))}catch{}if(r.EtherscanProvider&&n.etherscan!=="-")try{i.push(new r.EtherscanProvider(t,n.etherscan))}catch{}if(r.AlchemyProvider&&n.alchemy!=="-")try{i.push(new r.AlchemyProvider(t,n.alchemy))}catch{}if(r.PocketProvider&&n.pocket!=="-"){const o=["goerli","ropsten","rinkeby","sepolia"];try{const s=new r.PocketProvider(t,n.pocket);s.network&&o.indexOf(s.network.name)===-1&&i.push(s)}catch{}}if(r.CloudflareProvider&&n.cloudflare!=="-")try{i.push(new r.CloudflareProvider(t))}catch{}if(r.AnkrProvider&&n.ankr!=="-")try{const o=["ropsten"],s=new r.AnkrProvider(t,n.ankr);s.network&&o.indexOf(s.network.name)===-1&&i.push(s)}catch{}if(i.length===0)return null;if(r.FallbackProvider){let o=1;return n.quorum!=null?o=n.quorum:t==="homestead"&&(o=2),new r.FallbackProvider(i,o)}return i[0]};return e.renetwork=function(r){return bn(r)},e}function ru(t,e){const r=function(n,i){return n.JsonRpcProvider?new n.JsonRpcProvider(t,e):null};return r.renetwork=function(n){return ru(t,n)},r}const Up={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:bn("homestead")},Fp={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:bn("ropsten")},zp={chainId:63,name:"classicMordor",_defaultProvider:ru("https://www.ethercluster.com/mordor","classicMordor")},Wl={unspecified:{chainId:0,name:"unspecified"},homestead:Up,mainnet:Up,morden:{chainId:2,name:"morden"},ropsten:Fp,testnet:Fp,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:bn("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:bn("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:bn("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:bn("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:ru("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:zp,classicTestnet:zp,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:ru("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:bn("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:bn("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function Th(t){if(t==null)return null;if(typeof t=="number"){for(const n in Wl){const i=Wl[n];if(i.chainId===t)return{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress||null,_defaultProvider:i._defaultProvider||null}}return{chainId:t,name:"unknown"}}if(typeof t=="string"){const n=Wl[t];return n==null?null:{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress,_defaultProvider:n._defaultProvider||null}}const e=Wl[t.name];if(!e)return typeof t.chainId!="number"&&jp.throwArgumentError("invalid network chainId","network",t),t;t.chainId!==0&&t.chainId!==e.chainId&&jp.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;return r==null&&e._defaultProvider&&(w3(e._defaultProvider)?r=e._defaultProvider.renetwork(t):r=e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}const E3="web/5.7.1";var x3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};function A3(t,e){return x3(this,void 0,void 0,function*(){e==null&&(e={});const r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};if(e.skipFetchSetup!==!0&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),e.fetchOptions!=null){const s=e.fetchOptions;s.mode&&(r.mode=s.mode),s.cache&&(r.cache=s.cache),s.credentials&&(r.credentials=s.credentials),s.redirect&&(r.redirect=s.redirect),s.referrer&&(r.referrer=s.referrer)}const n=yield fetch(t,r),i=yield n.arrayBuffer(),o={};return n.headers.forEach?n.headers.forEach((s,l)=>{o[l.toLowerCase()]=s}):n.headers.keys().forEach(s=>{o[s.toLowerCase()]=n.headers.get(s)}),{headers:o,statusCode:n.status,statusMessage:n.statusText,body:oe(new Uint8Array(i))}})}var b3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Br=new T(E3);function $p(t){return new Promise(e=>{setTimeout(e,t)})}function Qn(t,e){if(t==null)return null;if(typeof t=="string")return t;if(bh(t)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return wl(t)}catch{}return te(t)}return t}function _3(t){return mr(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function S3(t,e,r){const n=typeof t=="object"&&t.throttleLimit!=null?t.throttleLimit:12;Br.assertArgument(n>0&&n%1===0,"invalid connection throttle limit","connection.throttleLimit",n);const i=typeof t=="object"?t.throttleCallback:null,o=typeof t=="object"&&typeof t.throttleSlotInterval=="number"?t.throttleSlotInterval:100;Br.assertArgument(o>0&&o%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const s=typeof t=="object"?!!t.errorPassThrough:!1,l={};let a=null;const u={method:"GET"};let c=!1,d=2*60*1e3;if(typeof t=="string")a=t;else if(typeof t=="object"){if((t==null||t.url==null)&&Br.throwArgumentError("missing URL","connection.url",t),a=t.url,typeof t.timeout=="number"&&t.timeout>0&&(d=t.timeout),t.headers)for(const E in t.headers)l[E.toLowerCase()]={key:E,value:String(t.headers[E])},["if-none-match","if-modified-since"].indexOf(E.toLowerCase())>=0&&(c=!0);if(u.allowGzip=!!t.allowGzip,t.user!=null&&t.password!=null){a.substring(0,6)!=="https:"&&t.allowInsecureAuthentication!==!0&&Br.throwError("basic authentication requires a secure https url",T.errors.INVALID_ARGUMENT,{argument:"url",url:a,user:t.user,password:"[REDACTED]"});const E=t.user+":"+t.password;l.authorization={key:"Authorization",value:"Basic "+Ay(mr(E))}}t.skipFetchSetup!=null&&(u.skipFetchSetup=!!t.skipFetchSetup),t.fetchOptions!=null&&(u.fetchOptions=it(t.fetchOptions))}const p=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),v=a?a.match(p):null;if(v)try{const E={statusCode:200,statusMessage:"OK",headers:{"content-type":v[1]||"text/plain"},body:v[2]?xy(v[3]):_3(v[3])};let w=E.body;return r&&(w=r(E.body,E)),Promise.resolve(w)}catch(E){Br.throwError("processing response error",T.errors.SERVER_ERROR,{body:Qn(v[1],v[2]),error:E,requestBody:null,requestMethod:"GET",url:a})}e&&(u.method="POST",u.body=e,l["content-type"]==null&&(l["content-type"]={key:"Content-Type",value:"application/octet-stream"}),l["content-length"]==null&&(l["content-length"]={key:"Content-Length",value:String(e.length)}));const g={};Object.keys(l).forEach(E=>{const w=l[E];g[w.key]=w.value}),u.headers=g;const x=function(){let E=null;return{promise:new Promise(function(O,B){d&&(E=setTimeout(()=>{E!=null&&(E=null,B(Br.makeError("timeout",T.errors.TIMEOUT,{requestBody:Qn(u.body,g["content-type"]),requestMethod:u.method,timeout:d,url:a})))},d))}),cancel:function(){E!=null&&(clearTimeout(E),E=null)}}}(),S=function(){return b3(this,void 0,void 0,function*(){for(let E=0;E=300)&&(x.cancel(),Br.throwError("bad response",T.errors.SERVER_ERROR,{status:w.statusCode,headers:w.headers,body:Qn(_,w.headers?w.headers["content-type"]:null),requestBody:Qn(u.body,g["content-type"]),requestMethod:u.method,url:a})),r)try{const O=yield r(_,w);return x.cancel(),O}catch(O){if(O.throttleRetry&&E{let l=null;if(o!=null)try{l=JSON.parse(wl(o))}catch(a){Br.throwError("invalid JSON",T.errors.SERVER_ERROR,{body:o,error:a})}return r&&(l=r(l,s)),l},i=null;if(e!=null){i=mr(e);const o=typeof t=="string"?{url:t}:it(t);o.headers?Object.keys(o.headers).filter(l=>l.toLowerCase()==="content-type").length!==0||(o.headers=it(o.headers),o.headers["content-type"]="application/json"):o.headers={"content-type":"application/json"},t=o}return S3(t,i,n)}function ho(t,e){return e||(e={}),e=it(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(r,n){let i=null,o=!1;const s=()=>o?!1:(o=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout(()=>{s()&&n(new Error("timeout"))},e.timeout));const l=e.retryLimit;let a=0;function u(){return t().then(function(c){if(c!==void 0)s()&&r(c);else if(e.oncePoll)e.oncePoll.once("poll",u);else if(e.onceBlock)e.onceBlock.once("block",u);else if(!o){if(a++,a>l){s()&&n(new Error("retry limit reached"));return}let d=e.interval*parseInt(String(Math.random()*Math.pow(2,a)));de.ceiling&&(d=e.ceiling),setTimeout(u,d)}return null},function(c){s()&&n(c)})}u()})}var nu="qpzry9x8gf2tvdw0s3jn54khce6mua7l",md={};for(var Gl=0;Gl>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function l1(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=bo(e)^n>>5}for(e=bo(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=l1(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",o=0;o>5)throw new Error("Non 5-bit word");n=bo(n)^s,i+=nu.charAt(s)}for(o=0;o<6;++o)n=bo(n);for(n^=1,o=0;o<6;++o){var l=n>>(5-o)*5&31;i+=nu.charAt(l)}return i}function a1(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var o=t.slice(0,i),s=t.slice(i+1);if(s.length<6)return"Data too short";var l=l1(o);if(typeof l=="string")return l;for(var a=[],u=0;u=s.length)&&a.push(d)}return l!==1?"Invalid checksum for "+t:{prefix:o,words:a}}function N3(){var t=a1.apply(null,arguments);if(typeof t=="object")return t}function P3(t){var e=a1.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function zu(t,e,r,n){for(var i=0,o=0,s=(1<=r;)o-=r,l.push(i>>o&s);if(n)o>0&&l.push(i<=e)return"Excess padding";if(i<this.data(d,!0);return e.transaction={hash:s,type:u,accessList:Z.allowNull(this.accessList.bind(this),null),blockHash:Z.allowNull(s,null),blockNumber:Z.allowNull(a,null),transactionIndex:Z.allowNull(a,null),confirmations:Z.allowNull(a,null),from:r,gasPrice:Z.allowNull(n),maxPriorityFeePerGas:Z.allowNull(n),maxFeePerGas:Z.allowNull(n),gasLimit:n,to:Z.allowNull(r,null),value:n,nonce:a,data:o,r:Z.allowNull(this.uint256),s:Z.allowNull(this.uint256),v:Z.allowNull(a),creates:Z.allowNull(r,null),raw:Z.allowNull(o)},e.transactionRequest={from:Z.allowNull(r),nonce:Z.allowNull(a),gasLimit:Z.allowNull(n),gasPrice:Z.allowNull(n),maxPriorityFeePerGas:Z.allowNull(n),maxFeePerGas:Z.allowNull(n),to:Z.allowNull(r),value:Z.allowNull(n),data:Z.allowNull(c),type:Z.allowNull(a),accessList:Z.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:s,address:r,topics:Z.arrayOf(s),data:o,logIndex:a,blockHash:s},e.receipt={to:Z.allowNull(this.address,null),from:Z.allowNull(this.address,null),contractAddress:Z.allowNull(r,null),transactionIndex:a,root:Z.allowNull(l),gasUsed:n,logsBloom:Z.allowNull(o),blockHash:s,transactionHash:s,logs:Z.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:Z.allowNull(a,null),cumulativeGasUsed:n,effectiveGasPrice:Z.allowNull(n),status:Z.allowNull(a),type:u},e.block={hash:Z.allowNull(s),parentHash:s,number:a,timestamp:a,nonce:Z.allowNull(l),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:Z.allowNull(r),extraData:o,transactions:Z.allowNull(Z.arrayOf(s)),baseFeePerGas:Z.allowNull(n)},e.blockWithTransactions=it(e.block),e.blockWithTransactions.transactions=Z.allowNull(Z.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:Z.allowNull(i,void 0),toBlock:Z.allowNull(i,void 0),blockHash:Z.allowNull(s,void 0),address:Z.allowNull(r,void 0),topics:Z.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:Z.allowNull(a),blockHash:Z.allowNull(s),transactionIndex:a,removed:Z.allowNull(this.boolean.bind(this)),address:r,data:Z.allowFalsish(o,"0x"),topics:Z.arrayOf(s),transactionHash:s,logIndex:a},e}accessList(e){return qi(e||[])}number(e){return e==="0x"?0:V.from(e).toNumber()}type(e){return e==="0x"||e==null?0:V.from(e).toNumber()}bigNumber(e){return V.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,r){return typeof e=="string"&&(!r&&e.substring(0,2)!=="0x"&&(e="0x"+e),pe(e))?e.toLowerCase():ss.throwArgumentError("invalid hash","value",e)}data(e,r){const n=this.hex(e,r);if(n.length%2!==0)throw new Error("invalid data; odd-length - "+e);return n}address(e){return mt(e)}callAddress(e){if(!pe(e,32))return null;const r=mt(It(e,12));return r===cA?null:r}contractAddress(e){return Nh(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||pe(e))return Tu(e);throw new Error("invalid blockTag")}hash(e,r){const n=this.hex(e,r);return On(n)!==32?ss.throwArgumentError("invalid hash","value",e):n}difficulty(e){if(e==null)return null;const r=V.from(e);try{return r.toNumber()}catch{}return null}uint256(e){if(!pe(e))throw new Error("invalid uint256");return pt(e,32)}_block(e,r){e.author!=null&&e.miner==null&&(e.miner=e.author);const n=e._difficulty!=null?e._difficulty:e.difficulty,i=Z.check(r,e);return i._difficulty=n==null?null:V.from(n),i}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return Z.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&V.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);const r=Z.check(this.formats.transaction,e);if(e.chainId!=null){let n=e.chainId;pe(n)&&(n=V.from(n).toNumber()),r.chainId=n}else{let n=e.networkId;n==null&&r.v==null&&(n=e.chainId),pe(n)&&(n=V.from(n).toNumber()),typeof n!="number"&&r.v!=null&&(n=(r.v-35)/2,n<0&&(n=0),n=parseInt(n)),typeof n!="number"&&(n=0),r.chainId=n}return r.blockHash&&r.blockHash.replace(/0/g,"")==="x"&&(r.blockHash=null),r}transaction(e){return a3(e)}receiptLog(e){return Z.check(this.formats.receiptLog,e)}receipt(e){const r=Z.check(this.formats.receipt,e);if(r.root!=null)if(r.root.length<=4){const n=V.from(r.root).toNumber();n===0||n===1?(r.status!=null&&r.status!==n&&ss.throwArgumentError("alt-root-status/status mismatch","value",{root:r.root,status:r.status}),r.status=n,delete r.root):ss.throwArgumentError("invalid alt-root-status","value.root",r.root)}else r.root.length!==66&&ss.throwArgumentError("invalid root hash","value.root",r.root);return r.status!=null&&(r.byzantium=!0),r}topics(e){return Array.isArray(e)?e.map(r=>this.topics(r)):e!=null?this.hash(e,!0):null}filter(e){return Z.check(this.formats.filter,e)}filterLog(e){return Z.check(this.formats.filterLog,e)}static check(e,r){const n={};for(const i in e)try{const o=e[i](r[i]);o!==void 0&&(n[i]=o)}catch(o){throw o.checkKey=i,o.checkValue=r[i],o}return n}static allowNull(e,r){return function(n){return n==null?r:e(n)}}static allowFalsish(e,r){return function(n){return n?e(n):r}}static arrayOf(e){return function(r){if(!Array.isArray(r))throw new Error("not an array");const n=[];return r.forEach(function(i){n.push(e(i))}),n}}}function u1(t){return t&&typeof t.isCommunityResource=="function"}function gd(t){return u1(t)&&t.isCommunityResource()}let qp=!1;function bl(){qp||(qp=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var ae=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const he=new T($t),O3=10;function Wp(t){return t==null?"null":(On(t)!==32&&he.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function Gp(t){for(t=t.slice();t.length>0&&t[t.length-1]==null;)t.pop();return t.map(e=>{if(Array.isArray(e)){const r={};e.forEach(i=>{r[Wp(i)]=!0});const n=Object.keys(r);return n.sort(),n.join("|")}else return Wp(e)}).join("&")}function L3(t){return t===""?[]:t.split(/&/g).map(e=>{if(e==="")return[];const r=e.split("|").map(n=>n==="null"?null:n);return r.length===1?r[0]:r})}function Gi(t){if(typeof t=="string"){if(t=t.toLowerCase(),On(t)===32)return"tx:"+t;if(t.indexOf(":")===-1)return t}else{if(Array.isArray(t))return"filter:*:"+Gp(t);if(fb.isForkEvent(t))throw he.warn("not implemented"),new Error("not implemented");if(t&&typeof t=="object")return"filter:"+(t.address||"*")+":"+Gp(t.topics||[])}throw new Error("invalid event - "+t)}function ls(){return new Date().getTime()}function Vp(t){return new Promise(e=>{setTimeout(e,t)})}const B3=["block","network","pending","poll"];class D3{constructor(e,r,n){z(this,"tag",e),z(this,"listener",r),z(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){const e=this.tag.split(":");if(e[0]!=="filter")return null;const r=e[1],n=L3(e[2]),i={};return n.length>0&&(i.topics=n),r&&r!=="*"&&(i.address=r),i}pollable(){return this.tag.indexOf(":")>=0||B3.indexOf(this.tag)>=0}}const j3={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Yc(t){return pt(V.from(t).toHexString(),32)}function Kp(t){return pd.encode(Ut([t,It(Dp(Dp(t)),0,4)]))}const c1=new RegExp("^(ipfs)://(.*)$","i"),Qp=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),c1,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function wa(t,e){try{return wl(ol(t,e))}catch{}return null}function ol(t,e){if(t==="0x")return null;const r=V.from(It(t,e,e+32)).toNumber(),n=V.from(It(t,r,r+32)).toNumber();return It(t,r+32,r+32+n)}function Xc(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):he.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function Jp(t){const e=oe(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function U3(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}function f1(t){const e=[];let r=0;for(let n=0;nV.from(e).eq(1)).catch(e=>{if(e.code===T.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,r){return ae(this,void 0,void 0,function*(){const n={to:this.address,ccipReadEnabled:!0,data:Xt([e,ma(this.name),r||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,n.data=Xt(["0x9061b923",f1([JA(this.name),n.data])]));try{let o=yield this.provider.call(n);return oe(o).length%32===4&&he.throwError("resolver threw error",T.errors.CALL_EXCEPTION,{transaction:n,data:o}),i&&(o=ol(o,0)),o}catch(o){if(o.code===T.errors.CALL_EXCEPTION)return null;throw o}})}_fetchBytes(e,r){return ae(this,void 0,void 0,function*(){const n=yield this._fetch(e,r);return n!=null?ol(n,0):null})}_getAddress(e,r){const n=j3[String(e)];if(n==null&&he.throwError(`unsupported coin type: ${e}`,T.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),n.ilk==="eth")return this.provider.formatter.address(r);const i=oe(r);if(n.p2pkh!=null){const o=r.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(o){const s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return Kp(Ut([[n.p2pkh],"0x"+o[2]]))}}if(n.p2sh!=null){const o=r.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(o){const s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return Kp(Ut([[n.p2sh],"0x"+o[2]]))}}if(n.prefix!=null){const o=i[1];let s=i[0];if(s===0?o!==20&&o!==32&&(s=-1):s=-1,s>=0&&i.length===2+o&&o>=1&&o<=75){const l=Hp.toWords(i.slice(2));return l.unshift(s),Hp.encode(n.prefix,l)}}return null}getAddress(e){return ae(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===pA?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===T.errors.CALL_EXCEPTION)return null;throw i}const r=yield this._fetchBytes("0xf1cb7e06",Yc(e));if(r==null||r==="0x")return null;const n=this._getAddress(e,r);return n==null&&he.throwError("invalid or unsupported coin data",T.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:r}),n})}getAvatar(){return ae(this,void 0,void 0,function*(){const e=[{type:"name",content:this.name}];try{const r=yield this.getText("avatar");if(r==null)return null;for(let n=0;ns[a])}return he.throwError("invalid or unsupported content hash data",T.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return ae(this,void 0,void 0,function*(){let r=mr(e);r=Ut([Yc(64),Yc(r.length),r]),r.length%32!==0&&(r=Ut([r,pt("0x",32-e.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",te(r));return n==null||n==="0x"?null:wl(n)})}}let Zc=null,F3=1;class $u extends qo{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),z(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(r=>{}),this._ready().catch(r=>{});else{const r=fr(new.target,"getNetwork")(e);r?(z(this,"_network",r),this.emit("network",r,null)):he.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return ae(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||he.throwError("no network detected",T.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:z(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return ho(()=>this._ready().then(e=>e,e=>{if(!(e.code===T.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return Zc==null&&(Zc=new Z),Zc}static getNetwork(e){return Th(e??"homestead")}ccipReadFetch(e,r,n){return ae(this,void 0,void 0,function*(){if(this.disableCcipRead||n.length===0)return null;const i=e.to.toLowerCase(),o=r.toLowerCase(),s=[];for(let l=0;l=0?null:JSON.stringify({data:o,sender:i}),d=yield Al({url:u,errorPassThrough:!0},c,(v,g)=>(v.status=g.statusCode,v));if(d.data)return d.data;const p=d.message||"unknown error";if(d.status>=400&&d.status<500)return he.throwError(`response not found during CCIP fetch: ${p}`,T.errors.SERVER_ERROR,{url:a,errorMessage:p});s.push(p)}return he.throwError(`error encountered during CCIP fetch: ${s.map(l=>JSON.stringify(l)).join(", ")}`,T.errors.SERVER_ERROR,{urls:n,errorMessages:s})})}_getInternalBlockNumber(e){return ae(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const i=this._internalBlockNumber;try{const o=yield i;if(ls()-o.respTime<=e)return o.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const r=ls(),n=yt({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(i=>null,i=>i)}).then(({blockNumber:i,networkError:o})=>{if(o)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),o;const s=ls();return i=V.from(i).toNumber(),i{this._internalBlockNumber===n&&(this._internalBlockNumber=null)}),(yield n).blockNumber})}poll(){return ae(this,void 0,void 0,function*(){const e=F3++,r=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(i){this.emit("error",i);return}if(this._setFastBlockNumber(n),this.emit("poll",e,n),n===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)he.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",he.makeError("network block skew detected",T.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let i=this._emitted.block+1;i<=n;i++)this.emit("block",i);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach(i=>{if(i==="block")return;const o=this._emitted[i];o!=="pending"&&n-o>12&&delete this._emitted[i]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=n-1),this._events.forEach(i=>{switch(i.type){case"tx":{const o=i.hash;let s=this.getTransactionReceipt(o).then(l=>(!l||l.blockNumber==null||(this._emitted["t:"+o]=l.blockNumber,this.emit(o,l)),null)).catch(l=>{this.emit("error",l)});r.push(s);break}case"filter":{if(!i._inflight){i._inflight=!0,i._lastBlockNumber===-2&&(i._lastBlockNumber=n-1);const o=i.filter;o.fromBlock=i._lastBlockNumber+1,o.toBlock=n;const s=o.toBlock-this._maxFilterBlockRange;s>o.fromBlock&&(o.fromBlock=s),o.fromBlock<0&&(o.fromBlock=0);const l=this.getLogs(o).then(a=>{i._inflight=!1,a.length!==0&&a.forEach(u=>{u.blockNumber>i._lastBlockNumber&&(i._lastBlockNumber=u.blockNumber),this._emitted["b:"+u.blockHash]=u.blockNumber,this._emitted["t:"+u.transactionHash]=u.blockNumber,this.emit(o,u)})}).catch(a=>{this.emit("error",a),i._inflight=!1});r.push(l)}break}}}),this._lastBlockNumber=n,Promise.all(r).then(()=>{this.emit("didPoll",e)}).catch(i=>{this.emit("error",i)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return ae(this,void 0,void 0,function*(){return he.throwError("provider does not support network detection",T.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return ae(this,void 0,void 0,function*(){const e=yield this._ready(),r=yield this.detectNetwork();if(e.chainId!==r.chainId){if(this.anyNetwork)return this._network=r,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",r,e),yield Vp(0),this._network;const n=he.makeError("underlying network changed",T.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:r});throw this.emit("error",n),n}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const e=ls();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(r=>((this._fastBlockNumber==null||r>this._fastBlockNumber)&&(this._fastBlockNumber=r),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,r,n){return ae(this,void 0,void 0,function*(){return this._waitForTransaction(e,r??1,n||0,null)})}_waitForTransaction(e,r,n,i){return ae(this,void 0,void 0,function*(){const o=yield this.getTransactionReceipt(e);return(o?o.confirmations:0)>=r?o:new Promise((s,l)=>{const a=[];let u=!1;const c=function(){return u?!0:(u=!0,a.forEach(p=>{p()}),!1)},d=p=>{p.confirmations{this.removeListener(e,d)}),i){let p=i.startBlock,v=null;const g=x=>ae(this,void 0,void 0,function*(){u||(yield Vp(1e3),this.getTransactionCount(i.from).then(S=>ae(this,void 0,void 0,function*(){if(!u){if(S<=i.nonce)p=x;else{{const E=yield this.getTransaction(e);if(E&&E.blockNumber!=null)return}for(v==null&&(v=p-3,v{u||this.once("block",g)}))});if(u)return;this.once("block",g),a.push(()=>{this.removeListener("block",g)})}if(typeof n=="number"&&n>0){const p=setTimeout(()=>{c()||l(he.makeError("timeout exceeded",T.errors.TIMEOUT,{timeout:n}))},n);p.unref&&p.unref(),a.push(()=>{clearTimeout(p)})}})})}getBlockNumber(){return ae(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return V.from(e)}catch(r){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:r})}})}getBalance(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getBalance",n);try{return V.from(i)}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getBalance",params:n,result:i,error:o})}})}getTransactionCount(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getTransactionCount",n);try{return V.from(i).toNumber()}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:i,error:o})}})}getCode(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getCode",n);try{return te(i)}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getCode",params:n,result:i,error:o})}})}getStorageAt(e,r,n){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(n),position:Promise.resolve(r).then(s=>Tu(s))}),o=yield this.perform("getStorageAt",i);try{return te(o)}catch(s){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:o,error:s})}})}_wrapTransaction(e,r,n){if(r!=null&&On(r)!==32)throw new Error("invalid response - sendTransaction");const i=e;return r!=null&&e.hash!==r&&he.throwError("Transaction hash mismatch from Provider.sendTransaction.",T.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:r}),i.wait=(o,s)=>ae(this,void 0,void 0,function*(){o==null&&(o=1),s==null&&(s=0);let l;o!==0&&n!=null&&(l={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:n});const a=yield this._waitForTransaction(e.hash,o,s,l);return a==null&&o===0?null:(this._emitted["t:"+e.hash]=a.blockNumber,a.status===0&&he.throwError("transaction failed",T.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:a}),a)}),i}sendTransaction(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield Promise.resolve(e).then(o=>te(o)),n=this.formatter.transaction(e);n.confirmations==null&&(n.confirmations=0);const i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const o=yield this.perform("sendTransaction",{signedTransaction:r});return this._wrapTransaction(n,o,i)}catch(o){throw o.transaction=n,o.transactionHash=n.hash,o}})}_getTransactionRequest(e){return ae(this,void 0,void 0,function*(){const r=yield e,n={};return["from","to"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?this._getAddress(o):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?V.from(o):null))}),["type"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o??null))}),r.accessList&&(n.accessList=this.formatter.accessList(r.accessList)),["data"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?te(o):null))}),this.formatter.transactionRequest(yield yt(n))})}_getFilter(e){return ae(this,void 0,void 0,function*(){e=yield e;const r={};return e.address!=null&&(r.address=this._getAddress(e.address)),["blockHash","topics"].forEach(n=>{e[n]!=null&&(r[n]=e[n])}),["fromBlock","toBlock"].forEach(n=>{e[n]!=null&&(r[n]=this._getBlockTag(e[n]))}),this.formatter.filter(yield yt(r))})}_call(e,r,n){return ae(this,void 0,void 0,function*(){n>=O3&&he.throwError("CCIP read exceeded maximum redirections",T.errors.SERVER_ERROR,{redirects:n,transaction:e});const i=e.to,o=yield this.perform("call",{transaction:e,blockTag:r});if(n>=0&&r==="latest"&&i!=null&&o.substring(0,10)==="0x556f1830"&&On(o)%32===4)try{const s=It(o,4),l=It(s,0,32);V.from(l).eq(i)||he.throwError("CCIP Read sender did not match",T.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o});const a=[],u=V.from(It(s,32,64)).toNumber(),c=V.from(It(s,u,u+32)).toNumber(),d=It(s,u+32);for(let E=0;Eae(this,void 0,void 0,function*(){const o=yield this.perform("getBlock",i);if(o==null)return i.blockHash!=null&&this._emitted["b:"+i.blockHash]==null||i.blockTag!=null&&n>this._emitted.block?null:void 0;if(r){let s=null;for(let a=0;athis._wrapTransaction(a)),l}return this.formatter.block(o)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return ho(()=>ae(this,void 0,void 0,function*(){const n=yield this.perform("getTransaction",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;const i=this.formatter.transactionResponse(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;s<=0&&(s=1),i.confirmations=s}return this._wrapTransaction(i)}),{oncePoll:this})})}getTransactionReceipt(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return ho(()=>ae(this,void 0,void 0,function*(){const n=yield this.perform("getTransactionReceipt",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;if(n.blockHash==null)return;const i=this.formatter.receipt(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;s<=0&&(s=1),i.confirmations=s}return i}),{oncePoll:this})})}getLogs(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield yt({filter:this._getFilter(e)}),n=yield this.perform("getLogs",r);return n.forEach(i=>{i.removed==null&&(i.removed=!1)}),Z.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)})}getEtherPrice(){return ae(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return ae(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&he.throwArgumentError("invalid BlockTag","blockTag",e);let r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return r+=e,r<0&&(r=0),this.formatter.blockTag(r)}return this.formatter.blockTag(e)})}getResolver(e){return ae(this,void 0,void 0,function*(){let r=e;for(;;){if(r===""||r==="."||e!=="eth"&&r==="eth")return null;const n=yield this._getResolver(r,"getResolver");if(n!=null){const i=new vd(this,n,e);return r!==e&&!(yield i.supportsWildcard())?null:i}r=r.split(".").slice(1).join(".")}})}_getResolver(e,r){return ae(this,void 0,void 0,function*(){r==null&&(r="ENS");const n=yield this.getNetwork();n.ensAddress||he.throwError("network does not support ENS",T.errors.UNSUPPORTED_OPERATION,{operation:r,network:n.name});try{const i=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+ma(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return ae(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(n){if(pe(e))throw n}typeof e!="string"&&he.throwArgumentError("invalid ENS name","name",e);const r=yield this.getResolver(e);return r?yield r.getAddress():null})}lookupAddress(e){return ae(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);const r=e.substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"lookupAddress");if(n==null)return null;const i=wa(yield this.call({to:n,data:"0x691f3431"+ma(r).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return ae(this,void 0,void 0,function*(){let r=null;if(pe(e)){const o=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",s=yield this._getResolver(o,"getAvatar");if(!s)return null;r=new vd(this,s,o);try{const l=yield r.getAvatar();if(l)return l.url}catch(l){if(l.code!==T.errors.CALL_EXCEPTION)throw l}try{const l=wa(yield this.call({to:s,data:"0x691f3431"+ma(o).substring(2)}),0);r=yield this.getResolver(l)}catch(l){if(l.code!==T.errors.CALL_EXCEPTION)throw l;return null}}else if(r=yield this.getResolver(e),!r)return null;const n=yield r.getAvatar();return n==null?null:n.url})}perform(e,r){return he.throwError(e+" not implemented",T.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_addEventListener(e,r,n){const i=new D3(Gi(e),r,n);return this._events.push(i),this._startEvent(i),this}on(e,r){return this._addEventListener(e,r,!1)}once(e,r){return this._addEventListener(e,r,!0)}emit(e,...r){let n=!1,i=[],o=Gi(e);return this._events=this._events.filter(s=>s.tag!==o?!0:(setTimeout(()=>{s.listener.apply(this,r)},0),n=!0,s.once?(i.push(s),!1):!0)),i.forEach(s=>{this._stopEvent(s)}),n}listenerCount(e){if(!e)return this._events.length;let r=Gi(e);return this._events.filter(n=>n.tag===r).length}listeners(e){if(e==null)return this._events.map(n=>n.listener);let r=Gi(e);return this._events.filter(n=>n.tag===r).map(n=>n.listener)}off(e,r){if(r==null)return this.removeAllListeners(e);const n=[];let i=!1,o=Gi(e);return this._events=this._events.filter(s=>s.tag!==o||s.listener!=r||i?!0:(i=!0,n.push(s),!1)),n.forEach(s=>{this._stopEvent(s)}),this}removeAllListeners(e){let r=[];if(e==null)r=this._events,this._events=[];else{const n=Gi(e);this._events=this._events.filter(i=>i.tag!==n?!0:(r.push(i),!1))}return r.forEach(n=>{this._stopEvent(n)}),this}}var xn=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const wt=new T($t),z3=["call","estimateGas"];function Ps(t,e){if(t==null)return null;if(typeof t.message=="string"&&t.message.match("reverted")){const r=pe(t.data)?t.data:null;if(!e||r)return{message:t.message,data:r}}if(typeof t=="object"){for(const r in t){const n=Ps(t[r],e);if(n)return n}return null}if(typeof t=="string")try{return Ps(JSON.parse(t),e)}catch{}return null}function d1(t,e,r){const n=r.transaction||r.signedTransaction;if(t==="call"){const o=Ps(e,!0);if(o)return o.data;wt.throwError("missing revert data in call exception; Transaction reverted without a reason string",T.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:e})}if(t==="estimateGas"){let o=Ps(e.body,!1);o==null&&(o=Ps(e,!1)),o&&wt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{reason:o.message,method:t,transaction:n,error:e})}let i=e.message;throw e.code===T.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&wt.throwError("insufficient funds for intrinsic transaction cost",T.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:n}),i.match(/nonce (is )?too low/i)&&wt.throwError("nonce has already been used",T.errors.NONCE_EXPIRED,{error:e,method:t,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&wt.throwError("replacement fee too low",T.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:n}),i.match(/only replay-protected/i)&&wt.throwError("legacy pre-eip-155 transactions not supported",T.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:n}),z3.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&wt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:n}),e}function Yp(t){return new Promise(function(e){setTimeout(e,t)})}function $3(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function as(t){return t&&t.toLowerCase()}const yd={};class Oh extends El{constructor(e,r,n){if(super(),e!==yd)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");z(this,"provider",r),n==null&&(n=0),typeof n=="string"?(z(this,"_address",this.provider.formatter.address(n)),z(this,"_index",null)):typeof n=="number"?(z(this,"_index",n),z(this,"_address",null)):wt.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(e){return wt.throwError("cannot alter JSON-RPC Signer connection",T.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new H3(yd,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&wt.throwError("unknown account #"+this._index,T.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=it(e);const r=this.getAddress().then(n=>(n&&(n=n.toLowerCase()),n));if(e.gasLimit==null){const n=it(e);n.from=r,e.gasLimit=this.provider.estimateGas(n)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(n=>xn(this,void 0,void 0,function*(){if(n==null)return null;const i=yield this.provider.resolveName(n);return i==null&&wt.throwArgumentError("provided ENS name resolves to null","tx.to",n),i}))),yt({tx:yt(e),sender:r}).then(({tx:n,sender:i})=>{n.from!=null?n.from.toLowerCase()!==i&&wt.throwArgumentError("from address mismatch","transaction",e):n.from=i;const o=this.provider.constructor.hexlifyTransaction(n,{from:!0});return this.provider.send("eth_sendTransaction",[o]).then(s=>s,s=>(typeof s.message=="string"&&s.message.match(/user denied/i)&&wt.throwError("user rejected transaction",T.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:n}),d1("sendTransaction",s,o)))})}signTransaction(e){return wt.throwError("signing transactions is unsupported",T.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return xn(this,void 0,void 0,function*(){const r=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(e);try{return yield ho(()=>xn(this,void 0,void 0,function*(){const i=yield this.provider.getTransaction(n);if(i!==null)return this.provider._wrapTransaction(i,n,r)}),{oncePoll:this.provider})}catch(i){throw i.transactionHash=n,i}})}signMessage(e){return xn(this,void 0,void 0,function*(){const r=typeof e=="string"?mr(e):e,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[te(r),n.toLowerCase()])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),i}})}_legacySignMessage(e){return xn(this,void 0,void 0,function*(){const r=typeof e=="string"?mr(e):e,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),te(r)])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),i}})}_signTypedData(e,r,n){return xn(this,void 0,void 0,function*(){const i=yield sr.resolveNames(e,r,n,s=>this.provider.resolveName(s)),o=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[o.toLowerCase(),JSON.stringify(sr.getPayload(i.domain,r,i.value))])}catch(s){throw typeof s.message=="string"&&s.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"_signTypedData",from:o,messageData:{domain:i.domain,types:r,value:i.value}}),s}})}unlock(e){return xn(this,void 0,void 0,function*(){const r=this.provider,n=yield this.getAddress();return r.send("personal_unlockAccount",[n.toLowerCase(),e,null])})}}class H3 extends Oh{sendTransaction(e){return this.sendUncheckedTransaction(e).then(r=>({hash:r,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:n=>this.provider.waitForTransaction(r,n)}))}}const q3={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class vi extends $u{constructor(e,r){let n=r;n==null&&(n=new Promise((i,o)=>{setTimeout(()=>{this.detectNetwork().then(s=>{i(s)},s=>{o(s)})},0)})),super(n),e||(e=fr(this.constructor,"defaultUrl")()),typeof e=="string"?z(this,"connection",Object.freeze({url:e})):z(this,"connection",Object.freeze(it(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return xn(this,void 0,void 0,function*(){yield Yp(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){const r=fr(this.constructor,"getNetwork");try{return r(V.from(e).toNumber())}catch(n){return wt.throwError("could not detect network",T.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:n})}}return wt.throwError("could not detect network",T.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new Oh(yd,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(r=>this.formatter.address(r)))}send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:nr(n),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const o=Al(this.connection,JSON.stringify(n),$3).then(s=>(this.emit("debug",{action:"response",request:n,response:s,provider:this}),s),s=>{throw this.emit("debug",{action:"response",error:s,request:n,provider:this}),s});return i&&(this._cache[e]=o,setTimeout(()=>{this._cache[e]=null},0)),o}prepareRequest(e,r){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[as(r.address),r.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[as(r.address),r.blockTag]];case"getCode":return["eth_getCode",[as(r.address),r.blockTag]];case"getStorageAt":return["eth_getStorageAt",[as(r.address),pt(r.position,32),r.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[r.signedTransaction]];case"getBlock":return r.blockTag?["eth_getBlockByNumber",[r.blockTag,!!r.includeTransactions]]:r.blockHash?["eth_getBlockByHash",[r.blockHash,!!r.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[r.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[r.transactionHash]];case"call":return["eth_call",[fr(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0}),r.blockTag]];case"estimateGas":return["eth_estimateGas",[fr(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0})]];case"getLogs":return r.filter&&r.filter.address!=null&&(r.filter.address=as(r.filter.address)),["eth_getLogs",[r.filter]]}return null}perform(e,r){return xn(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){const i=r.transaction;if(i&&i.type!=null&&V.from(i.type).isZero()&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const o=yield this.getFeeData();o.maxFeePerGas==null&&o.maxPriorityFeePerGas==null&&(r=it(r),r.transaction=it(i),delete r.transaction.type)}}const n=this.prepareRequest(e,r);n==null&&wt.throwError(e+" not implemented",T.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(n[0],n[1])}catch(i){return d1(e,i,r)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;const e=this,r=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=r,r.then(function(n){function i(){e.send("eth_getFilterChanges",[n]).then(function(o){if(e._pendingFilter!=r)return null;let s=Promise.resolve();return o.forEach(function(l){e._emitted["t:"+l.toLowerCase()]="pending",s=s.then(function(){return e.getTransaction(l).then(function(a){return e.emit("pending",a),null})})}),s.then(function(){return Yp(1e3)})}).then(function(){if(e._pendingFilter!=r){e.send("eth_uninstallFilter",[n]);return}return setTimeout(function(){i()},0),null}).catch(o=>{})}return i(),n}).catch(n=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,r){const n=it(q3);if(r)for(const o in r)r[o]&&(n[o]=!0);jx(e,n);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(o){if(e[o]==null)return;const s=Tu(V.from(e[o]));o==="gasLimit"&&(o="gas"),i[o]=s}),["from","to","data"].forEach(function(o){e[o]!=null&&(i[o]=te(e[o]))}),e.accessList&&(i.accessList=qi(e.accessList)),i}}let Cs=null;try{if(Cs=WebSocket,Cs==null)throw new Error("inject please")}catch{const e=new T($t);Cs=function(){e.throwError("WebSockets not supported in this environment",T.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var ef=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Vl=new T($t);let W3=1;class Hu extends vi{constructor(e,r){r==="any"&&Vl.throwError("WebSocketProvider does not support 'any' network yet",T.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,r):super("_websocket",r),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?z(this,"_websocket",new Cs(this.connection.url)):z(this,"_websocket",e),z(this,"_requests",{}),z(this,"_subs",{}),z(this,"_subIds",{}),z(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(i=>{this.websocket.send(this._requests[i].payload)})},this.websocket.onmessage=i=>{const o=i.data,s=JSON.parse(o);if(s.id!=null){const l=String(s.id),a=this._requests[l];if(delete this._requests[l],s.result!==void 0)a.callback(null,s.result),this.emit("debug",{action:"response",request:JSON.parse(a.payload),response:s.result,provider:this});else{let u=null;s.error?(u=new Error(s.error.message||"unknown error"),z(u,"code",s.error.code||null),z(u,"response",o)):u=new Error("unknown error"),a.callback(u,void 0),this.emit("debug",{action:"response",error:u,request:JSON.parse(a.payload),provider:this})}}else if(s.method==="eth_subscription"){const l=this._subs[s.params.subscription];l&&l.processFunc(s.params.result)}else console.warn("this should not happen")};const n=setInterval(()=>{this.emit("poll")},1e3);n.unref&&n.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){Vl.throwError("cannot reset events block on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){Vl.throwError("cannot set polling interval on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return ef(this,void 0,void 0,function*(){return null})}set polling(e){e&&Vl.throwError("cannot set polling on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,r){const n=W3++;return new Promise((i,o)=>{function s(a,u){return a?o(a):i(u)}const l=JSON.stringify({method:e,params:r,id:n,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(l),provider:this}),this._requests[String(n)]={callback:s,payload:l},this._wsReady&&this.websocket.send(l)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,r,n){return ef(this,void 0,void 0,function*(){let i=this._subIds[e];i==null&&(i=Promise.all(r).then(s=>this.send("eth_subscribe",s)),this._subIds[e]=i);const o=yield i;this._subs[o]={tag:e,processFunc:n}})}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],r=>{const n=V.from(r.number).toNumber();this._emitted.block=n,this.emit("block",n)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],r=>{this.emit("pending",r)});break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],r=>{r.removed==null&&(r.removed=!1),this.emit(e.filter,this.formatter.filterLog(r))});break;case"tx":{const r=n=>{const i=n.hash;this.getTransactionReceipt(i).then(o=>{o&&this.emit(i,o)})};r(e),this._subscribe("tx",["newHeads"],n=>{this._events.filter(i=>i.type==="tx").forEach(r)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e);break}}_stopEvent(e){let r=e.tag;if(e.type==="tx"){if(this._events.filter(i=>i.type==="tx").length)return;r="tx"}else if(this.listenerCount(e.event))return;const n=this._subIds[r];n&&(delete this._subIds[r],n.then(i=>{this._subs[i]&&(delete this._subs[i],this.send("eth_unsubscribe",[i]))}))}destroy(){return ef(this,void 0,void 0,function*(){this.websocket.readyState===Cs.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}var G3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const gs=new T($t);class h1 extends vi{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return G3(this,void 0,void 0,function*(){let r=this.network;return r==null&&(r=yield e.detectNetwork.call(this),r||gs.throwError("no network detected",T.errors.UNKNOWN_ERROR,{}),this._network==null&&(z(this,"_network",r),this.emit("network",r,null))),r})}}class Fn extends h1{constructor(e,r){gs.checkAbstract(new.target,Fn),e=fr(new.target,"getNetwork")(e),r=fr(new.target,"getApiKey")(r);const n=fr(new.target,"getUrl")(e,r);super(n,e),typeof r=="string"?z(this,"apiKey",r):r!=null&&Object.keys(r).forEach(i=>{z(this,i,r[i])})}_startPending(){gs.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return gs.throwError("API provider does not support signing",T.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,r){return gs.throwError("not implemented; sub-classes must override getUrl",T.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const Xp=new T($t),Ea="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class p1 extends Hu{constructor(e,r){const n=new Lh(e,r),i=n.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(i,n.network),z(this,"apiKey",n.apiKey)}isCommunityResource(){return this.apiKey===Ea}}class Lh extends Fn{static getWebSocketProvider(e,r){return new p1(e,r)}static getApiKey(e){return e==null?Ea:(e&&typeof e!="string"&&Xp.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,r){let n=null;switch(e.name){case"homestead":n="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":n="eth-goerli.g.alchemy.com/v2/";break;case"matic":n="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":n="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":n="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":n="arb-goerli.g.alchemy.com/v2/";break;case"optimism":n="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":n="opt-goerli.g.alchemy.com/v2/";break;default:Xp.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+n+r,throttleCallback:(i,o)=>(r===Ea&&bl(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===Ea}}const V3=new T($t),Kl="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function K3(t){switch(t){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return V3.throwArgumentError("unsupported network","name",t)}class m1 extends Fn{isCommunityResource(){return this.apiKey===Kl}static getApiKey(e){return e??Kl}static getUrl(e,r){r==null&&(r=Kl);const n={allowGzip:!0,url:"https://"+K3(e.name)+r,throttleCallback:(i,o)=>(r.apiKey===Kl&&bl(),Promise.resolve(!0))};return r.projectSecret!=null&&(n.user="",n.password=r.projectSecret),n}}var Q3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Zp=new T($t);class g1 extends Fn{static getApiKey(e){return e!=null&&Zp.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,r){let n=null;switch(e.name){case"homestead":n="https://cloudflare-eth.com/";break;default:Zp.throwArgumentError("unsupported network","network",arguments[0])}return n}perform(e,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return Q3(this,void 0,void 0,function*(){return e==="getBlockNumber"?(yield n.perform.call(this,"getBlock",{blockTag:"latest"})).number:n.perform.call(this,e,r)})}}var Ql=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const ti=new T($t);function em(t){const e={};for(let r in t){if(t[r]==null)continue;let n=t[r];r==="type"&&n===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?n=Tu(te(n)):r==="accessList"?n="["+qi(n).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":n=te(n),e[r]=n)}return e}function J3(t){if(t.status==0&&(t.message==="No records found"||t.message==="No transactions found"))return t.result;if(t.status!=1||typeof t.message!="string"||!t.message.match(/^OK/)){const e=new Error("invalid response");throw e.result=JSON.stringify(t),(t.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return t.result}function tm(t){if(t&&t.status==0&&t.message=="NOTOK"&&(t.result||"").toLowerCase().indexOf("rate limit")>=0){const e=new Error("throttled response");throw e.result=JSON.stringify(t),e.throttleRetry=!0,e}if(t.jsonrpc!="2.0"){const e=new Error("invalid response");throw e.result=JSON.stringify(t),e}if(t.error){const e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function rm(t){if(t==="pending")throw new Error("pending not supported");return t==="latest"?t:parseInt(t.substring(2),16)}function tf(t,e,r){if(t==="call"&&e.code===T.errors.SERVER_ERROR){const i=e.error;if(i&&(i.message.match(/reverted/i)||i.message.match(/VM execution error/i))){let o=i.data;if(o&&(o="0x"+o.replace(/^.*0x/i,"")),pe(o))return o;ti.throwError("missing revert data in call exception",T.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let n=e.message;throw e.code===T.errors.SERVER_ERROR&&(e.error&&typeof e.error.message=="string"?n=e.error.message:typeof e.body=="string"?n=e.body:typeof e.responseText=="string"&&(n=e.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&ti.throwError("insufficient funds for intrinsic transaction cost",T.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&ti.throwError("nonce has already been used",T.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),n.match(/another transaction with same nonce/)&&ti.throwError("replacement fee too low",T.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&ti.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}class v1 extends $u{constructor(e,r){super(e),z(this,"baseUrl",this.getBaseUrl()),z(this,"apiKey",r||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return ti.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,r){const n=Object.keys(r).reduce((o,s)=>{const l=r[s];return l!=null&&(o+=`&${s}=${l}`),o},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${n}${i}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,r){return r.module=e,r.apikey=this.apiKey,r}fetch(e,r,n){return Ql(this,void 0,void 0,function*(){const i=n?this.getPostUrl():this.getUrl(e,r),o=n?this.getPostData(e,r):null,s=e==="proxy"?tm:J3;this.emit("debug",{action:"request",request:i,provider:this});const l={url:i,throttleSlotInterval:1e3,throttleCallback:(c,d)=>(this.isCommunityResource()&&bl(),Promise.resolve(!0))};let a=null;o&&(l.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},a=Object.keys(o).map(c=>`${c}=${o[c]}`).join("&"));const u=yield Al(l,a,s||tm);return this.emit("debug",{action:"response",request:i,response:nr(u),provider:this}),u})}detectNetwork(){return Ql(this,void 0,void 0,function*(){return this.network})}perform(e,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return Ql(this,void 0,void 0,function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:r.address,tag:r.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:r.address,tag:r.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:r.address,tag:r.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:r.address,position:r.position,tag:r.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:r.signedTransaction},!0).catch(i=>tf("sendTransaction",i,r.signedTransaction));case"getBlock":if(r.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:r.blockTag,boolean:r.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:r.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:r.transactionHash});case"call":{if(r.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const i=em(r.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(o){return tf("call",o,r.transaction)}}case"estimateGas":{const i=em(r.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(o){return tf("estimateGas",o,r.transaction)}}case"getLogs":{const i={action:"getLogs"};if(r.filter.fromBlock&&(i.fromBlock=rm(r.filter.fromBlock)),r.filter.toBlock&&(i.toBlock=rm(r.filter.toBlock)),r.filter.address&&(i.address=r.filter.address),r.filter.topics&&r.filter.topics.length>0&&(r.filter.topics.length>1&&ti.throwError("unsupported topic count",T.errors.UNSUPPORTED_OPERATION,{topics:r.filter.topics}),r.filter.topics.length===1)){const l=r.filter.topics[0];(typeof l!="string"||l.length!==66)&&ti.throwError("unsupported topic format",T.errors.UNSUPPORTED_OPERATION,{topic0:l}),i.topic0=l}const o=yield this.fetch("logs",i);let s={};for(let l=0;l{["contractAddress","to"].forEach(function(a){s[a]==""&&delete s[a]}),s.creates==null&&s.contractAddress!=null&&(s.creates=s.contractAddress);const l=this.formatter.transactionResponse(s);return s.timeStamp&&(l.timestamp=parseInt(s.timeStamp)),l})})}isCommunityResource(){return this.apiKey==null}}var iu=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Si=new T($t);function Jl(){return new Date().getTime()}function nm(t){let e=null;for(let r=0;re?null:(n+i)/2}function po(t){if(t===null)return"null";if(typeof t=="number"||typeof t=="boolean")return JSON.stringify(t);if(typeof t=="string")return t;if(V.isBigNumber(t))return t.toString();if(Array.isArray(t))return JSON.stringify(t.map(e=>po(e)));if(typeof t=="object"){const e=Object.keys(t);return e.sort(),"{"+e.map(r=>{let n=t[r];return typeof n=="function"?n="[function]":n=po(n),JSON.stringify(r)+":"+n}).join(",")+"}"}throw new Error("unknown value type: "+typeof t)}let Y3=1;function om(t){let e=null,r=null,n=new Promise(s=>{e=function(){r&&(clearTimeout(r),r=null),s()},r=setTimeout(e,t)});const i=s=>(n=n.then(s),n);function o(){return n}return{cancel:e,getPromise:o,wait:i}}const X3=[T.errors.CALL_EXCEPTION,T.errors.INSUFFICIENT_FUNDS,T.errors.NONCE_EXPIRED,T.errors.REPLACEMENT_UNDERPRICED,T.errors.UNPREDICTABLE_GAS_LIMIT],Z3=["address","args","errorArgs","errorSignature","method","transaction"];function Yl(t,e){const r={weight:t.weight};return Object.defineProperty(r,"provider",{get:()=>t.provider}),t.start&&(r.start=t.start),e&&(r.duration=e-t.start),t.done&&(t.error?r.error=t.error:r.result=t.result||null),r}function eS(t,e){return function(r){const n={};r.forEach(o=>{const s=t(o.result);n[s]||(n[s]={count:0,result:o.result}),n[s].count++});const i=Object.keys(n);for(let o=0;o=e)return s.result}}}function tS(t,e,r){let n=po;switch(e){case"getBlockNumber":return function(i){const o=i.map(l=>l.result);let s=im(i.map(l=>l.result),2);if(s!=null)return s=Math.ceil(s),o.indexOf(s+1)>=0&&s++,s>=t._highestBlockNumber&&(t._highestBlockNumber=s),t._highestBlockNumber};case"getGasPrice":return function(i){const o=i.map(s=>s.result);return o.sort(),o[Math.floor(o.length/2)]};case"getEtherPrice":return function(i){return im(i.map(o=>o.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(i){return i==null?null:(i=it(i),i.confirmations=-1,po(i))};break;case"getBlock":r.includeTransactions?n=function(i){return i==null?null:(i=it(i),i.transactions=i.transactions.map(o=>(o=it(o),o.confirmations=-1,o)),po(i))}:n=function(i){return i==null?null:po(i)};break;default:throw new Error("unknown method: "+e)}return eS(n,t.quorum)}function us(t,e){return iu(this,void 0,void 0,function*(){const r=t.provider;return r.blockNumber!=null&&r.blockNumber>=e||e===-1?r:ho(()=>new Promise((n,i)=>{setTimeout(function(){return r.blockNumber>=e?n(r):t.cancelled?n(null):n(void 0)},0)}),{oncePoll:r})})}function rS(t,e,r,n){return iu(this,void 0,void 0,function*(){let i=t.provider;switch(r){case"getBlockNumber":case"getGasPrice":return i[r]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),r==="call"&&n.blockTag?i[r](n.transaction,n.blockTag):i[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return i[r](n.transactionHash);case"getLogs":{let o=n.filter;return(o.fromBlock&&pe(o.fromBlock)||o.toBlock&&pe(o.toBlock))&&(i=yield us(t,e)),i.getLogs(o)}}return Si.throwError("unknown method error",T.errors.UNKNOWN_ERROR,{method:r,params:n})})}class y1 extends $u{constructor(e,r){e.length===0&&Si.throwArgumentError("missing providers","providers",e);const n=e.map((s,l)=>{if(qo.isProvider(s)){const c=gd(s)?2e3:750;return Object.freeze({provider:s,weight:1,stallTimeout:c,priority:1})}const a=it(s);a.priority==null&&(a.priority=1),a.stallTimeout==null&&(a.stallTimeout=gd(s)?2e3:750),a.weight==null&&(a.weight=1);const u=a.weight;return(u%1||u>512||u<1)&&Si.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${l}].weight`,u),Object.freeze(a)}),i=n.reduce((s,l)=>s+l.weight,0);r==null?r=i/2:r>i&&Si.throwArgumentError("quorum will always fail; larger than total weight","quorum",r);let o=nm(n.map(s=>s.provider.network));o==null&&(o=new Promise((s,l)=>{setTimeout(()=>{this.detectNetwork().then(s,l)},0)})),super(o),z(this,"providerConfigs",Object.freeze(n)),z(this,"quorum",r),this._highestBlockNumber=-1}detectNetwork(){return iu(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(r=>r.provider.getNetwork()));return nm(e)})}perform(e,r){return iu(this,void 0,void 0,function*(){if(e==="sendTransaction"){const a=yield Promise.all(this.providerConfigs.map(u=>u.provider.sendTransaction(r.signedTransaction).then(c=>c.hash,c=>c)));for(let u=0;ua.priority-u.priority);const o=this._highestBlockNumber;let s=0,l=!0;for(;;){const a=Jl();let u=i.filter(v=>v.runner&&a-v.startv+g.weight,0);for(;u{v.staller=null}),v.runner=rS(v,o,e,r).then(x=>{v.done=!0,v.result=x,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:g,backend:Yl(v,Jl()),request:{method:e,params:nr(r)},provider:this})},x=>{v.done=!0,v.error=x,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:g,backend:Yl(v,Jl()),request:{method:e,params:nr(r)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:g,backend:Yl(v,null),request:{method:e,params:nr(r)},provider:this}),u+=v.weight}const c=[];i.forEach(v=>{v.done||!v.runner||(c.push(v.runner),v.staller&&c.push(v.staller.getPromise()))}),c.length&&(yield Promise.race(c));const d=i.filter(v=>v.done&&v.error==null);if(d.length>=this.quorum){const v=n(d);if(v!==void 0)return i.forEach(g=>{g.staller&&g.staller.cancel(),g.cancelled=!0}),v;l||(yield om(100).getPromise()),l=!1}const p=i.reduce((v,g)=>{if(!g.done||g.error==null)return v;const x=g.error.code;return X3.indexOf(x)>=0&&(v[x]||(v[x]={error:g.error,weight:0}),v[x].weight+=g.weight),v},{});if(Object.keys(p).forEach(v=>{const g=p[v];if(g.weight{E.staller&&E.staller.cancel(),E.cancelled=!0});const x=g.error,S={};Z3.forEach(E=>{x[E]!=null&&(S[E]=x[E])}),Si.throwError(x.reason||x.message,v,S)}),i.filter(v=>!v.done).length===0)break}return i.forEach(a=>{a.staller&&a.staller.cancel(),a.cancelled=!0}),Si.throwError("failed to meet quorum",T.errors.SERVER_ERROR,{method:e,params:r,results:i.map(a=>Yl(a)),provider:this})})}}const w1=null,xa=new T($t),vs="84842078b09946638c03157f83405213";class E1 extends Hu{constructor(e,r){const n=new Bh(e,r),i=n.connection;i.password&&xa.throwError("INFURA WebSocket project secrets unsupported",T.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const o=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(o,e),z(this,"apiKey",n.projectId),z(this,"projectId",n.projectId),z(this,"projectSecret",n.projectSecret)}isCommunityResource(){return this.projectId===vs}}class Bh extends Fn{static getWebSocketProvider(e,r){return new E1(e,r)}static getApiKey(e){const r={apiKey:vs,projectId:vs,projectSecret:null};return e==null||(typeof e=="string"?r.projectId=e:e.projectSecret!=null?(xa.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),xa.assertArgument(typeof e.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),r.projectId=e.projectId,r.projectSecret=e.projectSecret):e.projectId&&(r.projectId=e.projectId),r.apiKey=r.projectId),r}static getUrl(e,r){let n=null;switch(e?e.name:"unknown"){case"homestead":n="mainnet.infura.io";break;case"goerli":n="goerli.infura.io";break;case"sepolia":n="sepolia.infura.io";break;case"matic":n="polygon-mainnet.infura.io";break;case"maticmum":n="polygon-mumbai.infura.io";break;case"optimism":n="optimism-mainnet.infura.io";break;case"optimism-goerli":n="optimism-goerli.infura.io";break;case"arbitrum":n="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":n="arbitrum-goerli.infura.io";break;default:xa.throwError("unsupported network",T.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+n+"/v3/"+r.projectId,throttleCallback:(o,s)=>(r.projectId===vs&&bl(),Promise.resolve(!0))};return r.projectSecret!=null&&(i.user="",i.password=r.projectSecret),i}isCommunityResource(){return this.projectId===vs}}class nS extends vi{send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this._pendingBatch==null&&(this._pendingBatch=[]);const i={request:n,resolve:null,reject:null},o=new Promise((s,l)=>{i.resolve=s,i.reject=l});return this._pendingBatch.push(i),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout(()=>{const s=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const l=s.map(a=>a.request);return this.emit("debug",{action:"requestBatch",request:nr(l),provider:this}),Al(this.connection,JSON.stringify(l)).then(a=>{this.emit("debug",{action:"response",request:l,response:a,provider:this}),s.forEach((u,c)=>{const d=a[c];if(d.error){const p=new Error(d.error.message);p.code=d.error.code,p.data=d.error.data,u.reject(p)}else u.resolve(d.result)})},a=>{this.emit("debug",{action:"response",error:a,request:l,provider:this}),s.forEach(u=>{u.reject(a)})})},10)),o}}const rf=new T($t),iS="ETHERS_JS_SHARED";class x1 extends Fn{static getApiKey(e){return e&&typeof e!="string"&&rf.throwArgumentError("invalid apiKey","apiKey",e),e||iS}static getUrl(e,r){rf.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let n=null;switch(e.name){case"homestead":n="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":n="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":n="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":n="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":n="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:rf.throwArgumentError("unsupported network","network",arguments[0])}return n+"?apiKey="+r}}const sm=new T($t),lm="62e1ad51b37b8e00394bda3b";class A1 extends Fn{static getApiKey(e){const r={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?r.applicationId=lm:typeof e=="string"?r.applicationId=e:e.applicationSecretKey!=null?(r.applicationId=e.applicationId,r.applicationSecretKey=e.applicationSecretKey):e.applicationId?r.applicationId=e.applicationId:sm.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),r}static getUrl(e,r){let n=null;switch(e?e.name:"unknown"){case"goerli":n="eth-goerli.gateway.pokt.network";break;case"homestead":n="eth-mainnet.gateway.pokt.network";break;case"kovan":n="poa-kovan.gateway.pokt.network";break;case"matic":n="poly-mainnet.gateway.pokt.network";break;case"maticmum":n="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":n="eth-rinkeby.gateway.pokt.network";break;case"ropsten":n="eth-ropsten.gateway.pokt.network";break;default:sm.throwError("unsupported network",T.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i=`https://${n}/v1/lb/${r.applicationId}`,o={headers:{},url:i};return r.applicationSecretKey!=null&&(o.user="",o.password=r.applicationSecretKey),o}isCommunityResource(){return this.applicationId===lm}}const am=new T($t);let oS=1;function um(t,e){const r="Web3LegacyFetcher";return function(n,i){const o={method:n,params:i,id:oS++,jsonrpc:"2.0"};return new Promise((s,l)=>{this.emit("debug",{action:"request",fetcher:r,request:nr(o),provider:this}),e(o,(a,u)=>{if(a)return this.emit("debug",{action:"response",fetcher:r,error:a,request:o,provider:this}),l(a);if(this.emit("debug",{action:"response",fetcher:r,request:o,response:u,provider:this}),u.error){const c=new Error(u.error.message);return c.code=u.error.code,c.data=u.error.data,l(c)}s(u.result)})})}}function sS(t){return function(e,r){r==null&&(r=[]);const n={method:e,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:nr(n),provider:this}),t.request(n).then(i=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,response:i,provider:this}),i),i=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,error:i,provider:this}),i})}}class b1 extends vi{constructor(e,r){e==null&&am.throwArgumentError("missing provider","provider",e);let n=null,i=null,o=null;typeof e=="function"?(n="unknown:",i=e):(n=e.host||e.path||"",!n&&e.isMetaMask&&(n="metamask"),o=e,e.request?(n===""&&(n="eip-1193:"),i=sS(e)):e.sendAsync?i=um(e,e.sendAsync.bind(e)):e.send?i=um(e,e.send.bind(e)):am.throwArgumentError("unsupported provider","provider",e),n||(n="unknown:")),super(n,r),z(this,"jsonRpcFetchFunc",i),z(this,"provider",o)}send(e,r){return this.jsonRpcFetchFunc(e,r)}}const cm=new T($t);function lS(t,e){if(t==null&&(t="homestead"),typeof t=="string"){const n=t.match(/^(ws|http)s?:/i);if(n)switch(n[1].toLowerCase()){case"http":case"https":return new vi(t);case"ws":case"wss":return new Hu(t);default:cm.throwArgumentError("unsupported URL scheme","network",t)}}const r=Th(t);return(!r||!r._defaultProvider)&&cm.throwError("unsupported getDefaultProvider network",T.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:t}),r._defaultProvider({FallbackProvider:y1,AlchemyProvider:Lh,AnkrProvider:m1,CloudflareProvider:g1,EtherscanProvider:v1,InfuraProvider:Bh,JsonRpcProvider:vi,NodesmithProvider:x1,PocketProvider:A1,Web3Provider:b1,IpcProvider:w1},e)}const aS=Object.freeze(Object.defineProperty({__proto__:null,AlchemyProvider:Lh,AlchemyWebSocketProvider:p1,AnkrProvider:m1,BaseProvider:$u,CloudflareProvider:g1,EtherscanProvider:v1,FallbackProvider:y1,Formatter:Z,InfuraProvider:Bh,InfuraWebSocketProvider:E1,IpcProvider:w1,JsonRpcBatchProvider:nS,JsonRpcProvider:vi,JsonRpcSigner:Oh,NodesmithProvider:x1,PocketProvider:A1,Provider:qo,Resolver:vd,StaticJsonRpcProvider:h1,UrlJsonRpcProvider:Fn,Web3Provider:b1,WebSocketProvider:Hu,getDefaultProvider:lS,getNetwork:Th,isCommunityResourcable:u1,isCommunityResource:gd,showThrottleMessage:bl},Symbol.toStringTag,{value:"Module"})),uS="solidity/5.7.0",cS=new RegExp("^bytes([0-9]+)$"),fS=new RegExp("^(u?int)([0-9]*)$"),dS=new RegExp("^(.*)\\[([0-9]*)\\]$"),hS="0000000000000000000000000000000000000000000000000000000000000000",Yi=new T(uS);function _1(t,e,r){switch(t){case"address":return r?ha(e,32):oe(e);case"string":return mr(e);case"bytes":return oe(e);case"bool":return e=e?"0x01":"0x00",r?ha(e,32):oe(e)}let n=t.match(fS);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!==0||i===0||i>256)&&Yi.throwArgumentError("invalid number type","type",t),r&&(i=256),e=V.from(e).toTwos(i),ha(e,i/8)}if(n=t.match(cS),n){const i=parseInt(n[1]);return(String(i)!==n[1]||i===0||i>32)&&Yi.throwArgumentError("invalid bytes type","type",t),oe(e).byteLength!==i&&Yi.throwArgumentError(`invalid value for ${t}`,"value",e),r?oe((e+hS).substring(0,66)):e}if(n=t.match(dS),n&&Array.isArray(e)){const i=n[1];parseInt(n[2]||String(e.length))!=e.length&&Yi.throwArgumentError(`invalid array length for ${t}`,"value",e);const s=[];return e.forEach(function(l){s.push(_1(i,l,!0))}),Ut(s)}return Yi.throwArgumentError("invalid type","type",t)}function pS(t,e){t.length!=e.length&&Yi.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);const r=[];return t.forEach(function(n,i){r.push(_1(n,e[i]))}),te(Ut(r))}function mS(t,e){return ut(pS(t,e))}var qu={},Cn={},S1={};const gS=Uo(rA);var vS={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const fm=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??typeof c!="object"?c:Object.assign({},e,c),r.forEach(p=>p(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(vS?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},k1=t=>t?fm(t):fm;var N1={exports:{}},P1={},C1={exports:{}},M1={};/** + * @license React + * use-sync-external-store-shim.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Bo=L;function yS(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var wS=typeof Object.is=="function"?Object.is:yS,ES=Bo.useState,xS=Bo.useEffect,AS=Bo.useLayoutEffect,bS=Bo.useDebugValue;function _S(t,e){var r=e(),n=ES({inst:{value:r,getSnapshot:e}}),i=n[0].inst,o=n[1];return AS(function(){i.value=r,i.getSnapshot=e,nf(i)&&o({inst:i})},[t,r,e]),xS(function(){return nf(i)&&o({inst:i}),t(function(){nf(i)&&o({inst:i})})},[t]),bS(r),r}function nf(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!wS(t,r)}catch{return!0}}function SS(t,e){return e()}var kS=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?SS:_S;M1.useSyncExternalStore=Bo.useSyncExternalStore!==void 0?Bo.useSyncExternalStore:kS;C1.exports=M1;var NS=C1.exports;/** + * @license React + * use-sync-external-store-shim/with-selector.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Wu=L,PS=NS;function CS(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var MS=typeof Object.is=="function"?Object.is:CS,IS=PS.useSyncExternalStore,RS=Wu.useRef,TS=Wu.useEffect,OS=Wu.useMemo,LS=Wu.useDebugValue;P1.useSyncExternalStoreWithSelector=function(t,e,r,n,i){var o=RS(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=OS(function(){function a(v){if(!u){if(u=!0,c=v,v=n(v),i!==void 0&&s.hasValue){var g=s.value;if(i(g,v))return d=g}return d=v}if(g=d,MS(c,v))return g;var x=n(v);return i!==void 0&&i(g,x)?g:(c=v,d=x)}var u=!1,c,d,p=r===void 0?null:r;return[function(){return a(e())},p===null?void 0:function(){return a(p())}]},[e,r,n,i]);var l=IS(t,o[0],o[1]);return TS(function(){s.hasValue=!0,s.value=l},[l]),LS(l),l};N1.exports=P1;var BS=N1.exports;const Gu=jo(BS),{useSyncExternalStoreWithSelector:DS}=Gu;function I1(t,e=t.getState,r){const n=DS(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const dm=t=>{const e=typeof t=="function"?k1(t):t,r=(n,i)=>I1(e,n,i);return Object.assign(r,e),r},R1=t=>t?dm(t):dm;var jS=t=>R1(t);const US=Object.freeze(Object.defineProperty({__proto__:null,create:R1,createStore:k1,default:jS,useStore:I1},Symbol.toStringTag,{value:"Module"})),FS=Uo(US);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createWeb3ReactStoreAndActions=t.MAX_SAFE_CHAIN_ID=void 0;const e=gS,r=FS;t.MAX_SAFE_CHAIN_ID=0xfffffffffffec;function n(l){if(!Number.isInteger(l)||l<=0||l>t.MAX_SAFE_CHAIN_ID)throw new Error(`Invalid chainId ${l}`)}function i(l){return(0,e.getAddress)(l)}const o={chainId:void 0,accounts:void 0,activating:!1};function s(){const l=(0,r.createStore)()(()=>o);let a=0;function u(){const p=++a;return l.setState(Object.assign(Object.assign({},o),{activating:!0})),()=>{a===p&&l.setState({activating:!1})}}function c(p){if(p.chainId!==void 0&&n(p.chainId),p.accounts!==void 0)for(let v=0;v{var g,x;const S=(g=p.chainId)!==null&&g!==void 0?g:v.chainId,E=(x=p.accounts)!==null&&x!==void 0?x:v.accounts;let w=v.activating;return w&&S&&E&&(w=!1),{chainId:S,accounts:E,activating:w}})}function d(){a++,l.setState(o)}return[l,{startActivation:u,update:c,resetState:d}]}t.createWeb3ReactStoreAndActions=s})(S1);var zS={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const hm=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??typeof c!="object"?c:Object.assign({},e,c),r.forEach(p=>p(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(zS?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},Dh=t=>t?hm(t):hm,{useSyncExternalStoreWithSelector:$S}=Gu;function T1(t,e=t.getState,r){const n=$S(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const pm=t=>{const e=typeof t=="function"?Dh(t):t,r=(n,i)=>T1(e,n,i);return Object.assign(r,e),r},O1=t=>t?pm(t):pm;var HS=t=>O1(t);const qS=Object.freeze(Object.defineProperty({__proto__:null,create:O1,createStore:Dh,default:HS,useStore:T1},Symbol.toStringTag,{value:"Module"})),WS=Uo(qS),{useSyncExternalStoreWithSelector:GS}=Gu;function L1(t,e=t.getState,r){const n=GS(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const mm=(t,e)=>{const r=Dh(t),n=(i,o=e)=>L1(r,i,o);return Object.assign(n,r),n},VS=(t,e)=>t?mm(t,e):mm,KS=Object.freeze(Object.defineProperty({__proto__:null,createWithEqualityFn:VS,useStoreWithEqualityFn:L1},Symbol.toStringTag,{value:"Module"})),QS=Uo(KS),JS=Uo(aS);var YS=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XS=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZS=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&YS(e,t,r);return XS(e,t),e},ek=Fe&&Fe.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(Cn,"__esModule",{value:!0});Cn.getPriorityConnector=Cn.getSelectedConnector=Cn.initializeConnector=void 0;const tk=S1,mo=L,gm=WS,rk=QS;let _o;function nk(){return ek(this,void 0,void 0,function*(){if(_o===void 0)try{const{Web3Provider:t}=yield Promise.resolve().then(()=>ZS(JS));_o=t}catch{console.debug("@ethersproject/providers not available"),_o=null}})}function ik(t){const[e,r]=(0,tk.createWeb3ReactStoreAndActions)(),n=t(r),i=fk(e),o=dk(i),s=hk(n,i,o);return[n,Object.assign(Object.assign(Object.assign({},i),o),s),e]}Cn.initializeConnector=ik;function ok({chainId:t,accounts:e,activating:r}){return!!(t&&e&&!r)}function B1(...t){function e(d){const p=t.findIndex(([v])=>d===v);if(p===-1)throw new Error("Connector not found");return p}function r(d){const p=t[e(d)][2];if(!p)throw new Error("Stores not passed");return p}function n(d){return t.map(([,{useChainId:v}])=>v())[e(d)]}function i(d){return t.map(([,{useAccounts:v}])=>v())[e(d)]}function o(d){return t.map(([,{useIsActivating:v}])=>v())[e(d)]}function s(d){return t.map(([,{useAccount:v}])=>v())[e(d)]}function l(d){return t.map(([,{useIsActive:v}])=>v())[e(d)]}function a(d,p){const v=e(d);return t.map(([,{useProvider:x}],S)=>x(p,S===v))[v]}function u(d,p){const v=e(d);return t.map(([,{useENSNames:x}],S)=>x(S===v?p:void 0))[v]}function c(d,p){const v=e(d);return t.map(([,{useENSName:x}],S)=>x(S===v?p:void 0))[v]}return{useSelectedStore:r,useSelectedChainId:n,useSelectedAccounts:i,useSelectedIsActivating:o,useSelectedAccount:s,useSelectedIsActive:l,useSelectedProvider:a,useSelectedENSNames:u,useSelectedENSName:c}}Cn.getSelectedConnector=B1;function sk(...t){const{useSelectedStore:e,useSelectedChainId:r,useSelectedAccounts:n,useSelectedIsActivating:i,useSelectedAccount:o,useSelectedIsActive:s,useSelectedProvider:l,useSelectedENSNames:a,useSelectedENSName:u}=B1(...t);function c(){const B=t.map(([,{useIsActive:j}])=>j()).findIndex(j=>j);return t[B===-1?0:B][0]}function d(){return e(c())}function p(){return r(c())}function v(){return n(c())}function g(){return i(c())}function x(){return o(c())}function S(){return s(c())}function E(O){return l(c(),O)}function w(O){return a(c(),O)}function _(O){return u(c(),O)}return{useSelectedStore:e,useSelectedChainId:r,useSelectedAccounts:n,useSelectedIsActivating:i,useSelectedAccount:o,useSelectedIsActive:s,useSelectedProvider:l,useSelectedENSNames:a,useSelectedENSName:u,usePriorityConnector:c,usePriorityStore:d,usePriorityChainId:p,usePriorityAccounts:v,usePriorityIsActivating:g,usePriorityAccount:x,usePriorityIsActive:S,usePriorityProvider:E,usePriorityENSNames:w,usePriorityENSName:_}}Cn.getPriorityConnector=sk;const lk=({chainId:t})=>t,ak=({accounts:t})=>t,uk=({activating:t})=>t,ck=(t,e)=>t===void 0&&e===void 0||t!==void 0&&t.length===(e==null?void 0:e.length)&&t.every((r,n)=>r===e[n]);function fk(t){function e(){return(0,gm.useStore)(t,lk)}function r(){return(0,rk.useStoreWithEqualityFn)(t,ak,ck)}function n(){return(0,gm.useStore)(t,uk)}return{useChainId:e,useAccounts:r,useIsActivating:n}}function dk({useChainId:t,useAccounts:e,useIsActivating:r}){function n(){var o;return(o=e())===null||o===void 0?void 0:o[0]}function i(){const o=t(),s=e(),l=r();return ok({chainId:o,accounts:s,activating:l})}return{useAccount:n,useIsActive:i}}function vm(t,e=[]){const[r,n]=(0,mo.useState)();return(0,mo.useEffect)(()=>{if(t&&e.length){let i=!1;return Promise.all(e.map(o=>t.lookupAddress(o))).then(o=>{i||n(o)}).catch(o=>{i||(console.debug("Could not fetch ENS names",o),n(new Array(e.length).fill(null)))}),()=>{i=!0,n(void 0)}}},[t,e]),r??new Array(e.length).fill(void 0)}function hk(t,{useAccounts:e,useChainId:r},{useAccount:n,useIsActive:i}){function o(a,u=!0){const c=i(),d=r(),[p,v]=(0,mo.useState)(_o!==void 0);return(0,mo.useEffect)(()=>{if(p)return;let g=!1;return nk().then(()=>{g||v(!0)}),()=>{g=!0}},[p]),(0,mo.useMemo)(()=>{if(u){if(t.customProvider)return t.customProvider;if(_o&&t.provider)return new _o(t.provider,a)}},[p,u,c,d,a])}function s(a){const u=e();return vm(a,u)}function l(a){var u;const c=n(),d=(0,mo.useMemo)(()=>c===void 0?void 0:[c],[c]);return(u=vm(a,d))===null||u===void 0?void 0:u[0]}return{useProvider:o,useENSNames:s,useENSName:l}}var Vu={},D1={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(a,u,c){this.fn=a,this.context=u,this.once=c||!1}function o(a,u,c,d,p){if(typeof c!="function")throw new TypeError("The listener must be a function");var v=new i(c,d||a,p),g=r?r+u:u;return a._events[g]?a._events[g].fn?a._events[g]=[a._events[g],v]:a._events[g].push(v):(a._events[g]=v,a._eventsCount++),a}function s(a,u){--a._eventsCount===0?a._events=new n:delete a._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],c,d;if(this._eventsCount===0)return u;for(d in c=this._events)e.call(c,d)&&u.push(r?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},l.prototype.listeners=function(u){var c=r?r+u:u,d=this._events[c];if(!d)return[];if(d.fn)return[d.fn];for(var p=0,v=d.length,g=new Array(v);pe),this.eth_accounts=jest.fn(e=>e),this.eth_requestAccounts=jest.fn(e=>e)}request(e){if(!this.chainId)return Promise.reject(new Error);switch(e.method){case"eth_chainId":return Promise.resolve(this.eth_chainId(this.chainId));case"eth_accounts":return Promise.resolve(this.eth_accounts(this.accounts));case"eth_requestAccounts":return Promise.resolve(this.eth_requestAccounts(this.accounts));default:throw new Error(`Method not supported on mock: ${JSON.stringify(e)}`)}}emitConnect(e){this.emit("connect",{chainId:e})}emitDisconnect(e){this.emit("disconnect",e)}emitChainChanged(e){this.emit("chainChanged",e)}emitAccountsChanged(e){this.emit("accountsChanged",e)}}Vu.MockEIP1193Provider=gk;var Do={},vk=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yk=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wk=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vk(e,t,r);return yk(e,t),e};Object.defineProperty(Do,"__esModule",{value:!0});Do.useWeb3React=Do.Web3ReactProvider=void 0;const ou=wk(L),Ek=Cn,j1=(0,ou.createContext)(void 0);function xk({children:t,connectors:e,connectorOverride:r,network:n,lookupENS:i=!0}){const o=(0,ou.useRef)(e);if(e.length!=o.current.length||e.some((K,H)=>{const se=o.current[H];return K[0]!==se[0]}))throw new Error("The connectors prop passed to Web3ReactProvider must be referentially static. If connectors is changing, try providing a key prop to Web3ReactProvider that changes every time connectors changes.");const s=(0,Ek.getPriorityConnector)(...e),{usePriorityConnector:l,useSelectedChainId:a,useSelectedAccounts:u,useSelectedIsActivating:c,useSelectedAccount:d,useSelectedIsActive:p,useSelectedProvider:v,useSelectedENSNames:g,useSelectedENSName:x}=s,S=l(),E=r??S,w=a(E),_=u(E),O=c(E),B=d(E),j=p(E),$=v(E,n),q=g(E,i?$:void 0),ne=x(E,i?$:void 0);return ou.default.createElement(j1.Provider,{value:{connector:E,chainId:w,accounts:_,isActivating:O,account:B,isActive:j,provider:$,ENSNames:q,ENSName:ne,hooks:s}},t)}Do.Web3ReactProvider=xk;function Ak(){const t=(0,ou.useContext)(j1);if(!t)throw Error("useWeb3React can only be used within the Web3ReactProvider component");return t}Do.useWeb3React=Ak;(function(t){var e=Fe&&Fe.__createBinding||(Object.create?function(n,i,o,s){s===void 0&&(s=o);var l=Object.getOwnPropertyDescriptor(i,o);(!l||("get"in l?!i.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(n,s,l)}:function(n,i,o,s){s===void 0&&(s=o),n[s]=i[o]}),r=Fe&&Fe.__exportStar||function(n,i){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&e(i,n,o)};Object.defineProperty(t,"__esModule",{value:!0}),r(Cn,t),r(Vu,t),r(Do,t)})(qu);const of=[{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"approve",inputs:[{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"apps",inputs:[{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"balanceOf",inputs:[{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"contractURI",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"getApproved",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"getInitializedVersion",inputs:[],outputs:[{name:"",type:"uint64",internalType:"uint64"}],stateMutability:"view"},{type:"function",name:"getPackageId",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"pure"},{type:"function",name:"getPackageInfo",inputs:[{name:"package",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"tuple",internalType:"struct IKinodeAppStore.PackageInfo",components:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"getPackageInfo",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"tuple",internalType:"struct IKinodeAppStore.PackageInfo",components:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[{name:"_knsResolver",type:"address",internalType:"contract KNSRegistryResolver"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"isApprovedForAll",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"operator",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"knsResolver",inputs:[],outputs:[{name:"",type:"address",internalType:"contract KNSRegistryResolver"}],stateMutability:"view"},{type:"function",name:"name",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"ownerOf",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"proxiableUUID",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"registerApp",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setApprovalForAll",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"approved",type:"bool",internalType:"bool"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"symbol",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"tokenURI",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"transferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"unlistPacakge",inputs:[{name:"package",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateContractURI",inputs:[{name:"uri",type:"string",internalType:"string"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateMetadata",inputs:[{name:"package",type:"uint256",internalType:"uint256"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"upgradeToAndCall",inputs:[{name:"newImplementation",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"event",name:"AppMetadataUpdated",inputs:[{name:"package",type:"uint256",indexed:!0,internalType:"uint256"},{name:"metadataUrl",type:"string",indexed:!1,internalType:"string"},{name:"metadataHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"AppRegistered",inputs:[{name:"package",type:"uint256",indexed:!0,internalType:"uint256"},{name:"packageName",type:"string",indexed:!1,internalType:"string"},{name:"publisherName",type:"bytes",indexed:!1,internalType:"bytes"},{name:"metadataUrl",type:"string",indexed:!1,internalType:"string"},{name:"metadataHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"Approval",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"ApprovalForAll",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"operator",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint64",indexed:!1,internalType:"uint64"}],anonymous:!1},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Transfer",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"AddressEmptyCode",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{name:"implementation",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ERC721IncorrectOwner",inputs:[{name:"sender",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InsufficientApproval",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC721InvalidApprover",inputs:[{name:"approver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOperator",inputs:[{name:"operator",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidReceiver",inputs:[{name:"receiver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidSender",inputs:[{name:"sender",type:"address",internalType:"address"}]},{type:"error",name:"ERC721NonexistentToken",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"FailedInnerCall",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"OwnableInvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{name:"account",type:"address",internalType:"address"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{name:"slot",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"Unauthorized",inputs:[]}];class wd{static createInterface(){return new ad(of)}static connect(e,r){return new g3(e,of,r)}}zh(wd,"abi",of);var U1={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ym=qr.createContext&&qr.createContext(U1),bk=["attr","size","title"];function _k(t,e){if(t==null)return{};var r=Sk(t,e),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Sk(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,o;for(o=0;o=0)&&(r[i]=t[i]);return r}function su(){return su=Object.assign?Object.assign.bind():function(t){for(var e=1;eqr.createElement(e.tag,lu({key:r},e.attr),F1(e.child)))}function zn(t){return e=>qr.createElement(Ck,su({attr:lu({},t.attr)},e),F1(t.child))}function Ck(t){var e=r=>{var{attr:n,size:i,title:o}=t,s=_k(t,bk),l=i||r.size||"1em",a;return r.className&&(a=r.className),t.className&&(a=(a?a+" ":"")+t.className),qr.createElement("svg",su({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,n,s,{className:a,style:lu(lu({color:t.color||r.color},r.style),t.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),o&&qr.createElement("title",null,o),t.children)};return ym!==void 0?qr.createElement(ym.Consumer,null,r=>e(r)):e(U1)}function Mk(t){return zn({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"},child:[]}]})(t)}function Ik(t){return zn({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"},child:[]}]})(t)}function Rk(t){return zn({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"},child:[]}]})(t)}function Tk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(t)}function Ok(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"},child:[]}]})(t)}function Lk(t){return zn({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"},child:[]}]})(t)}function Bk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"},child:[]}]})(t)}function z1(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M296 384h-80c-13.3 0-24-10.7-24-24V192h-87.7c-17.8 0-26.7-21.5-14.1-34.1L242.3 5.7c7.5-7.5 19.8-7.5 27.3 0l152.2 152.2c12.6 12.6 3.7 34.1-14.1 34.1H320v168c0 13.3-10.7 24-24 24zm216-8v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h136v8c0 30.9 25.1 56 56 56h80c30.9 0 56-25.1 56-56v-8h136c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(t)}function Dk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm101.8-262.2L295.6 256l62.2 62.2c4.7 4.7 4.7 12.3 0 17l-22.6 22.6c-4.7 4.7-12.3 4.7-17 0L256 295.6l-62.2 62.2c-4.7 4.7-12.3 4.7-17 0l-22.6-22.6c-4.7-4.7-4.7-12.3 0-17l62.2-62.2-62.2-62.2c-4.7-4.7-4.7-12.3 0-17l22.6-22.6c4.7-4.7 12.3-4.7 17 0l62.2 62.2 62.2-62.2c4.7-4.7 12.3-4.7 17 0l22.6 22.6c4.7 4.7 4.7 12.3 0 17z"},child:[]}]})(t)}var jk={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Em=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??(typeof c!="object"||c===null)?c:Object.assign({},e,c),r.forEach(p=>p(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(jk?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},Uk=t=>t?Em(t):Em;var $1={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{useDebugValue:Fk}=qr,{useSyncExternalStoreWithSelector:zk}=Gu;let xm=!1;function $k(t,e=t.getState,r){($1?"production":void 0)!=="production"&&r&&!xm&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),xm=!0);const n=zk(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return Fk(n),n}const Am=t=>{($1?"production":void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof t=="function"?Uk(t):t,r=(n,i)=>$k(e,n,i);return Object.assign(r,e),r},Hk=t=>t?Am(t):Am;var qk={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function H1(t,e){let r;try{r=t()}catch{return}return{getItem:i=>{var o;const s=a=>a===null?null:JSON.parse(a,e==null?void 0:e.reviver),l=(o=r.getItem(i))!=null?o:null;return l instanceof Promise?l.then(s):s(l)},setItem:(i,o)=>r.setItem(i,JSON.stringify(o,e==null?void 0:e.replacer)),removeItem:i=>r.removeItem(i)}}const sl=t=>e=>{try{const r=t(e);return r instanceof Promise?r:{then(n){return sl(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return sl(n)(r)}}}},Wk=(t,e)=>(r,n,i)=>{let o={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:S=>S,version:0,merge:(S,E)=>({...E,...S}),...e},s=!1;const l=new Set,a=new Set;let u;try{u=o.getStorage()}catch{}if(!u)return t((...S)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...S)},n,i);const c=sl(o.serialize),d=()=>{const S=o.partialize({...n()});let E;const w=c({state:S,version:o.version}).then(_=>u.setItem(o.name,_)).catch(_=>{E=_});if(E)throw E;return w},p=i.setState;i.setState=(S,E)=>{p(S,E),d()};const v=t((...S)=>{r(...S),d()},n,i);let g;const x=()=>{var S;if(!u)return;s=!1,l.forEach(w=>w(n()));const E=((S=o.onRehydrateStorage)==null?void 0:S.call(o,n()))||void 0;return sl(u.getItem.bind(u))(o.name).then(w=>{if(w)return o.deserialize(w)}).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==o.version){if(o.migrate)return o.migrate(w.state,w.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return w.state}).then(w=>{var _;return g=o.merge(w,(_=n())!=null?_:v),r(g,!0),d()}).then(()=>{E==null||E(g,void 0),s=!0,a.forEach(w=>w(g))}).catch(w=>{E==null||E(void 0,w)})};return i.persist={setOptions:S=>{o={...o,...S},S.getStorage&&(u=S.getStorage())},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>x(),hasHydrated:()=>s,onHydrate:S=>(l.add(S),()=>{l.delete(S)}),onFinishHydration:S=>(a.add(S),()=>{a.delete(S)})},x(),g||v},Gk=(t,e)=>(r,n,i)=>{let o={storage:H1(()=>localStorage),partialize:x=>x,version:0,merge:(x,S)=>({...S,...x}),...e},s=!1;const l=new Set,a=new Set;let u=o.storage;if(!u)return t((...x)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...x)},n,i);const c=()=>{const x=o.partialize({...n()});return u.setItem(o.name,{state:x,version:o.version})},d=i.setState;i.setState=(x,S)=>{d(x,S),c()};const p=t((...x)=>{r(...x),c()},n,i);let v;const g=()=>{var x,S;if(!u)return;s=!1,l.forEach(w=>{var _;return w((_=n())!=null?_:p)});const E=((S=o.onRehydrateStorage)==null?void 0:S.call(o,(x=n())!=null?x:p))||void 0;return sl(u.getItem.bind(u))(o.name).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==o.version){if(o.migrate)return o.migrate(w.state,w.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return w.state}).then(w=>{var _;return v=o.merge(w,(_=n())!=null?_:p),r(v,!0),c()}).then(()=>{E==null||E(v,void 0),v=n(),s=!0,a.forEach(w=>w(v))}).catch(w=>{E==null||E(void 0,w)})};return i.persist={setOptions:x=>{o={...o,...x},x.storage&&(u=x.storage)},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>g(),hasHydrated:()=>s,onHydrate:x=>(l.add(x),()=>{l.delete(x)}),onFinishHydration:x=>(a.add(x),()=>{a.delete(x)})},o.skipHydration||g(),v||p},Vk=(t,e)=>"getStorage"in e||"serialize"in e||"deserialize"in e?((qk?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),Wk(t,e)):Gk(t,e),Kk=Vk;var Dr=(t=>(t[t.OK=200]="OK",t[t.CREATED=201]="CREATED",t[t.ACCEPTED=202]="ACCEPTED",t[t.NO_CONTENT=204]="NO_CONTENT",t[t.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",t[t.FOUND=302]="FOUND",t[t.SEE_OTHER=303]="SEE_OTHER",t[t.NOT_MODIFIED=304]="NOT_MODIFIED",t[t.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",t[t.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",t[t.BAD_REQUEST=400]="BAD_REQUEST",t[t.UNAUTHORIZED=401]="UNAUTHORIZED",t[t.FORBIDDEN=403]="FORBIDDEN",t[t.NOT_FOUND=404]="NOT_FOUND",t[t.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",t[t.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",t[t.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",t[t.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",t[t.BAD_GATEWAY=502]="BAD_GATEWAY",t[t.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",t))(Dr||{});const xe=t=>`${t.package}:${t.publisher}`,cs=t=>{var e;return((e=t.metadata)==null?void 0:e.name)||xe(t)},sf=t=>{var e,r;return t.publisher==="sys"?"system":(e=t.state)!=null&&e.our_version&&!((r=t.state)!=null&&r.capsApproved)?"downloaded":t.metadata?"installed":"local"},or="/main:app_store:sys",Xl=(t,e)=>t.package===e.package&&t.publisher===e.publisher,Qo=Hk()(Kk((t,e)=>({myApps:{downloaded:[],installed:[],local:[],system:[]},listedApps:[],searchResults:[],query:"",getMyApps:async()=>{const i=(await(await fetch(`${or}/apps`)).json()).reduce((o,s)=>{const l=sf(s);return o[l].push(s),o},{downloaded:[],installed:[],local:[],system:[]});return t(()=>({myApps:i})),i},getListedApps:async()=>{const n=await(await fetch(`${or}/apps/listed`)).json();return t({listedApps:n}),n},getMyApp:async r=>{const i=await(await fetch(`${or}/apps/${xe(r)}`)).json(),o=sf(i),s=e().myApps;s[o]=s[o].map(a=>Xl(a,i)?i:a);const l=[...e().listedApps].map(a=>Xl(a,i)?i:a);return t({myApps:s,listedApps:l}),i},installApp:async r=>{if((await fetch(`${or}/apps/${xe(r)}/caps`,{method:"POST"})).status!==Dr.OK)throw new Error(`Failed to approve caps for app: ${xe(r)}`);if((await fetch(`${or}/apps/${xe(r)}`,{method:"POST"})).status!==Dr.CREATED)throw new Error(`Failed to install app: ${xe(r)}`)},updateApp:async r=>{if((await fetch(`${or}/apps/${xe(r)}`,{method:"PUT"})).status!==Dr.NO_CONTENT)throw new Error(`Failed to update app: ${xe(r)}`)},uninstallApp:async r=>{if(!confirm(`Are you sure you want to remove ${xe(r)}?`))return;if((await fetch(`${or}/apps/${xe(r)}`,{method:"DELETE"})).status!==Dr.NO_CONTENT)throw new Error(`Failed to remove app: ${xe(r)}`);const i={...e().myApps},o=sf(r);i[o]=i[o].filter(l=>!Xl(l,r));const s=e().listedApps.map(l=>Xl(l,r)?{...l,state:void 0,installed:!1}:l);t({myApps:i,listedApps:s})},getListedApp:async r=>{const n=await fetch(`${or}/apps/listed/${r}`);if(n.status!==Dr.OK)throw new Error(`Failed to get app: ${r}`);return await n.json()},downloadApp:async r=>{if((await fetch(`${or}/apps/listed/${xe(r)}`,{method:"POST"})).status!==Dr.CREATED)throw new Error(`Failed to get app: ${xe(r)}`)},getCaps:async r=>{const n=await fetch(`${or}/apps/${xe(r)}/caps`);if(n.status!==Dr.OK)throw new Error(`Failed to get app: ${xe(r)}`);return(await n.json())[0]},approveCaps:async r=>{if((await fetch(`${or}/apps/${xe(r)}/caps`,{method:"POST"})).status!==Dr.OK)throw new Error(`Failed to get app: ${xe(r)}`)},setMirroring:async(r,n)=>{if((await fetch(`${or}/apps/${xe(r)}/mirror`,{method:n?"PUT":"DELETE"})).status!==Dr.OK)throw new Error(`Failed to start mirror: ${xe(r)}`);e().getMyApp(r)},setAutoUpdate:async(r,n)=>{if((await fetch(`${or}/apps/${xe(r)}/auto-update`,{method:n?"PUT":"DELETE"})).status!==Dr.OK)throw new Error(`Failed to change auto update: ${xe(r)}`);e().getMyApp(r)},get:e,set:t}),{name:"app_store",storage:H1(()=>sessionStorage)}));function q1({app:t,size:e="medium",...r}){var i,o;const n=Iu();return I.jsxs("div",{...r,className:`app-header row ${e} ${r.className||""}`,onClick:()=>n(`/app-details/${xe(t)}`),children:[I.jsx("img",{src:((i=t.metadata)==null?void 0:i.image)||"https://png.pngtree.com/png-vector/20190215/ourmid/pngtree-vector-question-mark-icon-png-image_515448.jpg",alt:"app icon"}),I.jsx("div",{className:"col title",children:I.jsx("div",{className:"app-name ellipsis",children:((o=t.metadata)==null?void 0:o.name)||xe(t)})})]})}const Qk=({show:t,hide:e,hideClose:r=!1,title:n,...i})=>{const o=s=>{s.stopPropagation()};return t?I.jsx("div",{className:`modal-backdrop ${t?"show":""}`,onClick:e,children:I.jsxs("div",{...i,className:`col modal ${i.className||""}`,onClick:o,children:[!!n&&I.jsx("h3",{className:"modal-title",children:n}),!r&&I.jsx(Lk,{className:"close",onClick:e}),I.jsx("div",{className:"col modal-content",onClick:o,children:i.children})]})}):null};function Ed({msg:t}){return I.jsxs("div",{id:"loading",className:"col center",children:[I.jsx("h3",{children:t}),I.jsxs("div",{id:"loader",children:[" ",I.jsx("div",{})," ",I.jsx("div",{})," ",I.jsx("div",{})," ",I.jsx("div",{})," "]})]})}function W1({app:t,...e}){var $,q,ne,K;const{updateApp:r,downloadApp:n,installApp:i,getCaps:o,getMyApp:s}=Qo(),[l,a]=L.useState(!1),[u,c]=L.useState(((q=($=t.metadata)==null?void 0:$.properties.mirrors)==null?void 0:q[0])||""),[d,p]=L.useState([]),[v,g]=L.useState(""),{clean:x,installed:S,downloaded:E,updatable:w}=L.useMemo(()=>{var m,A,N,b,M;const H=((m=t.metadata)==null?void 0:m.properties.current_version)&&((N=t.metadata)==null?void 0:N.properties.code_hashes[(A=t.metadata)==null?void 0:A.properties.current_version]),se=t.installed,C=!!t.state,f=!!((b=t.state)!=null&&b.our_version&&H)&&((M=t.state)==null?void 0:M.our_version)!==H&&t.publisher!==window.our.node;return{clean:!se&&!C&&!f,installed:se,downloaded:C,updatable:f}},[t]),_=L.useCallback(async()=>{S&&!w?window.alert("App is installed"):(E&&o(t).then(H=>{p(H.request_capabilities)}),a(!0))},[t,S,E,w,a,o]),O=L.useCallback(async()=>{try{g(`Downloading ${cs(t)}...`),await n(t);const H=setInterval(()=>{s(t).then(()=>{g(""),a(!1),clearInterval(H)}).catch(console.log)},2e3)}catch(H){console.error(H),window.alert(`Failed to download app from ${u}, please try a different mirror.`),g("")}},[u,t,n,s]),B=L.useCallback(async()=>{try{g(`Installing ${cs(t)}...`),await i(t);const H=setInterval(()=>{s(t).then(se=>{se.installed&&(g(""),a(!1),clearInterval(H))}).catch(console.log)},2e3)}catch(H){console.error(H),window.alert("Failed to install, please try again."),g("")}},[t,i,s]),j=L.useCallback(async()=>{try{g(`Updating ${cs(t)}...`),await r(t);const H=setInterval(()=>{s(t).then(se=>{se.installed&&(g(""),a(!1),clearInterval(H))}).catch(console.log)},2e3)}catch(H){console.error(H),window.alert("Failed to update, please try again."),g("")}},[t,r,s]);return I.jsxs(I.Fragment,{children:[I.jsx("button",{...e,type:"button",className:`unstyled action-btn ${e.className||""}`,onClick:_,children:S&&w?"Update":S?"Installed":E?"Install":"Download"}),I.jsx(Qk,{show:l,hide:()=>a(!1),children:v?I.jsx(Ed,{msg:v}):x?I.jsxs(I.Fragment,{children:[I.jsxs("h3",{children:["Download ",(ne=t.metadata)==null?void 0:ne.name,"?"]}),I.jsx("h4",{style:{margin:0},children:"Select Mirror"}),I.jsx("select",{style:{margin:"1em 0"},value:u,onChange:H=>c(H.target.value),children:(K=t.metadata)==null?void 0:K.properties.mirrors.map(H=>I.jsx("option",{value:H,children:H},H))}),I.jsx("button",{type:"button",onClick:O,children:"Download"})]}):E?I.jsxs(I.Fragment,{children:[I.jsx("h3",{children:"Approve App Permissions"}),I.jsxs("h4",{style:{margin:0},children:[cs(t)," needs the following permissions:"]}),I.jsx("ul",{className:"col",style:{margin:"1em 0",alignItems:"flex-start"},children:d.map(H=>I.jsx("li",{children:H},H))}),I.jsx("button",{type:"button",onClick:B,children:"Approve & Install"})]}):I.jsxs(I.Fragment,{children:[I.jsx("h3",{children:"Approve App Permissions"}),I.jsxs("h4",{style:{margin:0},children:[cs(t)," needs the following permissions:"]}),I.jsx("br",{}),I.jsx("ul",{className:"col",style:{margin:"1em 0",alignItems:"flex-start"},children:d.map(H=>I.jsx("li",{children:H},H))}),I.jsx("button",{type:"button",onClick:j,children:"Approve & Update"})]})})]})}const G1=t=>!!t&&t[0]==="o",bm=Qs.unstable_batchedUpdates||(t=>t()),Vi=(t,e,r=1e-4)=>Math.abs(t-e)t===!0||!!(t&&t[e]),hr=(t,e)=>typeof t=="function"?t(e):t,V1="_szhsinMenu",Jk=t=>t[V1],Yk=(t,e)=>Object.defineProperty(e,V1,{value:t}),Ku=(t,e)=>(e&&Object.keys(e).forEach(r=>{const n=t[r],i=e[r];typeof i=="function"&&n?t[r]=(...o)=>{i(...o),n(...o)}:t[r]=i}),t),Xk=t=>{if(typeof t!="string")return{top:0,right:0,bottom:0,left:0};const e=t.trim().split(/\s+/,4).map(parseFloat),r=isNaN(e[0])?0:e[0],n=isNaN(e[1])?r:e[1];return{top:r,right:n,bottom:isNaN(e[2])?r:e[2],left:isNaN(e[3])?n:e[3]}},lf=t=>{for(;t;){if(t=t.parentNode,!t||t===document.body||!t.parentNode)return;const{overflow:e,overflowX:r,overflowY:n}=getComputedStyle(t);if(/auto|scroll|overlay|hidden/.test(e+n+r))return t}};function K1(t,e){return{"aria-disabled":t||void 0,tabIndex:e?0:-1}}function _m(t,e){for(let r=0;rL.useMemo(()=>{const i=e?`${t}__${e}`:t;let o=i;r&&Object.keys(r).forEach(l=>{const a=r[l];a&&(o+=` ${i}--${a===!0?l:`${l}-${a}`}`)});let s=typeof n=="function"?n(r):n;return typeof s=="string"&&(s=s.trim(),s&&(o+=` ${s}`)),o},[t,e,r,n]),Zk="szh-menu-container",Aa="szh-menu",e4="szh-menu-button",t4="arrow",r4="item",Q1=L.createContext(),J1=L.createContext({}),Sm=L.createContext({}),Y1=L.createContext({}),n4=L.createContext({}),jh=L.createContext({}),$r=Object.freeze({ENTER:"Enter",ESC:"Escape",SPACE:" ",HOME:"Home",END:"End",LEFT:"ArrowLeft",RIGHT:"ArrowRight",UP:"ArrowUp",DOWN:"ArrowDown"}),xt=Object.freeze({RESET:0,SET:1,UNSET:2,INCREASE:3,DECREASE:4,FIRST:5,LAST:6,SET_INDEX:7}),ul=Object.freeze({CLICK:"click",CANCEL:"cancel",BLUR:"blur",SCROLL:"scroll"}),Ms=Object.freeze({FIRST:"first",LAST:"last"}),i4=Object.freeze({entering:"opening",entered:"open",exiting:"closing",exited:"closed"}),af="absolute",o4="presentation",X1="menuitem",km={"aria-hidden":!0,role:X1},s4=Yk("MenuButton",L.forwardRef(function({className:e,isOpen:r,disabled:n,children:i,...o},s){const l=L.useMemo(()=>({open:r}),[r]);return I.jsx("button",{"aria-haspopup":!0,"aria-expanded":r,"aria-disabled":n||void 0,type:"button",disabled:n,...o,ref:s,className:al({block:e4,modifiers:l,className:e}),children:i})})),l4=({className:t,containerRef:e,containerProps:r,children:n,isOpen:i,theming:o,transition:s,onClose:l})=>{const a=ll(s,"item"),u=({key:d})=>{switch(d){case $r.ESC:hr(l,{key:d,reason:ul.CANCEL});break}},c=d=>{i&&!d.currentTarget.contains(d.relatedTarget)&&hr(l,{reason:ul.BLUR})};return I.jsx("div",{...Ku({onKeyDown:u,onBlur:c},r),className:al({block:Zk,modifiers:L.useMemo(()=>({theme:o,itemTransition:a}),[o,a]),className:t}),style:{position:"absolute",...r==null?void 0:r.style},ref:e,children:n})},a4=()=>{let t,e=0;return{toggle:r=>{r?e++:e--,e=Math.max(e,0)},on:(r,n,i)=>{e?t||(t=setTimeout(()=>{t=0,n()},r)):i==null||i()},off:()=>{t&&(clearTimeout(t),t=0)}}},u4=(t,e)=>{const[r,n]=L.useState(),o=L.useRef({items:[],hoverIndex:-1,sorted:!1}).current,s=L.useCallback((a,u)=>{const{items:c}=o;if(!a)o.items=[];else if(u)c.push(a);else{const d=c.indexOf(a);d>-1&&(c.splice(d,1),a.contains(document.activeElement)&&(e.current.focus(),n()))}o.hoverIndex=-1,o.sorted=!1},[o,e]),l=L.useCallback((a,u,c)=>{const{items:d,hoverIndex:p}=o,v=()=>{if(o.sorted)return;const S=t.current.querySelectorAll(".szh-menu__item");d.sort((E,w)=>_m(S,E)-_m(S,w)),o.sorted=!0};let g=-1,x;switch(a){case xt.RESET:break;case xt.SET:x=u;break;case xt.UNSET:x=S=>S===u?void 0:S;break;case xt.FIRST:v(),g=0,x=d[g];break;case xt.LAST:v(),g=d.length-1,x=d[g];break;case xt.SET_INDEX:v(),g=c,x=d[g];break;case xt.INCREASE:v(),g=p,g<0&&(g=d.indexOf(u)),g++,g>=d.length&&(g=0),x=d[g];break;case xt.DECREASE:v(),g=p,g<0&&(g=d.indexOf(u)),g--,g<0&&(g=d.length-1),x=d[g];break}x||(g=-1),n(x),o.hoverIndex=g},[t,o]);return{hoverItem:r,dispatch:l,updateItems:s}},c4=(t,e,r,n)=>{const i=e.current.getBoundingClientRect(),o=t.current.getBoundingClientRect(),s=r===window?{left:0,top:0,right:document.documentElement.clientWidth,bottom:window.innerHeight}:r.getBoundingClientRect(),l=Xk(n),a=g=>g+o.left-s.left-l.left,u=g=>g+o.left+i.width-s.right+l.right,c=g=>g+o.top-s.top-l.top,d=g=>g+o.top+i.height-s.bottom+l.bottom;return{menuRect:i,containerRect:o,getLeftOverflow:a,getRightOverflow:u,getTopOverflow:c,getBottomOverflow:d,confineHorizontally:g=>{let x=a(g);if(x<0)g-=x;else{const S=u(g);S>0&&(g-=S,x=a(g),x<0&&(g-=x))}return g},confineVertically:g=>{let x=c(g);if(x<0)g-=x;else{const S=d(g);S>0&&(g-=S,x=c(g),x<0&&(g-=x))}return g}}},f4=({arrowRef:t,menuY:e,anchorRect:r,containerRect:n,menuRect:i})=>{let o=r.top-n.top-e+r.height/2;const s=t.current.offsetHeight*1.25;return o=Math.max(s,o),o=Math.min(o,i.height-s),o},d4=({anchorRect:t,containerRect:e,menuRect:r,placeLeftorRightY:n,placeLeftX:i,placeRightX:o,getLeftOverflow:s,getRightOverflow:l,confineHorizontally:a,confineVertically:u,arrowRef:c,arrow:d,direction:p,position:v})=>{let g=p,x=n;v!=="initial"&&(x=u(x),v==="anchor"&&(x=Math.min(x,t.bottom-e.top),x=Math.max(x,t.top-e.top-r.height)));let S,E,w;return g==="left"?(S=i,v!=="initial"&&(E=s(S),E<0&&(w=l(o),(w<=0||-E>w)&&(S=o,g="right")))):(S=o,v!=="initial"&&(w=l(S),w>0&&(E=s(i),(E>=0||-E{let o=r.left-n.left-e+r.width/2;const s=t.current.offsetWidth*1.25;return o=Math.max(s,o),o=Math.min(o,i.width-s),o},p4=({anchorRect:t,containerRect:e,menuRect:r,placeToporBottomX:n,placeTopY:i,placeBottomY:o,getTopOverflow:s,getBottomOverflow:l,confineHorizontally:a,confineVertically:u,arrowRef:c,arrow:d,direction:p,position:v})=>{let g=p==="top"?"top":"bottom",x=n;v!=="initial"&&(x=a(x),v==="anchor"&&(x=Math.min(x,t.right-e.left),x=Math.max(x,t.left-e.left-r.width)));let S,E,w;return g==="top"?(S=i,v!=="initial"&&(E=s(S),E<0&&(w=l(o),(w<=0||-E>w)&&(S=o,g="bottom")))):(S=o,v!=="initial"&&(w=l(S),w>0&&(E=s(i),(E>=0||-E{const{menuRect:u,containerRect:c}=a,d=r==="left"||r==="right";let p=d?n:i,v=d?i:n;if(t){const B=l.current;d?p+=B.offsetWidth:v+=B.offsetHeight}const g=s.left-c.left-u.width-p,x=s.right-c.left+p,S=s.top-c.top-u.height-v,E=s.bottom-c.top+v;let w,_;e==="end"?(w=s.right-c.left-u.width,_=s.bottom-c.top-u.height):e==="center"?(w=s.left-c.left-(u.width-s.width)/2,_=s.top-c.top-(u.height-s.height)/2):(w=s.left-c.left,_=s.top-c.top),w+=p,_+=v;const O={...a,anchorRect:s,placeLeftX:g,placeRightX:x,placeLeftorRightY:_,placeTopY:S,placeBottomY:E,placeToporBottomX:w,arrowRef:l,arrow:t,direction:r,position:o};switch(r){case"left":case"right":return d4(O);case"top":case"bottom":default:return p4(O)}},ba=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?L.useLayoutEffect:L.useEffect;function Nm(t,e){typeof t=="function"?t(e):t.current=e}const Uh=(t,e)=>L.useMemo(()=>t?e?r=>{Nm(t,r),Nm(e,r)}:t:e,[t,e]),Pm=-9999,g4=({ariaLabel:t,menuClassName:e,menuStyle:r,arrow:n,arrowProps:i={},anchorPoint:o,anchorRef:s,containerRef:l,containerProps:a,focusProps:u,externalRef:c,parentScrollingRef:d,align:p="start",direction:v="bottom",position:g="auto",overflow:x="visible",setDownOverflow:S,repositionFlag:E,captureFocus:w=!0,state:_,endTransition:O,isDisabled:B,menuItemFocus:j,gap:$=0,shift:q=0,children:ne,onClose:K,...H})=>{const[se,C]=L.useState({x:Pm,y:Pm}),[f,m]=L.useState({}),[A,N]=L.useState(),[b,M]=L.useState(v),[R]=L.useState(a4),[k,h]=L.useReducer(re=>re+1,1),{transition:P,boundingBoxRef:ee,boundingBoxPadding:y,rootMenuRef:D,rootAnchorRef:U,scrollNodesRef:F,reposition:G,viewScroll:ie,submenuCloseDelay:Y}=L.useContext(jh),{submenuCtx:Q,reposSubmenu:Je=E}=L.useContext(Sm),J=L.useRef(null),le=L.useRef(),Qr=L.useRef(),Te=L.useRef(!1),Ne=L.useRef({width:0,height:0}),Jr=L.useRef(()=>{}),{hoverItem:Pe,dispatch:ce,updateItems:wr}=u4(J,le),fe=G1(_),Oe=ll(P,"open"),Yr=ll(P,"close"),me=F.current,ze=re=>{switch(re.key){case $r.HOME:ce(xt.FIRST);break;case $r.END:ce(xt.LAST);break;case $r.UP:ce(xt.DECREASE,Pe);break;case $r.DOWN:ce(xt.INCREASE,Pe);break;case $r.SPACE:re.target&&re.target.className.indexOf(Aa)!==-1&&re.preventDefault();return;default:return}re.preventDefault(),re.stopPropagation()},gn=()=>{_==="closing"&&N(),hr(O)},$e=re=>{re.stopPropagation(),R.on(Y,()=>{ce(xt.RESET),le.current.focus()})},He=re=>{re.target===re.currentTarget&&R.off()},Ht=L.useCallback(re=>{var ot;const ge=s?(ot=s.current)==null?void 0:ot.getBoundingClientRect():o?{left:o.x,right:o.x,top:o.y,bottom:o.y,width:0,height:0}:null;if(!ge)return;me.menu||(me.menu=(ee?ee.current:lf(D.current))||window);const de=c4(l,J,me.menu,y);let{arrowX:rt,arrowY:be,x:_e,y:Ct,computedDirection:Me}=m4({arrow:n,align:p,direction:v,gap:$,shift:q,position:g,anchorRect:ge,arrowRef:Qr,positionHelpers:de});const{menuRect:je}=de;let Kt=je.height;if(!re&&x!=="visible"){const{getTopOverflow:Ve,getBottomOverflow:Ke}=de;let Qt,Ie;const Ue=Ne.current.height,Er=Ke(Ct);if(Er>0||Vi(Er,0)&&Vi(Kt,Ue))Qt=Kt-Er,Ie=Er;else{const ke=Ve(Ct);(ke<0||Vi(ke,0)&&Vi(Kt,Ue))&&(Qt=Kt+ke,Ie=0-ke,Qt>=0&&(Ct-=ke))}Qt>=0?(Kt=Qt,N({height:Qt,overflowAmt:Ie})):N()}n&&m({x:rt,y:be}),C({x:_e,y:Ct}),M(Me),Ne.current={width:je.width,height:Kt}},[n,p,y,v,$,q,g,x,o,s,l,ee,D,me]);ba(()=>{fe&&(Ht(),Te.current&&h()),Te.current=fe,Jr.current=Ht},[fe,Ht,Je]),ba(()=>{A&&!S&&(J.current.scrollTop=0)},[A,S]),ba(()=>wr,[wr]),L.useEffect(()=>{let{menu:re}=me;if(!fe||!re)return;if(re=re.addEventListener?re:window,!me.anchors){me.anchors=[];let rt=lf(U&&U.current);for(;rt&&rt!==re;)me.anchors.push(rt),rt=lf(rt)}let ot=ie;if(me.anchors.length&&ot==="initial"&&(ot="auto"),ot==="initial")return;const ge=()=>{ot==="auto"?bm(()=>Ht(!0)):hr(K,{reason:ul.SCROLL})},de=me.anchors.concat(ie!=="initial"?re:[]);return de.forEach(rt=>rt.addEventListener("scroll",ge)),()=>de.forEach(rt=>rt.removeEventListener("scroll",ge))},[U,me,fe,K,ie,Ht]);const Le=!!A&&A.overflowAmt>0;L.useEffect(()=>{if(Le||!fe||!d)return;const re=()=>bm(Ht),ot=d.current;return ot.addEventListener("scroll",re),()=>ot.removeEventListener("scroll",re)},[fe,Le,d,Ht]),L.useEffect(()=>{if(typeof ResizeObserver!="function"||G==="initial")return;const re=new ResizeObserver(([ge])=>{const{borderBoxSize:de,target:rt}=ge;let be,_e;if(de){const{inlineSize:Ct,blockSize:Me}=de[0]||de;be=Ct,_e=Me}else{const Ct=rt.getBoundingClientRect();be=Ct.width,_e=Ct.height}be===0||_e===0||Vi(be,Ne.current.width,1)&&Vi(_e,Ne.current.height,1)||Qs.flushSync(()=>{Jr.current(),h()})}),ot=J.current;return re.observe(ot,{box:"border-box"}),()=>re.unobserve(ot)},[G]),L.useEffect(()=>{if(!fe){ce(xt.RESET),Yr||N();return}const{position:re,alwaysUpdate:ot}=j||{},ge=()=>{re===Ms.FIRST?ce(xt.FIRST):re===Ms.LAST?ce(xt.LAST):re>=-1&&ce(xt.SET_INDEX,void 0,re)};if(ot)ge();else if(w){const de=setTimeout(()=>{const rt=J.current;rt&&!rt.contains(document.activeElement)&&(le.current.focus(),ge())},Oe?170:100);return()=>clearTimeout(de)}},[fe,Oe,Yr,w,j,ce]);const qe=L.useMemo(()=>({isParentOpen:fe,submenuCtx:R,dispatch:ce,updateItems:wr}),[fe,R,ce,wr]);let Rr,Ce;A&&(S?Ce=A.overflowAmt:Rr=A.height);const We=L.useMemo(()=>({reposSubmenu:k,submenuCtx:R,overflow:x,overflowAmt:Ce,parentMenuRef:J,parentDir:b}),[k,R,x,Ce,b]),vn=Rr>=0?{maxHeight:Rr,overflow:x}:void 0,Be=L.useMemo(()=>({state:_,dir:b}),[_,b]),Ge=L.useMemo(()=>({dir:b}),[b]),yn=al({block:Aa,element:t4,modifiers:Ge,className:i.className}),De=I.jsxs("ul",{role:"menu","aria-label":t,...K1(B),...Ku({onPointerEnter:Q==null?void 0:Q.off,onPointerMove:$e,onPointerLeave:He,onKeyDown:ze,onAnimationEnd:gn},H),ref:Uh(c,J),className:al({block:Aa,modifiers:Be,className:e}),style:{...r,...vn,margin:0,display:_==="closed"?"none":void 0,position:af,left:se.x,top:se.y},children:[I.jsx("li",{tabIndex:-1,style:{position:af,left:0,top:0,display:"block",outline:"none"},ref:le,...km,...u}),n&&I.jsx("li",{...km,...i,className:yn,style:{display:"block",position:af,left:f.x,top:f.y,...i.style},ref:Qr}),I.jsx(Sm.Provider,{value:We,children:I.jsx(J1.Provider,{value:qe,children:I.jsx(Q1.Provider,{value:Pe,children:hr(ne,Be)})})})]});return a?I.jsx(l4,{...a,isOpen:fe,children:De}):De},v4=L.forwardRef(function({"aria-label":e,className:r,containerProps:n,initialMounted:i,unmountOnClose:o,transition:s,transitionTimeout:l,boundingBoxRef:a,boundingBoxPadding:u,reposition:c="auto",submenuOpenDelay:d=300,submenuCloseDelay:p=150,viewScroll:v="initial",portal:g,theming:x,onItemClick:S,...E},w){const _=L.useRef(null),O=L.useRef({}),{anchorRef:B,state:j,onClose:$}=E,q=L.useMemo(()=>({initialMounted:i,unmountOnClose:o,transition:s,transitionTimeout:l,boundingBoxRef:a,boundingBoxPadding:u,rootMenuRef:_,rootAnchorRef:B,scrollNodesRef:O,reposition:c,viewScroll:v,submenuOpenDelay:d,submenuCloseDelay:p}),[i,o,s,l,B,a,u,c,v,d,p]),ne=L.useMemo(()=>({handleClick(H,se){H.stopPropagation||hr(S,H);let C=H.keepOpen;C===void 0&&(C=se&&H.key===$r.SPACE),C||hr($,{value:H.value,key:H.key,reason:ul.CLICK})},handleClose(H){hr($,{key:H,reason:ul.CLICK})}}),[S,$]);if(!j)return null;const K=I.jsx(jh.Provider,{value:q,children:I.jsx(Y1.Provider,{value:ne,children:I.jsx(g4,{...E,ariaLabel:e||"Menu",externalRef:w,containerRef:_,containerProps:{className:r,containerRef:_,containerProps:n,theming:x,transition:s,onClose:$}})})});return g===!0&&typeof document<"u"?Qs.createPortal(K,document.body):g?g.target?Qs.createPortal(K,g.target):g.stablePosition?null:K:K}),xd=0,Ad=1,au=2,uu=3,cu=4,y4=5,Z1=6,w4=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],ew=t=>({_s:t,status:w4[t],isEnter:tcu}),bd=t=>t?Z1:y4,E4=(t,e)=>{switch(t){case Ad:case xd:return au;case cu:case uu:return bd(e)}},x4=t=>typeof t=="object"?[t.enter,t.exit]:[t,t],A4=(t,e)=>setTimeout(()=>{isNaN(document.body.offsetTop)||t(e+1)},0),Cm=(t,e,r,n,i)=>{clearTimeout(n.current);const o=ew(t);e(o),r.current=o,i&&i({current:o})},b4=({enter:t=!0,exit:e=!0,preEnter:r,preExit:n,timeout:i,initialEntered:o,mountOnEnter:s,unmountOnExit:l,onStateChange:a}={})=>{const[u,c]=L.useState(()=>ew(o?au:bd(s))),d=L.useRef(u),p=L.useRef(),[v,g]=x4(i),x=L.useCallback(()=>{const E=E4(d.current._s,l);E&&Cm(E,c,d,p,a)},[a,l]),S=L.useCallback(E=>{const w=O=>{switch(Cm(O,c,d,p,a),O){case Ad:v>=0&&(p.current=setTimeout(x,v));break;case cu:g>=0&&(p.current=setTimeout(x,g));break;case xd:case uu:p.current=A4(w,O);break}},_=d.current.isEnter;typeof E!="boolean"&&(E=!_),E?!_&&w(t?r?xd:Ad:au):_&&w(e?n?uu:cu:bd(l))},[x,a,t,e,r,n,v,g,l]);return L.useEffect(()=>()=>clearTimeout(p.current),[]),[u,S,x]},_4=({initialOpen:t,initialMounted:e,unmountOnClose:r,transition:n,transitionTimeout:i=500}={})=>{const[{status:o},s,l]=b4({initialEntered:t,mountOnEnter:!e,unmountOnExit:r,timeout:i,enter:ll(n,"open"),exit:ll(n,"close")});return[{state:i4[o],endTransition:l},s]},S4=t=>{const[e,r]=_4(t),[n,i]=L.useState(),o=(s,l)=>{i({position:s,alwaysUpdate:l}),r(!0)};return[{menuItemFocus:n,...e},r,o]},k4=(t,e)=>{const[r]=L.useState({});return{onMouseDown:()=>{r.v=t&&t!=="closed"},onClick:n=>r.v?r.v=!1:e(!0,n)}},N4=(t,e)=>{const r=L.useRef(e);L.useEffect(()=>{r.current!==e&&hr(t,{open:e}),r.current=e},[t,e])},P4=L.forwardRef(function({"aria-label":e,captureFocus:r,initialOpen:n,menuButton:i,instanceRef:o,onMenuChange:s,...l},a){const[u,c,d]=S4(l),{state:p}=u,v=G1(p),g=L.useRef(null),x=k4(p,(B,j)=>d(j.detail?void 0:Ms.FIRST)),S=L.useCallback(B=>{c(!1),B.key&&g.current.focus()},[c]),E=B=>{switch(B.key){case $r.UP:d(Ms.LAST);break;case $r.DOWN:d(Ms.FIRST);break;default:return}B.preventDefault()},w=hr(i,{open:v});if(!w||!w.type)throw new Error("Menu requires a menuButton prop.");const _={ref:Uh(w.ref,g),...Ku({onKeyDown:E,...x},w.props)};Jk(w.type)==="MenuButton"&&(_.isOpen=v);const O=L.cloneElement(w,_);return N4(s,v),L.useImperativeHandle(o,()=>({openMenu:d,closeMenu:()=>c(!1)})),I.jsxs(L.Fragment,{children:[O,I.jsx(v4,{...l,...u,"aria-label":e||(typeof w.props.children=="string"?w.props.children:"Menu"),anchorRef:g,ref:a,onClose:S})]})}),C4=(t,e)=>{const r=L.memo(e),n=L.forwardRef((i,o)=>{const s=L.useRef(null);return I.jsx(r,{...i,itemRef:s,externalRef:o,isHovering:L.useContext(Q1)===s.current})});return n.displayName=`WithHovering(${t})`,n},M4=(t,e,r)=>{ba(()=>{if(t)return;const n=e.current;return r(n,!0),()=>{r(n)}},[t,e,r])},I4=(t,e,r,n)=>{const{submenuCloseDelay:i}=L.useContext(jh),{isParentOpen:o,submenuCtx:s,dispatch:l,updateItems:a}=L.useContext(J1),u=()=>{!r&&!n&&l(xt.SET,t.current)},c=()=>{!n&&l(xt.UNSET,t.current)},d=g=>{r&&!g.currentTarget.contains(g.relatedTarget)&&c()},p=g=>{n||(g.stopPropagation(),s.on(i,u,u))},v=(g,x)=>{s.off(),!x&&c()};return M4(n,t,a),L.useEffect(()=>{r&&o&&e.current&&e.current.focus()},[e,r,o]),{setHover:u,onBlur:d,onPointerMove:p,onPointerLeave:v}},Ki=C4("MenuItem",function({className:e,value:r,href:n,type:i,checked:o,disabled:s,children:l,onClick:a,isHovering:u,itemRef:c,externalRef:d,...p}){const v=!!s,{setHover:g,...x}=I4(c,c,u,v),S=L.useContext(Y1),E=L.useContext(n4),w=i==="radio",_=i==="checkbox",O=!!n&&!v&&!w&&!_,B=w?E.value===r:_?!!o:!1,j=H=>{if(v){H.stopPropagation(),H.preventDefault();return}const se={value:r,syntheticEvent:H};H.key!==void 0&&(se.key=H.key),_&&(se.checked=!B),w&&(se.name=E.name),hr(a,se),w&&hr(E.onRadioChange,se),S.handleClick(se,_||w)},$=H=>{if(u)switch(H.key){case $r.ENTER:H.preventDefault();case $r.SPACE:O?c.current.click():j(H)}},q=L.useMemo(()=>({type:i,disabled:v,hover:u,checked:B,anchor:O}),[i,v,u,B,O]),ne=Ku({...x,onPointerDown:g,onKeyDown:$,onClick:j},p),K={role:w?"menuitemradio":_?"menuitemcheckbox":X1,"aria-checked":w||_?B:void 0,...K1(v,u),...ne,ref:Uh(d,c),className:al({block:Aa,element:r4,modifiers:q,className:e}),children:L.useMemo(()=>hr(l,q),[l,q])};return O?I.jsx("li",{role:o4,children:I.jsx("a",{href:n,...K})}):I.jsx("li",{...K})});function Mm({...t}){return I.jsx(P4,{...t,className:"dropdown "+t.className,menuButton:I.jsx(s4,{className:"unstyled",children:I.jsx(Ok,{style:{marginBottom:"-0.125em"}})}),children:t.children})}function R4({app:t}){var s,l,a,u,c;const{uninstallApp:e,setMirroring:r,setAutoUpdate:n}=Qo(),i=Iu();return!t.state?t.metadata?I.jsxs(Mm,{children:[((s=t.metadata)==null?void 0:s.description)&&I.jsx(Ki,{className:"action-entry",onClick:()=>i(`/app-details/${xe(t)}`),children:"View Details"}),((l=t.metadata)==null?void 0:l.external_url)&&I.jsx(Ki,{children:I.jsx("a",{style:{color:"inherit",whiteSpace:"nowrap",cursor:"pointer",marginTop:"0.25em"},target:"_blank",href:(a=t.metadata)==null?void 0:a.external_url,children:"View Site"})})]}):I.jsx("div",{style:{width:24}}):I.jsxs(Mm,{children:[I.jsx(Ki,{className:"action-entry",onClick:()=>i(`/app-details/${xe(t)}`),children:"View Details"}),t.installed&&I.jsxs(I.Fragment,{children:[I.jsx(Ki,{className:"action-entry",onClick:()=>e(t),children:"Uninstall"}),I.jsxs(Ki,{className:"action-entry",onClick:()=>{var d;return r(t,!((d=t.state)!=null&&d.mirroring))},children:[(u=t.state)!=null&&u.mirroring?"Stop":"Start"," Mirroring"]}),I.jsxs(Ki,{className:"action-entry",onClick:()=>{var d;return n(t,!((d=t.state)!=null&&d.auto_update))},children:[(c=t.state)!=null&&c.auto_update?"Disable":"Enable"," Auto Update"]})]})]})}function ys({app:t,...e}){var r;return L.createElement("div",{...e,key:xe(t),className:"app-entry row between"},I.jsx(q1,{app:t,size:"small"}),I.jsxs("div",{className:"app-actions row",children:[!((r=t.state)!=null&&r.capsApproved)&&I.jsx(W1,{app:t,style:{marginRight:"1em"}}),I.jsx(R4,{app:t})]}))}const _d="/my-apps";function Qu({value:t="",onChange:e=()=>null,hideSearch:r=!1}){const n=Iu(),i=xh(),o=qr.useRef(null),s=i.key!=="default",l=i.pathname===_d;return I.jsxs("div",{className:"search-header row between",children:[i.pathname!=="/"?I.jsx("button",{className:"back-btn col center",onClick:()=>n(s?-1:"/"),children:I.jsx(Mk,{})}):I.jsx("button",{className:"back-btn col center",onClick:()=>n("/publish"),children:I.jsx(z1,{})}),!r&&I.jsxs("div",{className:"searchbar row",children:[I.jsx(Bk,{className:"search-icon",onClick:()=>{var a;return(a=o.current)==null?void 0:a.focus()}}),I.jsx("input",{ref:o,onChange:a=>e(a.target.value),value:t,placeholder:"Search for apps..."}),t.length>0&&I.jsx(Dk,{className:"search-icon",style:{margin:"0 -0.25em 0 0.25em"},onClick:()=>e("")})]}),I.jsx("div",{className:"row",children:I.jsxs("button",{className:`my-pkg-btn row ${l?"selected":""}`,onClick:()=>n(l?-1:_d),children:[I.jsx(Tk,{style:{marginRight:"0.5em"}}),"My Packages"]})})]})}function T4(t){const{listedApps:e,getListedApps:r}=Qo(),[n,i]=L.useState("Recently published"),[o,s]=L.useState(""),[l,a]=L.useState(e),[u,c]=L.useState(1),d=L.useMemo(()=>Array.from({length:Math.ceil(l.length/10)},(g,x)=>x+1),[l]);L.useEffect(()=>{const g=(u-1)*10,x=g+10;a(e.slice(g,x))},[e]),L.useEffect(()=>{r().then(g=>{a(Object.values(g))}).catch(g=>console.error(g))},[]);const p=L.useCallback(async g=>{},[]),v=L.useCallback(g=>{s(g);const x=e.filter(S=>{var E,w,_,O;return S.package.toLowerCase().includes(g.toLowerCase())||((w=(E=S.metadata)==null?void 0:E.description)==null?void 0:w.toLowerCase().includes(g.toLowerCase()))||((O=(_=S.metadata)==null?void 0:_.description)==null?void 0:O.toLowerCase().includes(g.toLowerCase()))},[e]);a(x)},[e]);return I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{value:o,onChange:v}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"New"}),I.jsxs("select",{value:n,onChange:g=>{i(g.target.value),p(g.target.value)},style:{marginBottom:"-1em"},children:[I.jsx("option",{children:"Recently published"}),I.jsx("option",{children:"Most popular"}),I.jsx("option",{children:"Best rating"}),I.jsx("option",{children:"Recently updated"})]})]}),I.jsxs("div",{className:"new card col",style:{flex:1,overflowY:"scroll"},children:[l.map(g=>{var x;return I.jsx(ys,{app:g},xe(g)+(((x=g.state)==null?void 0:x.our_version)||""))}),d.length>1&&I.jsxs("div",{className:"row",style:{alignSelf:"center"},children:[u!==d[0]&&I.jsx(Ik,{onClick:()=>c(u-1)}),d.map(g=>I.jsx("div",{className:`page-selector ${g===u?"selected":""}`,onClick:()=>c(g),children:g},`page-${g}`)),u!==d[d.length-1]&&I.jsx(Rk,{onClick:()=>c(u+1)})]})]})]})}function O4(t){const{myApps:e,getMyApps:r}=Qo(),n=Iu(),[i,o]=L.useState(""),[s,l]=L.useState(e);L.useEffect(()=>{r().then(l).catch(u=>console.error(u))},[]);const a=L.useCallback(u=>{o(u);const c=Object.keys(e).reduce((d,p)=>(d[p]=e[p].filter(v=>{var g,x,S,E;return v.package.toLowerCase().includes(u.toLowerCase())||((x=(g=v.metadata)==null?void 0:g.description)==null?void 0:x.toLowerCase().includes(u.toLowerCase()))||((E=(S=v.metadata)==null?void 0:S.description)==null?void 0:E.toLowerCase().includes(u.toLowerCase()))}),d),{downloaded:[],installed:[],local:[],system:[]});l(c)},[e]);return I.jsxs("div",{style:{width:"100%",height:"100%"},children:[I.jsx(Qu,{value:i,onChange:a}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"My Packages"}),I.jsxs("button",{className:"row",onClick:()=>n("/publish"),children:[I.jsx(z1,{style:{marginRight:"0.5em"}}),"Publish Package"]})]}),I.jsx("div",{className:"my-apps-list",children:I.jsxs("div",{className:"new card col",children:[I.jsx("h3",{children:"Downloaded"}),(s.downloaded||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"Installed"}),(s.installed||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"Local"}),(s.local||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"System"}),(s.system||[]).map(u=>I.jsx(ys,{app:u},xe(u)))]})})]})}function L4(t){var u,c,d,p,v,g,x;const{myApps:e,listedApps:r,getListedApp:n}=Qo(),i=lx(),[o,s]=L.useState(void 0);L.useEffect(()=>{const S=e.local.find(E=>xe(E)===i.id);if(S)return s(S);if(i.id){const E=r.find(w=>xe(w)===i.id);E?s(E):n(i.id).then(w=>s(w)).catch(console.error)}},[i.id]);const l=L.useMemo(()=>{var S;return((S=o==null?void 0:o.metadata)==null?void 0:S.properties.current_version)||"Unknown"},[o]),a=((u=o==null?void 0:o.state)==null?void 0:u.our_version)||((p=(c=o==null?void 0:o.metadata)==null?void 0:c.properties.code_hashes)==null?void 0:p[(d=o==null?void 0:o.metadata)==null?void 0:d.properties.current_version])||"";return I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{value:"",onChange:()=>null,hideSearch:!0}),I.jsx("div",{className:"card",style:{marginTop:"1em"},children:o?I.jsxs(I.Fragment,{children:[I.jsxs("div",{className:"row between",children:[I.jsx(q1,{app:o,size:"large"}),I.jsx(W1,{app:o,style:{marginRight:"0.5em"}})]}),I.jsxs("div",{className:"col",style:{marginTop:"1em"},children:[I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Description"}),I.jsx("div",{className:"value",children:(((v=o.metadata)==null?void 0:v.description)||"No description given").slice(0,2e3)})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Publisher"}),I.jsx("div",{className:"value underline",children:o.publisher})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Version"}),I.jsx("div",{className:"value",children:l})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Mirrors"}),I.jsx("div",{className:"col",children:(((g=o.metadata)==null?void 0:g.properties.mirrors)||[]).map((S,E)=>I.jsx("div",{className:"value underline",children:S},E+S))})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Hash"}),I.jsx("div",{className:"value",style:{wordBreak:"break-all"},children:a})]})]}),I.jsx("div",{className:"app-screenshots row",children:(((x=o.metadata)==null?void 0:x.properties.screenshots)||[]).map((S,E)=>I.jsx("img",{src:S},E+S))})]}):I.jsxs(I.Fragment,{children:[I.jsx("h3",{children:"App details not found for "}),I.jsx("h3",{children:i.id})]})})]})}var _a=(t=>(t[t.SEPOLIA=11155111]="SEPOLIA",t[t.OPTIMISM=10]="OPTIMISM",t[t.OPTIMISM_GOERLI=420]="OPTIMISM_GOERLI",t[t.LOCAL=1337]="LOCAL",t))(_a||{});const fu="0xaa36a7",Im="0xa",Rm={11155111:"0x18c39eB547A0060C6034f8bEaFB947D1C16eADF1"},B4="4902",Tm={[fu]:{chainId:fu,chainName:"Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:["https://rpc.sepolia.org"],blockExplorerUrls:["https://sepolia.etherscan.io"]},[Im]:{chainId:Im,chainName:"Optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:["https://mainnet.optimism.io"],blockExplorerUrls:["https://optimistic.etherscan.io"]}},D4=t=>{switch(t){case"1":case"0x1":return"Ethereum";case"10":case"a":case"0xa":return"Optimism";case"42161":return"Arbitrum";case"11155111":case"aa36a7":case"0xaa36a7":return"Sepolia";default:return"Unknown"}},Om=async t=>{var r,n,i;let e=await((r=window.ethereum)==null?void 0:r.request({method:"net_version"}).catch(()=>"1"));if(e="0x"+(typeof e=="string"?e.replace(/^0x/,""):e.toString(16)),!Tm[t]){console.error(`Invalid chain ID: ${t}`);return}if(t!==e)try{await((n=window.ethereum)==null?void 0:n.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}))}catch(o){if(String(o).includes(B4))await((i=window.ethereum)==null?void 0:i.request({method:"wallet_addEthereumChain",params:[Tm[t]]}));else throw window.alert(`You must enable the ${D4(t)} network in your wallet.`),new Error(`User cancelled connection to ${t}`)}};var cl={},Ju={};Object.defineProperty(Ju,"__esModule",{value:!0});Ju.Connector=void 0;class j4{constructor(e,r){this.actions=e,this.onError=r}resetState(){this.actions.resetState()}}Ju.Connector=j4;var uf,Lm;function U4(){if(Lm)return uf;Lm=1;function t({mustBeMetaMask:e=!1,silent:r=!1,timeout:n=3e3}={}){o();let i=!1;return new Promise(s=>{window.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout(()=>{l()},n));function l(){if(i)return;i=!0,window.removeEventListener("ethereum#initialized",l);const{ethereum:a}=window;a&&(!e||a.isMetaMask)?s(a):(!r&&console.error("@metamask/detect-provider:",e&&a?"Non-MetaMask window.ethereum detected.":"Unable to detect window.ethereum."),s(null))}});function o(){if(typeof e!="boolean")throw new Error("@metamask/detect-provider: Expected option 'mustBeMetaMask' to be a boolean.");if(typeof r!="boolean")throw new Error("@metamask/detect-provider: Expected option 'silent' to be a boolean.");if(typeof n!="number")throw new Error("@metamask/detect-provider: Expected option 'timeout' to be a number.")}}return uf=t,uf}var F4=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z4=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$4=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&F4(e,t,r);return z4(e,t),e},Qi=Fe&&Fe.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(cl,"__esModule",{value:!0});var tw=cl.MetaMask=cl.NoMetaMaskError=void 0;const H4=Ju;class fl extends Error{constructor(){super("MetaMask not installed"),this.name=fl.name,Object.setPrototypeOf(this,fl.prototype)}}cl.NoMetaMaskError=fl;function Zl(t){return Number.parseInt(t,16)}class q4 extends H4.Connector{constructor({actions:e,options:r,onError:n}){super(e,n),this.options=r}isomorphicInitialize(){return Qi(this,void 0,void 0,function*(){if(!this.eagerConnection)return this.eagerConnection=Promise.resolve().then(()=>$4(U4())).then(e=>Qi(this,void 0,void 0,function*(){var r,n;const i=yield e.default(this.options);i&&(this.provider=i,!((r=this.provider.providers)===null||r===void 0)&&r.length&&(this.provider=(n=this.provider.providers.find(o=>o.isMetaMask))!==null&&n!==void 0?n:this.provider.providers[0]),this.provider.on("connect",({chainId:o})=>{this.actions.update({chainId:Zl(o)})}),this.provider.on("disconnect",o=>{var s;if(o.code===1013){console.debug('MetaMask logged connection error 1013: "Try again later"');return}this.actions.resetState(),(s=this.onError)===null||s===void 0||s.call(this,o)}),this.provider.on("chainChanged",o=>{this.actions.update({chainId:Zl(o)})}),this.provider.on("accountsChanged",o=>{o.length===0?this.actions.resetState():this.actions.update({accounts:o})}))}))})}connectEagerly(){return Qi(this,void 0,void 0,function*(){const e=this.actions.startActivation();try{if(yield this.isomorphicInitialize(),!this.provider)return e();const r=yield this.provider.request({method:"eth_accounts"});if(!r.length)throw new Error("No accounts returned");const n=yield this.provider.request({method:"eth_chainId"});this.actions.update({chainId:Zl(n),accounts:r})}catch(r){console.debug("Could not connect eagerly",r),this.actions.resetState()}})}activate(e){var r,n;return Qi(this,void 0,void 0,function*(){let i;return!((n=(r=this.provider)===null||r===void 0?void 0:r.isConnected)===null||n===void 0)&&n.call(r)||(i=this.actions.startActivation()),this.isomorphicInitialize().then(()=>Qi(this,void 0,void 0,function*(){if(!this.provider)throw new fl;const o=yield this.provider.request({method:"eth_requestAccounts"}),s=yield this.provider.request({method:"eth_chainId"}),l=Zl(s),a=typeof e=="number"?e:e==null?void 0:e.chainId;if(!a||l===a)return this.actions.update({chainId:l,accounts:o});const u=`0x${a.toString(16)}`;return this.provider.request({method:"wallet_switchEthereumChain",params:[{chainId:u}]}).catch(c=>{var d,p;if((((p=(d=c.data)===null||d===void 0?void 0:d.originalError)===null||p===void 0?void 0:p.code)||c.code)===4902&&typeof e!="number"){if(!this.provider)throw new Error("No provider");return this.provider.request({method:"wallet_addEthereumChain",params:[Object.assign(Object.assign({},e),{chainId:u})]})}throw c}).then(()=>this.activate(a))})).catch(o=>{throw i==null||i(),o})})}watchAsset({address:e,symbol:r,decimals:n,image:i}){return Qi(this,void 0,void 0,function*(){if(!this.provider)throw new Error("No provider");return this.provider.request({method:"wallet_watchAsset",params:{type:"ERC20",options:{address:e,symbol:r,decimals:n,image:i}}}).then(o=>{if(!o)throw new Error("Rejected");return!0})})}}tw=cl.MetaMask=q4;const[rw,Fh]=qu.initializeConnector(t=>new tw({actions:t}));function W4(t){const e=t.split("."),r=new Uint8Array(t.length+e.length);let n=0;for(const i of e){const o=i.length;r[n]=o,n++;for(let s=0;si.toString(16).padStart(2,"0")).join("")}`}const{useIsActivating:G4}=Fh;function V4({provider:t,packageAbi:e}){const{listedApps:r}=Qo(),{account:n,isActive:i}=qu.useWeb3React(),o=G4(),[s,l]=L.useState(""),[a,u]=L.useState(),[c,d]=L.useState(!1),[p,v]=L.useState(""),[g,x]=L.useState(""),[S,E]=L.useState(""),[w,_]=L.useState(""),[O,B]=L.useState(!1),j=L.useCallback(async()=>{await rw.activate().catch(()=>{});try{Om(fu)}catch(K){console.error(K)}},[]),$=L.useCallback(async()=>{if(!S){_("");return}try{const H=await(await fetch(S)).text();let se=JSON.parse(H);if(!se.properties||!se.properties.package_name||!se.properties.publisher||!se.properties.current_version||!se.properties.mirrors||!se.properties.code_hashes)throw new Error("Invalid metadata");const C=ut(mr(H));_(C),v(se.properties.package_name),x(se.properties.publisher)}catch{window.alert("Error calculating metadata hash. Please ensure the URL is valid, that the metadata is in JSON format, and that it conforms to the Erc721 metadata format for kinode packages. Read more here: TODO")}},[S]),q=L.useCallback(async K=>{K.preventDefault(),K.stopPropagation();let H=w;try{if(!H){const f=await fetch(S);await f.json();const m=await f.text();H=ut(mr(m))}l("Please confirm the transaction in your wallet");const se=W4(g);await Om(fu);const C=await(O?e.updateMetadata(V.from(mS(["string","bytes"],[p,se])),S,H):e.registerApp(p,se,S,H));await new Promise(f=>setTimeout(f,2e3)),l("Publishing package..."),await C.wait(),u({packageName:p,publisherId:g}),v(""),x(g),E(""),_(""),B(!1)}catch(se){console.error(se),window.alert("Error publishing package. Please ensure the package name and publisher ID are valid, and the metadata is in JSON format.")}finally{l("")}},[p,O,g,S,w,e,u,v,x,E,_,B]),ne=L.useCallback(async()=>{O||p&&g&&r.find(K=>K.package===p&&K.publisher===g)&&B(!0)},[r,p,g,O,B]);return I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{hideSearch:!0}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"Publish Package"}),!!n&&I.jsxs("div",{style:{textAlign:"right",lineHeight:1.5},children:[" ","Connected as"," ",(n==null?void 0:n.slice(0,6))+"..."+(n==null?void 0:n.slice(n.length-6))]})]}),s?I.jsx("div",{className:"col center",children:I.jsx(Ed,{msg:s})}):a?I.jsxs("div",{className:"col center",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"Package Published!"}),I.jsxs("div",{style:{marginBottom:"0.5em"},children:[I.jsx("strong",{children:"Package Name:"})," ",a.packageName]}),I.jsxs("div",{style:{marginBottom:"0.5em"},children:[I.jsx("strong",{children:"Publisher ID:"})," ",a.publisherId]}),I.jsx("button",{className:"my-pkg-btn row",style:{marginTop:"1em"},onClick:()=>u(void 0),children:"Publish Another Package"})]}):!n||!i?I.jsxs(I.Fragment,{children:[I.jsx("h4",{style:{},children:"Please connect your wallet to publish a package"}),I.jsx("button",{className:"my-pkg-btn row",onClick:j,children:"Connect Wallet"})]}):o?I.jsx(Ed,{msg:"Approve connection in your wallet"}):I.jsxs("form",{className:"new card col",style:{flex:1,overflowY:"scroll"},onSubmit:q,children:[I.jsxs("div",{className:"row between",style:{cursor:"pointer",padding:"0.5em",margin:"0 0 0.5em -0.5em"},onClick:()=>B(!O),children:[I.jsx("input",{type:"checkbox",checked:O,readOnly:!0}),I.jsx("label",{htmlFor:"update",style:{cursor:"pointer"},children:"Update existing package"})]}),I.jsxs("div",{className:"col f-width",children:[I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsxs("label",{htmlFor:"metadata-url",children:["Metadata URL",I.jsx("span",{style:{marginLeft:"2em",fontSize:"0.9em",textDecoration:"underline",cursor:"pointer"},onClick:()=>d(!c),children:"What is this?"})]}),c&&I.jsxs("div",{style:{textAlign:"left",marginBottom:"0.5em"},children:["Metadata is a JSON file that describes your package.",I.jsx("br",{})," You can"," ",I.jsx("a",{target:"_blank",href:"https://pongo-uploads.s3.us-east-2.amazonaws.com/sample_metadata.json",children:"download a template here"}),"."]}),I.jsx("input",{style:{minWidth:"80%"},id:"metadata-url",type:"text",required:!0,value:S,onChange:K=>E(K.target.value),onBlur:$,placeholder:"https://my-site/metadata.json"})]}),I.jsx("label",{htmlFor:"package-name",children:"Package Name"}),I.jsx("input",{style:{minWidth:"80%"},readOnly:!0,id:"package-name",type:"text",required:!0,placeholder:"Retreived automatically from metadata URL",value:p,onBlur:ne})]}),I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsx("label",{htmlFor:"publisher-id",children:"Publisher ID"}),I.jsx("input",{style:{minWidth:"80%"},readOnly:!0,id:"publisher-id",type:"text",required:!0,placeholder:"Retreived automatically from metadata URL",value:g,onBlur:ne})]}),I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsx("label",{htmlFor:"metadata-hash",children:"Metadata Hash"}),I.jsx("input",{style:{minWidth:"80%"},readOnly:!0,id:"metadata-hash",type:"text",value:w,onChange:K=>_(K.target.value),placeholder:"Calculated automatically from metadata URL"})]}),I.jsx("button",{type:"submit",className:"primary",style:{marginTop:"1em"},children:"Publish"})]})]})}var K4={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Q4=[[rw,Fh]],{useProvider:J4}=Fh,Y4="https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",Is="/main:app_store:sys";window.our&&(window.our.process=Is==null?void 0:Is.replace("/",""));const X4=`${K4.VITE_NODE_URL||"http://localhost:8080"}${Is}`;function Z4(){const t=J4(),[e,r]=L.useState(!0),[n,i]=L.useState(wd.connect(Rm[_a.SEPOLIA],new vi(Y4)));if(L.useEffect(()=>{t==null||t.getNetwork().then(s=>{s.chainId===_a.SEPOLIA&&i(wd.connect(Rm[_a.SEPOLIA],t.getSigner()))})},[t]),L.useEffect(()=>{},[]),!e)return I.jsxs("div",{className:"node-not-connected",children:[I.jsx("h2",{style:{color:"red"},children:"Node not connected"}),I.jsxs("h4",{children:["You need to start a node at ",X4," before you can use this UI in development."]})]});const o={provider:t,packageAbi:n};return I.jsx(qu.Web3ReactProvider,{connectors:Q4,children:I.jsx(_x,{basename:Is,children:I.jsxs(Ax,{children:[I.jsx(ms,{path:"/",element:I.jsx(T4,{...o})}),I.jsx(ms,{path:_d,element:I.jsx(O4,{...o})}),I.jsx(ms,{path:"/app-details/:id",element:I.jsx(L4,{...o})}),I.jsx(ms,{path:"/publish",element:I.jsx(V4,{...o})})]})})})}cf.createRoot(document.getElementById("root")).render(I.jsx(qr.StrictMode,{children:I.jsx(Z4,{})})); diff --git a/kinode/packages/app_store/pkg/ui/assets/index-pkTLhk2L.js b/kinode/packages/app_store/pkg/ui/assets/index-pkTLhk2L.js deleted file mode 100644 index af5883ec2..000000000 --- a/kinode/packages/app_store/pkg/ui/assets/index-pkTLhk2L.js +++ /dev/null @@ -1,90 +0,0 @@ -var nw=Object.defineProperty;var iw=(t,e,r)=>e in t?nw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var zh=(t,e,r)=>(iw(t,typeof e!="symbol"?e+"":e,r),r);function ow(t,e){for(var r=0;rn[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=r(i);fetch(i.href,o)}})();var Fe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Uo(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Bm={exports:{}},du={},Dm={exports:{}},ye={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var dl=Symbol.for("react.element"),sw=Symbol.for("react.portal"),lw=Symbol.for("react.fragment"),aw=Symbol.for("react.strict_mode"),uw=Symbol.for("react.profiler"),cw=Symbol.for("react.provider"),fw=Symbol.for("react.context"),dw=Symbol.for("react.forward_ref"),hw=Symbol.for("react.suspense"),pw=Symbol.for("react.memo"),mw=Symbol.for("react.lazy"),$h=Symbol.iterator;function gw(t){return t===null||typeof t!="object"?null:(t=$h&&t[$h]||t["@@iterator"],typeof t=="function"?t:null)}var jm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Um=Object.assign,Fm={};function Fo(t,e,r){this.props=t,this.context=e,this.refs=Fm,this.updater=r||jm}Fo.prototype.isReactComponent={};Fo.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Fo.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function zm(){}zm.prototype=Fo.prototype;function Sd(t,e,r){this.props=t,this.context=e,this.refs=Fm,this.updater=r||jm}var kd=Sd.prototype=new zm;kd.constructor=Sd;Um(kd,Fo.prototype);kd.isPureReactComponent=!0;var Hh=Array.isArray,$m=Object.prototype.hasOwnProperty,Nd={current:null},Hm={key:!0,ref:!0,__self:!0,__source:!0};function qm(t,e,r){var n,i={},o=null,s=null;if(e!=null)for(n in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(o=""+e.key),e)$m.call(e,n)&&!Hm.hasOwnProperty(n)&&(i[n]=e[n]);var l=arguments.length-2;if(l===1)i.children=r;else if(1>>1,h=b[S];if(0>>1;Si(y,R))Di(U,y)?(b[S]=U,b[D]=R,S=D):(b[S]=y,b[te]=R,S=te);else if(Di(U,R))b[S]=U,b[D]=R,S=D;else break e}}return M}function i(b,M){var R=b.sortIndex-M.sortIndex;return R!==0?R:b.id-M.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,l=s.now();t.unstable_now=function(){return s.now()-l}}var a=[],u=[],c=1,d=null,m=3,v=!1,p=!1,x=!1,k=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(b){for(var M=r(u);M!==null;){if(M.callback===null)n(u);else if(M.startTime<=b)n(u),M.sortIndex=M.expirationTime,e(a,M);else break;M=r(u)}}function O(b){if(x=!1,_(b),!p)if(r(a)!==null)p=!0,A(B);else{var M=r(u);M!==null&&N(O,M.startTime-b)}}function B(b,M){p=!1,x&&(x=!1,E(H),H=-1),v=!0;var R=m;try{for(_(M),d=r(a);d!==null&&(!(d.expirationTime>M)||b&&!G());){var S=d.callback;if(typeof S=="function"){d.callback=null,m=d.priorityLevel;var h=S(d.expirationTime<=M);M=t.unstable_now(),typeof h=="function"?d.callback=h:d===r(a)&&n(a),_(M)}else n(a);d=r(a)}if(d!==null)var P=!0;else{var te=r(u);te!==null&&N(O,te.startTime-M),P=!1}return P}finally{d=null,m=R,v=!1}}var j=!1,$=null,H=-1,ie=5,X=-1;function G(){return!(t.unstable_now()-Xb||125S?(b.sortIndex=R,e(u,b),r(a)===null&&b===r(u)&&(x?(E(H),H=-1):x=!0,N(O,R-S))):(b.sortIndex=h,e(a,b),p||v||(p=!0,A(B))),b},t.unstable_shouldYield=G,t.unstable_wrapCallback=function(b){var M=m;return function(){var R=m;m=M;try{return b.apply(this,arguments)}finally{m=R}}}})(Km);Vm.exports=Km;var Pw=Vm.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Qm=L,pr=Pw;function q(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ff=Object.prototype.hasOwnProperty,Cw=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Wh={},Gh={};function Mw(t){return ff.call(Gh,t)?!0:ff.call(Wh,t)?!1:Cw.test(t)?Gh[t]=!0:(Wh[t]=!0,!1)}function Iw(t,e,r,n){if(r!==null&&r.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function Rw(t,e,r,n){if(e===null||typeof e>"u"||Iw(t,e,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Vt(t,e,r,n,i,o,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=s}var Tt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Tt[t]=new Vt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Tt[e]=new Vt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Tt[t]=new Vt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Tt[t]=new Vt(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Tt[t]=new Vt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Tt[t]=new Vt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Tt[t]=new Vt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Tt[t]=new Vt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Tt[t]=new Vt(t,5,!1,t.toLowerCase(),null,!1,!1)});var Cd=/[\-:]([a-z])/g;function Md(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Cd,Md);Tt[e]=new Vt(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Cd,Md);Tt[e]=new Vt(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Cd,Md);Tt[e]=new Vt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Tt[t]=new Vt(t,1,!1,t.toLowerCase(),null,!1,!1)});Tt.xlinkHref=new Vt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Tt[t]=new Vt(t,1,!1,t.toLowerCase(),null,!0,!0)});function Id(t,e,r,n){var i=Tt.hasOwnProperty(e)?Tt[e]:null;(i!==null?i.type!==0:n||!(2l||i[s]!==o[l]){var a=` -`+i[s].replace(" at new "," at ");return t.displayName&&a.includes("")&&(a=a.replace("",t.displayName)),a}while(1<=s&&0<=l);break}}}finally{hc=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?fs(t):""}function Tw(t){switch(t.tag){case 5:return fs(t.type);case 16:return fs("Lazy");case 13:return fs("Suspense");case 19:return fs("SuspenseList");case 0:case 2:case 15:return t=pc(t.type,!1),t;case 11:return t=pc(t.type.render,!1),t;case 1:return t=pc(t.type,!0),t;default:return""}}function mf(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Zi:return"Fragment";case Xi:return"Portal";case df:return"Profiler";case Rd:return"StrictMode";case hf:return"Suspense";case pf:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Xm:return(t.displayName||"Context")+".Consumer";case Ym:return(t._context.displayName||"Context")+".Provider";case Td:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Od:return e=t.displayName||null,e!==null?e:mf(t.type)||"Memo";case Jn:e=t._payload,t=t._init;try{return mf(t(e))}catch{}}return null}function Ow(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return mf(e);case 8:return e===Rd?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function pi(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function eg(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Lw(t){var e=eg(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,o=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){n=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(s){n=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function kl(t){t._valueTracker||(t._valueTracker=Lw(t))}function tg(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=eg(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function Sa(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function gf(t,e){var r=e.checked;return ft({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function Kh(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=pi(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function rg(t,e){e=e.checked,e!=null&&Id(t,"checked",e,!1)}function vf(t,e){rg(t,e);var r=pi(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?yf(t,e.type,r):e.hasOwnProperty("defaultValue")&&yf(t,e.type,pi(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Qh(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function yf(t,e,r){(e!=="number"||Sa(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var ds=Array.isArray;function go(t,e,r,n){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Nl.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ts(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var ws={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Bw=["Webkit","ms","Moz","O"];Object.keys(ws).forEach(function(t){Bw.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ws[e]=ws[t]})});function sg(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||ws.hasOwnProperty(t)&&ws[t]?(""+e).trim():e+"px"}function lg(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=sg(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,i):t[r]=i}}var Dw=ft({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function xf(t,e){if(e){if(Dw[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(q(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(q(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(q(61))}if(e.style!=null&&typeof e.style!="object")throw Error(q(62))}}function Af(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var bf=null;function Ld(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var _f=null,vo=null,yo=null;function Xh(t){if(t=ml(t)){if(typeof _f!="function")throw Error(q(280));var e=t.stateNode;e&&(e=vu(e),_f(t.stateNode,t.type,e))}}function ag(t){vo?yo?yo.push(t):yo=[t]:vo=t}function ug(){if(vo){var t=vo,e=yo;if(yo=vo=null,Xh(t),e)for(t=0;t>>=0,t===0?32:31-(Kw(t)/Qw|0)|0}var Pl=64,Cl=4194304;function hs(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Ca(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,i=t.suspendedLanes,o=t.pingedLanes,s=r&268435455;if(s!==0){var l=s&~i;l!==0?n=hs(l):(o&=s,o!==0&&(n=hs(o)))}else s=r&~i,s!==0?n=hs(s):o!==0&&(n=hs(o));if(n===0)return 0;if(e!==0&&e!==n&&!(e&i)&&(i=n&-n,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0r;r++)e.push(t);return e}function hl(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Wr(e),t[e]=r}function Zw(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0=xs),l0=" ",a0=!1;function Cg(t,e){switch(t){case"keyup":return N2.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Mg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var eo=!1;function C2(t,e){switch(t){case"compositionend":return Mg(e);case"keypress":return e.which!==32?null:(a0=!0,l0);case"textInput":return t=e.data,t===l0&&a0?null:t;default:return null}}function M2(t,e){if(eo)return t==="compositionend"||!Hd&&Cg(t,e)?(t=Ng(),na=Fd=ri=null,eo=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=d0(r)}}function Og(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Og(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Lg(){for(var t=window,e=Sa();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=Sa(t.document)}return e}function qd(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function U2(t){var e=Lg(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&Og(r.ownerDocument.documentElement,r)){if(n!==null&&qd(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=r.textContent.length,o=Math.min(n.start,i);n=n.end===void 0?o:Math.min(n.end,i),!t.extend&&o>n&&(i=n,n=o,o=i),i=h0(r,o);var s=h0(r,n);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>n?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,to=null,Mf=null,bs=null,If=!1;function p0(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;If||to==null||to!==Sa(n)||(n=to,"selectionStart"in n&&qd(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),bs&&Us(bs,n)||(bs=n,n=Ra(Mf,"onSelect"),0io||(t.current=Df[io],Df[io]=null,io--)}function Qe(t,e){io++,Df[io]=t.current,t.current=e}var mi={},zt=wi(mi),er=wi(!1),Ri=mi;function ko(t,e){var r=t.type.contextTypes;if(!r)return mi;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in r)i[o]=e[o];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function tr(t){return t=t.childContextTypes,t!=null}function Oa(){tt(er),tt(zt)}function x0(t,e,r){if(zt.current!==mi)throw Error(q(168));Qe(zt,e),Qe(er,r)}function qg(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in e))throw Error(q(108,Ow(t)||"Unknown",i));return ft({},r,n)}function La(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||mi,Ri=zt.current,Qe(zt,t),Qe(er,er.current),!0}function A0(t,e,r){var n=t.stateNode;if(!n)throw Error(q(169));r?(t=qg(t,e,Ri),n.__reactInternalMemoizedMergedChildContext=t,tt(er),tt(zt),Qe(zt,t)):tt(er),Qe(er,r)}var An=null,yu=!1,Pc=!1;function Wg(t){An===null?An=[t]:An.push(t)}function Y2(t){yu=!0,Wg(t)}function Ei(){if(!Pc&&An!==null){Pc=!0;var t=0,e=Re;try{var r=An;for(Re=1;t>=s,i-=s,Sn=1<<32-Wr(e)+i|r<H?(ie=$,$=null):ie=$.sibling;var X=m(E,$,_[H],O);if(X===null){$===null&&($=ie);break}t&&$&&X.alternate===null&&e(E,$),w=o(X,w,H),j===null?B=X:j.sibling=X,j=X,$=ie}if(H===_.length)return r(E,$),nt&&bi(E,H),B;if($===null){for(;H<_.length;H++)$=d(E,_[H],O),$!==null&&(w=o($,w,H),j===null?B=$:j.sibling=$,j=$);return nt&&bi(E,H),B}for($=n(E,$);H<_.length;H++)ie=v($,E,H,_[H],O),ie!==null&&(t&&ie.alternate!==null&&$.delete(ie.key===null?H:ie.key),w=o(ie,w,H),j===null?B=ie:j.sibling=ie,j=ie);return t&&$.forEach(function(G){return e(E,G)}),nt&&bi(E,H),B}function x(E,w,_,O){var B=Jo(_);if(typeof B!="function")throw Error(q(150));if(_=B.call(_),_==null)throw Error(q(151));for(var j=B=null,$=w,H=w=0,ie=null,X=_.next();$!==null&&!X.done;H++,X=_.next()){$.index>H?(ie=$,$=null):ie=$.sibling;var G=m(E,$,X.value,O);if(G===null){$===null&&($=ie);break}t&&$&&G.alternate===null&&e(E,$),w=o(G,w,H),j===null?B=G:j.sibling=G,j=G,$=ie}if(X.done)return r(E,$),nt&&bi(E,H),B;if($===null){for(;!X.done;H++,X=_.next())X=d(E,X.value,O),X!==null&&(w=o(X,w,H),j===null?B=X:j.sibling=X,j=X);return nt&&bi(E,H),B}for($=n(E,$);!X.done;H++,X=_.next())X=v($,E,H,X.value,O),X!==null&&(t&&X.alternate!==null&&$.delete(X.key===null?H:X.key),w=o(X,w,H),j===null?B=X:j.sibling=X,j=X);return t&&$.forEach(function(J){return e(E,J)}),nt&&bi(E,H),B}function k(E,w,_,O){if(typeof _=="object"&&_!==null&&_.type===Zi&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case Sl:e:{for(var B=_.key,j=w;j!==null;){if(j.key===B){if(B=_.type,B===Zi){if(j.tag===7){r(E,j.sibling),w=i(j,_.props.children),w.return=E,E=w;break e}}else if(j.elementType===B||typeof B=="object"&&B!==null&&B.$$typeof===Jn&&C0(B)===j.type){r(E,j.sibling),w=i(j,_.props),w.ref=ts(E,j,_),w.return=E,E=w;break e}r(E,j);break}else e(E,j);j=j.sibling}_.type===Zi?(w=Mi(_.props.children,E.mode,O,_.key),w.return=E,E=w):(O=fa(_.type,_.key,_.props,null,E.mode,O),O.ref=ts(E,w,_),O.return=E,E=O)}return s(E);case Xi:e:{for(j=_.key;w!==null;){if(w.key===j)if(w.tag===4&&w.stateNode.containerInfo===_.containerInfo&&w.stateNode.implementation===_.implementation){r(E,w.sibling),w=i(w,_.children||[]),w.return=E,E=w;break e}else{r(E,w);break}else e(E,w);w=w.sibling}w=Bc(_,E.mode,O),w.return=E,E=w}return s(E);case Jn:return j=_._init,k(E,w,j(_._payload),O)}if(ds(_))return p(E,w,_,O);if(Jo(_))return x(E,w,_,O);Bl(E,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,w!==null&&w.tag===6?(r(E,w.sibling),w=i(w,_),w.return=E,E=w):(r(E,w),w=Lc(_,E.mode,O),w.return=E,E=w),s(E)):r(E,w)}return k}var Po=Zg(!0),ev=Zg(!1),gl={},an=wi(gl),Hs=wi(gl),qs=wi(gl);function Pi(t){if(t===gl)throw Error(q(174));return t}function Zd(t,e){switch(Qe(qs,e),Qe(Hs,t),Qe(an,gl),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Ef(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Ef(e,t)}tt(an),Qe(an,e)}function Co(){tt(an),tt(Hs),tt(qs)}function tv(t){Pi(qs.current);var e=Pi(an.current),r=Ef(e,t.type);e!==r&&(Qe(Hs,t),Qe(an,r))}function eh(t){Hs.current===t&&(tt(an),tt(Hs))}var at=wi(0);function za(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Cc=[];function th(){for(var t=0;tr?r:4,t(!0);var n=Mc.transition;Mc.transition={};try{t(!1),e()}finally{Re=r,Mc.transition=n}}function vv(){return Pr().memoizedState}function tE(t,e,r){var n=di(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},yv(t))wv(e,r);else if(r=Qg(t,e,r,n),r!==null){var i=Wt();Gr(r,t,n,i),Ev(r,e,n)}}function rE(t,e,r){var n=di(t),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(yv(t))wv(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,l=o(s,r);if(i.hasEagerState=!0,i.eagerState=l,Vr(l,s)){var a=e.interleaved;a===null?(i.next=i,Yd(e)):(i.next=a.next,a.next=i),e.interleaved=i;return}}catch{}finally{}r=Qg(t,e,i,n),r!==null&&(i=Wt(),Gr(r,t,n,i),Ev(r,e,n))}}function yv(t){var e=t.alternate;return t===ct||e!==null&&e===ct}function wv(t,e){_s=$a=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function Ev(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,Dd(t,r)}}var Ha={readContext:Nr,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useInsertionEffect:Lt,useLayoutEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useMutableSource:Lt,useSyncExternalStore:Lt,useId:Lt,unstable_isNewReconciler:!1},nE={readContext:Nr,useCallback:function(t,e){return Zr().memoizedState=[t,e===void 0?null:e],t},useContext:Nr,useEffect:I0,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,la(4194308,4,dv.bind(null,e,t),r)},useLayoutEffect:function(t,e){return la(4194308,4,t,e)},useInsertionEffect:function(t,e){return la(4,2,t,e)},useMemo:function(t,e){var r=Zr();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=Zr();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=tE.bind(null,ct,t),[n.memoizedState,t]},useRef:function(t){var e=Zr();return t={current:t},e.memoizedState=t},useState:M0,useDebugValue:sh,useDeferredValue:function(t){return Zr().memoizedState=t},useTransition:function(){var t=M0(!1),e=t[0];return t=eE.bind(null,t[1]),Zr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=ct,i=Zr();if(nt){if(r===void 0)throw Error(q(407));r=r()}else{if(r=e(),Nt===null)throw Error(q(349));Oi&30||iv(n,e,r)}i.memoizedState=r;var o={value:r,getSnapshot:e};return i.queue=o,I0(sv.bind(null,n,o,t),[t]),n.flags|=2048,Vs(9,ov.bind(null,n,o,r,e),void 0,null),r},useId:function(){var t=Zr(),e=Nt.identifierPrefix;if(nt){var r=kn,n=Sn;r=(n&~(1<<32-Wr(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=Ws++,0<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=s.createElement(r,{is:n.is}):(t=s.createElement(r),r==="select"&&(s=t,n.multiple?s.multiple=!0:n.size&&(s.size=n.size))):t=s.createElementNS(t,r),t[nn]=e,t[$s]=n,Cv(t,e,!1,!1),e.stateNode=t;e:{switch(s=Af(r,n),r){case"dialog":et("cancel",t),et("close",t),i=n;break;case"iframe":case"object":case"embed":et("load",t),i=n;break;case"video":case"audio":for(i=0;iIo&&(e.flags|=128,n=!0,rs(o,!1),e.lanes=4194304)}else{if(!n)if(t=za(s),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),rs(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!nt)return Bt(e),null}else 2*vt()-o.renderingStartTime>Io&&r!==1073741824&&(e.flags|=128,n=!0,rs(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(r=o.last,r!==null?r.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=vt(),e.sibling=null,r=at.current,Qe(at,n?r&1|2:r&1),e):(Bt(e),null);case 22:case 23:return dh(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?lr&1073741824&&(Bt(e),e.subtreeFlags&6&&(e.flags|=8192)):Bt(e),null;case 24:return null;case 25:return null}throw Error(q(156,e.tag))}function fE(t,e){switch(Gd(e),e.tag){case 1:return tr(e.type)&&Oa(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Co(),tt(er),tt(zt),th(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return eh(e),null;case 13:if(tt(at),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(q(340));No()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return tt(at),null;case 4:return Co(),null;case 10:return Jd(e.type._context),null;case 22:case 23:return dh(),null;case 24:return null;default:return null}}var jl=!1,Dt=!1,dE=typeof WeakSet=="function"?WeakSet:Set,Z=null;function ao(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){ht(t,e,n)}else r.current=null}function Qf(t,e,r){try{r()}catch(n){ht(t,e,n)}}var F0=!1;function hE(t,e){if(Rf=Ma,t=Lg(),qd(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break e}var s=0,l=-1,a=-1,u=0,c=0,d=t,m=null;t:for(;;){for(var v;d!==r||i!==0&&d.nodeType!==3||(l=s+i),d!==o||n!==0&&d.nodeType!==3||(a=s+n),d.nodeType===3&&(s+=d.nodeValue.length),(v=d.firstChild)!==null;)m=d,d=v;for(;;){if(d===t)break t;if(m===r&&++u===i&&(l=s),m===o&&++c===n&&(a=s),(v=d.nextSibling)!==null)break;d=m,m=d.parentNode}d=v}r=l===-1||a===-1?null:{start:l,end:a}}else r=null}r=r||{start:0,end:0}}else r=null;for(Tf={focusedElem:t,selectionRange:r},Ma=!1,Z=e;Z!==null;)if(e=Z,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Z=t;else for(;Z!==null;){e=Z;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var x=p.memoizedProps,k=p.memoizedState,E=e.stateNode,w=E.getSnapshotBeforeUpdate(e.elementType===e.type?x:jr(e.type,x),k);E.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var _=e.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(q(163))}}catch(O){ht(e,e.return,O)}if(t=e.sibling,t!==null){t.return=e.return,Z=t;break}Z=e.return}return p=F0,F0=!1,p}function Ss(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&Qf(e,r,o)}i=i.next}while(i!==n)}}function xu(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function Jf(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function Rv(t){var e=t.alternate;e!==null&&(t.alternate=null,Rv(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[nn],delete e[$s],delete e[Bf],delete e[Q2],delete e[J2])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Tv(t){return t.tag===5||t.tag===3||t.tag===4}function z0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Tv(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Yf(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=Ta));else if(n!==4&&(t=t.child,t!==null))for(Yf(t,e,r),t=t.sibling;t!==null;)Yf(t,e,r),t=t.sibling}function Xf(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(Xf(t,e,r),t=t.sibling;t!==null;)Xf(t,e,r),t=t.sibling}var Mt=null,Fr=!1;function Vn(t,e,r){for(r=r.child;r!==null;)Ov(t,e,r),r=r.sibling}function Ov(t,e,r){if(ln&&typeof ln.onCommitFiberUnmount=="function")try{ln.onCommitFiberUnmount(hu,r)}catch{}switch(r.tag){case 5:Dt||ao(r,e);case 6:var n=Mt,i=Fr;Mt=null,Vn(t,e,r),Mt=n,Fr=i,Mt!==null&&(Fr?(t=Mt,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Mt.removeChild(r.stateNode));break;case 18:Mt!==null&&(Fr?(t=Mt,r=r.stateNode,t.nodeType===8?Nc(t.parentNode,r):t.nodeType===1&&Nc(t,r),Ds(t)):Nc(Mt,r.stateNode));break;case 4:n=Mt,i=Fr,Mt=r.stateNode.containerInfo,Fr=!0,Vn(t,e,r),Mt=n,Fr=i;break;case 0:case 11:case 14:case 15:if(!Dt&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&Qf(r,e,s),i=i.next}while(i!==n)}Vn(t,e,r);break;case 1:if(!Dt&&(ao(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){ht(r,e,l)}Vn(t,e,r);break;case 21:Vn(t,e,r);break;case 22:r.mode&1?(Dt=(n=Dt)||r.memoizedState!==null,Vn(t,e,r),Dt=n):Vn(t,e,r);break;default:Vn(t,e,r)}}function $0(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new dE),e.forEach(function(n){var i=AE.bind(null,t,n);r.has(n)||(r.add(n),n.then(i,i))})}}function Tr(t,e){var r=e.deletions;if(r!==null)for(var n=0;ni&&(i=s),n&=~o}if(n=i,n=vt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*mE(n/1960))-n,10t?16:t,ni===null)var n=!1;else{if(t=ni,ni=null,Ga=0,Ae&6)throw Error(q(331));var i=Ae;for(Ae|=4,Z=t.current;Z!==null;){var o=Z,s=o.child;if(Z.flags&16){var l=o.deletions;if(l!==null){for(var a=0;avt()-ch?Ci(t,0):uh|=r),rr(t,e)}function $v(t,e){e===0&&(t.mode&1?(e=Cl,Cl<<=1,!(Cl&130023424)&&(Cl=4194304)):e=1);var r=Wt();t=Rn(t,e),t!==null&&(hl(t,e,r),rr(t,r))}function xE(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),$v(t,r)}function AE(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,i=t.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(q(314))}n!==null&&n.delete(e),$v(t,r)}var Hv;Hv=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||er.current)Zt=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return Zt=!1,uE(t,e,r);Zt=!!(t.flags&131072)}else Zt=!1,nt&&e.flags&1048576&&Gg(e,Da,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;aa(t,e),t=e.pendingProps;var i=ko(e,zt.current);Eo(e,r),i=nh(null,e,n,t,i,r);var o=ih();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,tr(n)?(o=!0,La(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Xd(e),i.updater=wu,e.stateNode=i,i._reactInternals=e,$f(e,n,t,r),e=Wf(null,e,n,!0,o,r)):(e.tag=0,nt&&o&&Wd(e),qt(null,e,i,r),e=e.child),e;case 16:n=e.elementType;e:{switch(aa(t,e),t=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=_E(n),t=jr(n,t),i){case 0:e=qf(null,e,n,t,r);break e;case 1:e=D0(null,e,n,t,r);break e;case 11:e=L0(null,e,n,t,r);break e;case 14:e=B0(null,e,n,jr(n.type,t),r);break e}throw Error(q(306,n,""))}return e;case 0:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),qf(t,e,n,i,r);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),D0(t,e,n,i,r);case 3:e:{if(kv(e),t===null)throw Error(q(387));n=e.pendingProps,o=e.memoizedState,i=o.element,Jg(t,e),Fa(e,n,null,r);var s=e.memoizedState;if(n=s.element,o.isDehydrated)if(o={element:n,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=Mo(Error(q(423)),e),e=j0(t,e,n,r,i);break e}else if(n!==i){i=Mo(Error(q(424)),e),e=j0(t,e,n,r,i);break e}else for(cr=ui(e.stateNode.containerInfo.firstChild),dr=e,nt=!0,zr=null,r=ev(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(No(),n===i){e=Tn(t,e,r);break e}qt(t,e,n,r)}e=e.child}return e;case 5:return tv(e),t===null&&Uf(e),n=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,Of(n,i)?s=null:o!==null&&Of(n,o)&&(e.flags|=32),Sv(t,e),qt(t,e,s,r),e.child;case 6:return t===null&&Uf(e),null;case 13:return Nv(t,e,r);case 4:return Zd(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Po(e,null,n,r):qt(t,e,n,r),e.child;case 11:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),L0(t,e,n,i,r);case 7:return qt(t,e,e.pendingProps,r),e.child;case 8:return qt(t,e,e.pendingProps.children,r),e.child;case 12:return qt(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,Qe(ja,n._currentValue),n._currentValue=s,o!==null)if(Vr(o.value,s)){if(o.children===i.children&&!er.current){e=Tn(t,e,r);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var l=o.dependencies;if(l!==null){s=o.child;for(var a=l.firstContext;a!==null;){if(a.context===n){if(o.tag===1){a=Pn(-1,r&-r),a.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}o.lanes|=r,a=o.alternate,a!==null&&(a.lanes|=r),Ff(o.return,r,e),l.lanes|=r;break}a=a.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(q(341));s.lanes|=r,l=s.alternate,l!==null&&(l.lanes|=r),Ff(s,r,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}qt(t,e,i.children,r),e=e.child}return e;case 9:return i=e.type,n=e.pendingProps.children,Eo(e,r),i=Nr(i),n=n(i),e.flags|=1,qt(t,e,n,r),e.child;case 14:return n=e.type,i=jr(n,e.pendingProps),i=jr(n.type,i),B0(t,e,n,i,r);case 15:return bv(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),aa(t,e),e.tag=1,tr(n)?(t=!0,La(e)):t=!1,Eo(e,r),Xg(e,n,i),$f(e,n,i,r),Wf(null,e,n,!0,t,r);case 19:return Pv(t,e,r);case 22:return _v(t,e,r)}throw Error(q(156,e.tag))};function qv(t,e){return gg(t,e)}function bE(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sr(t,e,r,n){return new bE(t,e,r,n)}function ph(t){return t=t.prototype,!(!t||!t.isReactComponent)}function _E(t){if(typeof t=="function")return ph(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Td)return 11;if(t===Od)return 14}return 2}function hi(t,e){var r=t.alternate;return r===null?(r=Sr(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function fa(t,e,r,n,i,o){var s=2;if(n=t,typeof t=="function")ph(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case Zi:return Mi(r.children,i,o,e);case Rd:s=8,i|=8;break;case df:return t=Sr(12,r,e,i|2),t.elementType=df,t.lanes=o,t;case hf:return t=Sr(13,r,e,i),t.elementType=hf,t.lanes=o,t;case pf:return t=Sr(19,r,e,i),t.elementType=pf,t.lanes=o,t;case Zm:return bu(r,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Ym:s=10;break e;case Xm:s=9;break e;case Td:s=11;break e;case Od:s=14;break e;case Jn:s=16,n=null;break e}throw Error(q(130,t==null?t:typeof t,""))}return e=Sr(s,r,e,i),e.elementType=t,e.type=n,e.lanes=o,e}function Mi(t,e,r,n){return t=Sr(7,t,n,e),t.lanes=r,t}function bu(t,e,r,n){return t=Sr(22,t,n,e),t.elementType=Zm,t.lanes=r,t.stateNode={isHidden:!1},t}function Lc(t,e,r){return t=Sr(6,t,null,e),t.lanes=r,t}function Bc(t,e,r){return e=Sr(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function SE(t,e,r,n,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=gc(0),this.expirationTimes=gc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gc(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function mh(t,e,r,n,i,o,s,l,a){return t=new SE(t,e,r,l,a),e===1?(e=1,o===!0&&(e|=8)):e=0,o=Sr(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xd(o),t}function kE(t,e,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Kv)}catch(t){console.error(t)}}Kv(),Gm.exports=gr;var Qs=Gm.exports,J0=Qs;cf.createRoot=J0.createRoot,cf.hydrateRoot=J0.hydrateRoot;/** - * @remix-run/router v1.14.2 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Js(){return Js=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function wh(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function RE(){return Math.random().toString(36).substr(2,8)}function X0(t,e){return{usr:t.state,key:t.key,idx:e}}function nd(t,e,r,n){return r===void 0&&(r=null),Js({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Ho(e):e,{state:r,key:e&&e.key||n||RE()})}function Qv(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Ho(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function TE(t,e,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:o=!1}=n,s=i.history,l=ii.Pop,a=null,u=c();u==null&&(u=0,s.replaceState(Js({},s.state,{idx:u}),""));function c(){return(s.state||{idx:null}).idx}function d(){l=ii.Pop;let k=c(),E=k==null?null:k-u;u=k,a&&a({action:l,location:x.location,delta:E})}function m(k,E){l=ii.Push;let w=nd(x.location,k,E);r&&r(w,k),u=c()+1;let _=X0(w,u),O=x.createHref(w);try{s.pushState(_,"",O)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;i.location.assign(O)}o&&a&&a({action:l,location:x.location,delta:1})}function v(k,E){l=ii.Replace;let w=nd(x.location,k,E);r&&r(w,k),u=c();let _=X0(w,u),O=x.createHref(w);s.replaceState(_,"",O),o&&a&&a({action:l,location:x.location,delta:0})}function p(k){let E=i.location.origin!=="null"?i.location.origin:i.location.href,w=typeof k=="string"?k:Qv(k);return _t(E,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,E)}let x={get action(){return l},get location(){return t(i,s)},listen(k){if(a)throw new Error("A history only accepts one active listener");return i.addEventListener(Y0,d),a=k,()=>{i.removeEventListener(Y0,d),a=null}},createHref(k){return e(i,k)},createURL:p,encodeLocation(k){let E=p(k);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:m,replace:v,go(k){return s.go(k)}};return x}var Z0;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Z0||(Z0={}));function OE(t,e,r){r===void 0&&(r="/");let n=typeof e=="string"?Ho(e):e,i=Xv(n.pathname||"/",r);if(i==null)return null;let o=Jv(t);LE(o);let s=null;for(let l=0;s==null&&l{let a={relativePath:l===void 0?o.path||"":l,caseSensitive:o.caseSensitive===!0,childrenIndex:s,route:o};a.relativePath.startsWith("/")&&(_t(a.relativePath.startsWith(n),'Absolute route path "'+a.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),a.relativePath=a.relativePath.slice(n.length));let u=Ii([n,a.relativePath]),c=r.concat(a);o.children&&o.children.length>0&&(_t(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Jv(o.children,e,c,u)),!(o.path==null&&!o.index)&&e.push({path:u,score:$E(u,o.index),routesMeta:c})};return t.forEach((o,s)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))i(o,s);else for(let a of Yv(o.path))i(o,s,a)}),e}function Yv(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,i=r.endsWith("?"),o=r.replace(/\?$/,"");if(n.length===0)return i?[o,""]:[o];let s=Yv(n.join("/")),l=[];return l.push(...s.map(a=>a===""?o:[o,a].join("/"))),i&&l.push(...s),l.map(a=>t.startsWith("/")&&a===""?"/":a)}function LE(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:HE(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const BE=/^:[\w-]+$/,DE=3,jE=2,UE=1,FE=10,zE=-2,ep=t=>t==="*";function $E(t,e){let r=t.split("/"),n=r.length;return r.some(ep)&&(n+=zE),e&&(n+=jE),r.filter(i=>!ep(i)).reduce((i,o)=>i+(BE.test(o)?DE:o===""?UE:FE),n)}function HE(t,e){return t.length===e.length&&t.slice(0,-1).every((n,i)=>n===e[i])?t[t.length-1]-e[e.length-1]:0}function qE(t,e){let{routesMeta:r}=t,n={},i="/",o=[];for(let s=0;s{let{paramName:m,isOptional:v}=c;if(m==="*"){let x=l[d]||"";s=o.slice(0,o.length-x.length).replace(/(.)\/+$/,"$1")}const p=l[d];return v&&!p?u[m]=void 0:u[m]=KE(p||"",m),u},{}),pathname:o,pathnameBase:s,pattern:t}}function GE(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),wh(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,l,a)=>(n.push({paramName:l,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),n]}function VE(t){try{return decodeURI(t)}catch(e){return wh(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function KE(t,e){try{return decodeURIComponent(t)}catch(r){return wh(!1,'The value for the URL param "'+e+'" will not be decoded because'+(' the string "'+t+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+r+").")),t}}function Xv(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function QE(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:i=""}=typeof t=="string"?Ho(t):t;return{pathname:r?r.startsWith("/")?r:JE(r,e):e,search:tx(n),hash:rx(i)}}function JE(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function Dc(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function YE(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function XE(t,e){let r=YE(t);return e?r.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function ZE(t,e,r,n){n===void 0&&(n=!1);let i;typeof t=="string"?i=Ho(t):(i=Js({},t),_t(!i.pathname||!i.pathname.includes("?"),Dc("?","pathname","search",i)),_t(!i.pathname||!i.pathname.includes("#"),Dc("#","pathname","hash",i)),_t(!i.search||!i.search.includes("#"),Dc("#","search","hash",i)));let o=t===""||i.pathname==="",s=o?"/":i.pathname,l;if(s==null)l=r;else{let d=e.length-1;if(!n&&s.startsWith("..")){let m=s.split("/");for(;m[0]==="..";)m.shift(),d-=1;i.pathname=m.join("/")}l=d>=0?e[d]:"/"}let a=QE(i,l),u=s&&s!=="/"&&s.endsWith("/"),c=(o||s===".")&&r.endsWith("/");return!a.pathname.endsWith("/")&&(u||c)&&(a.pathname+="/"),a}const Ii=t=>t.join("/").replace(/\/\/+/g,"/"),ex=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),tx=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,rx=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function nx(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Zv=["post","put","patch","delete"];new Set(Zv);const ix=["get",...Zv];new Set(ix);/** - * React Router v6.21.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Ys(){return Ys=Object.assign?Object.assign.bind():function(t){for(var e=1;e{l.current=!0}),L.useCallback(function(u,c){if(c===void 0&&(c={}),!l.current)return;if(typeof u=="number"){n.go(u);return}let d=ZE(u,JSON.parse(s),o,c.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:Ii([e,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[e,n,s,o,t])}function lx(){let{matches:t}=L.useContext($i),e=t[t.length-1];return e?e.params:{}}function ax(t,e){return ux(t,e)}function ux(t,e,r,n){Mu()||_t(!1);let{navigator:i}=L.useContext(Pu),{matches:o}=L.useContext($i),s=o[o.length-1],l=s?s.params:{};s&&s.pathname;let a=s?s.pathnameBase:"/";s&&s.route;let u=xh(),c;if(e){var d;let k=typeof e=="string"?Ho(e):e;a==="/"||(d=k.pathname)!=null&&d.startsWith(a)||_t(!1),c=k}else c=u;let m=c.pathname||"/",v=a==="/"?m:m.slice(a.length)||"/",p=OE(t,{pathname:v}),x=px(p&&p.map(k=>Object.assign({},k,{params:Object.assign({},l,k.params),pathname:Ii([a,i.encodeLocation?i.encodeLocation(k.pathname).pathname:k.pathname]),pathnameBase:k.pathnameBase==="/"?a:Ii([a,i.encodeLocation?i.encodeLocation(k.pathnameBase).pathname:k.pathnameBase])})),o,r,n);return e&&x?L.createElement(Cu.Provider,{value:{location:Ys({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:ii.Pop}},x):x}function cx(){let t=yx(),e=nx(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},o=null;return L.createElement(L.Fragment,null,L.createElement("h2",null,"Unexpected Application Error!"),L.createElement("h3",{style:{fontStyle:"italic"}},e),r?L.createElement("pre",{style:i},r):null,o)}const fx=L.createElement(cx,null);class dx extends L.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?L.createElement($i.Provider,{value:this.props.routeContext},L.createElement(ey.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function hx(t){let{routeContext:e,match:r,children:n}=t,i=L.useContext(Eh);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),L.createElement($i.Provider,{value:e},n)}function px(t,e,r,n){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var o;if((o=r)!=null&&o.errors)t=r.matches;else return null}let s=t,l=(i=r)==null?void 0:i.errors;if(l!=null){let c=s.findIndex(d=>d.route.id&&(l==null?void 0:l[d.route.id]));c>=0||_t(!1),s=s.slice(0,Math.min(s.length,c+1))}let a=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let c=0;c=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((c,d,m)=>{let v,p=!1,x=null,k=null;r&&(v=l&&d.route.id?l[d.route.id]:void 0,x=d.route.errorElement||fx,a&&(u<0&&m===0?(Ex("route-fallback",!1),p=!0,k=null):u===m&&(p=!0,k=d.route.hydrateFallbackElement||null)));let E=e.concat(s.slice(0,m+1)),w=()=>{let _;return v?_=x:p?_=k:d.route.Component?_=L.createElement(d.route.Component,null):d.route.element?_=d.route.element:_=c,L.createElement(hx,{match:d,routeContext:{outlet:c,matches:E,isDataRoute:r!=null},children:_})};return r&&(d.route.ErrorBoundary||d.route.errorElement||m===0)?L.createElement(dx,{location:r.location,revalidation:r.revalidation,component:x,error:v,children:w(),routeContext:{outlet:null,matches:E,isDataRoute:!0}}):w()},null)}var ry=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(ry||{}),Qa=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Qa||{});function mx(t){let e=L.useContext(Eh);return e||_t(!1),e}function gx(t){let e=L.useContext(ox);return e||_t(!1),e}function vx(t){let e=L.useContext($i);return e||_t(!1),e}function ny(t){let e=vx(),r=e.matches[e.matches.length-1];return r.route.id||_t(!1),r.route.id}function yx(){var t;let e=L.useContext(ey),r=gx(Qa.UseRouteError),n=ny(Qa.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function wx(){let{router:t}=mx(ry.UseNavigateStable),e=ny(Qa.UseNavigateStable),r=L.useRef(!1);return ty(()=>{r.current=!0}),L.useCallback(function(i,o){o===void 0&&(o={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Ys({fromRouteId:e},o)))},[t,e])}const tp={};function Ex(t,e,r){!e&&!tp[t]&&(tp[t]=!0)}function ms(t){_t(!1)}function xx(t){let{basename:e="/",children:r=null,location:n,navigationType:i=ii.Pop,navigator:o,static:s=!1,future:l}=t;Mu()&&_t(!1);let a=e.replace(/^\/*/,"/"),u=L.useMemo(()=>({basename:a,navigator:o,static:s,future:Ys({v7_relativeSplatPath:!1},l)}),[a,l,o,s]);typeof n=="string"&&(n=Ho(n));let{pathname:c="/",search:d="",hash:m="",state:v=null,key:p="default"}=n,x=L.useMemo(()=>{let k=Xv(c,a);return k==null?null:{location:{pathname:k,search:d,hash:m,state:v,key:p},navigationType:i}},[a,c,d,m,v,p,i]);return x==null?null:L.createElement(Pu.Provider,{value:u},L.createElement(Cu.Provider,{children:r,value:x}))}function Ax(t){let{children:e,location:r}=t;return ax(id(e),r)}new Promise(()=>{});function id(t,e){e===void 0&&(e=[]);let r=[];return L.Children.forEach(t,(n,i)=>{if(!L.isValidElement(n))return;let o=[...e,i];if(n.type===L.Fragment){r.push.apply(r,id(n.props.children,o));return}n.type!==ms&&_t(!1),!n.props.index||!n.props.children||_t(!1);let s={id:n.props.id||o.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(s.children=id(n.props.children,o)),r.push(s)}),r}/** - * React Router DOM v6.21.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */const bx="startTransition",rp=xw[bx];function _x(t){let{basename:e,children:r,future:n,window:i}=t,o=L.useRef();o.current==null&&(o.current=IE({window:i,v5Compat:!0}));let s=o.current,[l,a]=L.useState({action:s.action,location:s.location}),{v7_startTransition:u}=n||{},c=L.useCallback(d=>{u&&rp?rp(()=>a(d)):a(d)},[a,u]);return L.useLayoutEffect(()=>s.listen(c),[s,c]),L.createElement(xx,{basename:e,children:r,location:l.location,navigationType:l.action,navigator:s,future:n})}var np;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(np||(np={}));var ip;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(ip||(ip={}));var Ah={exports:{}};const Sx={},kx=Object.freeze(Object.defineProperty({__proto__:null,default:Sx},Symbol.toStringTag,{value:"Module"})),Nx=Uo(kx);Ah.exports;(function(t){(function(e,r){function n(C,f){if(!C)throw new Error(f||"Assertion failed")}function i(C,f){C.super_=f;var g=function(){};g.prototype=f.prototype,C.prototype=new g,C.prototype.constructor=C}function o(C,f,g){if(o.isBN(C))return C;this.negative=0,this.words=null,this.length=0,this.red=null,C!==null&&((f==="le"||f==="be")&&(g=f,f=10),this._init(C||0,f||10,g||"be"))}typeof e=="object"?e.exports=o:r.BN=o,o.BN=o,o.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=Nx.Buffer}catch{}o.isBN=function(f){return f instanceof o?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===o.wordSize&&Array.isArray(f.words)},o.max=function(f,g){return f.cmp(g)>0?f:g},o.min=function(f,g){return f.cmp(g)<0?f:g},o.prototype._init=function(f,g,A){if(typeof f=="number")return this._initNumber(f,g,A);if(typeof f=="object")return this._initArray(f,g,A);g==="hex"&&(g=16),n(g===(g|0)&&g>=2&&g<=36),f=f.toString().replace(/\s+/g,"");var N=0;f[0]==="-"&&(N++,this.negative=1),N=0;N-=3)M=f[N]|f[N-1]<<8|f[N-2]<<16,this.words[b]|=M<>>26-R&67108863,R+=24,R>=26&&(R-=26,b++);else if(A==="le")for(N=0,b=0;N>>26-R&67108863,R+=24,R>=26&&(R-=26,b++);return this._strip()};function l(C,f){var g=C.charCodeAt(f);if(g>=48&&g<=57)return g-48;if(g>=65&&g<=70)return g-55;if(g>=97&&g<=102)return g-87;n(!1,"Invalid character in "+C)}function a(C,f,g){var A=l(C,g);return g-1>=f&&(A|=l(C,g-1)<<4),A}o.prototype._parseHex=function(f,g,A){this.length=Math.ceil((f.length-g)/6),this.words=new Array(this.length);for(var N=0;N=g;N-=2)R=a(f,g,N)<=18?(b-=18,M+=1,this.words[M]|=R>>>26):b+=8;else{var S=f.length-g;for(N=S%2===0?g+1:g;N=18?(b-=18,M+=1,this.words[M]|=R>>>26):b+=8}this._strip()};function u(C,f,g,A){for(var N=0,b=0,M=Math.min(C.length,g),R=f;R=49?b=S-49+10:S>=17?b=S-17+10:b=S,n(S>=0&&b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch{o.prototype.inspect=d}else o.prototype.inspect=d;function d(){return(this.red?""}var m=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],v=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(f,g){f=f||10,g=g|0||1;var A;if(f===16||f==="hex"){A="";for(var N=0,b=0,M=0;M>>24-N&16777215,N+=2,N>=26&&(N-=26,M--),b!==0||M!==this.length-1?A=m[6-S.length]+S+A:A=S+A}for(b!==0&&(A=b.toString(16)+A);A.length%g!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}if(f===(f|0)&&f>=2&&f<=36){var h=v[f],P=p[f];A="";var te=this.clone();for(te.negative=0;!te.isZero();){var y=te.modrn(P).toString(f);te=te.idivn(P),te.isZero()?A=y+A:A=m[h-y.length]+y+A}for(this.isZero()&&(A="0"+A);A.length%g!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(f,g){return this.toArrayLike(s,f,g)}),o.prototype.toArray=function(f,g){return this.toArrayLike(Array,f,g)};var x=function(f,g){return f.allocUnsafe?f.allocUnsafe(g):new f(g)};o.prototype.toArrayLike=function(f,g,A){this._strip();var N=this.byteLength(),b=A||Math.max(1,N);n(N<=b,"byte array longer than desired length"),n(b>0,"Requested array length <= 0");var M=x(f,b),R=g==="le"?"LE":"BE";return this["_toArrayLike"+R](M,N),M},o.prototype._toArrayLikeLE=function(f,g){for(var A=0,N=0,b=0,M=0;b>8&255),A>16&255),M===6?(A>24&255),N=0,M=0):(N=R>>>24,M+=2)}if(A=0&&(f[A--]=R>>8&255),A>=0&&(f[A--]=R>>16&255),M===6?(A>=0&&(f[A--]=R>>24&255),N=0,M=0):(N=R>>>24,M+=2)}if(A>=0)for(f[A--]=N;A>=0;)f[A--]=0},Math.clz32?o.prototype._countBits=function(f){return 32-Math.clz32(f)}:o.prototype._countBits=function(f){var g=f,A=0;return g>=4096&&(A+=13,g>>>=13),g>=64&&(A+=7,g>>>=7),g>=8&&(A+=4,g>>>=4),g>=2&&(A+=2,g>>>=2),A+g},o.prototype._zeroBits=function(f){if(f===0)return 26;var g=f,A=0;return g&8191||(A+=13,g>>>=13),g&127||(A+=7,g>>>=7),g&15||(A+=4,g>>>=4),g&3||(A+=2,g>>>=2),g&1||A++,A},o.prototype.bitLength=function(){var f=this.words[this.length-1],g=this._countBits(f);return(this.length-1)*26+g};function k(C){for(var f=new Array(C.bitLength()),g=0;g>>N&1}return f}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,g=0;gf.length?this.clone().ior(f):f.clone().ior(this)},o.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},o.prototype.iuand=function(f){var g;this.length>f.length?g=f:g=this;for(var A=0;Af.length?this.clone().iand(f):f.clone().iand(this)},o.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},o.prototype.iuxor=function(f){var g,A;this.length>f.length?(g=this,A=f):(g=f,A=this);for(var N=0;Nf.length?this.clone().ixor(f):f.clone().ixor(this)},o.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},o.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var g=Math.ceil(f/26)|0,A=f%26;this._expand(g),A>0&&g--;for(var N=0;N0&&(this.words[N]=~this.words[N]&67108863>>26-A),this._strip()},o.prototype.notn=function(f){return this.clone().inotn(f)},o.prototype.setn=function(f,g){n(typeof f=="number"&&f>=0);var A=f/26|0,N=f%26;return this._expand(A+1),g?this.words[A]=this.words[A]|1<f.length?(A=this,N=f):(A=f,N=this);for(var b=0,M=0;M>>26;for(;b!==0&&M>>26;if(this.length=A.length,b!==0)this.words[this.length]=b,this.length++;else if(A!==this)for(;Mf.length?this.clone().iadd(f):f.clone().iadd(this)},o.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var g=this.iadd(f);return f.negative=1,g._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var A=this.cmp(f);if(A===0)return this.negative=0,this.length=1,this.words[0]=0,this;var N,b;A>0?(N=this,b=f):(N=f,b=this);for(var M=0,R=0;R>26,this.words[R]=g&67108863;for(;M!==0&&R>26,this.words[R]=g&67108863;if(M===0&&R>>26,te=S&67108863,y=Math.min(h,f.length-1),D=Math.max(0,h-C.length+1);D<=y;D++){var U=h-D|0;N=C.words[U]|0,b=f.words[D]|0,M=N*b+te,P+=M/67108864|0,te=M&67108863}g.words[h]=te|0,S=P|0}return S!==0?g.words[h]=S|0:g.length--,g._strip()}var w=function(f,g,A){var N=f.words,b=g.words,M=A.words,R=0,S,h,P,te=N[0]|0,y=te&8191,D=te>>>13,U=N[1]|0,F=U&8191,W=U>>>13,oe=N[2]|0,Y=oe&8191,K=oe>>>13,Je=N[3]|0,Q=Je&8191,le=Je>>>13,Qr=N[4]|0,Te=Qr&8191,Ne=Qr>>>13,Jr=N[5]|0,Pe=Jr&8191,ce=Jr>>>13,wr=N[6]|0,fe=wr&8191,Oe=wr>>>13,Yr=N[7]|0,me=Yr&8191,ze=Yr>>>13,gn=N[8]|0,$e=gn&8191,He=gn>>>13,Ht=N[9]|0,Le=Ht&8191,qe=Ht>>>13,Rr=b[0]|0,Ce=Rr&8191,We=Rr>>>13,vn=b[1]|0,Be=vn&8191,Ge=vn>>>13,yn=b[2]|0,De=yn&8191,ne=yn>>>13,ot=b[3]|0,ge=ot&8191,de=ot>>>13,rt=b[4]|0,be=rt&8191,_e=rt>>>13,Ct=b[5]|0,Me=Ct&8191,je=Ct>>>13,Kt=b[6]|0,Ve=Kt&8191,Ke=Kt>>>13,Qt=b[7]|0,Ie=Qt&8191,Ue=Qt>>>13,Er=b[8]|0,ke=Er&8191,Ye=Er>>>13,Ai=b[9]|0,Xe=Ai&8191,Ze=Ai>>>13;A.negative=f.negative^g.negative,A.length=19,S=Math.imul(y,Ce),h=Math.imul(y,We),h=h+Math.imul(D,Ce)|0,P=Math.imul(D,We);var $n=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+($n>>>26)|0,$n&=67108863,S=Math.imul(F,Ce),h=Math.imul(F,We),h=h+Math.imul(W,Ce)|0,P=Math.imul(W,We),S=S+Math.imul(y,Be)|0,h=h+Math.imul(y,Ge)|0,h=h+Math.imul(D,Be)|0,P=P+Math.imul(D,Ge)|0;var Hn=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Hn>>>26)|0,Hn&=67108863,S=Math.imul(Y,Ce),h=Math.imul(Y,We),h=h+Math.imul(K,Ce)|0,P=Math.imul(K,We),S=S+Math.imul(F,Be)|0,h=h+Math.imul(F,Ge)|0,h=h+Math.imul(W,Be)|0,P=P+Math.imul(W,Ge)|0,S=S+Math.imul(y,De)|0,h=h+Math.imul(y,ne)|0,h=h+Math.imul(D,De)|0,P=P+Math.imul(D,ne)|0;var qn=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(qn>>>26)|0,qn&=67108863,S=Math.imul(Q,Ce),h=Math.imul(Q,We),h=h+Math.imul(le,Ce)|0,P=Math.imul(le,We),S=S+Math.imul(Y,Be)|0,h=h+Math.imul(Y,Ge)|0,h=h+Math.imul(K,Be)|0,P=P+Math.imul(K,Ge)|0,S=S+Math.imul(F,De)|0,h=h+Math.imul(F,ne)|0,h=h+Math.imul(W,De)|0,P=P+Math.imul(W,ne)|0,S=S+Math.imul(y,ge)|0,h=h+Math.imul(y,de)|0,h=h+Math.imul(D,ge)|0,P=P+Math.imul(D,de)|0;var Wn=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,S=Math.imul(Te,Ce),h=Math.imul(Te,We),h=h+Math.imul(Ne,Ce)|0,P=Math.imul(Ne,We),S=S+Math.imul(Q,Be)|0,h=h+Math.imul(Q,Ge)|0,h=h+Math.imul(le,Be)|0,P=P+Math.imul(le,Ge)|0,S=S+Math.imul(Y,De)|0,h=h+Math.imul(Y,ne)|0,h=h+Math.imul(K,De)|0,P=P+Math.imul(K,ne)|0,S=S+Math.imul(F,ge)|0,h=h+Math.imul(F,de)|0,h=h+Math.imul(W,ge)|0,P=P+Math.imul(W,de)|0,S=S+Math.imul(y,be)|0,h=h+Math.imul(y,_e)|0,h=h+Math.imul(D,be)|0,P=P+Math.imul(D,_e)|0;var Gn=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Gn>>>26)|0,Gn&=67108863,S=Math.imul(Pe,Ce),h=Math.imul(Pe,We),h=h+Math.imul(ce,Ce)|0,P=Math.imul(ce,We),S=S+Math.imul(Te,Be)|0,h=h+Math.imul(Te,Ge)|0,h=h+Math.imul(Ne,Be)|0,P=P+Math.imul(Ne,Ge)|0,S=S+Math.imul(Q,De)|0,h=h+Math.imul(Q,ne)|0,h=h+Math.imul(le,De)|0,P=P+Math.imul(le,ne)|0,S=S+Math.imul(Y,ge)|0,h=h+Math.imul(Y,de)|0,h=h+Math.imul(K,ge)|0,P=P+Math.imul(K,de)|0,S=S+Math.imul(F,be)|0,h=h+Math.imul(F,_e)|0,h=h+Math.imul(W,be)|0,P=P+Math.imul(W,_e)|0,S=S+Math.imul(y,Me)|0,h=h+Math.imul(y,je)|0,h=h+Math.imul(D,Me)|0,P=P+Math.imul(D,je)|0;var Yu=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Yu>>>26)|0,Yu&=67108863,S=Math.imul(fe,Ce),h=Math.imul(fe,We),h=h+Math.imul(Oe,Ce)|0,P=Math.imul(Oe,We),S=S+Math.imul(Pe,Be)|0,h=h+Math.imul(Pe,Ge)|0,h=h+Math.imul(ce,Be)|0,P=P+Math.imul(ce,Ge)|0,S=S+Math.imul(Te,De)|0,h=h+Math.imul(Te,ne)|0,h=h+Math.imul(Ne,De)|0,P=P+Math.imul(Ne,ne)|0,S=S+Math.imul(Q,ge)|0,h=h+Math.imul(Q,de)|0,h=h+Math.imul(le,ge)|0,P=P+Math.imul(le,de)|0,S=S+Math.imul(Y,be)|0,h=h+Math.imul(Y,_e)|0,h=h+Math.imul(K,be)|0,P=P+Math.imul(K,_e)|0,S=S+Math.imul(F,Me)|0,h=h+Math.imul(F,je)|0,h=h+Math.imul(W,Me)|0,P=P+Math.imul(W,je)|0,S=S+Math.imul(y,Ve)|0,h=h+Math.imul(y,Ke)|0,h=h+Math.imul(D,Ve)|0,P=P+Math.imul(D,Ke)|0;var Xu=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,S=Math.imul(me,Ce),h=Math.imul(me,We),h=h+Math.imul(ze,Ce)|0,P=Math.imul(ze,We),S=S+Math.imul(fe,Be)|0,h=h+Math.imul(fe,Ge)|0,h=h+Math.imul(Oe,Be)|0,P=P+Math.imul(Oe,Ge)|0,S=S+Math.imul(Pe,De)|0,h=h+Math.imul(Pe,ne)|0,h=h+Math.imul(ce,De)|0,P=P+Math.imul(ce,ne)|0,S=S+Math.imul(Te,ge)|0,h=h+Math.imul(Te,de)|0,h=h+Math.imul(Ne,ge)|0,P=P+Math.imul(Ne,de)|0,S=S+Math.imul(Q,be)|0,h=h+Math.imul(Q,_e)|0,h=h+Math.imul(le,be)|0,P=P+Math.imul(le,_e)|0,S=S+Math.imul(Y,Me)|0,h=h+Math.imul(Y,je)|0,h=h+Math.imul(K,Me)|0,P=P+Math.imul(K,je)|0,S=S+Math.imul(F,Ve)|0,h=h+Math.imul(F,Ke)|0,h=h+Math.imul(W,Ve)|0,P=P+Math.imul(W,Ke)|0,S=S+Math.imul(y,Ie)|0,h=h+Math.imul(y,Ue)|0,h=h+Math.imul(D,Ie)|0,P=P+Math.imul(D,Ue)|0;var Zu=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Zu>>>26)|0,Zu&=67108863,S=Math.imul($e,Ce),h=Math.imul($e,We),h=h+Math.imul(He,Ce)|0,P=Math.imul(He,We),S=S+Math.imul(me,Be)|0,h=h+Math.imul(me,Ge)|0,h=h+Math.imul(ze,Be)|0,P=P+Math.imul(ze,Ge)|0,S=S+Math.imul(fe,De)|0,h=h+Math.imul(fe,ne)|0,h=h+Math.imul(Oe,De)|0,P=P+Math.imul(Oe,ne)|0,S=S+Math.imul(Pe,ge)|0,h=h+Math.imul(Pe,de)|0,h=h+Math.imul(ce,ge)|0,P=P+Math.imul(ce,de)|0,S=S+Math.imul(Te,be)|0,h=h+Math.imul(Te,_e)|0,h=h+Math.imul(Ne,be)|0,P=P+Math.imul(Ne,_e)|0,S=S+Math.imul(Q,Me)|0,h=h+Math.imul(Q,je)|0,h=h+Math.imul(le,Me)|0,P=P+Math.imul(le,je)|0,S=S+Math.imul(Y,Ve)|0,h=h+Math.imul(Y,Ke)|0,h=h+Math.imul(K,Ve)|0,P=P+Math.imul(K,Ke)|0,S=S+Math.imul(F,Ie)|0,h=h+Math.imul(F,Ue)|0,h=h+Math.imul(W,Ie)|0,P=P+Math.imul(W,Ue)|0,S=S+Math.imul(y,ke)|0,h=h+Math.imul(y,Ye)|0,h=h+Math.imul(D,ke)|0,P=P+Math.imul(D,Ye)|0;var ec=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ec>>>26)|0,ec&=67108863,S=Math.imul(Le,Ce),h=Math.imul(Le,We),h=h+Math.imul(qe,Ce)|0,P=Math.imul(qe,We),S=S+Math.imul($e,Be)|0,h=h+Math.imul($e,Ge)|0,h=h+Math.imul(He,Be)|0,P=P+Math.imul(He,Ge)|0,S=S+Math.imul(me,De)|0,h=h+Math.imul(me,ne)|0,h=h+Math.imul(ze,De)|0,P=P+Math.imul(ze,ne)|0,S=S+Math.imul(fe,ge)|0,h=h+Math.imul(fe,de)|0,h=h+Math.imul(Oe,ge)|0,P=P+Math.imul(Oe,de)|0,S=S+Math.imul(Pe,be)|0,h=h+Math.imul(Pe,_e)|0,h=h+Math.imul(ce,be)|0,P=P+Math.imul(ce,_e)|0,S=S+Math.imul(Te,Me)|0,h=h+Math.imul(Te,je)|0,h=h+Math.imul(Ne,Me)|0,P=P+Math.imul(Ne,je)|0,S=S+Math.imul(Q,Ve)|0,h=h+Math.imul(Q,Ke)|0,h=h+Math.imul(le,Ve)|0,P=P+Math.imul(le,Ke)|0,S=S+Math.imul(Y,Ie)|0,h=h+Math.imul(Y,Ue)|0,h=h+Math.imul(K,Ie)|0,P=P+Math.imul(K,Ue)|0,S=S+Math.imul(F,ke)|0,h=h+Math.imul(F,Ye)|0,h=h+Math.imul(W,ke)|0,P=P+Math.imul(W,Ye)|0,S=S+Math.imul(y,Xe)|0,h=h+Math.imul(y,Ze)|0,h=h+Math.imul(D,Xe)|0,P=P+Math.imul(D,Ze)|0;var tc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(tc>>>26)|0,tc&=67108863,S=Math.imul(Le,Be),h=Math.imul(Le,Ge),h=h+Math.imul(qe,Be)|0,P=Math.imul(qe,Ge),S=S+Math.imul($e,De)|0,h=h+Math.imul($e,ne)|0,h=h+Math.imul(He,De)|0,P=P+Math.imul(He,ne)|0,S=S+Math.imul(me,ge)|0,h=h+Math.imul(me,de)|0,h=h+Math.imul(ze,ge)|0,P=P+Math.imul(ze,de)|0,S=S+Math.imul(fe,be)|0,h=h+Math.imul(fe,_e)|0,h=h+Math.imul(Oe,be)|0,P=P+Math.imul(Oe,_e)|0,S=S+Math.imul(Pe,Me)|0,h=h+Math.imul(Pe,je)|0,h=h+Math.imul(ce,Me)|0,P=P+Math.imul(ce,je)|0,S=S+Math.imul(Te,Ve)|0,h=h+Math.imul(Te,Ke)|0,h=h+Math.imul(Ne,Ve)|0,P=P+Math.imul(Ne,Ke)|0,S=S+Math.imul(Q,Ie)|0,h=h+Math.imul(Q,Ue)|0,h=h+Math.imul(le,Ie)|0,P=P+Math.imul(le,Ue)|0,S=S+Math.imul(Y,ke)|0,h=h+Math.imul(Y,Ye)|0,h=h+Math.imul(K,ke)|0,P=P+Math.imul(K,Ye)|0,S=S+Math.imul(F,Xe)|0,h=h+Math.imul(F,Ze)|0,h=h+Math.imul(W,Xe)|0,P=P+Math.imul(W,Ze)|0;var rc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(rc>>>26)|0,rc&=67108863,S=Math.imul(Le,De),h=Math.imul(Le,ne),h=h+Math.imul(qe,De)|0,P=Math.imul(qe,ne),S=S+Math.imul($e,ge)|0,h=h+Math.imul($e,de)|0,h=h+Math.imul(He,ge)|0,P=P+Math.imul(He,de)|0,S=S+Math.imul(me,be)|0,h=h+Math.imul(me,_e)|0,h=h+Math.imul(ze,be)|0,P=P+Math.imul(ze,_e)|0,S=S+Math.imul(fe,Me)|0,h=h+Math.imul(fe,je)|0,h=h+Math.imul(Oe,Me)|0,P=P+Math.imul(Oe,je)|0,S=S+Math.imul(Pe,Ve)|0,h=h+Math.imul(Pe,Ke)|0,h=h+Math.imul(ce,Ve)|0,P=P+Math.imul(ce,Ke)|0,S=S+Math.imul(Te,Ie)|0,h=h+Math.imul(Te,Ue)|0,h=h+Math.imul(Ne,Ie)|0,P=P+Math.imul(Ne,Ue)|0,S=S+Math.imul(Q,ke)|0,h=h+Math.imul(Q,Ye)|0,h=h+Math.imul(le,ke)|0,P=P+Math.imul(le,Ye)|0,S=S+Math.imul(Y,Xe)|0,h=h+Math.imul(Y,Ze)|0,h=h+Math.imul(K,Xe)|0,P=P+Math.imul(K,Ze)|0;var nc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(nc>>>26)|0,nc&=67108863,S=Math.imul(Le,ge),h=Math.imul(Le,de),h=h+Math.imul(qe,ge)|0,P=Math.imul(qe,de),S=S+Math.imul($e,be)|0,h=h+Math.imul($e,_e)|0,h=h+Math.imul(He,be)|0,P=P+Math.imul(He,_e)|0,S=S+Math.imul(me,Me)|0,h=h+Math.imul(me,je)|0,h=h+Math.imul(ze,Me)|0,P=P+Math.imul(ze,je)|0,S=S+Math.imul(fe,Ve)|0,h=h+Math.imul(fe,Ke)|0,h=h+Math.imul(Oe,Ve)|0,P=P+Math.imul(Oe,Ke)|0,S=S+Math.imul(Pe,Ie)|0,h=h+Math.imul(Pe,Ue)|0,h=h+Math.imul(ce,Ie)|0,P=P+Math.imul(ce,Ue)|0,S=S+Math.imul(Te,ke)|0,h=h+Math.imul(Te,Ye)|0,h=h+Math.imul(Ne,ke)|0,P=P+Math.imul(Ne,Ye)|0,S=S+Math.imul(Q,Xe)|0,h=h+Math.imul(Q,Ze)|0,h=h+Math.imul(le,Xe)|0,P=P+Math.imul(le,Ze)|0;var ic=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ic>>>26)|0,ic&=67108863,S=Math.imul(Le,be),h=Math.imul(Le,_e),h=h+Math.imul(qe,be)|0,P=Math.imul(qe,_e),S=S+Math.imul($e,Me)|0,h=h+Math.imul($e,je)|0,h=h+Math.imul(He,Me)|0,P=P+Math.imul(He,je)|0,S=S+Math.imul(me,Ve)|0,h=h+Math.imul(me,Ke)|0,h=h+Math.imul(ze,Ve)|0,P=P+Math.imul(ze,Ke)|0,S=S+Math.imul(fe,Ie)|0,h=h+Math.imul(fe,Ue)|0,h=h+Math.imul(Oe,Ie)|0,P=P+Math.imul(Oe,Ue)|0,S=S+Math.imul(Pe,ke)|0,h=h+Math.imul(Pe,Ye)|0,h=h+Math.imul(ce,ke)|0,P=P+Math.imul(ce,Ye)|0,S=S+Math.imul(Te,Xe)|0,h=h+Math.imul(Te,Ze)|0,h=h+Math.imul(Ne,Xe)|0,P=P+Math.imul(Ne,Ze)|0;var oc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(oc>>>26)|0,oc&=67108863,S=Math.imul(Le,Me),h=Math.imul(Le,je),h=h+Math.imul(qe,Me)|0,P=Math.imul(qe,je),S=S+Math.imul($e,Ve)|0,h=h+Math.imul($e,Ke)|0,h=h+Math.imul(He,Ve)|0,P=P+Math.imul(He,Ke)|0,S=S+Math.imul(me,Ie)|0,h=h+Math.imul(me,Ue)|0,h=h+Math.imul(ze,Ie)|0,P=P+Math.imul(ze,Ue)|0,S=S+Math.imul(fe,ke)|0,h=h+Math.imul(fe,Ye)|0,h=h+Math.imul(Oe,ke)|0,P=P+Math.imul(Oe,Ye)|0,S=S+Math.imul(Pe,Xe)|0,h=h+Math.imul(Pe,Ze)|0,h=h+Math.imul(ce,Xe)|0,P=P+Math.imul(ce,Ze)|0;var sc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(sc>>>26)|0,sc&=67108863,S=Math.imul(Le,Ve),h=Math.imul(Le,Ke),h=h+Math.imul(qe,Ve)|0,P=Math.imul(qe,Ke),S=S+Math.imul($e,Ie)|0,h=h+Math.imul($e,Ue)|0,h=h+Math.imul(He,Ie)|0,P=P+Math.imul(He,Ue)|0,S=S+Math.imul(me,ke)|0,h=h+Math.imul(me,Ye)|0,h=h+Math.imul(ze,ke)|0,P=P+Math.imul(ze,Ye)|0,S=S+Math.imul(fe,Xe)|0,h=h+Math.imul(fe,Ze)|0,h=h+Math.imul(Oe,Xe)|0,P=P+Math.imul(Oe,Ze)|0;var lc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(lc>>>26)|0,lc&=67108863,S=Math.imul(Le,Ie),h=Math.imul(Le,Ue),h=h+Math.imul(qe,Ie)|0,P=Math.imul(qe,Ue),S=S+Math.imul($e,ke)|0,h=h+Math.imul($e,Ye)|0,h=h+Math.imul(He,ke)|0,P=P+Math.imul(He,Ye)|0,S=S+Math.imul(me,Xe)|0,h=h+Math.imul(me,Ze)|0,h=h+Math.imul(ze,Xe)|0,P=P+Math.imul(ze,Ze)|0;var ac=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ac>>>26)|0,ac&=67108863,S=Math.imul(Le,ke),h=Math.imul(Le,Ye),h=h+Math.imul(qe,ke)|0,P=Math.imul(qe,Ye),S=S+Math.imul($e,Xe)|0,h=h+Math.imul($e,Ze)|0,h=h+Math.imul(He,Xe)|0,P=P+Math.imul(He,Ze)|0;var uc=(R+S|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(uc>>>26)|0,uc&=67108863,S=Math.imul(Le,Xe),h=Math.imul(Le,Ze),h=h+Math.imul(qe,Xe)|0,P=Math.imul(qe,Ze);var cc=(R+S|0)+((h&8191)<<13)|0;return R=(P+(h>>>13)|0)+(cc>>>26)|0,cc&=67108863,M[0]=$n,M[1]=Hn,M[2]=qn,M[3]=Wn,M[4]=Gn,M[5]=Yu,M[6]=Xu,M[7]=Zu,M[8]=ec,M[9]=tc,M[10]=rc,M[11]=nc,M[12]=ic,M[13]=oc,M[14]=sc,M[15]=lc,M[16]=ac,M[17]=uc,M[18]=cc,R!==0&&(M[19]=R,A.length++),A};Math.imul||(w=E);function _(C,f,g){g.negative=f.negative^C.negative,g.length=C.length+f.length;for(var A=0,N=0,b=0;b>>26)|0,N+=M>>>26,M&=67108863}g.words[b]=R,A=M,M=N}return A!==0?g.words[b]=A:g.length--,g._strip()}function O(C,f,g){return _(C,f,g)}o.prototype.mulTo=function(f,g){var A,N=this.length+f.length;return this.length===10&&f.length===10?A=w(this,f,g):N<63?A=E(this,f,g):N<1024?A=_(this,f,g):A=O(this,f,g),A},o.prototype.mul=function(f){var g=new o(null);return g.words=new Array(this.length+f.length),this.mulTo(f,g)},o.prototype.mulf=function(f){var g=new o(null);return g.words=new Array(this.length+f.length),O(this,f,g)},o.prototype.imul=function(f){return this.clone().mulTo(f,this)},o.prototype.imuln=function(f){var g=f<0;g&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var A=0,N=0;N>=26,A+=b/67108864|0,A+=M>>>26,this.words[N]=M&67108863}return A!==0&&(this.words[N]=A,this.length++),g?this.ineg():this},o.prototype.muln=function(f){return this.clone().imuln(f)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(f){var g=k(f);if(g.length===0)return new o(1);for(var A=this,N=0;N=0);var g=f%26,A=(f-g)/26,N=67108863>>>26-g<<26-g,b;if(g!==0){var M=0;for(b=0;b>>26-g}M&&(this.words[b]=M,this.length++)}if(A!==0){for(b=this.length-1;b>=0;b--)this.words[b+A]=this.words[b];for(b=0;b=0);var N;g?N=(g-g%26)/26:N=0;var b=f%26,M=Math.min((f-b)/26,this.length),R=67108863^67108863>>>b<M)for(this.length-=M,h=0;h=0&&(P!==0||h>=N);h--){var te=this.words[h]|0;this.words[h]=P<<26-b|te>>>b,P=te&R}return S&&P!==0&&(S.words[S.length++]=P),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(f,g,A){return n(this.negative===0),this.iushrn(f,g,A)},o.prototype.shln=function(f){return this.clone().ishln(f)},o.prototype.ushln=function(f){return this.clone().iushln(f)},o.prototype.shrn=function(f){return this.clone().ishrn(f)},o.prototype.ushrn=function(f){return this.clone().iushrn(f)},o.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var g=f%26,A=(f-g)/26,N=1<=0);var g=f%26,A=(f-g)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=A)return this;if(g!==0&&A++,this.length=Math.min(A,this.length),g!==0){var N=67108863^67108863>>>g<=67108864;g++)this.words[g]-=67108864,g===this.length-1?this.words[g+1]=1:this.words[g+1]++;return this.length=Math.max(this.length,g+1),this},o.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var g=0;g>26)-(S/67108864|0),this.words[b+A]=M&67108863}for(;b>26,this.words[b+A]=M&67108863;if(R===0)return this._strip();for(n(R===-1),R=0,b=0;b>26,this.words[b]=M&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(f,g){var A=this.length-f.length,N=this.clone(),b=f,M=b.words[b.length-1]|0,R=this._countBits(M);A=26-R,A!==0&&(b=b.ushln(A),N.iushln(A),M=b.words[b.length-1]|0);var S=N.length-b.length,h;if(g!=="mod"){h=new o(null),h.length=S+1,h.words=new Array(h.length);for(var P=0;P=0;y--){var D=(N.words[b.length+y]|0)*67108864+(N.words[b.length+y-1]|0);for(D=Math.min(D/M|0,67108863),N._ishlnsubmul(b,D,y);N.negative!==0;)D--,N.negative=0,N._ishlnsubmul(b,1,y),N.isZero()||(N.negative^=1);h&&(h.words[y]=D)}return h&&h._strip(),N._strip(),g!=="div"&&A!==0&&N.iushrn(A),{div:h||null,mod:N}},o.prototype.divmod=function(f,g,A){if(n(!f.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var N,b,M;return this.negative!==0&&f.negative===0?(M=this.neg().divmod(f,g),g!=="mod"&&(N=M.div.neg()),g!=="div"&&(b=M.mod.neg(),A&&b.negative!==0&&b.iadd(f)),{div:N,mod:b}):this.negative===0&&f.negative!==0?(M=this.divmod(f.neg(),g),g!=="mod"&&(N=M.div.neg()),{div:N,mod:M.mod}):this.negative&f.negative?(M=this.neg().divmod(f.neg(),g),g!=="div"&&(b=M.mod.neg(),A&&b.negative!==0&&b.isub(f)),{div:M.div,mod:b}):f.length>this.length||this.cmp(f)<0?{div:new o(0),mod:this}:f.length===1?g==="div"?{div:this.divn(f.words[0]),mod:null}:g==="mod"?{div:null,mod:new o(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new o(this.modrn(f.words[0]))}:this._wordDiv(f,g)},o.prototype.div=function(f){return this.divmod(f,"div",!1).div},o.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},o.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},o.prototype.divRound=function(f){var g=this.divmod(f);if(g.mod.isZero())return g.div;var A=g.div.negative!==0?g.mod.isub(f):g.mod,N=f.ushrn(1),b=f.andln(1),M=A.cmp(N);return M<0||b===1&&M===0?g.div:g.div.negative!==0?g.div.isubn(1):g.div.iaddn(1)},o.prototype.modrn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var A=(1<<26)%f,N=0,b=this.length-1;b>=0;b--)N=(A*N+(this.words[b]|0))%f;return g?-N:N},o.prototype.modn=function(f){return this.modrn(f)},o.prototype.idivn=function(f){var g=f<0;g&&(f=-f),n(f<=67108863);for(var A=0,N=this.length-1;N>=0;N--){var b=(this.words[N]|0)+A*67108864;this.words[N]=b/f|0,A=b%f}return this._strip(),g?this.ineg():this},o.prototype.divn=function(f){return this.clone().idivn(f)},o.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var g=this,A=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var N=new o(1),b=new o(0),M=new o(0),R=new o(1),S=0;g.isEven()&&A.isEven();)g.iushrn(1),A.iushrn(1),++S;for(var h=A.clone(),P=g.clone();!g.isZero();){for(var te=0,y=1;!(g.words[0]&y)&&te<26;++te,y<<=1);if(te>0)for(g.iushrn(te);te-- >0;)(N.isOdd()||b.isOdd())&&(N.iadd(h),b.isub(P)),N.iushrn(1),b.iushrn(1);for(var D=0,U=1;!(A.words[0]&U)&&D<26;++D,U<<=1);if(D>0)for(A.iushrn(D);D-- >0;)(M.isOdd()||R.isOdd())&&(M.iadd(h),R.isub(P)),M.iushrn(1),R.iushrn(1);g.cmp(A)>=0?(g.isub(A),N.isub(M),b.isub(R)):(A.isub(g),M.isub(N),R.isub(b))}return{a:M,b:R,gcd:A.iushln(S)}},o.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var g=this,A=f.clone();g.negative!==0?g=g.umod(f):g=g.clone();for(var N=new o(1),b=new o(0),M=A.clone();g.cmpn(1)>0&&A.cmpn(1)>0;){for(var R=0,S=1;!(g.words[0]&S)&&R<26;++R,S<<=1);if(R>0)for(g.iushrn(R);R-- >0;)N.isOdd()&&N.iadd(M),N.iushrn(1);for(var h=0,P=1;!(A.words[0]&P)&&h<26;++h,P<<=1);if(h>0)for(A.iushrn(h);h-- >0;)b.isOdd()&&b.iadd(M),b.iushrn(1);g.cmp(A)>=0?(g.isub(A),N.isub(b)):(A.isub(g),b.isub(N))}var te;return g.cmpn(1)===0?te=N:te=b,te.cmpn(0)<0&&te.iadd(f),te},o.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var g=this.clone(),A=f.clone();g.negative=0,A.negative=0;for(var N=0;g.isEven()&&A.isEven();N++)g.iushrn(1),A.iushrn(1);do{for(;g.isEven();)g.iushrn(1);for(;A.isEven();)A.iushrn(1);var b=g.cmp(A);if(b<0){var M=g;g=A,A=M}else if(b===0||A.cmpn(1)===0)break;g.isub(A)}while(!0);return A.iushln(N)},o.prototype.invm=function(f){return this.egcd(f).a.umod(f)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(f){return this.words[0]&f},o.prototype.bincn=function(f){n(typeof f=="number");var g=f%26,A=(f-g)/26,N=1<>>26,R&=67108863,this.words[M]=R}return b!==0&&(this.words[M]=b,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(f){var g=f<0;if(this.negative!==0&&!g)return-1;if(this.negative===0&&g)return 1;this._strip();var A;if(this.length>1)A=1;else{g&&(f=-f),n(f<=67108863,"Number is too big");var N=this.words[0]|0;A=N===f?0:Nf.length)return 1;if(this.length=0;A--){var N=this.words[A]|0,b=f.words[A]|0;if(N!==b){Nb&&(g=1);break}}return g},o.prototype.gtn=function(f){return this.cmpn(f)===1},o.prototype.gt=function(f){return this.cmp(f)===1},o.prototype.gten=function(f){return this.cmpn(f)>=0},o.prototype.gte=function(f){return this.cmp(f)>=0},o.prototype.ltn=function(f){return this.cmpn(f)===-1},o.prototype.lt=function(f){return this.cmp(f)===-1},o.prototype.lten=function(f){return this.cmpn(f)<=0},o.prototype.lte=function(f){return this.cmp(f)<=0},o.prototype.eqn=function(f){return this.cmpn(f)===0},o.prototype.eq=function(f){return this.cmp(f)===0},o.red=function(f){return new G(f)},o.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(f){return this.red=f,this},o.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},o.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},o.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},o.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},o.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},o.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},o.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},o.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var B={k256:null,p224:null,p192:null,p25519:null};function j(C,f){this.name=C,this.p=new o(f,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}j.prototype._tmp=function(){var f=new o(null);return f.words=new Array(Math.ceil(this.n/13)),f},j.prototype.ireduce=function(f){var g=f,A;do this.split(g,this.tmp),g=this.imulK(g),g=g.iadd(this.tmp),A=g.bitLength();while(A>this.n);var N=A0?g.isub(this.p):g.strip!==void 0?g.strip():g._strip(),g},j.prototype.split=function(f,g){f.iushrn(this.n,0,g)},j.prototype.imulK=function(f){return f.imul(this.k)};function $(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i($,j),$.prototype.split=function(f,g){for(var A=4194303,N=Math.min(f.length,9),b=0;b>>22,M=R}M>>>=22,f.words[b-10]=M,M===0&&f.length>10?f.length-=10:f.length-=9},$.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var g=0,A=0;A>>=26,f.words[A]=b,g=N}return g!==0&&(f.words[f.length++]=g),f},o._prime=function(f){if(B[f])return B[f];var g;if(f==="k256")g=new $;else if(f==="p224")g=new H;else if(f==="p192")g=new ie;else if(f==="p25519")g=new X;else throw new Error("Unknown prime "+f);return B[f]=g,g};function G(C){if(typeof C=="string"){var f=o._prime(C);this.m=f.p,this.prime=f}else n(C.gtn(1),"modulus must be greater than 1"),this.m=C,this.prime=null}G.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},G.prototype._verify2=function(f,g){n((f.negative|g.negative)===0,"red works only with positives"),n(f.red&&f.red===g.red,"red works only with red numbers")},G.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(c(f,f.umod(this.m)._forceRed(this)),f)},G.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},G.prototype.add=function(f,g){this._verify2(f,g);var A=f.add(g);return A.cmp(this.m)>=0&&A.isub(this.m),A._forceRed(this)},G.prototype.iadd=function(f,g){this._verify2(f,g);var A=f.iadd(g);return A.cmp(this.m)>=0&&A.isub(this.m),A},G.prototype.sub=function(f,g){this._verify2(f,g);var A=f.sub(g);return A.cmpn(0)<0&&A.iadd(this.m),A._forceRed(this)},G.prototype.isub=function(f,g){this._verify2(f,g);var A=f.isub(g);return A.cmpn(0)<0&&A.iadd(this.m),A},G.prototype.shl=function(f,g){return this._verify1(f),this.imod(f.ushln(g))},G.prototype.imul=function(f,g){return this._verify2(f,g),this.imod(f.imul(g))},G.prototype.mul=function(f,g){return this._verify2(f,g),this.imod(f.mul(g))},G.prototype.isqr=function(f){return this.imul(f,f.clone())},G.prototype.sqr=function(f){return this.mul(f,f)},G.prototype.sqrt=function(f){if(f.isZero())return f.clone();var g=this.m.andln(3);if(n(g%2===1),g===3){var A=this.m.add(new o(1)).iushrn(2);return this.pow(f,A)}for(var N=this.m.subn(1),b=0;!N.isZero()&&N.andln(1)===0;)b++,N.iushrn(1);n(!N.isZero());var M=new o(1).toRed(this),R=M.redNeg(),S=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);this.pow(h,S).cmp(R)!==0;)h.redIAdd(R);for(var P=this.pow(h,N),te=this.pow(f,N.addn(1).iushrn(1)),y=this.pow(f,N),D=b;y.cmp(M)!==0;){for(var U=y,F=0;U.cmp(M)!==0;F++)U=U.redSqr();n(F=0;b--){for(var P=g.words[b],te=h-1;te>=0;te--){var y=P>>te&1;if(M!==N[0]&&(M=this.sqr(M)),y===0&&R===0){S=0;continue}R<<=1,R|=y,S++,!(S!==A&&(b!==0||te!==0))&&(M=this.mul(M,N[R]),S=0,R=0)}h=26}return M},G.prototype.convertTo=function(f){var g=f.umod(this.m);return g===f?g.clone():g},G.prototype.convertFrom=function(f){var g=f.clone();return g.red=null,g},o.mont=function(f){return new J(f)};function J(C){G.call(this,C),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(J,G),J.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},J.prototype.convertFrom=function(f){var g=this.imod(f.mul(this.rinv));return g.red=null,g},J.prototype.imul=function(f,g){if(f.isZero()||g.isZero())return f.words[0]=0,f.length=1,f;var A=f.imul(g),N=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=A.isub(N).iushrn(this.shift),M=b;return b.cmp(this.m)>=0?M=b.isub(this.m):b.cmpn(0)<0&&(M=b.iadd(this.m)),M._forceRed(this)},J.prototype.mul=function(f,g){if(f.isZero()||g.isZero())return new o(0)._forceRed(this);var A=f.mul(g),N=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=A.isub(N).iushrn(this.shift),M=b;return b.cmp(this.m)>=0?M=b.isub(this.m):b.cmpn(0)<0&&(M=b.iadd(this.m)),M._forceRed(this)},J.prototype.invm=function(f){var g=this.imod(f._invmp(this.m).mul(this.r2));return g._forceRed(this)}})(t,Fe)})(Ah);var Px=Ah.exports;const ue=jo(Px),Cx="logger/5.7.0";let op=!1,sp=!1;const da={debug:1,default:2,info:2,warning:3,error:4,off:5};let lp=da.default,jc=null;function Mx(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const ap=Mx();var od;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(od||(od={}));var Ur;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(Ur||(Ur={}));const up="0123456789abcdef";class T{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();da[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(lp>da[n])&&console.log.apply(console,r)}debug(...e){this._log(T.levels.DEBUG,e)}info(...e){this._log(T.levels.INFO,e)}warn(...e){this._log(T.levels.WARNING,e)}makeError(e,r,n){if(sp)return this.makeError("censored error",r,{});r||(r=T.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(a=>{const u=n[a];try{if(u instanceof Uint8Array){let c="";for(let d=0;d>4],c+=up[u[d]&15];i.push(a+"=Uint8Array(0x"+c+")")}else i.push(a+"="+JSON.stringify(u))}catch{i.push(a+"="+JSON.stringify(n[a].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const o=e;let s="";switch(r){case Ur.NUMERIC_FAULT:{s="NUMERIC_FAULT";const a=e;switch(a){case"overflow":case"underflow":case"division-by-zero":s+="-"+a;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result";break}break}case Ur.CALL_EXCEPTION:case Ur.INSUFFICIENT_FUNDS:case Ur.MISSING_NEW:case Ur.NONCE_EXPIRED:case Ur.REPLACEMENT_UNDERPRICED:case Ur.TRANSACTION_REPLACED:case Ur.UNPREDICTABLE_GAS_LIMIT:s=r;break}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const l=new Error(e);return l.reason=o,l.code=r,Object.keys(n).forEach(function(a){l[a]=n[a]}),l}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,T.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){ap&&this.throwError("platform missing String.prototype.normalize",T.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ap})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,T.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,T.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,T.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",T.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",T.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",T.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return jc||(jc=new T(Cx)),jc}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",T.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),op){if(!e)return;this.globalLogger().throwError("error censorship permanent",T.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}sp=!!e,op=!!r}static setLogLevel(e){const r=da[e.toLowerCase()];if(r==null){T.globalLogger().warn("invalid log level - "+e);return}lp=r}static from(e){return new T(e)}}T.errors=Ur;T.levels=od;const Ix="bytes/5.7.0",dt=new T(Ix);function iy(t){return!!t.toHexString}function Ao(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Ao(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function bh(t){return pe(t)&&!(t.length%2)||Ru(t)}function cp(t){return typeof t=="number"&&t==t&&t%1===0}function Ru(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!cp(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function se(t,e){if(e||(e={}),typeof t=="number"){dt.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Ao(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),iy(t)&&(t=t.toHexString()),pe(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":dt.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ise(i)),r=e.reduce((i,o)=>i+o.length,0),n=new Uint8Array(r);return e.reduce((i,o)=>(n.set(o,i),i+o.length),0),Ao(n)}function Ro(t){let e=se(t);if(e.length===0)return e;let r=0;for(;re&&dt.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),Ao(r)}function pe(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const Uc="0123456789abcdef";function re(t,e){if(e||(e={}),typeof t=="number"){dt.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=Uc[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),iy(t))return t.toHexString();if(pe(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":dt.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Ru(t)){let r="0x";for(let n=0;n>4]+Uc[i&15]}return r}return dt.throwArgumentError("invalid hexlify value","value",t)}function On(t){if(typeof t!="string")t=re(t);else if(!pe(t)||t.length%2)return null;return(t.length-2)/2}function It(t,e,r){return typeof t!="string"?t=re(t):(!pe(t)||t.length%2)&&dt.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Xt(t){let e="0x";return t.forEach(r=>{e+=re(r).substring(2)}),e}function Tu(t){const e=Rx(re(t,{hexPad:"left"}));return e==="0x"?"0x0":e}function Rx(t){typeof t!="string"&&(t=re(t)),pe(t)||dt.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e2*e+2&&dt.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Ou(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(bh(t)){let r=se(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=re(r.slice(0,32)),e.s=re(r.slice(32,64))):r.length===65?(e.r=re(r.slice(0,32)),e.s=re(r.slice(32,64)),e.v=r[64]):dt.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:dt.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=re(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=ha(se(e._vs),32);e._vs=re(i);const o=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=o:e.recoveryParam!==o&&dt.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const s=re(i);e.s==null?e.s=s:e.s!==s&&dt.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?dt.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&dt.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!pe(e.r)?dt.throwArgumentError("signature missing or invalid r","signature",t):e.r=pt(e.r,32),e.s==null||!pe(e.s)?dt.throwArgumentError("signature missing or invalid s","signature",t):e.s=pt(e.s,32);const r=se(e.s);r[0]>=128&&dt.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=re(r);e._vs&&(pe(e._vs)||dt.throwArgumentError("signature invalid _vs","signature",t),e._vs=pt(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&dt.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const Tx="bignumber/5.7.0";var Xs=ue.BN;const En=new T(Tx),Fc={},fp=9007199254740991;let dp=!1;class V{constructor(e,r){e!==Fc&&En.throwError("cannot call constructor directly; use BigNumber.from",T.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Jt(ve(this).fromTwos(e))}toTwos(e){return Jt(ve(this).toTwos(e))}abs(){return this._hex[0]==="-"?V.from(this._hex.substring(1)):this}add(e){return Jt(ve(this).add(ve(e)))}sub(e){return Jt(ve(this).sub(ve(e)))}div(e){return V.from(e).isZero()&&xr("division-by-zero","div"),Jt(ve(this).div(ve(e)))}mul(e){return Jt(ve(this).mul(ve(e)))}mod(e){const r=ve(e);return r.isNeg()&&xr("division-by-zero","mod"),Jt(ve(this).umod(r))}pow(e){const r=ve(e);return r.isNeg()&&xr("negative-power","pow"),Jt(ve(this).pow(r))}and(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","and"),Jt(ve(this).and(r))}or(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","or"),Jt(ve(this).or(r))}xor(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","xor"),Jt(ve(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&xr("negative-width","mask"),Jt(ve(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&xr("negative-width","shl"),Jt(ve(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&xr("negative-width","shr"),Jt(ve(this).shrn(e))}eq(e){return ve(this).eq(ve(e))}lt(e){return ve(this).lt(ve(e))}lte(e){return ve(this).lte(ve(e))}gt(e){return ve(this).gt(ve(e))}gte(e){return ve(this).gte(ve(e))}isNegative(){return this._hex[0]==="-"}isZero(){return ve(this).isZero()}toNumber(){try{return ve(this).toNumber()}catch{xr("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return En.throwError("this platform does not support BigInt",T.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?dp||(dp=!0,En.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?En.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",T.errors.UNEXPECTED_ARGUMENT,{}):En.throwError("BigNumber.toString does not accept parameters",T.errors.UNEXPECTED_ARGUMENT,{})),ve(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof V)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new V(Fc,Zs(e)):e.match(/^-?[0-9]+$/)?new V(Fc,Zs(new Xs(e))):En.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&xr("underflow","BigNumber.from",e),(e>=fp||e<=-fp)&&xr("overflow","BigNumber.from",e),V.from(String(e));const r=e;if(typeof r=="bigint")return V.from(r.toString());if(Ru(r))return V.from(re(r));if(r)if(r.toHexString){const n=r.toHexString();if(typeof n=="string")return V.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(pe(n)||n[0]==="-"&&pe(n.substring(1))))return V.from(n)}return En.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function Zs(t){if(typeof t!="string")return Zs(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&En.throwArgumentError("invalid hex","value",t),t=Zs(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function Jt(t){return V.from(Zs(t))}function ve(t){const e=V.from(t).toHexString();return e[0]==="-"?new Xs("-"+e.substring(3),16):new Xs(e.substring(2),16)}function xr(t,e,r){const n={fault:t,operation:e};return r!=null&&(n.value=r),En.throwError(t,T.errors.NUMERIC_FAULT,n)}function Ox(t){return new Xs(t,36).toString(16)}function Lx(t){return new Xs(t,16).toString(36)}const Bx="properties/5.7.0";var Dx=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Ja=new T(Bx);function z(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function fr(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||typeof t.prototype!="object")break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function yt(t){return Dx(this,void 0,void 0,function*(){const e=Object.keys(t).map(n=>{const i=t[n];return Promise.resolve(i).then(o=>({key:n,value:o}))});return(yield Promise.all(e)).reduce((n,i)=>(n[i.key]=i.value,n),{})})}function jx(t,e){(!t||typeof t!="object")&&Ja.throwArgumentError("invalid object","object",t),Object.keys(t).forEach(r=>{e[r]||Ja.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)})}function it(t){const e={};for(const r in t)e[r]=t[r];return e}const Ux={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function oy(t){if(t==null||Ux[typeof t])return!0;if(Array.isArray(t)||typeof t=="object"){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;rnr(e)));if(typeof t=="object"){const e={};for(const r in t){const n=t[r];n!==void 0&&z(e,r,nr(n))}return e}return Ja.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function nr(t){return Fx(t)}class vl{constructor(e){for(const r in e)this[r]=nr(e[r])}}const yl="abi/5.7.0",Ee=new T(yl),Di={};let hp={calldata:!0,memory:!0,storage:!0},zx={calldata:!0,memory:!0};function zl(t,e){if(t==="bytes"||t==="string"){if(hp[e])return!0}else if(t==="address"){if(e==="payable")return!0}else if((t.indexOf("[")>=0||t==="tuple")&&zx[e])return!0;return(hp[e]||e==="payable")&&Ee.throwArgumentError("invalid modifier","name",e),!1}function $x(t,e){let r=t;function n(l){Ee.throwArgumentError(`unexpected character at position ${l}`,"param",t)}t=t.replace(/\s/g," ");function i(l){let a={type:"",name:"",parent:l,state:{allowType:!0}};return e&&(a.indexed=!1),a}let o={type:"",name:"",state:{allowType:!0}},s=o;for(let l=0;lJSON.parse(i.format(e)))),JSON.stringify(n)}let r="";return this.baseType==="array"?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==Se.sighash&&(r+=this.type),r+="("+this.components.map(n=>n.format(e)).join(e===Se.full?", ":",")+")"):r+=this.type,e!==Se.sighash&&(this.indexed===!0&&(r+=" indexed"),e===Se.full&&this.name&&(r+=" "+this.name)),r}static from(e,r){return typeof e=="string"?kt.fromString(e,r):kt.fromObject(e)}static fromObject(e){return kt.isParamType(e)?e:new kt(Di,{name:e.name||null,type:Ji(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(kt.fromObject):null})}static fromString(e,r){function n(i){return kt.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return n($x(e,!!r))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function el(t,e){return Wx(t).map(r=>kt.fromString(r,e))}class Nn{constructor(e,r){e!==Di&&Ee.throwError("use a static from method",T.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),pa(this,r),this._isFragment=!0,Object.freeze(this)}static from(e){return Nn.isFragment(e)?e:typeof e=="string"?Nn.fromString(e):Nn.fromObject(e)}static fromObject(e){if(Nn.isFragment(e))return e;switch(e.type){case"function":return sn.fromObject(e);case"event":return _n.fromObject(e);case"constructor":return on.fromObject(e);case"error":return ei.fromObject(e);case"fallback":case"receive":return null}return Ee.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?_n.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?sn.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?on.fromString(e.trim()):e.split(" ")[0]==="error"?ei.fromString(e.substring(5).trim()):Ee.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class _n extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",e!==Se.sighash&&this.anonymous&&(r+="anonymous "),r.trim()}static from(e){return typeof e=="string"?_n.fromString(e):_n.fromObject(e)}static fromObject(e){if(_n.isEventFragment(e))return e;e.type!=="event"&&Ee.throwArgumentError("invalid event object","value",e);const r={name:tl(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(kt.fromObject):[],type:"event"};return new _n(Di,r)}static fromString(e){let r=e.match(rl);r||Ee.throwArgumentError("invalid event string","value",e);let n=!1;return r[3].split(" ").forEach(i=>{switch(i.trim()){case"anonymous":n=!0;break;case"":break;default:Ee.warn("unknown modifier: "+i)}}),_n.fromObject({name:r[1].trim(),anonymous:n,inputs:el(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function sy(t,e){e.gas=null;let r=t.split("@");return r.length!==1?(r.length>2&&Ee.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||Ee.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=V.from(r[1]),r[0]):t}function ly(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach(r=>{switch(r.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+r)}})}function ay(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return t.stateMutability!=null?(e.stateMutability=t.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",t.constant!=null&&!!t.constant!==e.constant&&Ee.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable=e.stateMutability==="payable",t.payable!=null&&!!t.payable!==e.payable&&Ee.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):t.payable!=null?(e.payable=!!t.payable,t.constant==null&&!e.payable&&t.type!=="constructor"&&Ee.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Ee.throwArgumentError("cannot have constant payable function","value",t)):t.constant!=null?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):t.type!=="constructor"&&Ee.throwArgumentError("unable to determine stateMutability","value",t),e}class on extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});e===Se.sighash&&Ee.throwError("cannot format a constructor for sighash",T.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let r="constructor("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "),r.trim()}static from(e){return typeof e=="string"?on.fromString(e):on.fromObject(e)}static fromObject(e){if(on.isConstructorFragment(e))return e;e.type!=="constructor"&&Ee.throwArgumentError("invalid constructor object","value",e);let r=ay(e);r.constant&&Ee.throwArgumentError("constructor cannot be constant","value",e);const n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(kt.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?V.from(e.gas):null};return new on(Di,n)}static fromString(e){let r={type:"constructor"};e=sy(e,r);let n=e.match(rl);return(!n||n[1].trim()!=="constructor")&&Ee.throwArgumentError("invalid constructor string","value",e),r.inputs=el(n[2].trim(),!1),ly(n[3].trim(),r),on.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class sn extends on{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e))),outputs:this.outputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",e!==Se.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "):this.constant&&(r+="view "),this.outputs&&this.outputs.length&&(r+="returns ("+this.outputs.map(n=>n.format(e)).join(", ")+") "),this.gas!=null&&(r+="@"+this.gas.toString()+" ")),r.trim()}static from(e){return typeof e=="string"?sn.fromString(e):sn.fromObject(e)}static fromObject(e){if(sn.isFunctionFragment(e))return e;e.type!=="function"&&Ee.throwArgumentError("invalid function object","value",e);let r=ay(e);const n={type:e.type,name:tl(e.name),constant:r.constant,inputs:e.inputs?e.inputs.map(kt.fromObject):[],outputs:e.outputs?e.outputs.map(kt.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?V.from(e.gas):null};return new sn(Di,n)}static fromString(e){let r={type:"function"};e=sy(e,r);let n=e.split(" returns ");n.length>2&&Ee.throwArgumentError("invalid function string","value",e);let i=n[0].match(rl);if(i||Ee.throwArgumentError("invalid function signature","value",e),r.name=i[1].trim(),r.name&&tl(r.name),r.inputs=el(i[2],!1),ly(i[3].trim(),r),n.length>1){let o=n[1].match(rl);(o[1].trim()!=""||o[3].trim()!="")&&Ee.throwArgumentError("unexpected tokens","value",e),r.outputs=el(o[2],!1)}else r.outputs=[];return sn.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function pp(t){const e=t.format();return(e==="Error(string)"||e==="Panic(uint256)")&&Ee.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class ei extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",r.trim()}static from(e){return typeof e=="string"?ei.fromString(e):ei.fromObject(e)}static fromObject(e){if(ei.isErrorFragment(e))return e;e.type!=="error"&&Ee.throwArgumentError("invalid error object","value",e);const r={type:e.type,name:tl(e.name),inputs:e.inputs?e.inputs.map(kt.fromObject):[]};return pp(new ei(Di,r))}static fromString(e){let r={type:"error"},n=e.match(rl);return n||Ee.throwArgumentError("invalid error signature","value",e),r.name=n[1].trim(),r.name&&tl(r.name),r.inputs=el(n[2],!1),pp(ei.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function Ji(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const qx=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function tl(t){return(!t||!t.match(qx))&&Ee.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const rl=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function Wx(t){t=t.trim();let e=[],r="",n=0;for(let i=0;ithis.wordSize&&_h.throwError("value out-of-bounds",T.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=Ut([this._padding.slice(r.length%this.wordSize),r])),r}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,r=>{this._data[e]=this._getValue(r)}}}class Ya{constructor(e,r,n,i){z(this,"_data",se(e)),z(this,"wordSize",r||32),z(this,"_coerceFunc",n),z(this,"allowLoose",i),this._offset=0}get data(){return re(this._data)}get consumed(){return this._offset}static coerce(e,r){let n=e.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(r=r.toNumber()),r}coerce(e,r){return this._coerceFunc?this._coerceFunc(e,r):Ya.coerce(e,r)}_peekBytes(e,r,n){let i=Math.ceil(r/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&n&&this._offset+r<=this._data.length?i=r:_h.throwError("data out-of-bounds",T.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new Ya(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,r){let n=this._peekBytes(0,e,!!r);return this._offset+=n.length,n.slice(0,e)}readValue(){return V.from(this.readBytes(this.wordSize))}}var uy={exports:{}};/** - * [js-sha3]{@link https://github.com/emn178/js-sha3} - * - * @version 0.8.0 - * @author Chen, Yi-Cyuan [emn178@gmail.com] - * @copyright Chen, Yi-Cyuan 2015-2018 - * @license MIT - */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&typeof self=="object",s=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;s?i=Fe:o&&(i=self);var l=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,a=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),c=[31,7936,2031616,520093696],d=[4,1024,262144,67108864],m=[1,256,65536,16777216],v=[6,1536,393216,100663296],p=[0,8,16,24],x=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],k=[224,256,384,512],E=[128,256],w=["hex","buffer","arrayBuffer","array","digest"],_={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(y){return Object.prototype.toString.call(y)==="[object Array]"}),a&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(y){return typeof y=="object"&&y.buffer&&y.buffer.constructor===ArrayBuffer});for(var O=function(y,D,U){return function(F){return new h(y,D,y).update(F)[U]()}},B=function(y,D,U){return function(F,W){return new h(y,D,W).update(F)[U]()}},j=function(y,D,U){return function(F,W,oe,Y){return f["cshake"+y].update(F,W,oe,Y)[U]()}},$=function(y,D,U){return function(F,W,oe,Y){return f["kmac"+y].update(F,W,oe,Y)[U]()}},H=function(y,D,U,F){for(var W=0;W>5,this.byteCount=this.blockCount<<2,this.outputBlocks=U>>5,this.extraBytes=(U&31)>>3;for(var F=0;F<50;++F)this.s[F]=0}h.prototype.update=function(y){if(this.finalized)throw new Error(r);var D,U=typeof y;if(U!=="string"){if(U==="object"){if(y===null)throw new Error(e);if(a&&y.constructor===ArrayBuffer)y=new Uint8Array(y);else if(!Array.isArray(y)&&(!a||!ArrayBuffer.isView(y)))throw new Error(e)}else throw new Error(e);D=!0}for(var F=this.blocks,W=this.byteCount,oe=y.length,Y=this.blockCount,K=0,Je=this.s,Q,le;K>2]|=y[K]<>2]|=le<>2]|=(192|le>>6)<>2]|=(128|le&63)<=57344?(F[Q>>2]|=(224|le>>12)<>2]|=(128|le>>6&63)<>2]|=(128|le&63)<>2]|=(240|le>>18)<>2]|=(128|le>>12&63)<>2]|=(128|le>>6&63)<>2]|=(128|le&63)<=W){for(this.start=Q-W,this.block=F[Y],Q=0;Q>8,U=y&255;U>0;)W.unshift(U),y=y>>8,U=y&255,++F;return D?W.push(F):W.unshift(F),this.update(W),W.length},h.prototype.encodeString=function(y){var D,U=typeof y;if(U!=="string"){if(U==="object"){if(y===null)throw new Error(e);if(a&&y.constructor===ArrayBuffer)y=new Uint8Array(y);else if(!Array.isArray(y)&&(!a||!ArrayBuffer.isView(y)))throw new Error(e)}else throw new Error(e);D=!0}var F=0,W=y.length;if(D)F=W;else for(var oe=0;oe=57344?F+=3:(Y=65536+((Y&1023)<<10|y.charCodeAt(++oe)&1023),F+=4)}return F+=this.encode(F*8),this.update(y),F},h.prototype.bytepad=function(y,D){for(var U=this.encode(D),F=0;F>2]|=this.padding[D&3],this.lastByteIndex===this.byteCount)for(y[0]=y[U],D=1;D>4&15]+u[K&15]+u[K>>12&15]+u[K>>8&15]+u[K>>20&15]+u[K>>16&15]+u[K>>28&15]+u[K>>24&15];oe%y===0&&(te(D),W=0)}return F&&(K=D[W],Y+=u[K>>4&15]+u[K&15],F>1&&(Y+=u[K>>12&15]+u[K>>8&15]),F>2&&(Y+=u[K>>20&15]+u[K>>16&15])),Y},h.prototype.arrayBuffer=function(){this.finalize();var y=this.blockCount,D=this.s,U=this.outputBlocks,F=this.extraBytes,W=0,oe=0,Y=this.outputBits>>3,K;F?K=new ArrayBuffer(U+1<<2):K=new ArrayBuffer(Y);for(var Je=new Uint32Array(K);oe>8&255,Y[K+2]=Je>>16&255,Y[K+3]=Je>>24&255;oe%y===0&&te(D)}return F&&(K=oe<<2,Je=D[W],Y[K]=Je&255,F>1&&(Y[K+1]=Je>>8&255),F>2&&(Y[K+2]=Je>>16&255)),Y};function P(y,D,U){h.call(this,y,D,U)}P.prototype=new h,P.prototype.finalize=function(){return this.encode(this.outputBits,!0),h.prototype.finalize.call(this)};var te=function(y){var D,U,F,W,oe,Y,K,Je,Q,le,Qr,Te,Ne,Jr,Pe,ce,wr,fe,Oe,Yr,me,ze,gn,$e,He,Ht,Le,qe,Rr,Ce,We,vn,Be,Ge,yn,De,ne,ot,ge,de,rt,be,_e,Ct,Me,je,Kt,Ve,Ke,Qt,Ie,Ue,Er,ke,Ye,Ai,Xe,Ze,$n,Hn,qn,Wn,Gn;for(F=0;F<48;F+=2)W=y[0]^y[10]^y[20]^y[30]^y[40],oe=y[1]^y[11]^y[21]^y[31]^y[41],Y=y[2]^y[12]^y[22]^y[32]^y[42],K=y[3]^y[13]^y[23]^y[33]^y[43],Je=y[4]^y[14]^y[24]^y[34]^y[44],Q=y[5]^y[15]^y[25]^y[35]^y[45],le=y[6]^y[16]^y[26]^y[36]^y[46],Qr=y[7]^y[17]^y[27]^y[37]^y[47],Te=y[8]^y[18]^y[28]^y[38]^y[48],Ne=y[9]^y[19]^y[29]^y[39]^y[49],D=Te^(Y<<1|K>>>31),U=Ne^(K<<1|Y>>>31),y[0]^=D,y[1]^=U,y[10]^=D,y[11]^=U,y[20]^=D,y[21]^=U,y[30]^=D,y[31]^=U,y[40]^=D,y[41]^=U,D=W^(Je<<1|Q>>>31),U=oe^(Q<<1|Je>>>31),y[2]^=D,y[3]^=U,y[12]^=D,y[13]^=U,y[22]^=D,y[23]^=U,y[32]^=D,y[33]^=U,y[42]^=D,y[43]^=U,D=Y^(le<<1|Qr>>>31),U=K^(Qr<<1|le>>>31),y[4]^=D,y[5]^=U,y[14]^=D,y[15]^=U,y[24]^=D,y[25]^=U,y[34]^=D,y[35]^=U,y[44]^=D,y[45]^=U,D=Je^(Te<<1|Ne>>>31),U=Q^(Ne<<1|Te>>>31),y[6]^=D,y[7]^=U,y[16]^=D,y[17]^=U,y[26]^=D,y[27]^=U,y[36]^=D,y[37]^=U,y[46]^=D,y[47]^=U,D=le^(W<<1|oe>>>31),U=Qr^(oe<<1|W>>>31),y[8]^=D,y[9]^=U,y[18]^=D,y[19]^=U,y[28]^=D,y[29]^=U,y[38]^=D,y[39]^=U,y[48]^=D,y[49]^=U,Jr=y[0],Pe=y[1],je=y[11]<<4|y[10]>>>28,Kt=y[10]<<4|y[11]>>>28,qe=y[20]<<3|y[21]>>>29,Rr=y[21]<<3|y[20]>>>29,Hn=y[31]<<9|y[30]>>>23,qn=y[30]<<9|y[31]>>>23,be=y[40]<<18|y[41]>>>14,_e=y[41]<<18|y[40]>>>14,Ge=y[2]<<1|y[3]>>>31,yn=y[3]<<1|y[2]>>>31,ce=y[13]<<12|y[12]>>>20,wr=y[12]<<12|y[13]>>>20,Ve=y[22]<<10|y[23]>>>22,Ke=y[23]<<10|y[22]>>>22,Ce=y[33]<<13|y[32]>>>19,We=y[32]<<13|y[33]>>>19,Wn=y[42]<<2|y[43]>>>30,Gn=y[43]<<2|y[42]>>>30,ke=y[5]<<30|y[4]>>>2,Ye=y[4]<<30|y[5]>>>2,De=y[14]<<6|y[15]>>>26,ne=y[15]<<6|y[14]>>>26,fe=y[25]<<11|y[24]>>>21,Oe=y[24]<<11|y[25]>>>21,Qt=y[34]<<15|y[35]>>>17,Ie=y[35]<<15|y[34]>>>17,vn=y[45]<<29|y[44]>>>3,Be=y[44]<<29|y[45]>>>3,$e=y[6]<<28|y[7]>>>4,He=y[7]<<28|y[6]>>>4,Ai=y[17]<<23|y[16]>>>9,Xe=y[16]<<23|y[17]>>>9,ot=y[26]<<25|y[27]>>>7,ge=y[27]<<25|y[26]>>>7,Yr=y[36]<<21|y[37]>>>11,me=y[37]<<21|y[36]>>>11,Ue=y[47]<<24|y[46]>>>8,Er=y[46]<<24|y[47]>>>8,Ct=y[8]<<27|y[9]>>>5,Me=y[9]<<27|y[8]>>>5,Ht=y[18]<<20|y[19]>>>12,Le=y[19]<<20|y[18]>>>12,Ze=y[29]<<7|y[28]>>>25,$n=y[28]<<7|y[29]>>>25,de=y[38]<<8|y[39]>>>24,rt=y[39]<<8|y[38]>>>24,ze=y[48]<<14|y[49]>>>18,gn=y[49]<<14|y[48]>>>18,y[0]=Jr^~ce&fe,y[1]=Pe^~wr&Oe,y[10]=$e^~Ht&qe,y[11]=He^~Le&Rr,y[20]=Ge^~De&ot,y[21]=yn^~ne&ge,y[30]=Ct^~je&Ve,y[31]=Me^~Kt&Ke,y[40]=ke^~Ai&Ze,y[41]=Ye^~Xe&$n,y[2]=ce^~fe&Yr,y[3]=wr^~Oe&me,y[12]=Ht^~qe&Ce,y[13]=Le^~Rr&We,y[22]=De^~ot&de,y[23]=ne^~ge&rt,y[32]=je^~Ve&Qt,y[33]=Kt^~Ke&Ie,y[42]=Ai^~Ze&Hn,y[43]=Xe^~$n&qn,y[4]=fe^~Yr&ze,y[5]=Oe^~me&gn,y[14]=qe^~Ce&vn,y[15]=Rr^~We&Be,y[24]=ot^~de&be,y[25]=ge^~rt&_e,y[34]=Ve^~Qt&Ue,y[35]=Ke^~Ie&Er,y[44]=Ze^~Hn&Wn,y[45]=$n^~qn&Gn,y[6]=Yr^~ze&Jr,y[7]=me^~gn&Pe,y[16]=Ce^~vn&$e,y[17]=We^~Be&He,y[26]=de^~be&Ge,y[27]=rt^~_e&yn,y[36]=Qt^~Ue&Ct,y[37]=Ie^~Er&Me,y[46]=Hn^~Wn&ke,y[47]=qn^~Gn&Ye,y[8]=ze^~Jr&ce,y[9]=gn^~Pe&wr,y[18]=vn^~$e&Ht,y[19]=Be^~He&Le,y[28]=be^~Ge&De,y[29]=_e^~yn&ne,y[38]=Ue^~Ct&je,y[39]=Er^~Me&Kt,y[48]=Wn^~ke&Ai,y[49]=Gn^~Ye&Xe,y[0]^=x[F],y[1]^=x[F+1]};if(l)t.exports=f;else for(A=0;A>=8;return e}function gp(t,e,r){let n=0;for(let i=0;ie+1+n&&tn.throwError("child data too short",T.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function fy(t,e){if(t.length===0&&tn.throwError("data too short",T.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&tn.throwError("data short segment too short",T.errors.BUFFER_OVERRUN,{});const n=gp(t,e+1,r);return e+1+r+n>t.length&&tn.throwError("data long segment too short",T.errors.BUFFER_OVERRUN,{}),vp(t,e,e+1+r,r+n)}else if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{}),vp(t,e,e+1,r)}else if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{});const n=gp(t,e+1,r);e+1+r+n>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{});const i=re(t.slice(e+1+r,e+1+r+n));return{consumed:1+r+n,result:i}}else if(t[e]>=128){const r=t[e]-128;e+1+r>t.length&&tn.throwError("data too short",T.errors.BUFFER_OVERRUN,{});const n=re(t.slice(e+1,e+1+r));return{consumed:1+r,result:n}}return{consumed:1,result:re(t[e])}}function Sh(t){const e=se(t),r=fy(e,0);return r.consumed!==e.length&&tn.throwArgumentError("invalid rlp data","data",t),r.result}const Jx="address/5.7.0",oi=new T(Jx);function yp(t){pe(t,20)||oi.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=se(ut(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const Yx=9007199254740991;function Xx(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const kh={};for(let t=0;t<10;t++)kh[String(t)]=String(t);for(let t=0;t<26;t++)kh[String.fromCharCode(65+t)]=String(10+t);const wp=Math.floor(Xx(Yx));function dy(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>kh[n]).join("");for(;e.length>=wp;){let n=e.substring(0,wp);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function mt(t){let e=null;if(typeof t!="string"&&oi.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=yp(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&oi.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==dy(t)&&oi.throwArgumentError("bad icap checksum","address",t),e=Ox(t.substring(4));e.length<40;)e="0"+e;e=yp("0x"+e)}else oi.throwArgumentError("invalid address","address",t);return e}function Zx(t){try{return mt(t),!0}catch{}return!1}function eA(t){let e=Lx(mt(t).substring(2)).toUpperCase();for(;e.length<30;)e="0"+e;return"XE"+dy("XE00"+e)+e}function Nh(t){let e=null;try{e=mt(t.from)}catch{oi.throwArgumentError("missing from address","transaction",t)}const r=Ro(se(V.from(t.nonce).toHexString()));return mt(It(ut(Lu([e,r])),12))}function tA(t,e,r){return On(e)!==32&&oi.throwArgumentError("salt must be 32 bytes","salt",e),On(r)!==32&&oi.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),mt(It(ut(Ut(["0xff",mt(t),e,r])),12))}const rA=Object.freeze(Object.defineProperty({__proto__:null,getAddress:mt,getContractAddress:Nh,getCreate2Address:tA,getIcapAddress:eA,isAddress:Zx},Symbol.toStringTag,{value:"Module"}));class nA extends jn{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){try{r=mt(r)}catch(n){this._throwError(n.message,r)}return e.writeValue(r)}decode(e){return mt(pt(e.readValue().toHexString(),20))}}class iA extends jn{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,r){return this.coder.encode(e,r)}decode(e){return this.coder.decode(e)}}const co=new T(yl);function hy(t,e,r){let n=null;if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let a={};n=e.map(u=>{const c=u.localName;return c||co.throwError("cannot encode object for signature with missing names",T.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),a[c]&&co.throwError("cannot encode object for signature with duplicate names",T.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),a[c]=!0,r[c]})}else co.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&co.throwArgumentError("types/value length mismatch","tuple",r);let i=new sd(t.wordSize),o=new sd(t.wordSize),s=[];e.forEach((a,u)=>{let c=n[u];if(a.dynamic){let d=o.length;a.encode(o,c);let m=i.writeUpdatableValue();s.push(v=>{m(v+d)})}else a.encode(i,c)}),s.forEach(a=>{a(i.length)});let l=t.appendWriter(i);return l+=t.appendWriter(o),l}function py(t,e){let r=[],n=t.subReader(0);e.forEach(o=>{let s=null;if(o.dynamic){let l=t.readValue(),a=n.subReader(l.toNumber());try{s=o.decode(a)}catch(u){if(u.code===T.errors.BUFFER_OVERRUN)throw u;s=u,s.baseType=o.name,s.name=o.localName,s.type=o.type}}else try{s=o.decode(t)}catch(l){if(l.code===T.errors.BUFFER_OVERRUN)throw l;s=l,s.baseType=o.name,s.name=o.localName,s.type=o.type}s!=null&&r.push(s)});const i=e.reduce((o,s)=>{const l=s.localName;return l&&(o[l]||(o[l]=0),o[l]++),o},{});e.forEach((o,s)=>{let l=o.localName;if(!l||i[l]!==1||(l==="length"&&(l="_length"),r[l]!=null))return;const a=r[s];a instanceof Error?Object.defineProperty(r,l,{enumerable:!0,get:()=>{throw a}}):r[l]=a});for(let o=0;o{throw s}})}return Object.freeze(r)}class oA extends jn{constructor(e,r,n){const i=e.type+"["+(r>=0?r:"")+"]",o=r===-1||e.dynamic;super("array",i,n,o),this.coder=e,this.length=r}defaultValue(){const e=this.coder.defaultValue(),r=[];for(let n=0;ne._data.length&&co.throwError("insufficient data length",T.errors.BUFFER_OVERRUN,{length:e._data.length,count:r}));let n=[];for(let i=0;i>6===2;s++)o++;return o}return t===ar.OVERRUN?r.length-e-1:0}function yA(t,e,r,n,i){return t===ar.OVERLONG?(n.push(i),0):(n.push(65533),yy(t,e,r))}const wA=Object.freeze({error:vA,ignore:yy,replace:yA});function wy(t,e){e==null&&(e=wA.error),t=se(t);const r=[];let n=0;for(;n>7)){r.push(i);continue}let o=null,s=null;if((i&224)===192)o=1,s=127;else if((i&240)===224)o=2,s=2047;else if((i&248)===240)o=3,s=65535;else{(i&192)===128?n+=e(ar.UNEXPECTED_CONTINUE,n-1,t,r):n+=e(ar.BAD_PREFIX,n-1,t,r);continue}if(n-1+o>=t.length){n+=e(ar.OVERRUN,n-1,t,r);continue}let l=i&(1<<8-o-1)-1;for(let a=0;a1114111){n+=e(ar.OUT_OF_RANGE,n-1-o,t,r,l);continue}if(l>=55296&&l<=57343){n+=e(ar.UTF16_SURROGATE,n-1-o,t,r,l);continue}if(l<=s){n+=e(ar.OVERLONG,n-1-o,t,r,l);continue}r.push(l)}}return r}function mr(t,e=nl.current){e!=nl.current&&(vy.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const o=t.charCodeAt(n);if(n>=t.length||(o&64512)!==56320)throw new Error("invalid utf-8 string");const s=65536+((i&1023)<<10)+(o&1023);r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return se(r)}function EA(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function wl(t,e){return EA(wy(t,e))}function xA(t,e=nl.current){return wy(mr(t,e))}class AA extends my{constructor(e){super("string",e)}defaultValue(){return""}encode(e,r){return super.encode(e,mr(r))}decode(e){return wl(super.decode(e))}}class $l extends jn{constructor(e,r){let n=!1;const i=[];e.forEach(s=>{s.dynamic&&(n=!0),i.push(s.type)});const o="tuple("+i.join(",")+")";super("tuple",o,r,n),this.coders=e}defaultValue(){const e=[];this.coders.forEach(n=>{e.push(n.defaultValue())});const r=this.coders.reduce((n,i)=>{const o=i.localName;return o&&(n[o]||(n[o]=0),n[o]++),n},{});return this.coders.forEach((n,i)=>{let o=n.localName;!o||r[o]!==1||(o==="length"&&(o="_length"),e[o]==null&&(e[o]=e[i]))}),Object.freeze(e)}encode(e,r){return hy(e,this.coders,r)}decode(e){return e.coerce(this.name,py(e,this.coders))}}const Hl=new T(yl),bA=new RegExp(/^bytes([0-9]*)$/),_A=new RegExp(/^(u?int)([0-9]*)$/);class SA{constructor(e){z(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new nA(e.name);case"bool":return new sA(e.name);case"string":return new AA(e.name);case"bytes":return new lA(e.name);case"array":return new oA(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new $l((e.components||[]).map(n=>this._getCoder(n)),e.name);case"":return new uA(e.name)}let r=e.type.match(_A);if(r){let n=parseInt(r[2]||"256");return(n===0||n>256||n%8!==0)&&Hl.throwArgumentError("invalid "+r[1]+" bit length","param",e),new mA(n/8,r[1]==="int",e.name)}if(r=e.type.match(bA),r){let n=parseInt(r[1]);return(n===0||n>32)&&Hl.throwArgumentError("invalid bytes length","param",e),new aA(n,e.name)}return Hl.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,r){return new Ya(e,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new sd(this._getWordSize())}getDefaultValue(e){const r=e.map(i=>this._getCoder(kt.from(i)));return new $l(r,"_").defaultValue()}encode(e,r){e.length!==r.length&&Hl.throwError("types/values length mismatch",T.errors.INVALID_ARGUMENT,{count:{types:e.length,values:r.length},value:{types:e,values:r}});const n=e.map(s=>this._getCoder(kt.from(s))),i=new $l(n,"_"),o=this._getWriter();return i.encode(o,r),o.data}decode(e,r,n){const i=e.map(s=>this._getCoder(kt.from(s)));return new $l(i,"_").decode(this._getReader(se(r),n))}}const kA=new SA;function fo(t){return ut(mr(t))}const Ey="hash/5.7.0";function xy(t){t=atob(t);const e=[];for(let r=0;r0&&Array.isArray(l)?i(l,s-1):r.push(l)})};return i(t,e),r}function NA(t){const e={};for(let r=0;r>--a&1}const d=31,m=Math.pow(2,d),v=m>>>1,p=v>>1,x=m-1;let k=0;for(let B=0;B1;){let X=j+$>>>1;B>>1|c(),H=H<<1^v,ie=(ie^v)<<1|v|1;w=H,_=1+ie-H}let O=n-4;return E.map(B=>{switch(B-O){case 3:return O+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return O+256+(t[l++]<<8|t[l++]);case 1:return O+t[l++];default:return B-1}})}function CA(t){let e=0;return()=>t[e++]}function MA(t){return CA(PA(t))}function IA(t){return t&1?~t>>1:t>>1}function RA(t,e){let r=Array(t);for(let n=0;ne[s]):r}function OA(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(BA(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(DA(r,t))}return NA(by(e))}function LA(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function _y(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;in[s].push(o));return n}function BA(t,e){let r=1+e(),n=e(),i=LA(e),o=_y(i.length,1+t,e);return by(o.map((s,l)=>{const a=s[0],u=s.slice(1);return Array(i[l]).fill(void 0).map((c,d)=>{let m=d*n;return[a+d*r,u.map(v=>v+m)]})}))}function DA(t,e){let r=1+e();return _y(r,1+t,e).map(i=>[i[0],i.slice(1)])}function jA(t){let e=Xa(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let u=Xa(t,e);if(u.length==0)break;n.push({set:new Set(u),node:r()})}n.sort((u,c)=>c.set.size-u.set.size);let i=t(),o=i%3;i=i/3|0;let s=!!(i&1);i>>=1;let l=i==1,a=i==2;return{branches:n,valid:o,fe0f:s,save:l,check:a}}}function UA(){return MA(xy("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const Bu=UA(),FA=new Set(Xa(Bu)),zA=new Set(Xa(Bu)),$A=OA(Bu),HA=jA(Bu),xp=45,Ap=95;function Sy(t){return xA(t)}function qA(t){return t.filter(e=>e!=65039)}function ky(t){for(let e of t.split(".")){let r=Sy(e);try{for(let n=r.lastIndexOf(Ap)-1;n>=0;n--)if(r[n]!==Ap)throw new Error("underscore only allowed at start");if(r.length>=4&&r.every(n=>n<128)&&r[2]===xp&&r[3]===xp)throw new Error("invalid label extension")}catch(n){throw new Error(`Invalid label "${e}": ${n.message}`)}}return t}function WA(t){return ky(GA(t,qA))}function GA(t,e){let r=Sy(t).reverse(),n=[];for(;r.length;){let i=KA(r);if(i){n.push(...e(i));continue}let o=r.pop();if(FA.has(o)){n.push(o);continue}if(zA.has(o))continue;let s=$A[o];if(s){n.push(...s);continue}throw new Error(`Disallowed codepoint: 0x${o.toString(16).toUpperCase()}`)}return ky(VA(String.fromCodePoint(...n)))}function VA(t){return t.normalize("NFC")}function KA(t,e){var r;let n=HA,i,o,s=[],l=t.length;for(e&&(e.length=0);l;){let a=t[--l];if(n=(r=n.branches.find(u=>u.set.has(a)))===null||r===void 0?void 0:r.node,!n)break;if(n.save)o=a;else if(n.check&&a===o)break;s.push(a),n.fe0f&&(s.push(65039),l>0&&t[l-1]==65039&&l--),n.valid&&(i=s.slice(),n.valid==2&&i.splice(1,1),e&&e.push(...t.slice(l).reverse()),t.length=l)}return i}const QA=new T(Ey),Ny=new Uint8Array(32);Ny.fill(0);function bp(t){if(t.length===0)throw new Error("invalid ENS name; empty component");return t}function Py(t){const e=mr(WA(t)),r=[];if(t.length===0)return r;let n=0;for(let i=0;i=e.length)throw new Error("invalid ENS name; empty component");return r.push(bp(e.slice(n))),r}function ma(t){typeof t!="string"&&QA.throwArgumentError("invalid ENS name; not a string","name",t);let e=Ny;const r=Py(t);for(;r.length;)e=ut(Ut([e,ut(r.pop())]));return re(e)}function JA(t){return re(Ut(Py(t).map(e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const r=new Uint8Array(e.length+1);return r.set(e,1),r[0]=r.length-1,r})))+"00"}var YA=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const lt=new T(Ey),Cy=new Uint8Array(32);Cy.fill(0);const XA=V.from(-1),My=V.from(0),Iy=V.from(1),ZA=V.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function eb(t){const e=se(t),r=e.length%32;return r?Xt([e,Cy.slice(r)]):re(e)}const tb=pt(Iy.toHexString(),32),rb=pt(My.toHexString(),32),_p={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},zc=["name","version","chainId","verifyingContract","salt"];function Sp(t){return function(e){return typeof e!="string"&<.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const nb={name:Sp("name"),version:Sp("version"),chainId:function(t){try{return V.from(t).toString()}catch{}return lt.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return mt(t).toLowerCase()}catch{}return lt.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=se(t);if(e.length!==32)throw new Error("bad length");return re(e)}catch{}return lt.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function $c(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=e[1]==="",n=parseInt(e[2]||"256");(n%8!==0||n>256||e[2]&&e[2]!==String(n))&<.throwArgumentError("invalid numeric width","type",t);const i=ZA.mask(r?n-1:n),o=r?i.add(Iy).mul(XA):My;return function(s){const l=V.from(s);return(l.lt(o)||l.gt(i))&<.throwArgumentError(`value out-of-bounds for ${t}`,"value",s),pt(l.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(r===0||r>32||e[1]!==String(r))&<.throwArgumentError("invalid bytes width","type",t),function(n){return se(n).length!==r&<.throwArgumentError(`invalid length for ${t}`,"value",n),eb(n)}}}switch(t){case"address":return function(e){return pt(mt(e),32)};case"bool":return function(e){return e?tb:rb};case"bytes":return function(e){return ut(e)};case"string":return function(e){return fo(e)}}return null}function kp(t,e){return`${t}(${e.map(({name:r,type:n})=>n+" "+r).join(",")})`}class sr{constructor(e){z(this,"types",Object.freeze(nr(e))),z(this,"_encoderCache",{}),z(this,"_types",{});const r={},n={},i={};Object.keys(e).forEach(l=>{r[l]={},n[l]=[],i[l]={}});for(const l in e){const a={};e[l].forEach(u=>{a[u.name]&<.throwArgumentError(`duplicate variable name ${JSON.stringify(u.name)} in ${JSON.stringify(l)}`,"types",e),a[u.name]=!0;const c=u.type.match(/^([^\x5b]*)(\x5b|$)/)[1];c===l&<.throwArgumentError(`circular type reference to ${JSON.stringify(c)}`,"types",e),!$c(c)&&(n[c]||lt.throwArgumentError(`unknown type ${JSON.stringify(c)}`,"types",e),n[c].push(l),r[l][c]=!0)})}const o=Object.keys(n).filter(l=>n[l].length===0);o.length===0?lt.throwArgumentError("missing primary type","types",e):o.length>1&<.throwArgumentError(`ambiguous primary types or unused types: ${o.map(l=>JSON.stringify(l)).join(", ")}`,"types",e),z(this,"primaryType",o[0]);function s(l,a){a[l]&<.throwArgumentError(`circular type reference to ${JSON.stringify(l)}`,"types",e),a[l]=!0,Object.keys(r[l]).forEach(u=>{n[u]&&(s(u,a),Object.keys(a).forEach(c=>{i[c][u]=!0}))}),delete a[l]}s(this.primaryType,{});for(const l in i){const a=Object.keys(i[l]);a.sort(),this._types[l]=kp(l,e[l])+a.map(u=>kp(u,e[u])).join("")}}getEncoder(e){let r=this._encoderCache[e];return r||(r=this._encoderCache[e]=this._getEncoder(e)),r}_getEncoder(e){{const i=$c(e);if(i)return i}const r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const i=r[1],o=this.getEncoder(i),s=parseInt(r[3]);return l=>{s>=0&&l.length!==s&<.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",l);let a=l.map(o);return this._types[i]&&(a=a.map(ut)),ut(Xt(a))}}const n=this.types[e];if(n){const i=fo(this._types[e]);return o=>{const s=n.map(({name:l,type:a})=>{const u=this.getEncoder(a)(o[l]);return this._types[a]?ut(u):u});return s.unshift(i),Xt(s)}}return lt.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const r=this._types[e];return r||lt.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return ut(this.encodeData(e,r))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,r,n){if($c(e))return n(e,r);const i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const s=i[1],l=parseInt(i[3]);return l>=0&&r.length!==l&<.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map(a=>this._visit(s,a,n))}const o=this.types[e];return o?o.reduce((s,{name:l,type:a})=>(s[l]=this._visit(a,r[l],n),s),{}):lt.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new sr(e)}static getPrimaryType(e){return sr.from(e).primaryType}static hashStruct(e,r,n){return sr.from(r).hashStruct(e,n)}static hashDomain(e){const r=[];for(const n in e){const i=_p[n];i||lt.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),r.push({name:n,type:i})}return r.sort((n,i)=>zc.indexOf(n.name)-zc.indexOf(i.name)),sr.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,n){return Xt(["0x1901",sr.hashDomain(e),sr.from(r).hash(n)])}static hash(e,r,n){return ut(sr.encode(e,r,n))}static resolveNames(e,r,n,i){return YA(this,void 0,void 0,function*(){e=it(e);const o={};e.verifyingContract&&!pe(e.verifyingContract,20)&&(o[e.verifyingContract]="0x");const s=sr.from(r);s.visit(n,(l,a)=>(l==="address"&&!pe(a,20)&&(o[a]="0x"),a));for(const l in o)o[l]=yield i(l);return e.verifyingContract&&o[e.verifyingContract]&&(e.verifyingContract=o[e.verifyingContract]),n=s.visit(n,(l,a)=>l==="address"&&o[a]?o[a]:a),{domain:e,value:n}})}static getPayload(e,r,n){sr.hashDomain(e);const i={},o=[];zc.forEach(a=>{const u=e[a];u!=null&&(i[a]=nb[a](u),o.push({name:a,type:_p[a]}))});const s=sr.from(r),l=it(r);return l.EIP712Domain?lt.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):l.EIP712Domain=o,s.encode(n),{types:l,domain:i,primaryType:s.primaryType,message:s.visit(n,(a,u)=>{if(a.match(/^bytes(\d*)/))return re(se(u));if(a.match(/^u?int/))return V.from(u).toString();switch(a){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return typeof u!="string"&<.throwArgumentError("invalid string","value",u),u}return lt.throwArgumentError("unsupported type","type",a)})}}}const st=new T(yl);class ib extends vl{}class ob extends vl{}class sb extends vl{}class ld extends vl{static isIndexed(e){return!!(e&&e._isIndexed)}}const lb={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Np(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class ad{constructor(e){let r=[];typeof e=="string"?r=JSON.parse(e):r=e,z(this,"fragments",r.map(n=>Nn.from(n)).filter(n=>n!=null)),z(this,"_abiCoder",fr(new.target,"getAbiCoder")()),z(this,"functions",{}),z(this,"errors",{}),z(this,"events",{}),z(this,"structs",{}),this.fragments.forEach(n=>{let i=null;switch(n.type){case"constructor":if(this.deploy){st.warn("duplicate definition - constructor");return}z(this,"deploy",n);return;case"function":i=this.functions;break;case"event":i=this.events;break;case"error":i=this.errors;break;default:return}let o=n.format();if(i[o]){st.warn("duplicate definition - "+o);return}i[o]=n}),this.deploy||z(this,"deploy",on.from({payable:!1,type:"constructor"})),z(this,"_isInterface",!0)}format(e){e||(e=Se.full),e===Se.sighash&&st.throwArgumentError("interface does not support formatting sighash","format",e);const r=this.fragments.map(n=>n.format(e));return e===Se.json?JSON.stringify(r.map(n=>JSON.parse(n))):r}static getAbiCoder(){return kA}static getAddress(e){return mt(e)}static getSighash(e){return It(fo(e.format()),0,4)}static getEventTopic(e){return fo(e.format())}getFunction(e){if(pe(e)){for(const n in this.functions)if(e===this.getSighash(n))return this.functions[n];st.throwArgumentError("no matching function","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.functions).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching function","name",n):i.length>1&&st.throwArgumentError("multiple matching functions","name",n),this.functions[i[0]]}const r=this.functions[sn.fromString(e).format()];return r||st.throwArgumentError("no matching function","signature",e),r}getEvent(e){if(pe(e)){const n=e.toLowerCase();for(const i in this.events)if(n===this.getEventTopic(i))return this.events[i];st.throwArgumentError("no matching event","topichash",n)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.events).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching event","name",n):i.length>1&&st.throwArgumentError("multiple matching events","name",n),this.events[i[0]]}const r=this.events[_n.fromString(e).format()];return r||st.throwArgumentError("no matching event","signature",e),r}getError(e){if(pe(e)){const n=fr(this.constructor,"getSighash");for(const i in this.errors){const o=this.errors[i];if(e===n(o))return this.errors[i]}st.throwArgumentError("no matching error","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.errors).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching error","name",n):i.length>1&&st.throwArgumentError("multiple matching errors","name",n),this.errors[i[0]]}const r=this.errors[sn.fromString(e).format()];return r||st.throwArgumentError("no matching error","signature",e),r}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e)}catch(r){try{e=this.getError(e)}catch{throw r}}return fr(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),fr(this.constructor,"getEventTopic")(e)}_decodeParams(e,r){return this._abiCoder.decode(e,r)}_encodeParams(e,r){return this._abiCoder.encode(e,r)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,r){typeof e=="string"&&(e=this.getError(e));const n=se(r);return re(n.slice(0,4))!==this.getSighash(e)&&st.throwArgumentError(`data signature does not match error ${e.name}.`,"data",re(n)),this._decodeParams(e.inputs,n.slice(4))}encodeErrorResult(e,r){return typeof e=="string"&&(e=this.getError(e)),re(Ut([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionData(e,r){typeof e=="string"&&(e=this.getFunction(e));const n=se(r);return re(n.slice(0,4))!==this.getSighash(e)&&st.throwArgumentError(`data signature does not match function ${e.name}.`,"data",re(n)),this._decodeParams(e.inputs,n.slice(4))}encodeFunctionData(e,r){return typeof e=="string"&&(e=this.getFunction(e)),re(Ut([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionResult(e,r){typeof e=="string"&&(e=this.getFunction(e));let n=se(r),i=null,o="",s=null,l=null,a=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,n)}catch{}break;case 4:{const u=re(n.slice(0,4)),c=lb[u];if(c)s=this._abiCoder.decode(c.inputs,n.slice(4)),l=c.name,a=c.signature,c.reason&&(i=s[0]),l==="Error"?o=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(s[0])}`:l==="Panic"&&(o=`; VM Exception while processing transaction: reverted with panic code ${s[0]}`);else try{const d=this.getError(u);s=this._abiCoder.decode(d.inputs,n.slice(4)),l=d.name,a=d.format()}catch{}break}}return st.throwError("call revert exception"+o,T.errors.CALL_EXCEPTION,{method:e.format(),data:re(r),errorArgs:s,errorName:l,errorSignature:a,reason:i})}encodeFunctionResult(e,r){return typeof e=="string"&&(e=this.getFunction(e)),re(this._abiCoder.encode(e.outputs,r||[]))}encodeFilterTopics(e,r){typeof e=="string"&&(e=this.getEvent(e)),r.length>e.inputs.length&&st.throwError("too many arguments for "+e.format(),T.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:r});let n=[];e.anonymous||n.push(this.getEventTopic(e));const i=(o,s)=>o.type==="string"?fo(s):o.type==="bytes"?ut(re(s)):(o.type==="bool"&&typeof s=="boolean"&&(s=s?"0x01":"0x00"),o.type.match(/^u?int/)&&(s=V.from(s).toHexString()),o.type==="address"&&this._abiCoder.encode(["address"],[s]),pt(re(s),32));for(r.forEach((o,s)=>{let l=e.inputs[s];if(!l.indexed){o!=null&&st.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+l.name,o);return}o==null?n.push(null):l.baseType==="array"||l.baseType==="tuple"?st.throwArgumentError("filtering with tuples or arrays not supported","contract."+l.name,o):Array.isArray(o)?n.push(o.map(a=>i(l,a))):n.push(i(l,o))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,r){typeof e=="string"&&(e=this.getEvent(e));const n=[],i=[],o=[];return e.anonymous||n.push(this.getEventTopic(e)),r.length!==e.inputs.length&&st.throwArgumentError("event arguments/values mismatch","values",r),e.inputs.forEach((s,l)=>{const a=r[l];if(s.indexed)if(s.type==="string")n.push(fo(a));else if(s.type==="bytes")n.push(ut(a));else{if(s.baseType==="tuple"||s.baseType==="array")throw new Error("not implemented");n.push(this._abiCoder.encode([s.type],[a]))}else i.push(s),o.push(a)}),{data:this._abiCoder.encode(i,o),topics:n}}decodeEventLog(e,r,n){if(typeof e=="string"&&(e=this.getEvent(e)),n!=null&&!e.anonymous){let m=this.getEventTopic(e);(!pe(n[0],32)||n[0].toLowerCase()!==m)&&st.throwError("fragment/topic mismatch",T.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:m,value:n[0]}),n=n.slice(1)}let i=[],o=[],s=[];e.inputs.forEach((m,v)=>{m.indexed?m.type==="string"||m.type==="bytes"||m.baseType==="tuple"||m.baseType==="array"?(i.push(kt.fromObject({type:"bytes32",name:m.name})),s.push(!0)):(i.push(m),s.push(!1)):(o.push(m),s.push(!1))});let l=n!=null?this._abiCoder.decode(i,Ut(n)):null,a=this._abiCoder.decode(o,r,!0),u=[],c=0,d=0;e.inputs.forEach((m,v)=>{if(m.indexed)if(l==null)u[v]=new ld({_isIndexed:!0,hash:null});else if(s[v])u[v]=new ld({_isIndexed:!0,hash:l[d++]});else try{u[v]=l[d++]}catch(p){u[v]=p}else try{u[v]=a[c++]}catch(p){u[v]=p}if(m.name&&u[m.name]==null){const p=u[v];p instanceof Error?Object.defineProperty(u,m.name,{enumerable:!0,get:()=>{throw Np(`property ${JSON.stringify(m.name)}`,p)}}):u[m.name]=p}});for(let m=0;m{throw Np(`index ${m}`,v)}})}return Object.freeze(u)}parseTransaction(e){let r=this.getFunction(e.data.substring(0,10).toLowerCase());return r?new ob({args:this._abiCoder.decode(r.inputs,"0x"+e.data.substring(10)),functionFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r),value:V.from(e.value||"0")}):null}parseLog(e){let r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new ib({eventFragment:r,name:r.name,signature:r.format(),topic:this.getEventTopic(r),args:this.decodeEventLog(r,e.data,e.topics)})}parseError(e){const r=re(e);let n=this.getError(r.substring(0,10).toLowerCase());return n?new sb({args:this._abiCoder.decode(n.inputs,"0x"+r.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(e){return!!(e&&e._isInterface)}}const ab="abstract-provider/5.7.0";var ub=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const cb=new T(ab);class fb extends vl{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class qo{constructor(){cb.checkAbstract(new.target,qo),z(this,"_isProvider",!0)}getFeeData(){return ub(this,void 0,void 0,function*(){const{block:e,gasPrice:r}=yield yt({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(s=>null)});let n=null,i=null,o=null;return e&&e.baseFeePerGas&&(n=e.baseFeePerGas,o=V.from("1500000000"),i=e.baseFeePerGas.mul(2).add(o)),{lastBaseFeePerGas:n,maxFeePerGas:i,maxPriorityFeePerGas:o,gasPrice:r}})}addListener(e,r){return this.on(e,r)}removeListener(e,r){return this.off(e,r)}static isProvider(e){return!!(e&&e._isProvider)}}const db="abstract-signer/5.7.0";var Or=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Ar=new T(db),hb=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],pb=[T.errors.INSUFFICIENT_FUNDS,T.errors.NONCE_EXPIRED,T.errors.REPLACEMENT_UNDERPRICED];class El{constructor(){Ar.checkAbstract(new.target,El),z(this,"_isSigner",!0)}getBalance(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return Or(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const r=yield yt(this.checkTransaction(e));return yield this.provider.estimateGas(r)})}call(e,r){return Or(this,void 0,void 0,function*(){this._checkProvider("call");const n=yield yt(this.checkTransaction(e));return yield this.provider.call(n,r)})}sendTransaction(e){return Or(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const r=yield this.populateTransaction(e),n=yield this.signTransaction(r);return yield this.provider.sendTransaction(n)})}getChainId(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const n in e)hb.indexOf(n)===-1&&Ar.throwArgumentError("invalid transaction key: "+n,"transaction",e);const r=it(e);return r.from==null?r.from=this.getAddress():r.from=Promise.all([Promise.resolve(r.from),this.getAddress()]).then(n=>(n[0].toLowerCase()!==n[1].toLowerCase()&&Ar.throwArgumentError("from address mismatch","transaction",e),n[0])),r}populateTransaction(e){return Or(this,void 0,void 0,function*(){const r=yield yt(this.checkTransaction(e));r.to!=null&&(r.to=Promise.resolve(r.to).then(i=>Or(this,void 0,void 0,function*(){if(i==null)return null;const o=yield this.resolveName(i);return o==null&&Ar.throwArgumentError("provided ENS name resolves to null","tx.to",i),o})),r.to.catch(i=>{}));const n=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||n)?Ar.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(r.type===0||r.type===1)&&n&&Ar.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1)r.gasPrice==null&&(r.gasPrice=this.getGasPrice());else{const i=yield this.getFeeData();if(r.type==null)if(i.maxFeePerGas!=null&&i.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){const o=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=o,r.maxPriorityFeePerGas=o}else r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas);else i.gasPrice!=null?(n&&Ar.throwError("network does not support EIP-1559",T.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=i.gasPrice),r.type=0):Ar.throwError("failed to get consistent fee data",T.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else r.type===2&&(r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas))}return r.nonce==null&&(r.nonce=this.getTransactionCount("pending")),r.gasLimit==null&&(r.gasLimit=this.estimateGas(r).catch(i=>{if(pb.indexOf(i.code)>=0)throw i;return Ar.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:i,tx:r})})),r.chainId==null?r.chainId=this.getChainId():r.chainId=Promise.all([Promise.resolve(r.chainId),this.getChainId()]).then(i=>(i[1]!==0&&i[0]!==i[1]&&Ar.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield yt(r)})}_checkProvider(e){this.provider||Ar.throwError("missing provider",T.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class Ph extends El{constructor(e,r){super(),z(this,"address",e),z(this,"provider",r||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,r){return Promise.resolve().then(()=>{Ar.throwError(e,T.errors.UNSUPPORTED_OPERATION,{operation:r})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,r,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new Ph(this.address,e)}}var Ry={},we={},xl=Ty;function Ty(t,e){if(!t)throw new Error(e||"Assertion failed")}Ty.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var ud={exports:{}};typeof Object.create=="function"?ud.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ud.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var mb=ud.exports,gb=xl,vb=mb;we.inherits=vb;function yb(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function wb(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=o&63|128):yb(t,i)?(o=65536+((o&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=o&63|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=o&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}we.htonl=Oy;function xb(t,e){for(var r="",n=0;n>>0}return o}we.join32=Ab;function bb(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=o&255):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=o&255)}return r}we.split32=bb;function _b(t,e){return t>>>e|t<<32-e}we.rotr32=_b;function Sb(t,e){return t<>>32-e}we.rotl32=Sb;function kb(t,e){return t+e>>>0}we.sum32=kb;function Nb(t,e,r){return t+e+r>>>0}we.sum32_3=Nb;function Pb(t,e,r,n){return t+e+r+n>>>0}we.sum32_4=Pb;function Cb(t,e,r,n,i){return t+e+r+n+i>>>0}we.sum32_5=Cb;function Mb(t,e,r,n){var i=t[e],o=t[e+1],s=n+o>>>0,l=(s>>0,t[e+1]=s}we.sum64=Mb;function Ib(t,e,r,n){var i=e+n>>>0,o=(i>>0}we.sum64_hi=Ib;function Rb(t,e,r,n){var i=e+n;return i>>>0}we.sum64_lo=Rb;function Tb(t,e,r,n,i,o,s,l){var a=0,u=e;u=u+n>>>0,a+=u>>0,a+=u>>0,a+=u>>0}we.sum64_4_hi=Tb;function Ob(t,e,r,n,i,o,s,l){var a=e+n+o+l;return a>>>0}we.sum64_4_lo=Ob;function Lb(t,e,r,n,i,o,s,l,a,u){var c=0,d=e;d=d+n>>>0,c+=d>>0,c+=d>>0,c+=d>>0,c+=d>>0}we.sum64_5_hi=Lb;function Bb(t,e,r,n,i,o,s,l,a,u){var c=e+n+o+l+u;return c>>>0}we.sum64_5_lo=Bb;function Db(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}we.rotr64_hi=Db;function jb(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}we.rotr64_lo=jb;function Ub(t,e,r){return t>>>r}we.shr64_hi=Ub;function Fb(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}we.shr64_lo=Fb;var Wo={},Pp=we,zb=xl;function Du(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Wo.BlockHash=Du;Du.prototype.update=function(e,r){if(e=Pp.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Pp.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[o++]=e>>>16&255,i[o++]=e>>>8&255,i[o++]=e&255}else for(i[o++]=e&255,i[o++]=e>>>8&255,i[o++]=e>>>16&255,i[o++]=e>>>24&255,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,s=8;s>>3}mn.g0_256=Gb;function Vb(t){return un(t,17)^un(t,19)^t>>>10}mn.g1_256=Vb;var To=we,Kb=Wo,Qb=mn,Hc=To.rotl32,is=To.sum32,Jb=To.sum32_5,Yb=Qb.ft_1,Fy=Kb.BlockHash,Xb=[1518500249,1859775393,2400959708,3395469782];function dn(){if(!(this instanceof dn))return new dn;Fy.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}To.inherits(dn,Fy);var Zb=dn;dn.blockSize=512;dn.outSize=160;dn.hmacStrength=80;dn.padLength=64;dn.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),F_(e.length<=this.blockSize);for(var r=e.length;r>8,m=c&255;d?a.push(d,m):a.push(m)}return a}r.toArray=n;function i(s){return s.length===1?"0"+s:s}r.zero2=i;function o(s){for(var l="",a=0;a(m>>1)-1?x=(m>>1)-k:x=k,v.isubn(x)):x=0,d[p]=x,v.iushrn(1)}return d}r.getNAF=n;function i(a,u){var c=[[],[]];a=a.clone(),u=u.clone();for(var d=0,m=0,v;a.cmpn(-d)>0||u.cmpn(-m)>0;){var p=a.andln(3)+d&3,x=u.andln(3)+m&3;p===3&&(p=-1),x===3&&(x=-1);var k;p&1?(v=a.andln(7)+d&7,(v===3||v===5)&&x===2?k=-p:k=p):k=0,c[0].push(k);var E;x&1?(v=u.andln(7)+m&7,(v===3||v===5)&&p===2?E=-x:E=x):E=0,c[1].push(E),2*d===k+1&&(d=1-d),2*m===E+1&&(m=1-m),a.iushrn(1),u.iushrn(1)}return c}r.getJSF=i;function o(a,u,c){var d="_"+u;a.prototype[u]=function(){return this[d]!==void 0?this[d]:this[d]=c.call(this)}}r.cachedProperty=o;function s(a){return typeof a=="string"?r.toArray(a,"hex"):a}r.parseBytes=s;function l(a){return new ue(a,"hex","le")}r.intFromLE=l}),Za=yr.getNAF,H_=yr.getJSF,eu=yr.assert;function xi(t,e){this.type=t,this.p=new ue(e.p,16),this.red=e.prime?ue.red(e.prime):ue.mont(this.p),this.zero=new ue(0).toRed(this.red),this.one=new ue(1).toRed(this.red),this.two=new ue(2).toRed(this.red),this.n=e.n&&new ue(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Hi=xi;xi.prototype.point=function(){throw new Error("Not implemented")};xi.prototype.validate=function(){throw new Error("Not implemented")};xi.prototype._fixedNafMul=function(e,r){eu(e.precomputed);var n=e._getDoubles(),i=Za(r,1,this._bitLength),o=(1<=l;u--)a=(a<<1)+i[u];s.push(a)}for(var c=this.jpoint(null,null,null),d=this.jpoint(null,null,null),m=o;m>0;m--){for(l=0;l=0;a--){for(var u=0;a>=0&&s[a]===0;a--)u++;if(a>=0&&u++,l=l.dblp(u),a<0)break;var c=s[a];eu(c!==0),e.type==="affine"?c>0?l=l.mixedAdd(o[c-1>>1]):l=l.mixedAdd(o[-c-1>>1].neg()):c>0?l=l.add(o[c-1>>1]):l=l.add(o[-c-1>>1].neg())}return e.type==="affine"?l.toP():l};xi.prototype._wnafMulAdd=function(e,r,n,i,o){var s=this._wnafT1,l=this._wnafT2,a=this._wnafT3,u=0,c,d,m;for(c=0;c=1;c-=2){var p=c-1,x=c;if(s[p]!==1||s[x]!==1){a[p]=Za(n[p],s[p],this._bitLength),a[x]=Za(n[x],s[x],this._bitLength),u=Math.max(a[p].length,u),u=Math.max(a[x].length,u);continue}var k=[r[p],null,null,r[x]];r[p].y.cmp(r[x].y)===0?(k[1]=r[p].add(r[x]),k[2]=r[p].toJ().mixedAdd(r[x].neg())):r[p].y.cmp(r[x].y.redNeg())===0?(k[1]=r[p].toJ().mixedAdd(r[x]),k[2]=r[p].add(r[x].neg())):(k[1]=r[p].toJ().mixedAdd(r[x]),k[2]=r[p].toJ().mixedAdd(r[x].neg()));var E=[-3,-1,-5,-7,0,7,5,1,3],w=H_(n[p],n[x]);for(u=Math.max(w[0].length,u),a[p]=new Array(u),a[x]=new Array(u),d=0;d=0;c--){for(var $=0;c>=0;){var H=!0;for(d=0;d=0&&$++,B=B.dblp($),c<0)break;for(d=0;d0?m=l[d][ie-1>>1]:ie<0&&(m=l[d][-ie-1>>1].neg()),m.type==="affine"?B=B.mixedAdd(m):B=B.add(m))}}for(c=0;c=Math.ceil((e.bitLength()+1)/r.step):!1};Mr.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,o=0;o=0&&(v=u,p=c),d.negative&&(d=d.neg(),m=m.neg()),v.negative&&(v=v.neg(),p=p.neg()),[{a:d,b:m},{a:v,b:p}]};Ir.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],o=i.b.mul(e).divRound(this.n),s=n.b.neg().mul(e).divRound(this.n),l=o.mul(n.a),a=s.mul(i.a),u=o.mul(n.b),c=s.mul(i.b),d=e.sub(l).sub(a),m=u.add(c).neg();return{k1:d,k2:m}};Ir.prototype.pointFromX=function(e,r){e=new ue(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var o=i.fromRed().isOdd();return(r&&!o||!r&&o)&&(i=i.redNeg()),this.point(e,i)};Ir.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),o=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(o).cmpn(0)===0};Ir.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,o=this._endoWnafT2,s=0;s":""};Pt.prototype.isInfinity=function(){return this.inf};Pt.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};Pt.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),s=o.redSqr().redISub(this.x.redAdd(this.x)),l=o.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,l)};Pt.prototype.getX=function(){return this.x.fromRed()};Pt.prototype.getY=function(){return this.y.fromRed()};Pt.prototype.mul=function(e){return e=new ue(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Pt.prototype.mulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o):this.curve._wnafMulAdd(1,i,o,2)};Pt.prototype.jmulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o,!0):this.curve._wnafMulAdd(1,i,o,2,!0)};Pt.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Pt.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(o){return o.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};Pt.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Ot(t,e,r,n){Hi.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new ue(0)):(this.x=new ue(e,16),this.y=new ue(r,16),this.z=new ue(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Mh(Ot,Hi.BasePoint);Ir.prototype.jpoint=function(e,r,n){return new Ot(this,e,r,n)};Ot.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};Ot.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Ot.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),o=e.x.redMul(n),s=this.y.redMul(r.redMul(e.z)),l=e.y.redMul(n.redMul(this.z)),a=i.redSub(o),u=s.redSub(l);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),d=c.redMul(a),m=i.redMul(c),v=u.redSqr().redIAdd(d).redISub(m).redISub(m),p=u.redMul(m.redISub(v)).redISub(s.redMul(d)),x=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(v,p,x)};Ot.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),o=this.y,s=e.y.redMul(r).redMul(this.z),l=n.redSub(i),a=o.redSub(s);if(l.cmpn(0)===0)return a.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=l.redSqr(),c=u.redMul(l),d=n.redMul(u),m=a.redSqr().redIAdd(c).redISub(d).redISub(d),v=a.redMul(d.redISub(m)).redISub(o.redMul(c)),p=this.z.redMul(l);return this.curve.jpoint(m,v,p)};Ot.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(o),this.x.cmp(n)===0)return!0}};Ot.prototype.inspect=function(){return this.isInfinity()?"":""};Ot.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var ga=Ko(function(t,e){var r=e;r.base=Hi,r.short=W_,r.mont=null,r.edwards=null}),va=Ko(function(t,e){var r=e,n=yr.assert;function i(l){l.type==="short"?this.curve=new ga.short(l):l.type==="edwards"?this.curve=new ga.edwards(l):this.curve=new ga.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function o(l,a){Object.defineProperty(r,l,{configurable:!0,enumerable:!0,get:function(){var u=new i(a);return Object.defineProperty(r,l,{configurable:!0,enumerable:!0,value:u}),u}})}o("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:en.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:en.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:en.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:en.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),o("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:en.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:en.sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:en.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var s;try{s=null.crash()}catch{s=void 0}o("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:en.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",s]})});function gi(t){if(!(this instanceof gi))return new gi(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Hr.toArray(t.entropy,t.entropyEnc||"hex"),r=Hr.toArray(t.nonce,t.nonceEnc||"hex"),n=Hr.toArray(t.pers,t.persEnc||"hex");Ch(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Xy=gi;gi.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};gi.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Hr.toArray(n,i||"hex"),this._update(n));for(var o=[];o.length"};var G_=yr.assert;function ju(t,e){if(t instanceof ju)return t;this._importDER(t,e)||(G_(t.r&&t.s,"Signature without r or s"),this.r=new ue(t.r,16),this.s=new ue(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Uu=ju;function V_(){this.place=0}function Gc(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,o=0,s=e.place;o>>=0;return i<=127?!1:(e.place=s,i)}function Rp(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}ju.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=Rp(r),n=Rp(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Vc(i,r.length),i=i.concat(r),i.push(2),Vc(i,n.length);var o=i.concat(n),s=[48];return Vc(s,o.length),s=s.concat(o),yr.encode(s,e)};var K_=function(){throw new Error("unsupported")},Zy=yr.assert;function Cr(t){if(!(this instanceof Cr))return new Cr(t);typeof t=="string"&&(Zy(Object.prototype.hasOwnProperty.call(va,t),"Unknown curve "+t),t=va[t]),t instanceof va.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Q_=Cr;Cr.prototype.keyPair=function(e){return new Ih(this,e)};Cr.prototype.keyFromPrivate=function(e,r){return Ih.fromPrivate(this,e,r)};Cr.prototype.keyFromPublic=function(e,r){return Ih.fromPublic(this,e,r)};Cr.prototype.genKeyPair=function(e){e||(e={});for(var r=new Xy({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||K_(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new ue(2));;){var o=new ue(r.generate(n));if(!(o.cmp(i)>0))return o.iaddn(1),this.keyFromPrivate(o)}};Cr.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};Cr.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new ue(e,16));for(var o=this.n.byteLength(),s=r.getPrivate().toArray("be",o),l=e.toArray("be",o),a=new Xy({hash:this.hash,entropy:s,nonce:l,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new ue(1)),c=0;;c++){var d=i.k?i.k(c):new ue(a.generate(this.n.byteLength()));if(d=this._truncateToN(d,!0),!(d.cmpn(1)<=0||d.cmp(u)>=0)){var m=this.g.mul(d);if(!m.isInfinity()){var v=m.getX(),p=v.umod(this.n);if(p.cmpn(0)!==0){var x=d.invm(this.n).mul(p.mul(r.getPrivate()).iadd(e));if(x=x.umod(this.n),x.cmpn(0)!==0){var k=(m.getY().isOdd()?1:0)|(v.cmp(p)!==0?2:0);return i.canonical&&x.cmp(this.nh)>0&&(x=this.n.sub(x),k^=1),new Uu({r:p,s:x,recoveryParam:k})}}}}}};Cr.prototype.verify=function(e,r,n,i){e=this._truncateToN(new ue(e,16)),n=this.keyFromPublic(n,i),r=new Uu(r,"hex");var o=r.r,s=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var l=s.invm(this.n),a=l.mul(e).umod(this.n),u=l.mul(o).umod(this.n),c;return this.curve._maxwellTrick?(c=this.g.jmulAdd(a,n.getPublic(),u),c.isInfinity()?!1:c.eqXToP(o)):(c=this.g.mulAdd(a,n.getPublic(),u),c.isInfinity()?!1:c.getX().umod(this.n).cmp(o)===0)};Cr.prototype.recoverPubKey=function(t,e,r,n){Zy((3&r)===r,"The recovery param is more than two bits"),e=new Uu(e,n);var i=this.n,o=new ue(t),s=e.r,l=e.s,a=r&1,u=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?s=this.curve.pointFromX(s.add(this.curve.n),a):s=this.curve.pointFromX(s,a);var c=e.r.invm(i),d=i.sub(o).mul(c).umod(i),m=l.mul(c).umod(i);return this.g.mulAdd(d,s,m)};Cr.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Uu(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch{continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var J_=Ko(function(t,e){var r=e;r.version="6.5.4",r.utils=yr,r.rand=function(){throw new Error("unsupported")},r.curve=ga,r.curves=va,r.ec=Q_,r.eddsa=null}),Y_=J_.ec;const X_="signing-key/5.7.0",hd=new T(X_);let Kc=null;function rn(){return Kc||(Kc=new Y_("secp256k1")),Kc}class Z_{constructor(e){z(this,"curve","secp256k1"),z(this,"privateKey",re(e)),On(this.privateKey)!==32&&hd.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=rn().keyFromPrivate(se(this.privateKey));z(this,"publicKey","0x"+r.getPublic(!1,"hex")),z(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),z(this,"_isSigningKey",!0)}_addPoint(e){const r=rn().keyFromPublic(se(this.publicKey)),n=rn().keyFromPublic(se(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=rn().keyFromPrivate(se(this.privateKey)),n=se(e);n.length!==32&&hd.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Ou({recoveryParam:i.recoveryParam,r:pt("0x"+i.r.toString(16),32),s:pt("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=rn().keyFromPrivate(se(this.privateKey)),n=rn().keyFromPublic(se(e1(e)));return pt("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function e3(t,e){const r=Ou(e),n={r:se(r.r),s:se(r.s)};return"0x"+rn().recoverPubKey(se(t),n,r.recoveryParam).encode("hex",!1)}function e1(t,e){const r=se(t);if(r.length===32){const n=new Z_(r);return e?"0x"+rn().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return e?re(r):"0x"+rn().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+rn().keyFromPublic(r).getPublic(!0,"hex"):re(r)}return hd.throwArgumentError("invalid public or private key","key","[REDACTED]")}const t3="transactions/5.7.0",Un=new T(t3);var Tp;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(Tp||(Tp={}));function Rh(t){return t==="0x"?null:mt(t)}function jt(t){return t==="0x"?gy:V.from(t)}function r3(t){const e=e1(t);return mt(It(ut(It(e,1)),12))}function t1(t,e){return r3(e3(se(t),e))}function ur(t,e){const r=Ro(V.from(t).toHexString());return r.length>32&&Un.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function Qc(t,e){return{address:mt(t),storageKeys:(e||[]).map((r,n)=>(On(r)!==32&&Un.throwArgumentError("invalid access list storageKey",`accessList[${t}:${n}]`,r),r.toLowerCase()))}}function qi(t){if(Array.isArray(t))return t.map((r,n)=>Array.isArray(r)?(r.length>2&&Un.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${n}]`,r),Qc(r[0],r[1])):Qc(r.address,r.storageKeys));const e=Object.keys(t).map(r=>{const n=t[r].reduce((i,o)=>(i[o]=!0,i),{});return Qc(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function r1(t){return qi(t).map(e=>[e.address,e.storageKeys])}function n3(t,e){if(t.gasPrice!=null){const n=V.from(t.gasPrice),i=V.from(t.maxFeePerGas||0);n.eq(i)||Un.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:n,maxFeePerGas:i})}const r=[ur(t.chainId||0,"chainId"),ur(t.nonce||0,"nonce"),ur(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ur(t.maxFeePerGas||0,"maxFeePerGas"),ur(t.gasLimit||0,"gasLimit"),t.to!=null?mt(t.to):"0x",ur(t.value||0,"value"),t.data||"0x",r1(t.accessList||[])];if(e){const n=Ou(e);r.push(ur(n.recoveryParam,"recoveryParam")),r.push(Ro(n.r)),r.push(Ro(n.s))}return Xt(["0x02",Lu(r)])}function i3(t,e){const r=[ur(t.chainId||0,"chainId"),ur(t.nonce||0,"nonce"),ur(t.gasPrice||0,"gasPrice"),ur(t.gasLimit||0,"gasLimit"),t.to!=null?mt(t.to):"0x",ur(t.value||0,"value"),t.data||"0x",r1(t.accessList||[])];if(e){const n=Ou(e);r.push(ur(n.recoveryParam,"recoveryParam")),r.push(Ro(n.r)),r.push(Ro(n.s))}return Xt(["0x01",Lu(r)])}function n1(t,e,r){try{const n=jt(e[0]).toNumber();if(n!==0&&n!==1)throw new Error("bad recid");t.v=n}catch{Un.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=pt(e[1],32),t.s=pt(e[2],32);try{const n=ut(r(t));t.from=t1(n,{r:t.r,s:t.s,recoveryParam:t.v})}catch{}}function o3(t){const e=Sh(t.slice(1));e.length!==9&&e.length!==12&&Un.throwArgumentError("invalid component count for transaction type: 2","payload",re(t));const r=jt(e[2]),n=jt(e[3]),i={type:2,chainId:jt(e[0]).toNumber(),nonce:jt(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:jt(e[4]),to:Rh(e[5]),value:jt(e[6]),data:e[7],accessList:qi(e[8])};return e.length===9||(i.hash=ut(t),n1(i,e.slice(9),n3)),i}function s3(t){const e=Sh(t.slice(1));e.length!==8&&e.length!==11&&Un.throwArgumentError("invalid component count for transaction type: 1","payload",re(t));const r={type:1,chainId:jt(e[0]).toNumber(),nonce:jt(e[1]).toNumber(),gasPrice:jt(e[2]),gasLimit:jt(e[3]),to:Rh(e[4]),value:jt(e[5]),data:e[6],accessList:qi(e[7])};return e.length===8||(r.hash=ut(t),n1(r,e.slice(8),i3)),r}function l3(t){const e=Sh(t);e.length!==9&&e.length!==6&&Un.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:jt(e[0]).toNumber(),gasPrice:jt(e[1]),gasLimit:jt(e[2]),to:Rh(e[3]),value:jt(e[4]),data:e[5],chainId:0};if(e.length===6)return r;try{r.v=V.from(e[6]).toNumber()}catch{return r}if(r.r=pt(e[7],32),r.s=pt(e[8],32),V.from(r.r).isZero()&&V.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=e.slice(0,6);r.chainId!==0&&(i.push(re(r.chainId)),i.push("0x"),i.push("0x"),n-=r.chainId*2+8);const o=ut(Lu(i));try{r.from=t1(o,{r:re(r.r),s:re(r.s),recoveryParam:n})}catch{}r.hash=ut(t)}return r.type=null,r}function a3(t){const e=se(t);if(e[0]>127)return l3(e);switch(e[0]){case 1:return s3(e);case 2:return o3(e)}return Un.throwError(`unsupported transaction type: ${e[0]}`,T.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const u3="contracts/5.7.0";var Ui=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const gt=new T(u3);function tu(t,e){return Ui(this,void 0,void 0,function*(){const r=yield e;typeof r!="string"&>.throwArgumentError("invalid address or ENS name","name",r);try{return mt(r)}catch{}t||gt.throwError("a provider or signer is needed to resolve ENS names",T.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield t.resolveName(r);return n==null&>.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n})}function ya(t,e,r){return Ui(this,void 0,void 0,function*(){return Array.isArray(r)?yield Promise.all(r.map((n,i)=>ya(t,Array.isArray(e)?e[i]:e[n.name],n))):r.type==="address"?yield tu(t,e):r.type==="tuple"?yield ya(t,e,r.components):r.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(n=>ya(t,n,r.arrayChildren))):Promise.reject(gt.makeError("invalid value for array",T.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function Fu(t,e,r){return Ui(this,void 0,void 0,function*(){let n={};r.length===e.inputs.length+1&&typeof r[r.length-1]=="object"&&(n=it(r.pop())),gt.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?n.from?n.from=yt({override:tu(t.signer,n.from),signer:t.signer.getAddress()}).then(u=>Ui(this,void 0,void 0,function*(){return mt(u.signer)!==u.override&>.throwError("Contract with a Signer cannot override from",T.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),u.override})):n.from=t.signer.getAddress():n.from&&(n.from=tu(t.provider,n.from));const i=yield yt({args:ya(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:yt(n)||{}}),o=t.interface.encodeFunctionData(e,i.args),s={data:o,to:i.address},l=i.overrides;if(l.nonce!=null&&(s.nonce=V.from(l.nonce).toNumber()),l.gasLimit!=null&&(s.gasLimit=V.from(l.gasLimit)),l.gasPrice!=null&&(s.gasPrice=V.from(l.gasPrice)),l.maxFeePerGas!=null&&(s.maxFeePerGas=V.from(l.maxFeePerGas)),l.maxPriorityFeePerGas!=null&&(s.maxPriorityFeePerGas=V.from(l.maxPriorityFeePerGas)),l.from!=null&&(s.from=l.from),l.type!=null&&(s.type=l.type),l.accessList!=null&&(s.accessList=qi(l.accessList)),s.gasLimit==null&&e.gas!=null){let u=21e3;const c=se(o);for(let d=0;dn[u]!=null);return a.length&>.throwError(`cannot override ${a.map(u=>JSON.stringify(u)).join(",")}`,T.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:a}),s})}function c3(t,e){return function(...r){return Fu(t,e,r)}}function f3(t,e){const r=t.signer||t.provider;return function(...n){return Ui(this,void 0,void 0,function*(){r||gt.throwError("estimate require a provider or signer",T.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield Fu(t,e,n);return yield r.estimateGas(i)})}}function d3(t,e){const r=e.wait.bind(e);e.wait=n=>r(n).then(i=>(i.events=i.logs.map(o=>{let s=nr(o),l=null;try{l=t.interface.parseLog(o)}catch{}return l&&(s.args=l.args,s.decode=(a,u)=>t.interface.decodeEventLog(l.eventFragment,a,u),s.event=l.name,s.eventSignature=l.signature),s.removeListener=()=>t.provider,s.getBlock=()=>t.provider.getBlock(i.blockHash),s.getTransaction=()=>t.provider.getTransaction(i.transactionHash),s.getTransactionReceipt=()=>Promise.resolve(i),s}),i))}function i1(t,e,r){const n=t.signer||t.provider;return function(...i){return Ui(this,void 0,void 0,function*(){let o;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const a=it(i.pop());a.blockTag!=null&&(o=yield a.blockTag),delete a.blockTag,i.push(a)}t.deployTransaction!=null&&(yield t._deployed(o));const s=yield Fu(t,e,i),l=yield n.call(s,o);try{let a=t.interface.decodeFunctionResult(e,l);return r&&e.outputs.length===1&&(a=a[0]),a}catch(a){throw a.code===T.errors.CALL_EXCEPTION&&(a.address=t.address,a.args=i,a.transaction=s),a}})}}function h3(t,e){return function(...r){return Ui(this,void 0,void 0,function*(){t.signer||gt.throwError("sending a transaction requires a signer",T.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),t.deployTransaction!=null&&(yield t._deployed());const n=yield Fu(t,e,r),i=yield t.signer.sendTransaction(n);return d3(t,i),i})}}function Op(t,e,r){return e.constant?i1(t,e,r):h3(t,e)}function o1(t){return t.address&&(t.topics==null||t.topics.length===0)?"*":(t.address||"*")+"@"+(t.topics?t.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):"")}class il{constructor(e,r){z(this,"tag",e),z(this,"filter",r),this._listeners=[]}addListener(e,r){this._listeners.push({listener:e,once:r})}removeListener(e){let r=!1;this._listeners=this._listeners.filter(n=>r||n.listener!==e?!0:(r=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){const r=this.listenerCount();return this._listeners=this._listeners.filter(n=>{const i=e.slice();return setTimeout(()=>{n.listener.apply(this,i)},0),!n.once}),r}prepareEvent(e){}getEmit(e){return[e]}}class p3 extends il{constructor(){super("error",null)}}class Lp extends il{constructor(e,r,n,i){const o={address:e};let s=r.getEventTopic(n);i?(s!==i[0]&>.throwArgumentError("topic mismatch","topics",i),o.topics=i.slice()):o.topics=[s],super(o1(o),o),z(this,"address",e),z(this,"interface",r),z(this,"fragment",n)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(r,n)=>this.interface.decodeEventLog(this.fragment,r,n);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(r){e.args=null,e.decodeError=r}}getEmit(e){const r=Gx(e.args);if(r.length)throw r[0].error;const n=(e.args||[]).slice();return n.push(e),n}}class Bp extends il{constructor(e,r){super("*",{address:e}),z(this,"address",e),z(this,"interface",r)}prepareEvent(e){super.prepareEvent(e);try{const r=this.interface.parseLog(e);e.event=r.name,e.eventSignature=r.signature,e.decode=(n,i)=>this.interface.decodeEventLog(r.eventFragment,n,i),e.args=r.args}catch{}}}class m3{constructor(e,r,n){z(this,"interface",fr(new.target,"getInterface")(r)),n==null?(z(this,"provider",null),z(this,"signer",null)):El.isSigner(n)?(z(this,"provider",n.provider||null),z(this,"signer",n)):qo.isProvider(n)?(z(this,"provider",n),z(this,"signer",null)):gt.throwArgumentError("invalid signer or provider","signerOrProvider",n),z(this,"callStatic",{}),z(this,"estimateGas",{}),z(this,"functions",{}),z(this,"populateTransaction",{}),z(this,"filters",{});{const s={};Object.keys(this.interface.events).forEach(l=>{const a=this.interface.events[l];z(this.filters,l,(...u)=>({address:this.address,topics:this.interface.encodeFilterTopics(a,u)})),s[a.name]||(s[a.name]=[]),s[a.name].push(l)}),Object.keys(s).forEach(l=>{const a=s[l];a.length===1?z(this.filters,l,this.filters[a[0]]):gt.warn(`Duplicate definition of ${l} (${a.join(", ")})`)})}if(z(this,"_runningEvents",{}),z(this,"_wrappedEmits",{}),e==null&>.throwArgumentError("invalid contract address or ENS name","addressOrName",e),z(this,"address",e),this.provider)z(this,"resolvedAddress",tu(this.provider,e));else try{z(this,"resolvedAddress",Promise.resolve(mt(e)))}catch{gt.throwError("provider is required to use ENS name as contract address",T.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(s=>{});const i={},o={};Object.keys(this.interface.functions).forEach(s=>{const l=this.interface.functions[s];if(o[s]){gt.warn(`Duplicate ABI entry for ${JSON.stringify(s)}`);return}o[s]=!0;{const a=l.name;i[`%${a}`]||(i[`%${a}`]=[]),i[`%${a}`].push(s)}this[s]==null&&z(this,s,Op(this,l,!0)),this.functions[s]==null&&z(this.functions,s,Op(this,l,!1)),this.callStatic[s]==null&&z(this.callStatic,s,i1(this,l,!0)),this.populateTransaction[s]==null&&z(this.populateTransaction,s,c3(this,l)),this.estimateGas[s]==null&&z(this.estimateGas,s,f3(this,l))}),Object.keys(i).forEach(s=>{const l=i[s];if(l.length>1)return;s=s.substring(1);const a=l[0];try{this[s]==null&&z(this,s,this[a])}catch{}this.functions[s]==null&&z(this.functions,s,this.functions[a]),this.callStatic[s]==null&&z(this.callStatic,s,this.callStatic[a]),this.populateTransaction[s]==null&&z(this.populateTransaction,s,this.populateTransaction[a]),this.estimateGas[s]==null&&z(this.estimateGas,s,this.estimateGas[a])})}static getContractAddress(e){return Nh(e)}static getInterface(e){return ad.isInterface(e)?e:new ad(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(r=>(r==="0x"&>.throwError("contract not deployed",T.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||gt.throwError("sending a transactions require a signer",T.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const r=it(e||{});return["from","to"].forEach(function(n){r[n]!=null&>.throwError("cannot override "+n,T.errors.UNSUPPORTED_OPERATION,{operation:n})}),r.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(r))}connect(e){typeof e=="string"&&(e=new Ph(e,this.provider));const r=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&z(r,"deployTransaction",this.deployTransaction),r}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return ld.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if(typeof e=="string"){if(e==="error")return this._normalizeRunningEvent(new p3);if(e==="event")return this._normalizeRunningEvent(new il("event",null));if(e==="*")return this._normalizeRunningEvent(new Bp(this.address,this.interface));const r=this.interface.getEvent(e);return this._normalizeRunningEvent(new Lp(this.address,this.interface,r))}if(e.topics&&e.topics.length>0){try{const n=e.topics[0];if(typeof n!="string")throw new Error("invalid topic");const i=this.interface.getEvent(n);return this._normalizeRunningEvent(new Lp(this.address,this.interface,i,e.topics))}catch{}const r={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new il(o1(r),r))}return this._normalizeRunningEvent(new Bp(this.address,this.interface))}_checkRunningEvents(e){if(e.listenerCount()===0){delete this._runningEvents[e.tag];const r=this._wrappedEmits[e.tag];r&&e.filter&&(this.provider.off(e.filter,r),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,r,n){const i=nr(r);return i.removeListener=()=>{n&&(e.removeListener(n),this._checkRunningEvents(e))},i.getBlock=()=>this.provider.getBlock(r.blockHash),i.getTransaction=()=>this.provider.getTransaction(r.transactionHash),i.getTransactionReceipt=()=>this.provider.getTransactionReceipt(r.transactionHash),e.prepareEvent(i),i}_addEventListener(e,r,n){if(this.provider||gt.throwError("events require a provider or a signer with a provider",T.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(r,n),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const i=o=>{let s=this._wrapEvent(e,o,r);if(s.decodeError==null)try{const l=e.getEmit(s);this.emit(e.filter,...l)}catch(l){s.decodeError=l.error}e.filter!=null&&this.emit("event",s),s.decodeError!=null&&this.emit("error",s.decodeError,s)};this._wrappedEmits[e.tag]=i,e.filter!=null&&this.provider.on(e.filter,i)}}queryFilter(e,r,n){const i=this._getRunningEvent(e),o=it(i.filter);return typeof r=="string"&&pe(r,32)?(n!=null&>.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),o.blockHash=r):(o.fromBlock=r??0,o.toBlock=n??"latest"),this.provider.getLogs(o).then(s=>s.map(l=>this._wrapEvent(i,l,null)))}on(e,r){return this._addEventListener(this._getRunningEvent(e),r,!1),this}once(e,r){return this._addEventListener(this._getRunningEvent(e),r,!0),this}emit(e,...r){if(!this.provider)return!1;const n=this._getRunningEvent(e),i=n.run(r)>0;return this._checkRunningEvents(n),i}listenerCount(e){return this.provider?e==null?Object.keys(this._runningEvents).reduce((r,n)=>r+this._runningEvents[n].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(e==null){const r=[];for(let n in this._runningEvents)this._runningEvents[n].listeners().forEach(i=>{r.push(i)});return r}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(e==null){for(const n in this._runningEvents){const i=this._runningEvents[n];i.removeAllListeners(),this._checkRunningEvents(i)}return this}const r=this._getRunningEvent(e);return r.removeAllListeners(),this._checkRunningEvents(r),this}off(e,r){if(!this.provider)return this;const n=this._getRunningEvent(e);return n.removeListener(r),this._checkRunningEvents(n),this}removeListener(e,r){return this.off(e,r)}}class g3 extends m3{}class s1{constructor(e){z(this,"alphabet",e),z(this,"base",e.length),z(this,"_alphabetMap",{}),z(this,"_leader",e.charAt(0));for(let r=0;r0;)n.push(s%this.base),s=s/this.base|0}let i="";for(let o=0;r[o]===0&&o=0;--o)i+=this.alphabet[n[o]];return i}decode(e){if(typeof e!="string")throw new TypeError("Expected String");let r=[];if(e.length===0)return new Uint8Array(r);r.push(0);for(let n=0;n>=8;for(;o>0;)r.push(o&255),o>>=8}for(let n=0;e[n]===this._leader&&n0;e--){const r=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[r],t[r]=n}return t}const y3="networks/5.7.1",jp=new T(y3);function w3(t){return t&&typeof t.renetwork=="function"}function bn(t){const e=function(r,n){n==null&&(n={});const i=[];if(r.InfuraProvider&&n.infura!=="-")try{i.push(new r.InfuraProvider(t,n.infura))}catch{}if(r.EtherscanProvider&&n.etherscan!=="-")try{i.push(new r.EtherscanProvider(t,n.etherscan))}catch{}if(r.AlchemyProvider&&n.alchemy!=="-")try{i.push(new r.AlchemyProvider(t,n.alchemy))}catch{}if(r.PocketProvider&&n.pocket!=="-"){const o=["goerli","ropsten","rinkeby","sepolia"];try{const s=new r.PocketProvider(t,n.pocket);s.network&&o.indexOf(s.network.name)===-1&&i.push(s)}catch{}}if(r.CloudflareProvider&&n.cloudflare!=="-")try{i.push(new r.CloudflareProvider(t))}catch{}if(r.AnkrProvider&&n.ankr!=="-")try{const o=["ropsten"],s=new r.AnkrProvider(t,n.ankr);s.network&&o.indexOf(s.network.name)===-1&&i.push(s)}catch{}if(i.length===0)return null;if(r.FallbackProvider){let o=1;return n.quorum!=null?o=n.quorum:t==="homestead"&&(o=2),new r.FallbackProvider(i,o)}return i[0]};return e.renetwork=function(r){return bn(r)},e}function ru(t,e){const r=function(n,i){return n.JsonRpcProvider?new n.JsonRpcProvider(t,e):null};return r.renetwork=function(n){return ru(t,n)},r}const Up={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:bn("homestead")},Fp={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:bn("ropsten")},zp={chainId:63,name:"classicMordor",_defaultProvider:ru("https://www.ethercluster.com/mordor","classicMordor")},Wl={unspecified:{chainId:0,name:"unspecified"},homestead:Up,mainnet:Up,morden:{chainId:2,name:"morden"},ropsten:Fp,testnet:Fp,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:bn("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:bn("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:bn("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:bn("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:ru("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:zp,classicTestnet:zp,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:ru("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:bn("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:bn("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function Th(t){if(t==null)return null;if(typeof t=="number"){for(const n in Wl){const i=Wl[n];if(i.chainId===t)return{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress||null,_defaultProvider:i._defaultProvider||null}}return{chainId:t,name:"unknown"}}if(typeof t=="string"){const n=Wl[t];return n==null?null:{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress,_defaultProvider:n._defaultProvider||null}}const e=Wl[t.name];if(!e)return typeof t.chainId!="number"&&jp.throwArgumentError("invalid network chainId","network",t),t;t.chainId!==0&&t.chainId!==e.chainId&&jp.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;return r==null&&e._defaultProvider&&(w3(e._defaultProvider)?r=e._defaultProvider.renetwork(t):r=e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}const E3="web/5.7.1";var x3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};function A3(t,e){return x3(this,void 0,void 0,function*(){e==null&&(e={});const r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};if(e.skipFetchSetup!==!0&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),e.fetchOptions!=null){const s=e.fetchOptions;s.mode&&(r.mode=s.mode),s.cache&&(r.cache=s.cache),s.credentials&&(r.credentials=s.credentials),s.redirect&&(r.redirect=s.redirect),s.referrer&&(r.referrer=s.referrer)}const n=yield fetch(t,r),i=yield n.arrayBuffer(),o={};return n.headers.forEach?n.headers.forEach((s,l)=>{o[l.toLowerCase()]=s}):n.headers.keys().forEach(s=>{o[s.toLowerCase()]=n.headers.get(s)}),{headers:o,statusCode:n.status,statusMessage:n.statusText,body:se(new Uint8Array(i))}})}var b3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Br=new T(E3);function $p(t){return new Promise(e=>{setTimeout(e,t)})}function Qn(t,e){if(t==null)return null;if(typeof t=="string")return t;if(bh(t)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return wl(t)}catch{}return re(t)}return t}function _3(t){return mr(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function S3(t,e,r){const n=typeof t=="object"&&t.throttleLimit!=null?t.throttleLimit:12;Br.assertArgument(n>0&&n%1===0,"invalid connection throttle limit","connection.throttleLimit",n);const i=typeof t=="object"?t.throttleCallback:null,o=typeof t=="object"&&typeof t.throttleSlotInterval=="number"?t.throttleSlotInterval:100;Br.assertArgument(o>0&&o%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const s=typeof t=="object"?!!t.errorPassThrough:!1,l={};let a=null;const u={method:"GET"};let c=!1,d=2*60*1e3;if(typeof t=="string")a=t;else if(typeof t=="object"){if((t==null||t.url==null)&&Br.throwArgumentError("missing URL","connection.url",t),a=t.url,typeof t.timeout=="number"&&t.timeout>0&&(d=t.timeout),t.headers)for(const E in t.headers)l[E.toLowerCase()]={key:E,value:String(t.headers[E])},["if-none-match","if-modified-since"].indexOf(E.toLowerCase())>=0&&(c=!0);if(u.allowGzip=!!t.allowGzip,t.user!=null&&t.password!=null){a.substring(0,6)!=="https:"&&t.allowInsecureAuthentication!==!0&&Br.throwError("basic authentication requires a secure https url",T.errors.INVALID_ARGUMENT,{argument:"url",url:a,user:t.user,password:"[REDACTED]"});const E=t.user+":"+t.password;l.authorization={key:"Authorization",value:"Basic "+Ay(mr(E))}}t.skipFetchSetup!=null&&(u.skipFetchSetup=!!t.skipFetchSetup),t.fetchOptions!=null&&(u.fetchOptions=it(t.fetchOptions))}const m=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),v=a?a.match(m):null;if(v)try{const E={statusCode:200,statusMessage:"OK",headers:{"content-type":v[1]||"text/plain"},body:v[2]?xy(v[3]):_3(v[3])};let w=E.body;return r&&(w=r(E.body,E)),Promise.resolve(w)}catch(E){Br.throwError("processing response error",T.errors.SERVER_ERROR,{body:Qn(v[1],v[2]),error:E,requestBody:null,requestMethod:"GET",url:a})}e&&(u.method="POST",u.body=e,l["content-type"]==null&&(l["content-type"]={key:"Content-Type",value:"application/octet-stream"}),l["content-length"]==null&&(l["content-length"]={key:"Content-Length",value:String(e.length)}));const p={};Object.keys(l).forEach(E=>{const w=l[E];p[w.key]=w.value}),u.headers=p;const x=function(){let E=null;return{promise:new Promise(function(O,B){d&&(E=setTimeout(()=>{E!=null&&(E=null,B(Br.makeError("timeout",T.errors.TIMEOUT,{requestBody:Qn(u.body,p["content-type"]),requestMethod:u.method,timeout:d,url:a})))},d))}),cancel:function(){E!=null&&(clearTimeout(E),E=null)}}}(),k=function(){return b3(this,void 0,void 0,function*(){for(let E=0;E=300)&&(x.cancel(),Br.throwError("bad response",T.errors.SERVER_ERROR,{status:w.statusCode,headers:w.headers,body:Qn(_,w.headers?w.headers["content-type"]:null),requestBody:Qn(u.body,p["content-type"]),requestMethod:u.method,url:a})),r)try{const O=yield r(_,w);return x.cancel(),O}catch(O){if(O.throttleRetry&&E{let l=null;if(o!=null)try{l=JSON.parse(wl(o))}catch(a){Br.throwError("invalid JSON",T.errors.SERVER_ERROR,{body:o,error:a})}return r&&(l=r(l,s)),l},i=null;if(e!=null){i=mr(e);const o=typeof t=="string"?{url:t}:it(t);o.headers?Object.keys(o.headers).filter(l=>l.toLowerCase()==="content-type").length!==0||(o.headers=it(o.headers),o.headers["content-type"]="application/json"):o.headers={"content-type":"application/json"},t=o}return S3(t,i,n)}function ho(t,e){return e||(e={}),e=it(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(r,n){let i=null,o=!1;const s=()=>o?!1:(o=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout(()=>{s()&&n(new Error("timeout"))},e.timeout));const l=e.retryLimit;let a=0;function u(){return t().then(function(c){if(c!==void 0)s()&&r(c);else if(e.oncePoll)e.oncePoll.once("poll",u);else if(e.onceBlock)e.onceBlock.once("block",u);else if(!o){if(a++,a>l){s()&&n(new Error("retry limit reached"));return}let d=e.interval*parseInt(String(Math.random()*Math.pow(2,a)));de.ceiling&&(d=e.ceiling),setTimeout(u,d)}return null},function(c){s()&&n(c)})}u()})}var nu="qpzry9x8gf2tvdw0s3jn54khce6mua7l",md={};for(var Gl=0;Gl>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function l1(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=bo(e)^n>>5}for(e=bo(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=l1(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",o=0;o>5)throw new Error("Non 5-bit word");n=bo(n)^s,i+=nu.charAt(s)}for(o=0;o<6;++o)n=bo(n);for(n^=1,o=0;o<6;++o){var l=n>>(5-o)*5&31;i+=nu.charAt(l)}return i}function a1(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var o=t.slice(0,i),s=t.slice(i+1);if(s.length<6)return"Data too short";var l=l1(o);if(typeof l=="string")return l;for(var a=[],u=0;u=s.length)&&a.push(d)}return l!==1?"Invalid checksum for "+t:{prefix:o,words:a}}function N3(){var t=a1.apply(null,arguments);if(typeof t=="object")return t}function P3(t){var e=a1.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function zu(t,e,r,n){for(var i=0,o=0,s=(1<=r;)o-=r,l.push(i>>o&s);if(n)o>0&&l.push(i<=e)return"Excess padding";if(i<this.data(d,!0);return e.transaction={hash:s,type:u,accessList:ee.allowNull(this.accessList.bind(this),null),blockHash:ee.allowNull(s,null),blockNumber:ee.allowNull(a,null),transactionIndex:ee.allowNull(a,null),confirmations:ee.allowNull(a,null),from:r,gasPrice:ee.allowNull(n),maxPriorityFeePerGas:ee.allowNull(n),maxFeePerGas:ee.allowNull(n),gasLimit:n,to:ee.allowNull(r,null),value:n,nonce:a,data:o,r:ee.allowNull(this.uint256),s:ee.allowNull(this.uint256),v:ee.allowNull(a),creates:ee.allowNull(r,null),raw:ee.allowNull(o)},e.transactionRequest={from:ee.allowNull(r),nonce:ee.allowNull(a),gasLimit:ee.allowNull(n),gasPrice:ee.allowNull(n),maxPriorityFeePerGas:ee.allowNull(n),maxFeePerGas:ee.allowNull(n),to:ee.allowNull(r),value:ee.allowNull(n),data:ee.allowNull(c),type:ee.allowNull(a),accessList:ee.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:s,address:r,topics:ee.arrayOf(s),data:o,logIndex:a,blockHash:s},e.receipt={to:ee.allowNull(this.address,null),from:ee.allowNull(this.address,null),contractAddress:ee.allowNull(r,null),transactionIndex:a,root:ee.allowNull(l),gasUsed:n,logsBloom:ee.allowNull(o),blockHash:s,transactionHash:s,logs:ee.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:ee.allowNull(a,null),cumulativeGasUsed:n,effectiveGasPrice:ee.allowNull(n),status:ee.allowNull(a),type:u},e.block={hash:ee.allowNull(s),parentHash:s,number:a,timestamp:a,nonce:ee.allowNull(l),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:ee.allowNull(r),extraData:o,transactions:ee.allowNull(ee.arrayOf(s)),baseFeePerGas:ee.allowNull(n)},e.blockWithTransactions=it(e.block),e.blockWithTransactions.transactions=ee.allowNull(ee.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:ee.allowNull(i,void 0),toBlock:ee.allowNull(i,void 0),blockHash:ee.allowNull(s,void 0),address:ee.allowNull(r,void 0),topics:ee.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:ee.allowNull(a),blockHash:ee.allowNull(s),transactionIndex:a,removed:ee.allowNull(this.boolean.bind(this)),address:r,data:ee.allowFalsish(o,"0x"),topics:ee.arrayOf(s),transactionHash:s,logIndex:a},e}accessList(e){return qi(e||[])}number(e){return e==="0x"?0:V.from(e).toNumber()}type(e){return e==="0x"||e==null?0:V.from(e).toNumber()}bigNumber(e){return V.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,r){return typeof e=="string"&&(!r&&e.substring(0,2)!=="0x"&&(e="0x"+e),pe(e))?e.toLowerCase():ss.throwArgumentError("invalid hash","value",e)}data(e,r){const n=this.hex(e,r);if(n.length%2!==0)throw new Error("invalid data; odd-length - "+e);return n}address(e){return mt(e)}callAddress(e){if(!pe(e,32))return null;const r=mt(It(e,12));return r===cA?null:r}contractAddress(e){return Nh(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||pe(e))return Tu(e);throw new Error("invalid blockTag")}hash(e,r){const n=this.hex(e,r);return On(n)!==32?ss.throwArgumentError("invalid hash","value",e):n}difficulty(e){if(e==null)return null;const r=V.from(e);try{return r.toNumber()}catch{}return null}uint256(e){if(!pe(e))throw new Error("invalid uint256");return pt(e,32)}_block(e,r){e.author!=null&&e.miner==null&&(e.miner=e.author);const n=e._difficulty!=null?e._difficulty:e.difficulty,i=ee.check(r,e);return i._difficulty=n==null?null:V.from(n),i}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return ee.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&V.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);const r=ee.check(this.formats.transaction,e);if(e.chainId!=null){let n=e.chainId;pe(n)&&(n=V.from(n).toNumber()),r.chainId=n}else{let n=e.networkId;n==null&&r.v==null&&(n=e.chainId),pe(n)&&(n=V.from(n).toNumber()),typeof n!="number"&&r.v!=null&&(n=(r.v-35)/2,n<0&&(n=0),n=parseInt(n)),typeof n!="number"&&(n=0),r.chainId=n}return r.blockHash&&r.blockHash.replace(/0/g,"")==="x"&&(r.blockHash=null),r}transaction(e){return a3(e)}receiptLog(e){return ee.check(this.formats.receiptLog,e)}receipt(e){const r=ee.check(this.formats.receipt,e);if(r.root!=null)if(r.root.length<=4){const n=V.from(r.root).toNumber();n===0||n===1?(r.status!=null&&r.status!==n&&ss.throwArgumentError("alt-root-status/status mismatch","value",{root:r.root,status:r.status}),r.status=n,delete r.root):ss.throwArgumentError("invalid alt-root-status","value.root",r.root)}else r.root.length!==66&&ss.throwArgumentError("invalid root hash","value.root",r.root);return r.status!=null&&(r.byzantium=!0),r}topics(e){return Array.isArray(e)?e.map(r=>this.topics(r)):e!=null?this.hash(e,!0):null}filter(e){return ee.check(this.formats.filter,e)}filterLog(e){return ee.check(this.formats.filterLog,e)}static check(e,r){const n={};for(const i in e)try{const o=e[i](r[i]);o!==void 0&&(n[i]=o)}catch(o){throw o.checkKey=i,o.checkValue=r[i],o}return n}static allowNull(e,r){return function(n){return n==null?r:e(n)}}static allowFalsish(e,r){return function(n){return n?e(n):r}}static arrayOf(e){return function(r){if(!Array.isArray(r))throw new Error("not an array");const n=[];return r.forEach(function(i){n.push(e(i))}),n}}}function u1(t){return t&&typeof t.isCommunityResource=="function"}function gd(t){return u1(t)&&t.isCommunityResource()}let qp=!1;function bl(){qp||(qp=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var ae=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const he=new T($t),O3=10;function Wp(t){return t==null?"null":(On(t)!==32&&he.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function Gp(t){for(t=t.slice();t.length>0&&t[t.length-1]==null;)t.pop();return t.map(e=>{if(Array.isArray(e)){const r={};e.forEach(i=>{r[Wp(i)]=!0});const n=Object.keys(r);return n.sort(),n.join("|")}else return Wp(e)}).join("&")}function L3(t){return t===""?[]:t.split(/&/g).map(e=>{if(e==="")return[];const r=e.split("|").map(n=>n==="null"?null:n);return r.length===1?r[0]:r})}function Gi(t){if(typeof t=="string"){if(t=t.toLowerCase(),On(t)===32)return"tx:"+t;if(t.indexOf(":")===-1)return t}else{if(Array.isArray(t))return"filter:*:"+Gp(t);if(fb.isForkEvent(t))throw he.warn("not implemented"),new Error("not implemented");if(t&&typeof t=="object")return"filter:"+(t.address||"*")+":"+Gp(t.topics||[])}throw new Error("invalid event - "+t)}function ls(){return new Date().getTime()}function Vp(t){return new Promise(e=>{setTimeout(e,t)})}const B3=["block","network","pending","poll"];class D3{constructor(e,r,n){z(this,"tag",e),z(this,"listener",r),z(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){const e=this.tag.split(":");if(e[0]!=="filter")return null;const r=e[1],n=L3(e[2]),i={};return n.length>0&&(i.topics=n),r&&r!=="*"&&(i.address=r),i}pollable(){return this.tag.indexOf(":")>=0||B3.indexOf(this.tag)>=0}}const j3={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Yc(t){return pt(V.from(t).toHexString(),32)}function Kp(t){return pd.encode(Ut([t,It(Dp(Dp(t)),0,4)]))}const c1=new RegExp("^(ipfs)://(.*)$","i"),Qp=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),c1,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function wa(t,e){try{return wl(ol(t,e))}catch{}return null}function ol(t,e){if(t==="0x")return null;const r=V.from(It(t,e,e+32)).toNumber(),n=V.from(It(t,r,r+32)).toNumber();return It(t,r+32,r+32+n)}function Xc(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):he.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function Jp(t){const e=se(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function U3(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}function f1(t){const e=[];let r=0;for(let n=0;nV.from(e).eq(1)).catch(e=>{if(e.code===T.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,r){return ae(this,void 0,void 0,function*(){const n={to:this.address,ccipReadEnabled:!0,data:Xt([e,ma(this.name),r||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,n.data=Xt(["0x9061b923",f1([JA(this.name),n.data])]));try{let o=yield this.provider.call(n);return se(o).length%32===4&&he.throwError("resolver threw error",T.errors.CALL_EXCEPTION,{transaction:n,data:o}),i&&(o=ol(o,0)),o}catch(o){if(o.code===T.errors.CALL_EXCEPTION)return null;throw o}})}_fetchBytes(e,r){return ae(this,void 0,void 0,function*(){const n=yield this._fetch(e,r);return n!=null?ol(n,0):null})}_getAddress(e,r){const n=j3[String(e)];if(n==null&&he.throwError(`unsupported coin type: ${e}`,T.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),n.ilk==="eth")return this.provider.formatter.address(r);const i=se(r);if(n.p2pkh!=null){const o=r.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(o){const s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return Kp(Ut([[n.p2pkh],"0x"+o[2]]))}}if(n.p2sh!=null){const o=r.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(o){const s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return Kp(Ut([[n.p2sh],"0x"+o[2]]))}}if(n.prefix!=null){const o=i[1];let s=i[0];if(s===0?o!==20&&o!==32&&(s=-1):s=-1,s>=0&&i.length===2+o&&o>=1&&o<=75){const l=Hp.toWords(i.slice(2));return l.unshift(s),Hp.encode(n.prefix,l)}}return null}getAddress(e){return ae(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===pA?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===T.errors.CALL_EXCEPTION)return null;throw i}const r=yield this._fetchBytes("0xf1cb7e06",Yc(e));if(r==null||r==="0x")return null;const n=this._getAddress(e,r);return n==null&&he.throwError("invalid or unsupported coin data",T.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:r}),n})}getAvatar(){return ae(this,void 0,void 0,function*(){const e=[{type:"name",content:this.name}];try{const r=yield this.getText("avatar");if(r==null)return null;for(let n=0;ns[a])}return he.throwError("invalid or unsupported content hash data",T.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return ae(this,void 0,void 0,function*(){let r=mr(e);r=Ut([Yc(64),Yc(r.length),r]),r.length%32!==0&&(r=Ut([r,pt("0x",32-e.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",re(r));return n==null||n==="0x"?null:wl(n)})}}let Zc=null,F3=1;class $u extends qo{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),z(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(r=>{}),this._ready().catch(r=>{});else{const r=fr(new.target,"getNetwork")(e);r?(z(this,"_network",r),this.emit("network",r,null)):he.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return ae(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||he.throwError("no network detected",T.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:z(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return ho(()=>this._ready().then(e=>e,e=>{if(!(e.code===T.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return Zc==null&&(Zc=new ee),Zc}static getNetwork(e){return Th(e??"homestead")}ccipReadFetch(e,r,n){return ae(this,void 0,void 0,function*(){if(this.disableCcipRead||n.length===0)return null;const i=e.to.toLowerCase(),o=r.toLowerCase(),s=[];for(let l=0;l=0?null:JSON.stringify({data:o,sender:i}),d=yield Al({url:u,errorPassThrough:!0},c,(v,p)=>(v.status=p.statusCode,v));if(d.data)return d.data;const m=d.message||"unknown error";if(d.status>=400&&d.status<500)return he.throwError(`response not found during CCIP fetch: ${m}`,T.errors.SERVER_ERROR,{url:a,errorMessage:m});s.push(m)}return he.throwError(`error encountered during CCIP fetch: ${s.map(l=>JSON.stringify(l)).join(", ")}`,T.errors.SERVER_ERROR,{urls:n,errorMessages:s})})}_getInternalBlockNumber(e){return ae(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const i=this._internalBlockNumber;try{const o=yield i;if(ls()-o.respTime<=e)return o.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const r=ls(),n=yt({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(i=>null,i=>i)}).then(({blockNumber:i,networkError:o})=>{if(o)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),o;const s=ls();return i=V.from(i).toNumber(),i{this._internalBlockNumber===n&&(this._internalBlockNumber=null)}),(yield n).blockNumber})}poll(){return ae(this,void 0,void 0,function*(){const e=F3++,r=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(i){this.emit("error",i);return}if(this._setFastBlockNumber(n),this.emit("poll",e,n),n===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)he.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",he.makeError("network block skew detected",T.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let i=this._emitted.block+1;i<=n;i++)this.emit("block",i);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach(i=>{if(i==="block")return;const o=this._emitted[i];o!=="pending"&&n-o>12&&delete this._emitted[i]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=n-1),this._events.forEach(i=>{switch(i.type){case"tx":{const o=i.hash;let s=this.getTransactionReceipt(o).then(l=>(!l||l.blockNumber==null||(this._emitted["t:"+o]=l.blockNumber,this.emit(o,l)),null)).catch(l=>{this.emit("error",l)});r.push(s);break}case"filter":{if(!i._inflight){i._inflight=!0,i._lastBlockNumber===-2&&(i._lastBlockNumber=n-1);const o=i.filter;o.fromBlock=i._lastBlockNumber+1,o.toBlock=n;const s=o.toBlock-this._maxFilterBlockRange;s>o.fromBlock&&(o.fromBlock=s),o.fromBlock<0&&(o.fromBlock=0);const l=this.getLogs(o).then(a=>{i._inflight=!1,a.length!==0&&a.forEach(u=>{u.blockNumber>i._lastBlockNumber&&(i._lastBlockNumber=u.blockNumber),this._emitted["b:"+u.blockHash]=u.blockNumber,this._emitted["t:"+u.transactionHash]=u.blockNumber,this.emit(o,u)})}).catch(a=>{this.emit("error",a),i._inflight=!1});r.push(l)}break}}}),this._lastBlockNumber=n,Promise.all(r).then(()=>{this.emit("didPoll",e)}).catch(i=>{this.emit("error",i)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return ae(this,void 0,void 0,function*(){return he.throwError("provider does not support network detection",T.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return ae(this,void 0,void 0,function*(){const e=yield this._ready(),r=yield this.detectNetwork();if(e.chainId!==r.chainId){if(this.anyNetwork)return this._network=r,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",r,e),yield Vp(0),this._network;const n=he.makeError("underlying network changed",T.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:r});throw this.emit("error",n),n}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const e=ls();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(r=>((this._fastBlockNumber==null||r>this._fastBlockNumber)&&(this._fastBlockNumber=r),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,r,n){return ae(this,void 0,void 0,function*(){return this._waitForTransaction(e,r??1,n||0,null)})}_waitForTransaction(e,r,n,i){return ae(this,void 0,void 0,function*(){const o=yield this.getTransactionReceipt(e);return(o?o.confirmations:0)>=r?o:new Promise((s,l)=>{const a=[];let u=!1;const c=function(){return u?!0:(u=!0,a.forEach(m=>{m()}),!1)},d=m=>{m.confirmations{this.removeListener(e,d)}),i){let m=i.startBlock,v=null;const p=x=>ae(this,void 0,void 0,function*(){u||(yield Vp(1e3),this.getTransactionCount(i.from).then(k=>ae(this,void 0,void 0,function*(){if(!u){if(k<=i.nonce)m=x;else{{const E=yield this.getTransaction(e);if(E&&E.blockNumber!=null)return}for(v==null&&(v=m-3,v{u||this.once("block",p)}))});if(u)return;this.once("block",p),a.push(()=>{this.removeListener("block",p)})}if(typeof n=="number"&&n>0){const m=setTimeout(()=>{c()||l(he.makeError("timeout exceeded",T.errors.TIMEOUT,{timeout:n}))},n);m.unref&&m.unref(),a.push(()=>{clearTimeout(m)})}})})}getBlockNumber(){return ae(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return V.from(e)}catch(r){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:r})}})}getBalance(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getBalance",n);try{return V.from(i)}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getBalance",params:n,result:i,error:o})}})}getTransactionCount(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getTransactionCount",n);try{return V.from(i).toNumber()}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:i,error:o})}})}getCode(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getCode",n);try{return re(i)}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getCode",params:n,result:i,error:o})}})}getStorageAt(e,r,n){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(n),position:Promise.resolve(r).then(s=>Tu(s))}),o=yield this.perform("getStorageAt",i);try{return re(o)}catch(s){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:o,error:s})}})}_wrapTransaction(e,r,n){if(r!=null&&On(r)!==32)throw new Error("invalid response - sendTransaction");const i=e;return r!=null&&e.hash!==r&&he.throwError("Transaction hash mismatch from Provider.sendTransaction.",T.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:r}),i.wait=(o,s)=>ae(this,void 0,void 0,function*(){o==null&&(o=1),s==null&&(s=0);let l;o!==0&&n!=null&&(l={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:n});const a=yield this._waitForTransaction(e.hash,o,s,l);return a==null&&o===0?null:(this._emitted["t:"+e.hash]=a.blockNumber,a.status===0&&he.throwError("transaction failed",T.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:a}),a)}),i}sendTransaction(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield Promise.resolve(e).then(o=>re(o)),n=this.formatter.transaction(e);n.confirmations==null&&(n.confirmations=0);const i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const o=yield this.perform("sendTransaction",{signedTransaction:r});return this._wrapTransaction(n,o,i)}catch(o){throw o.transaction=n,o.transactionHash=n.hash,o}})}_getTransactionRequest(e){return ae(this,void 0,void 0,function*(){const r=yield e,n={};return["from","to"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?this._getAddress(o):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?V.from(o):null))}),["type"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o??null))}),r.accessList&&(n.accessList=this.formatter.accessList(r.accessList)),["data"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?re(o):null))}),this.formatter.transactionRequest(yield yt(n))})}_getFilter(e){return ae(this,void 0,void 0,function*(){e=yield e;const r={};return e.address!=null&&(r.address=this._getAddress(e.address)),["blockHash","topics"].forEach(n=>{e[n]!=null&&(r[n]=e[n])}),["fromBlock","toBlock"].forEach(n=>{e[n]!=null&&(r[n]=this._getBlockTag(e[n]))}),this.formatter.filter(yield yt(r))})}_call(e,r,n){return ae(this,void 0,void 0,function*(){n>=O3&&he.throwError("CCIP read exceeded maximum redirections",T.errors.SERVER_ERROR,{redirects:n,transaction:e});const i=e.to,o=yield this.perform("call",{transaction:e,blockTag:r});if(n>=0&&r==="latest"&&i!=null&&o.substring(0,10)==="0x556f1830"&&On(o)%32===4)try{const s=It(o,4),l=It(s,0,32);V.from(l).eq(i)||he.throwError("CCIP Read sender did not match",T.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o});const a=[],u=V.from(It(s,32,64)).toNumber(),c=V.from(It(s,u,u+32)).toNumber(),d=It(s,u+32);for(let E=0;Eae(this,void 0,void 0,function*(){const o=yield this.perform("getBlock",i);if(o==null)return i.blockHash!=null&&this._emitted["b:"+i.blockHash]==null||i.blockTag!=null&&n>this._emitted.block?null:void 0;if(r){let s=null;for(let a=0;athis._wrapTransaction(a)),l}return this.formatter.block(o)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return ho(()=>ae(this,void 0,void 0,function*(){const n=yield this.perform("getTransaction",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;const i=this.formatter.transactionResponse(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;s<=0&&(s=1),i.confirmations=s}return this._wrapTransaction(i)}),{oncePoll:this})})}getTransactionReceipt(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return ho(()=>ae(this,void 0,void 0,function*(){const n=yield this.perform("getTransactionReceipt",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;if(n.blockHash==null)return;const i=this.formatter.receipt(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;s<=0&&(s=1),i.confirmations=s}return i}),{oncePoll:this})})}getLogs(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield yt({filter:this._getFilter(e)}),n=yield this.perform("getLogs",r);return n.forEach(i=>{i.removed==null&&(i.removed=!1)}),ee.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)})}getEtherPrice(){return ae(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return ae(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&he.throwArgumentError("invalid BlockTag","blockTag",e);let r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return r+=e,r<0&&(r=0),this.formatter.blockTag(r)}return this.formatter.blockTag(e)})}getResolver(e){return ae(this,void 0,void 0,function*(){let r=e;for(;;){if(r===""||r==="."||e!=="eth"&&r==="eth")return null;const n=yield this._getResolver(r,"getResolver");if(n!=null){const i=new vd(this,n,e);return r!==e&&!(yield i.supportsWildcard())?null:i}r=r.split(".").slice(1).join(".")}})}_getResolver(e,r){return ae(this,void 0,void 0,function*(){r==null&&(r="ENS");const n=yield this.getNetwork();n.ensAddress||he.throwError("network does not support ENS",T.errors.UNSUPPORTED_OPERATION,{operation:r,network:n.name});try{const i=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+ma(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return ae(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(n){if(pe(e))throw n}typeof e!="string"&&he.throwArgumentError("invalid ENS name","name",e);const r=yield this.getResolver(e);return r?yield r.getAddress():null})}lookupAddress(e){return ae(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);const r=e.substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"lookupAddress");if(n==null)return null;const i=wa(yield this.call({to:n,data:"0x691f3431"+ma(r).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return ae(this,void 0,void 0,function*(){let r=null;if(pe(e)){const o=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",s=yield this._getResolver(o,"getAvatar");if(!s)return null;r=new vd(this,s,o);try{const l=yield r.getAvatar();if(l)return l.url}catch(l){if(l.code!==T.errors.CALL_EXCEPTION)throw l}try{const l=wa(yield this.call({to:s,data:"0x691f3431"+ma(o).substring(2)}),0);r=yield this.getResolver(l)}catch(l){if(l.code!==T.errors.CALL_EXCEPTION)throw l;return null}}else if(r=yield this.getResolver(e),!r)return null;const n=yield r.getAvatar();return n==null?null:n.url})}perform(e,r){return he.throwError(e+" not implemented",T.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_addEventListener(e,r,n){const i=new D3(Gi(e),r,n);return this._events.push(i),this._startEvent(i),this}on(e,r){return this._addEventListener(e,r,!1)}once(e,r){return this._addEventListener(e,r,!0)}emit(e,...r){let n=!1,i=[],o=Gi(e);return this._events=this._events.filter(s=>s.tag!==o?!0:(setTimeout(()=>{s.listener.apply(this,r)},0),n=!0,s.once?(i.push(s),!1):!0)),i.forEach(s=>{this._stopEvent(s)}),n}listenerCount(e){if(!e)return this._events.length;let r=Gi(e);return this._events.filter(n=>n.tag===r).length}listeners(e){if(e==null)return this._events.map(n=>n.listener);let r=Gi(e);return this._events.filter(n=>n.tag===r).map(n=>n.listener)}off(e,r){if(r==null)return this.removeAllListeners(e);const n=[];let i=!1,o=Gi(e);return this._events=this._events.filter(s=>s.tag!==o||s.listener!=r||i?!0:(i=!0,n.push(s),!1)),n.forEach(s=>{this._stopEvent(s)}),this}removeAllListeners(e){let r=[];if(e==null)r=this._events,this._events=[];else{const n=Gi(e);this._events=this._events.filter(i=>i.tag!==n?!0:(r.push(i),!1))}return r.forEach(n=>{this._stopEvent(n)}),this}}var xn=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const wt=new T($t),z3=["call","estimateGas"];function Ps(t,e){if(t==null)return null;if(typeof t.message=="string"&&t.message.match("reverted")){const r=pe(t.data)?t.data:null;if(!e||r)return{message:t.message,data:r}}if(typeof t=="object"){for(const r in t){const n=Ps(t[r],e);if(n)return n}return null}if(typeof t=="string")try{return Ps(JSON.parse(t),e)}catch{}return null}function d1(t,e,r){const n=r.transaction||r.signedTransaction;if(t==="call"){const o=Ps(e,!0);if(o)return o.data;wt.throwError("missing revert data in call exception; Transaction reverted without a reason string",T.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:e})}if(t==="estimateGas"){let o=Ps(e.body,!1);o==null&&(o=Ps(e,!1)),o&&wt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{reason:o.message,method:t,transaction:n,error:e})}let i=e.message;throw e.code===T.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&wt.throwError("insufficient funds for intrinsic transaction cost",T.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:n}),i.match(/nonce (is )?too low/i)&&wt.throwError("nonce has already been used",T.errors.NONCE_EXPIRED,{error:e,method:t,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&wt.throwError("replacement fee too low",T.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:n}),i.match(/only replay-protected/i)&&wt.throwError("legacy pre-eip-155 transactions not supported",T.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:n}),z3.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&wt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:n}),e}function Yp(t){return new Promise(function(e){setTimeout(e,t)})}function $3(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function as(t){return t&&t.toLowerCase()}const yd={};class Oh extends El{constructor(e,r,n){if(super(),e!==yd)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");z(this,"provider",r),n==null&&(n=0),typeof n=="string"?(z(this,"_address",this.provider.formatter.address(n)),z(this,"_index",null)):typeof n=="number"?(z(this,"_index",n),z(this,"_address",null)):wt.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(e){return wt.throwError("cannot alter JSON-RPC Signer connection",T.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new H3(yd,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&wt.throwError("unknown account #"+this._index,T.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=it(e);const r=this.getAddress().then(n=>(n&&(n=n.toLowerCase()),n));if(e.gasLimit==null){const n=it(e);n.from=r,e.gasLimit=this.provider.estimateGas(n)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(n=>xn(this,void 0,void 0,function*(){if(n==null)return null;const i=yield this.provider.resolveName(n);return i==null&&wt.throwArgumentError("provided ENS name resolves to null","tx.to",n),i}))),yt({tx:yt(e),sender:r}).then(({tx:n,sender:i})=>{n.from!=null?n.from.toLowerCase()!==i&&wt.throwArgumentError("from address mismatch","transaction",e):n.from=i;const o=this.provider.constructor.hexlifyTransaction(n,{from:!0});return this.provider.send("eth_sendTransaction",[o]).then(s=>s,s=>(typeof s.message=="string"&&s.message.match(/user denied/i)&&wt.throwError("user rejected transaction",T.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:n}),d1("sendTransaction",s,o)))})}signTransaction(e){return wt.throwError("signing transactions is unsupported",T.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return xn(this,void 0,void 0,function*(){const r=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(e);try{return yield ho(()=>xn(this,void 0,void 0,function*(){const i=yield this.provider.getTransaction(n);if(i!==null)return this.provider._wrapTransaction(i,n,r)}),{oncePoll:this.provider})}catch(i){throw i.transactionHash=n,i}})}signMessage(e){return xn(this,void 0,void 0,function*(){const r=typeof e=="string"?mr(e):e,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[re(r),n.toLowerCase()])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),i}})}_legacySignMessage(e){return xn(this,void 0,void 0,function*(){const r=typeof e=="string"?mr(e):e,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),re(r)])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),i}})}_signTypedData(e,r,n){return xn(this,void 0,void 0,function*(){const i=yield sr.resolveNames(e,r,n,s=>this.provider.resolveName(s)),o=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[o.toLowerCase(),JSON.stringify(sr.getPayload(i.domain,r,i.value))])}catch(s){throw typeof s.message=="string"&&s.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"_signTypedData",from:o,messageData:{domain:i.domain,types:r,value:i.value}}),s}})}unlock(e){return xn(this,void 0,void 0,function*(){const r=this.provider,n=yield this.getAddress();return r.send("personal_unlockAccount",[n.toLowerCase(),e,null])})}}class H3 extends Oh{sendTransaction(e){return this.sendUncheckedTransaction(e).then(r=>({hash:r,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:n=>this.provider.waitForTransaction(r,n)}))}}const q3={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class vi extends $u{constructor(e,r){let n=r;n==null&&(n=new Promise((i,o)=>{setTimeout(()=>{this.detectNetwork().then(s=>{i(s)},s=>{o(s)})},0)})),super(n),e||(e=fr(this.constructor,"defaultUrl")()),typeof e=="string"?z(this,"connection",Object.freeze({url:e})):z(this,"connection",Object.freeze(it(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return xn(this,void 0,void 0,function*(){yield Yp(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){const r=fr(this.constructor,"getNetwork");try{return r(V.from(e).toNumber())}catch(n){return wt.throwError("could not detect network",T.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:n})}}return wt.throwError("could not detect network",T.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new Oh(yd,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(r=>this.formatter.address(r)))}send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:nr(n),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const o=Al(this.connection,JSON.stringify(n),$3).then(s=>(this.emit("debug",{action:"response",request:n,response:s,provider:this}),s),s=>{throw this.emit("debug",{action:"response",error:s,request:n,provider:this}),s});return i&&(this._cache[e]=o,setTimeout(()=>{this._cache[e]=null},0)),o}prepareRequest(e,r){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[as(r.address),r.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[as(r.address),r.blockTag]];case"getCode":return["eth_getCode",[as(r.address),r.blockTag]];case"getStorageAt":return["eth_getStorageAt",[as(r.address),pt(r.position,32),r.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[r.signedTransaction]];case"getBlock":return r.blockTag?["eth_getBlockByNumber",[r.blockTag,!!r.includeTransactions]]:r.blockHash?["eth_getBlockByHash",[r.blockHash,!!r.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[r.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[r.transactionHash]];case"call":return["eth_call",[fr(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0}),r.blockTag]];case"estimateGas":return["eth_estimateGas",[fr(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0})]];case"getLogs":return r.filter&&r.filter.address!=null&&(r.filter.address=as(r.filter.address)),["eth_getLogs",[r.filter]]}return null}perform(e,r){return xn(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){const i=r.transaction;if(i&&i.type!=null&&V.from(i.type).isZero()&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const o=yield this.getFeeData();o.maxFeePerGas==null&&o.maxPriorityFeePerGas==null&&(r=it(r),r.transaction=it(i),delete r.transaction.type)}}const n=this.prepareRequest(e,r);n==null&&wt.throwError(e+" not implemented",T.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(n[0],n[1])}catch(i){return d1(e,i,r)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;const e=this,r=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=r,r.then(function(n){function i(){e.send("eth_getFilterChanges",[n]).then(function(o){if(e._pendingFilter!=r)return null;let s=Promise.resolve();return o.forEach(function(l){e._emitted["t:"+l.toLowerCase()]="pending",s=s.then(function(){return e.getTransaction(l).then(function(a){return e.emit("pending",a),null})})}),s.then(function(){return Yp(1e3)})}).then(function(){if(e._pendingFilter!=r){e.send("eth_uninstallFilter",[n]);return}return setTimeout(function(){i()},0),null}).catch(o=>{})}return i(),n}).catch(n=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,r){const n=it(q3);if(r)for(const o in r)r[o]&&(n[o]=!0);jx(e,n);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(o){if(e[o]==null)return;const s=Tu(V.from(e[o]));o==="gasLimit"&&(o="gas"),i[o]=s}),["from","to","data"].forEach(function(o){e[o]!=null&&(i[o]=re(e[o]))}),e.accessList&&(i.accessList=qi(e.accessList)),i}}let Cs=null;try{if(Cs=WebSocket,Cs==null)throw new Error("inject please")}catch{const e=new T($t);Cs=function(){e.throwError("WebSockets not supported in this environment",T.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var ef=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Vl=new T($t);let W3=1;class Hu extends vi{constructor(e,r){r==="any"&&Vl.throwError("WebSocketProvider does not support 'any' network yet",T.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,r):super("_websocket",r),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?z(this,"_websocket",new Cs(this.connection.url)):z(this,"_websocket",e),z(this,"_requests",{}),z(this,"_subs",{}),z(this,"_subIds",{}),z(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(i=>{this.websocket.send(this._requests[i].payload)})},this.websocket.onmessage=i=>{const o=i.data,s=JSON.parse(o);if(s.id!=null){const l=String(s.id),a=this._requests[l];if(delete this._requests[l],s.result!==void 0)a.callback(null,s.result),this.emit("debug",{action:"response",request:JSON.parse(a.payload),response:s.result,provider:this});else{let u=null;s.error?(u=new Error(s.error.message||"unknown error"),z(u,"code",s.error.code||null),z(u,"response",o)):u=new Error("unknown error"),a.callback(u,void 0),this.emit("debug",{action:"response",error:u,request:JSON.parse(a.payload),provider:this})}}else if(s.method==="eth_subscription"){const l=this._subs[s.params.subscription];l&&l.processFunc(s.params.result)}else console.warn("this should not happen")};const n=setInterval(()=>{this.emit("poll")},1e3);n.unref&&n.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){Vl.throwError("cannot reset events block on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){Vl.throwError("cannot set polling interval on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return ef(this,void 0,void 0,function*(){return null})}set polling(e){e&&Vl.throwError("cannot set polling on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,r){const n=W3++;return new Promise((i,o)=>{function s(a,u){return a?o(a):i(u)}const l=JSON.stringify({method:e,params:r,id:n,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(l),provider:this}),this._requests[String(n)]={callback:s,payload:l},this._wsReady&&this.websocket.send(l)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,r,n){return ef(this,void 0,void 0,function*(){let i=this._subIds[e];i==null&&(i=Promise.all(r).then(s=>this.send("eth_subscribe",s)),this._subIds[e]=i);const o=yield i;this._subs[o]={tag:e,processFunc:n}})}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],r=>{const n=V.from(r.number).toNumber();this._emitted.block=n,this.emit("block",n)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],r=>{this.emit("pending",r)});break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],r=>{r.removed==null&&(r.removed=!1),this.emit(e.filter,this.formatter.filterLog(r))});break;case"tx":{const r=n=>{const i=n.hash;this.getTransactionReceipt(i).then(o=>{o&&this.emit(i,o)})};r(e),this._subscribe("tx",["newHeads"],n=>{this._events.filter(i=>i.type==="tx").forEach(r)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e);break}}_stopEvent(e){let r=e.tag;if(e.type==="tx"){if(this._events.filter(i=>i.type==="tx").length)return;r="tx"}else if(this.listenerCount(e.event))return;const n=this._subIds[r];n&&(delete this._subIds[r],n.then(i=>{this._subs[i]&&(delete this._subs[i],this.send("eth_unsubscribe",[i]))}))}destroy(){return ef(this,void 0,void 0,function*(){this.websocket.readyState===Cs.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}var G3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const gs=new T($t);class h1 extends vi{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return G3(this,void 0,void 0,function*(){let r=this.network;return r==null&&(r=yield e.detectNetwork.call(this),r||gs.throwError("no network detected",T.errors.UNKNOWN_ERROR,{}),this._network==null&&(z(this,"_network",r),this.emit("network",r,null))),r})}}class Fn extends h1{constructor(e,r){gs.checkAbstract(new.target,Fn),e=fr(new.target,"getNetwork")(e),r=fr(new.target,"getApiKey")(r);const n=fr(new.target,"getUrl")(e,r);super(n,e),typeof r=="string"?z(this,"apiKey",r):r!=null&&Object.keys(r).forEach(i=>{z(this,i,r[i])})}_startPending(){gs.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return gs.throwError("API provider does not support signing",T.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,r){return gs.throwError("not implemented; sub-classes must override getUrl",T.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const Xp=new T($t),Ea="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class p1 extends Hu{constructor(e,r){const n=new Lh(e,r),i=n.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(i,n.network),z(this,"apiKey",n.apiKey)}isCommunityResource(){return this.apiKey===Ea}}class Lh extends Fn{static getWebSocketProvider(e,r){return new p1(e,r)}static getApiKey(e){return e==null?Ea:(e&&typeof e!="string"&&Xp.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,r){let n=null;switch(e.name){case"homestead":n="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":n="eth-goerli.g.alchemy.com/v2/";break;case"matic":n="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":n="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":n="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":n="arb-goerli.g.alchemy.com/v2/";break;case"optimism":n="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":n="opt-goerli.g.alchemy.com/v2/";break;default:Xp.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+n+r,throttleCallback:(i,o)=>(r===Ea&&bl(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===Ea}}const V3=new T($t),Kl="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function K3(t){switch(t){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return V3.throwArgumentError("unsupported network","name",t)}class m1 extends Fn{isCommunityResource(){return this.apiKey===Kl}static getApiKey(e){return e??Kl}static getUrl(e,r){r==null&&(r=Kl);const n={allowGzip:!0,url:"https://"+K3(e.name)+r,throttleCallback:(i,o)=>(r.apiKey===Kl&&bl(),Promise.resolve(!0))};return r.projectSecret!=null&&(n.user="",n.password=r.projectSecret),n}}var Q3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Zp=new T($t);class g1 extends Fn{static getApiKey(e){return e!=null&&Zp.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,r){let n=null;switch(e.name){case"homestead":n="https://cloudflare-eth.com/";break;default:Zp.throwArgumentError("unsupported network","network",arguments[0])}return n}perform(e,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return Q3(this,void 0,void 0,function*(){return e==="getBlockNumber"?(yield n.perform.call(this,"getBlock",{blockTag:"latest"})).number:n.perform.call(this,e,r)})}}var Ql=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const ti=new T($t);function em(t){const e={};for(let r in t){if(t[r]==null)continue;let n=t[r];r==="type"&&n===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?n=Tu(re(n)):r==="accessList"?n="["+qi(n).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":n=re(n),e[r]=n)}return e}function J3(t){if(t.status==0&&(t.message==="No records found"||t.message==="No transactions found"))return t.result;if(t.status!=1||typeof t.message!="string"||!t.message.match(/^OK/)){const e=new Error("invalid response");throw e.result=JSON.stringify(t),(t.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return t.result}function tm(t){if(t&&t.status==0&&t.message=="NOTOK"&&(t.result||"").toLowerCase().indexOf("rate limit")>=0){const e=new Error("throttled response");throw e.result=JSON.stringify(t),e.throttleRetry=!0,e}if(t.jsonrpc!="2.0"){const e=new Error("invalid response");throw e.result=JSON.stringify(t),e}if(t.error){const e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function rm(t){if(t==="pending")throw new Error("pending not supported");return t==="latest"?t:parseInt(t.substring(2),16)}function tf(t,e,r){if(t==="call"&&e.code===T.errors.SERVER_ERROR){const i=e.error;if(i&&(i.message.match(/reverted/i)||i.message.match(/VM execution error/i))){let o=i.data;if(o&&(o="0x"+o.replace(/^.*0x/i,"")),pe(o))return o;ti.throwError("missing revert data in call exception",T.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let n=e.message;throw e.code===T.errors.SERVER_ERROR&&(e.error&&typeof e.error.message=="string"?n=e.error.message:typeof e.body=="string"?n=e.body:typeof e.responseText=="string"&&(n=e.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&ti.throwError("insufficient funds for intrinsic transaction cost",T.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&ti.throwError("nonce has already been used",T.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),n.match(/another transaction with same nonce/)&&ti.throwError("replacement fee too low",T.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&ti.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}class v1 extends $u{constructor(e,r){super(e),z(this,"baseUrl",this.getBaseUrl()),z(this,"apiKey",r||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return ti.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,r){const n=Object.keys(r).reduce((o,s)=>{const l=r[s];return l!=null&&(o+=`&${s}=${l}`),o},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${n}${i}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,r){return r.module=e,r.apikey=this.apiKey,r}fetch(e,r,n){return Ql(this,void 0,void 0,function*(){const i=n?this.getPostUrl():this.getUrl(e,r),o=n?this.getPostData(e,r):null,s=e==="proxy"?tm:J3;this.emit("debug",{action:"request",request:i,provider:this});const l={url:i,throttleSlotInterval:1e3,throttleCallback:(c,d)=>(this.isCommunityResource()&&bl(),Promise.resolve(!0))};let a=null;o&&(l.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},a=Object.keys(o).map(c=>`${c}=${o[c]}`).join("&"));const u=yield Al(l,a,s||tm);return this.emit("debug",{action:"response",request:i,response:nr(u),provider:this}),u})}detectNetwork(){return Ql(this,void 0,void 0,function*(){return this.network})}perform(e,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return Ql(this,void 0,void 0,function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:r.address,tag:r.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:r.address,tag:r.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:r.address,tag:r.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:r.address,position:r.position,tag:r.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:r.signedTransaction},!0).catch(i=>tf("sendTransaction",i,r.signedTransaction));case"getBlock":if(r.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:r.blockTag,boolean:r.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:r.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:r.transactionHash});case"call":{if(r.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const i=em(r.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(o){return tf("call",o,r.transaction)}}case"estimateGas":{const i=em(r.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(o){return tf("estimateGas",o,r.transaction)}}case"getLogs":{const i={action:"getLogs"};if(r.filter.fromBlock&&(i.fromBlock=rm(r.filter.fromBlock)),r.filter.toBlock&&(i.toBlock=rm(r.filter.toBlock)),r.filter.address&&(i.address=r.filter.address),r.filter.topics&&r.filter.topics.length>0&&(r.filter.topics.length>1&&ti.throwError("unsupported topic count",T.errors.UNSUPPORTED_OPERATION,{topics:r.filter.topics}),r.filter.topics.length===1)){const l=r.filter.topics[0];(typeof l!="string"||l.length!==66)&&ti.throwError("unsupported topic format",T.errors.UNSUPPORTED_OPERATION,{topic0:l}),i.topic0=l}const o=yield this.fetch("logs",i);let s={};for(let l=0;l{["contractAddress","to"].forEach(function(a){s[a]==""&&delete s[a]}),s.creates==null&&s.contractAddress!=null&&(s.creates=s.contractAddress);const l=this.formatter.transactionResponse(s);return s.timeStamp&&(l.timestamp=parseInt(s.timeStamp)),l})})}isCommunityResource(){return this.apiKey==null}}var iu=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Si=new T($t);function Jl(){return new Date().getTime()}function nm(t){let e=null;for(let r=0;re?null:(n+i)/2}function po(t){if(t===null)return"null";if(typeof t=="number"||typeof t=="boolean")return JSON.stringify(t);if(typeof t=="string")return t;if(V.isBigNumber(t))return t.toString();if(Array.isArray(t))return JSON.stringify(t.map(e=>po(e)));if(typeof t=="object"){const e=Object.keys(t);return e.sort(),"{"+e.map(r=>{let n=t[r];return typeof n=="function"?n="[function]":n=po(n),JSON.stringify(r)+":"+n}).join(",")+"}"}throw new Error("unknown value type: "+typeof t)}let Y3=1;function om(t){let e=null,r=null,n=new Promise(s=>{e=function(){r&&(clearTimeout(r),r=null),s()},r=setTimeout(e,t)});const i=s=>(n=n.then(s),n);function o(){return n}return{cancel:e,getPromise:o,wait:i}}const X3=[T.errors.CALL_EXCEPTION,T.errors.INSUFFICIENT_FUNDS,T.errors.NONCE_EXPIRED,T.errors.REPLACEMENT_UNDERPRICED,T.errors.UNPREDICTABLE_GAS_LIMIT],Z3=["address","args","errorArgs","errorSignature","method","transaction"];function Yl(t,e){const r={weight:t.weight};return Object.defineProperty(r,"provider",{get:()=>t.provider}),t.start&&(r.start=t.start),e&&(r.duration=e-t.start),t.done&&(t.error?r.error=t.error:r.result=t.result||null),r}function eS(t,e){return function(r){const n={};r.forEach(o=>{const s=t(o.result);n[s]||(n[s]={count:0,result:o.result}),n[s].count++});const i=Object.keys(n);for(let o=0;o=e)return s.result}}}function tS(t,e,r){let n=po;switch(e){case"getBlockNumber":return function(i){const o=i.map(l=>l.result);let s=im(i.map(l=>l.result),2);if(s!=null)return s=Math.ceil(s),o.indexOf(s+1)>=0&&s++,s>=t._highestBlockNumber&&(t._highestBlockNumber=s),t._highestBlockNumber};case"getGasPrice":return function(i){const o=i.map(s=>s.result);return o.sort(),o[Math.floor(o.length/2)]};case"getEtherPrice":return function(i){return im(i.map(o=>o.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(i){return i==null?null:(i=it(i),i.confirmations=-1,po(i))};break;case"getBlock":r.includeTransactions?n=function(i){return i==null?null:(i=it(i),i.transactions=i.transactions.map(o=>(o=it(o),o.confirmations=-1,o)),po(i))}:n=function(i){return i==null?null:po(i)};break;default:throw new Error("unknown method: "+e)}return eS(n,t.quorum)}function us(t,e){return iu(this,void 0,void 0,function*(){const r=t.provider;return r.blockNumber!=null&&r.blockNumber>=e||e===-1?r:ho(()=>new Promise((n,i)=>{setTimeout(function(){return r.blockNumber>=e?n(r):t.cancelled?n(null):n(void 0)},0)}),{oncePoll:r})})}function rS(t,e,r,n){return iu(this,void 0,void 0,function*(){let i=t.provider;switch(r){case"getBlockNumber":case"getGasPrice":return i[r]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),r==="call"&&n.blockTag?i[r](n.transaction,n.blockTag):i[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return i[r](n.transactionHash);case"getLogs":{let o=n.filter;return(o.fromBlock&&pe(o.fromBlock)||o.toBlock&&pe(o.toBlock))&&(i=yield us(t,e)),i.getLogs(o)}}return Si.throwError("unknown method error",T.errors.UNKNOWN_ERROR,{method:r,params:n})})}class y1 extends $u{constructor(e,r){e.length===0&&Si.throwArgumentError("missing providers","providers",e);const n=e.map((s,l)=>{if(qo.isProvider(s)){const c=gd(s)?2e3:750;return Object.freeze({provider:s,weight:1,stallTimeout:c,priority:1})}const a=it(s);a.priority==null&&(a.priority=1),a.stallTimeout==null&&(a.stallTimeout=gd(s)?2e3:750),a.weight==null&&(a.weight=1);const u=a.weight;return(u%1||u>512||u<1)&&Si.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${l}].weight`,u),Object.freeze(a)}),i=n.reduce((s,l)=>s+l.weight,0);r==null?r=i/2:r>i&&Si.throwArgumentError("quorum will always fail; larger than total weight","quorum",r);let o=nm(n.map(s=>s.provider.network));o==null&&(o=new Promise((s,l)=>{setTimeout(()=>{this.detectNetwork().then(s,l)},0)})),super(o),z(this,"providerConfigs",Object.freeze(n)),z(this,"quorum",r),this._highestBlockNumber=-1}detectNetwork(){return iu(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(r=>r.provider.getNetwork()));return nm(e)})}perform(e,r){return iu(this,void 0,void 0,function*(){if(e==="sendTransaction"){const a=yield Promise.all(this.providerConfigs.map(u=>u.provider.sendTransaction(r.signedTransaction).then(c=>c.hash,c=>c)));for(let u=0;ua.priority-u.priority);const o=this._highestBlockNumber;let s=0,l=!0;for(;;){const a=Jl();let u=i.filter(v=>v.runner&&a-v.startv+p.weight,0);for(;u{v.staller=null}),v.runner=rS(v,o,e,r).then(x=>{v.done=!0,v.result=x,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Yl(v,Jl()),request:{method:e,params:nr(r)},provider:this})},x=>{v.done=!0,v.error=x,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Yl(v,Jl()),request:{method:e,params:nr(r)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:p,backend:Yl(v,null),request:{method:e,params:nr(r)},provider:this}),u+=v.weight}const c=[];i.forEach(v=>{v.done||!v.runner||(c.push(v.runner),v.staller&&c.push(v.staller.getPromise()))}),c.length&&(yield Promise.race(c));const d=i.filter(v=>v.done&&v.error==null);if(d.length>=this.quorum){const v=n(d);if(v!==void 0)return i.forEach(p=>{p.staller&&p.staller.cancel(),p.cancelled=!0}),v;l||(yield om(100).getPromise()),l=!1}const m=i.reduce((v,p)=>{if(!p.done||p.error==null)return v;const x=p.error.code;return X3.indexOf(x)>=0&&(v[x]||(v[x]={error:p.error,weight:0}),v[x].weight+=p.weight),v},{});if(Object.keys(m).forEach(v=>{const p=m[v];if(p.weight{E.staller&&E.staller.cancel(),E.cancelled=!0});const x=p.error,k={};Z3.forEach(E=>{x[E]!=null&&(k[E]=x[E])}),Si.throwError(x.reason||x.message,v,k)}),i.filter(v=>!v.done).length===0)break}return i.forEach(a=>{a.staller&&a.staller.cancel(),a.cancelled=!0}),Si.throwError("failed to meet quorum",T.errors.SERVER_ERROR,{method:e,params:r,results:i.map(a=>Yl(a)),provider:this})})}}const w1=null,xa=new T($t),vs="84842078b09946638c03157f83405213";class E1 extends Hu{constructor(e,r){const n=new Bh(e,r),i=n.connection;i.password&&xa.throwError("INFURA WebSocket project secrets unsupported",T.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const o=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(o,e),z(this,"apiKey",n.projectId),z(this,"projectId",n.projectId),z(this,"projectSecret",n.projectSecret)}isCommunityResource(){return this.projectId===vs}}class Bh extends Fn{static getWebSocketProvider(e,r){return new E1(e,r)}static getApiKey(e){const r={apiKey:vs,projectId:vs,projectSecret:null};return e==null||(typeof e=="string"?r.projectId=e:e.projectSecret!=null?(xa.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),xa.assertArgument(typeof e.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),r.projectId=e.projectId,r.projectSecret=e.projectSecret):e.projectId&&(r.projectId=e.projectId),r.apiKey=r.projectId),r}static getUrl(e,r){let n=null;switch(e?e.name:"unknown"){case"homestead":n="mainnet.infura.io";break;case"goerli":n="goerli.infura.io";break;case"sepolia":n="sepolia.infura.io";break;case"matic":n="polygon-mainnet.infura.io";break;case"maticmum":n="polygon-mumbai.infura.io";break;case"optimism":n="optimism-mainnet.infura.io";break;case"optimism-goerli":n="optimism-goerli.infura.io";break;case"arbitrum":n="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":n="arbitrum-goerli.infura.io";break;default:xa.throwError("unsupported network",T.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+n+"/v3/"+r.projectId,throttleCallback:(o,s)=>(r.projectId===vs&&bl(),Promise.resolve(!0))};return r.projectSecret!=null&&(i.user="",i.password=r.projectSecret),i}isCommunityResource(){return this.projectId===vs}}class nS extends vi{send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this._pendingBatch==null&&(this._pendingBatch=[]);const i={request:n,resolve:null,reject:null},o=new Promise((s,l)=>{i.resolve=s,i.reject=l});return this._pendingBatch.push(i),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout(()=>{const s=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const l=s.map(a=>a.request);return this.emit("debug",{action:"requestBatch",request:nr(l),provider:this}),Al(this.connection,JSON.stringify(l)).then(a=>{this.emit("debug",{action:"response",request:l,response:a,provider:this}),s.forEach((u,c)=>{const d=a[c];if(d.error){const m=new Error(d.error.message);m.code=d.error.code,m.data=d.error.data,u.reject(m)}else u.resolve(d.result)})},a=>{this.emit("debug",{action:"response",error:a,request:l,provider:this}),s.forEach(u=>{u.reject(a)})})},10)),o}}const rf=new T($t),iS="ETHERS_JS_SHARED";class x1 extends Fn{static getApiKey(e){return e&&typeof e!="string"&&rf.throwArgumentError("invalid apiKey","apiKey",e),e||iS}static getUrl(e,r){rf.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let n=null;switch(e.name){case"homestead":n="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":n="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":n="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":n="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":n="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:rf.throwArgumentError("unsupported network","network",arguments[0])}return n+"?apiKey="+r}}const sm=new T($t),lm="62e1ad51b37b8e00394bda3b";class A1 extends Fn{static getApiKey(e){const r={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?r.applicationId=lm:typeof e=="string"?r.applicationId=e:e.applicationSecretKey!=null?(r.applicationId=e.applicationId,r.applicationSecretKey=e.applicationSecretKey):e.applicationId?r.applicationId=e.applicationId:sm.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),r}static getUrl(e,r){let n=null;switch(e?e.name:"unknown"){case"goerli":n="eth-goerli.gateway.pokt.network";break;case"homestead":n="eth-mainnet.gateway.pokt.network";break;case"kovan":n="poa-kovan.gateway.pokt.network";break;case"matic":n="poly-mainnet.gateway.pokt.network";break;case"maticmum":n="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":n="eth-rinkeby.gateway.pokt.network";break;case"ropsten":n="eth-ropsten.gateway.pokt.network";break;default:sm.throwError("unsupported network",T.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i=`https://${n}/v1/lb/${r.applicationId}`,o={headers:{},url:i};return r.applicationSecretKey!=null&&(o.user="",o.password=r.applicationSecretKey),o}isCommunityResource(){return this.applicationId===lm}}const am=new T($t);let oS=1;function um(t,e){const r="Web3LegacyFetcher";return function(n,i){const o={method:n,params:i,id:oS++,jsonrpc:"2.0"};return new Promise((s,l)=>{this.emit("debug",{action:"request",fetcher:r,request:nr(o),provider:this}),e(o,(a,u)=>{if(a)return this.emit("debug",{action:"response",fetcher:r,error:a,request:o,provider:this}),l(a);if(this.emit("debug",{action:"response",fetcher:r,request:o,response:u,provider:this}),u.error){const c=new Error(u.error.message);return c.code=u.error.code,c.data=u.error.data,l(c)}s(u.result)})})}}function sS(t){return function(e,r){r==null&&(r=[]);const n={method:e,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:nr(n),provider:this}),t.request(n).then(i=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,response:i,provider:this}),i),i=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,error:i,provider:this}),i})}}class b1 extends vi{constructor(e,r){e==null&&am.throwArgumentError("missing provider","provider",e);let n=null,i=null,o=null;typeof e=="function"?(n="unknown:",i=e):(n=e.host||e.path||"",!n&&e.isMetaMask&&(n="metamask"),o=e,e.request?(n===""&&(n="eip-1193:"),i=sS(e)):e.sendAsync?i=um(e,e.sendAsync.bind(e)):e.send?i=um(e,e.send.bind(e)):am.throwArgumentError("unsupported provider","provider",e),n||(n="unknown:")),super(n,r),z(this,"jsonRpcFetchFunc",i),z(this,"provider",o)}send(e,r){return this.jsonRpcFetchFunc(e,r)}}const cm=new T($t);function lS(t,e){if(t==null&&(t="homestead"),typeof t=="string"){const n=t.match(/^(ws|http)s?:/i);if(n)switch(n[1].toLowerCase()){case"http":case"https":return new vi(t);case"ws":case"wss":return new Hu(t);default:cm.throwArgumentError("unsupported URL scheme","network",t)}}const r=Th(t);return(!r||!r._defaultProvider)&&cm.throwError("unsupported getDefaultProvider network",T.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:t}),r._defaultProvider({FallbackProvider:y1,AlchemyProvider:Lh,AnkrProvider:m1,CloudflareProvider:g1,EtherscanProvider:v1,InfuraProvider:Bh,JsonRpcProvider:vi,NodesmithProvider:x1,PocketProvider:A1,Web3Provider:b1,IpcProvider:w1},e)}const aS=Object.freeze(Object.defineProperty({__proto__:null,AlchemyProvider:Lh,AlchemyWebSocketProvider:p1,AnkrProvider:m1,BaseProvider:$u,CloudflareProvider:g1,EtherscanProvider:v1,FallbackProvider:y1,Formatter:ee,InfuraProvider:Bh,InfuraWebSocketProvider:E1,IpcProvider:w1,JsonRpcBatchProvider:nS,JsonRpcProvider:vi,JsonRpcSigner:Oh,NodesmithProvider:x1,PocketProvider:A1,Provider:qo,Resolver:vd,StaticJsonRpcProvider:h1,UrlJsonRpcProvider:Fn,Web3Provider:b1,WebSocketProvider:Hu,getDefaultProvider:lS,getNetwork:Th,isCommunityResourcable:u1,isCommunityResource:gd,showThrottleMessage:bl},Symbol.toStringTag,{value:"Module"})),uS="solidity/5.7.0",cS=new RegExp("^bytes([0-9]+)$"),fS=new RegExp("^(u?int)([0-9]*)$"),dS=new RegExp("^(.*)\\[([0-9]*)\\]$"),hS="0000000000000000000000000000000000000000000000000000000000000000",Yi=new T(uS);function _1(t,e,r){switch(t){case"address":return r?ha(e,32):se(e);case"string":return mr(e);case"bytes":return se(e);case"bool":return e=e?"0x01":"0x00",r?ha(e,32):se(e)}let n=t.match(fS);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!==0||i===0||i>256)&&Yi.throwArgumentError("invalid number type","type",t),r&&(i=256),e=V.from(e).toTwos(i),ha(e,i/8)}if(n=t.match(cS),n){const i=parseInt(n[1]);return(String(i)!==n[1]||i===0||i>32)&&Yi.throwArgumentError("invalid bytes type","type",t),se(e).byteLength!==i&&Yi.throwArgumentError(`invalid value for ${t}`,"value",e),r?se((e+hS).substring(0,66)):e}if(n=t.match(dS),n&&Array.isArray(e)){const i=n[1];parseInt(n[2]||String(e.length))!=e.length&&Yi.throwArgumentError(`invalid array length for ${t}`,"value",e);const s=[];return e.forEach(function(l){s.push(_1(i,l,!0))}),Ut(s)}return Yi.throwArgumentError("invalid type","type",t)}function pS(t,e){t.length!=e.length&&Yi.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);const r=[];return t.forEach(function(n,i){r.push(_1(n,e[i]))}),re(Ut(r))}function mS(t,e){return ut(pS(t,e))}var qu={},Cn={},S1={};const gS=Uo(rA);var vS={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const fm=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??typeof c!="object"?c:Object.assign({},e,c),r.forEach(m=>m(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(vS?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},k1=t=>t?fm(t):fm;var N1={exports:{}},P1={},C1={exports:{}},M1={};/** - * @license React - * use-sync-external-store-shim.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Bo=L;function yS(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var wS=typeof Object.is=="function"?Object.is:yS,ES=Bo.useState,xS=Bo.useEffect,AS=Bo.useLayoutEffect,bS=Bo.useDebugValue;function _S(t,e){var r=e(),n=ES({inst:{value:r,getSnapshot:e}}),i=n[0].inst,o=n[1];return AS(function(){i.value=r,i.getSnapshot=e,nf(i)&&o({inst:i})},[t,r,e]),xS(function(){return nf(i)&&o({inst:i}),t(function(){nf(i)&&o({inst:i})})},[t]),bS(r),r}function nf(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!wS(t,r)}catch{return!0}}function SS(t,e){return e()}var kS=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?SS:_S;M1.useSyncExternalStore=Bo.useSyncExternalStore!==void 0?Bo.useSyncExternalStore:kS;C1.exports=M1;var NS=C1.exports;/** - * @license React - * use-sync-external-store-shim/with-selector.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Wu=L,PS=NS;function CS(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var MS=typeof Object.is=="function"?Object.is:CS,IS=PS.useSyncExternalStore,RS=Wu.useRef,TS=Wu.useEffect,OS=Wu.useMemo,LS=Wu.useDebugValue;P1.useSyncExternalStoreWithSelector=function(t,e,r,n,i){var o=RS(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=OS(function(){function a(v){if(!u){if(u=!0,c=v,v=n(v),i!==void 0&&s.hasValue){var p=s.value;if(i(p,v))return d=p}return d=v}if(p=d,MS(c,v))return p;var x=n(v);return i!==void 0&&i(p,x)?p:(c=v,d=x)}var u=!1,c,d,m=r===void 0?null:r;return[function(){return a(e())},m===null?void 0:function(){return a(m())}]},[e,r,n,i]);var l=IS(t,o[0],o[1]);return TS(function(){s.hasValue=!0,s.value=l},[l]),LS(l),l};N1.exports=P1;var BS=N1.exports;const Gu=jo(BS),{useSyncExternalStoreWithSelector:DS}=Gu;function I1(t,e=t.getState,r){const n=DS(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const dm=t=>{const e=typeof t=="function"?k1(t):t,r=(n,i)=>I1(e,n,i);return Object.assign(r,e),r},R1=t=>t?dm(t):dm;var jS=t=>R1(t);const US=Object.freeze(Object.defineProperty({__proto__:null,create:R1,createStore:k1,default:jS,useStore:I1},Symbol.toStringTag,{value:"Module"})),FS=Uo(US);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createWeb3ReactStoreAndActions=t.MAX_SAFE_CHAIN_ID=void 0;const e=gS,r=FS;t.MAX_SAFE_CHAIN_ID=0xfffffffffffec;function n(l){if(!Number.isInteger(l)||l<=0||l>t.MAX_SAFE_CHAIN_ID)throw new Error(`Invalid chainId ${l}`)}function i(l){return(0,e.getAddress)(l)}const o={chainId:void 0,accounts:void 0,activating:!1};function s(){const l=(0,r.createStore)()(()=>o);let a=0;function u(){const m=++a;return l.setState(Object.assign(Object.assign({},o),{activating:!0})),()=>{a===m&&l.setState({activating:!1})}}function c(m){if(m.chainId!==void 0&&n(m.chainId),m.accounts!==void 0)for(let v=0;v{var p,x;const k=(p=m.chainId)!==null&&p!==void 0?p:v.chainId,E=(x=m.accounts)!==null&&x!==void 0?x:v.accounts;let w=v.activating;return w&&k&&E&&(w=!1),{chainId:k,accounts:E,activating:w}})}function d(){a++,l.setState(o)}return[l,{startActivation:u,update:c,resetState:d}]}t.createWeb3ReactStoreAndActions=s})(S1);var zS={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const hm=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??typeof c!="object"?c:Object.assign({},e,c),r.forEach(m=>m(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(zS?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},Dh=t=>t?hm(t):hm,{useSyncExternalStoreWithSelector:$S}=Gu;function T1(t,e=t.getState,r){const n=$S(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const pm=t=>{const e=typeof t=="function"?Dh(t):t,r=(n,i)=>T1(e,n,i);return Object.assign(r,e),r},O1=t=>t?pm(t):pm;var HS=t=>O1(t);const qS=Object.freeze(Object.defineProperty({__proto__:null,create:O1,createStore:Dh,default:HS,useStore:T1},Symbol.toStringTag,{value:"Module"})),WS=Uo(qS),{useSyncExternalStoreWithSelector:GS}=Gu;function L1(t,e=t.getState,r){const n=GS(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const mm=(t,e)=>{const r=Dh(t),n=(i,o=e)=>L1(r,i,o);return Object.assign(n,r),n},VS=(t,e)=>t?mm(t,e):mm,KS=Object.freeze(Object.defineProperty({__proto__:null,createWithEqualityFn:VS,useStoreWithEqualityFn:L1},Symbol.toStringTag,{value:"Module"})),QS=Uo(KS),JS=Uo(aS);var YS=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XS=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZS=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&YS(e,t,r);return XS(e,t),e},ek=Fe&&Fe.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(Cn,"__esModule",{value:!0});Cn.getPriorityConnector=Cn.getSelectedConnector=Cn.initializeConnector=void 0;const tk=S1,mo=L,gm=WS,rk=QS;let _o;function nk(){return ek(this,void 0,void 0,function*(){if(_o===void 0)try{const{Web3Provider:t}=yield Promise.resolve().then(()=>ZS(JS));_o=t}catch{console.debug("@ethersproject/providers not available"),_o=null}})}function ik(t){const[e,r]=(0,tk.createWeb3ReactStoreAndActions)(),n=t(r),i=fk(e),o=dk(i),s=hk(n,i,o);return[n,Object.assign(Object.assign(Object.assign({},i),o),s),e]}Cn.initializeConnector=ik;function ok({chainId:t,accounts:e,activating:r}){return!!(t&&e&&!r)}function B1(...t){function e(d){const m=t.findIndex(([v])=>d===v);if(m===-1)throw new Error("Connector not found");return m}function r(d){const m=t[e(d)][2];if(!m)throw new Error("Stores not passed");return m}function n(d){return t.map(([,{useChainId:v}])=>v())[e(d)]}function i(d){return t.map(([,{useAccounts:v}])=>v())[e(d)]}function o(d){return t.map(([,{useIsActivating:v}])=>v())[e(d)]}function s(d){return t.map(([,{useAccount:v}])=>v())[e(d)]}function l(d){return t.map(([,{useIsActive:v}])=>v())[e(d)]}function a(d,m){const v=e(d);return t.map(([,{useProvider:x}],k)=>x(m,k===v))[v]}function u(d,m){const v=e(d);return t.map(([,{useENSNames:x}],k)=>x(k===v?m:void 0))[v]}function c(d,m){const v=e(d);return t.map(([,{useENSName:x}],k)=>x(k===v?m:void 0))[v]}return{useSelectedStore:r,useSelectedChainId:n,useSelectedAccounts:i,useSelectedIsActivating:o,useSelectedAccount:s,useSelectedIsActive:l,useSelectedProvider:a,useSelectedENSNames:u,useSelectedENSName:c}}Cn.getSelectedConnector=B1;function sk(...t){const{useSelectedStore:e,useSelectedChainId:r,useSelectedAccounts:n,useSelectedIsActivating:i,useSelectedAccount:o,useSelectedIsActive:s,useSelectedProvider:l,useSelectedENSNames:a,useSelectedENSName:u}=B1(...t);function c(){const B=t.map(([,{useIsActive:j}])=>j()).findIndex(j=>j);return t[B===-1?0:B][0]}function d(){return e(c())}function m(){return r(c())}function v(){return n(c())}function p(){return i(c())}function x(){return o(c())}function k(){return s(c())}function E(O){return l(c(),O)}function w(O){return a(c(),O)}function _(O){return u(c(),O)}return{useSelectedStore:e,useSelectedChainId:r,useSelectedAccounts:n,useSelectedIsActivating:i,useSelectedAccount:o,useSelectedIsActive:s,useSelectedProvider:l,useSelectedENSNames:a,useSelectedENSName:u,usePriorityConnector:c,usePriorityStore:d,usePriorityChainId:m,usePriorityAccounts:v,usePriorityIsActivating:p,usePriorityAccount:x,usePriorityIsActive:k,usePriorityProvider:E,usePriorityENSNames:w,usePriorityENSName:_}}Cn.getPriorityConnector=sk;const lk=({chainId:t})=>t,ak=({accounts:t})=>t,uk=({activating:t})=>t,ck=(t,e)=>t===void 0&&e===void 0||t!==void 0&&t.length===(e==null?void 0:e.length)&&t.every((r,n)=>r===e[n]);function fk(t){function e(){return(0,gm.useStore)(t,lk)}function r(){return(0,rk.useStoreWithEqualityFn)(t,ak,ck)}function n(){return(0,gm.useStore)(t,uk)}return{useChainId:e,useAccounts:r,useIsActivating:n}}function dk({useChainId:t,useAccounts:e,useIsActivating:r}){function n(){var o;return(o=e())===null||o===void 0?void 0:o[0]}function i(){const o=t(),s=e(),l=r();return ok({chainId:o,accounts:s,activating:l})}return{useAccount:n,useIsActive:i}}function vm(t,e=[]){const[r,n]=(0,mo.useState)();return(0,mo.useEffect)(()=>{if(t&&e.length){let i=!1;return Promise.all(e.map(o=>t.lookupAddress(o))).then(o=>{i||n(o)}).catch(o=>{i||(console.debug("Could not fetch ENS names",o),n(new Array(e.length).fill(null)))}),()=>{i=!0,n(void 0)}}},[t,e]),r??new Array(e.length).fill(void 0)}function hk(t,{useAccounts:e,useChainId:r},{useAccount:n,useIsActive:i}){function o(a,u=!0){const c=i(),d=r(),[m,v]=(0,mo.useState)(_o!==void 0);return(0,mo.useEffect)(()=>{if(m)return;let p=!1;return nk().then(()=>{p||v(!0)}),()=>{p=!0}},[m]),(0,mo.useMemo)(()=>{if(u){if(t.customProvider)return t.customProvider;if(_o&&t.provider)return new _o(t.provider,a)}},[m,u,c,d,a])}function s(a){const u=e();return vm(a,u)}function l(a){var u;const c=n(),d=(0,mo.useMemo)(()=>c===void 0?void 0:[c],[c]);return(u=vm(a,d))===null||u===void 0?void 0:u[0]}return{useProvider:o,useENSNames:s,useENSName:l}}var Vu={},D1={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(a,u,c){this.fn=a,this.context=u,this.once=c||!1}function o(a,u,c,d,m){if(typeof c!="function")throw new TypeError("The listener must be a function");var v=new i(c,d||a,m),p=r?r+u:u;return a._events[p]?a._events[p].fn?a._events[p]=[a._events[p],v]:a._events[p].push(v):(a._events[p]=v,a._eventsCount++),a}function s(a,u){--a._eventsCount===0?a._events=new n:delete a._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],c,d;if(this._eventsCount===0)return u;for(d in c=this._events)e.call(c,d)&&u.push(r?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},l.prototype.listeners=function(u){var c=r?r+u:u,d=this._events[c];if(!d)return[];if(d.fn)return[d.fn];for(var m=0,v=d.length,p=new Array(v);me),this.eth_accounts=jest.fn(e=>e),this.eth_requestAccounts=jest.fn(e=>e)}request(e){if(!this.chainId)return Promise.reject(new Error);switch(e.method){case"eth_chainId":return Promise.resolve(this.eth_chainId(this.chainId));case"eth_accounts":return Promise.resolve(this.eth_accounts(this.accounts));case"eth_requestAccounts":return Promise.resolve(this.eth_requestAccounts(this.accounts));default:throw new Error(`Method not supported on mock: ${JSON.stringify(e)}`)}}emitConnect(e){this.emit("connect",{chainId:e})}emitDisconnect(e){this.emit("disconnect",e)}emitChainChanged(e){this.emit("chainChanged",e)}emitAccountsChanged(e){this.emit("accountsChanged",e)}}Vu.MockEIP1193Provider=gk;var Do={},vk=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yk=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wk=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vk(e,t,r);return yk(e,t),e};Object.defineProperty(Do,"__esModule",{value:!0});Do.useWeb3React=Do.Web3ReactProvider=void 0;const ou=wk(L),Ek=Cn,j1=(0,ou.createContext)(void 0);function xk({children:t,connectors:e,connectorOverride:r,network:n,lookupENS:i=!0}){const o=(0,ou.useRef)(e);if(e.length!=o.current.length||e.some((X,G)=>{const J=o.current[G];return X[0]!==J[0]}))throw new Error("The connectors prop passed to Web3ReactProvider must be referentially static. If connectors is changing, try providing a key prop to Web3ReactProvider that changes every time connectors changes.");const s=(0,Ek.getPriorityConnector)(...e),{usePriorityConnector:l,useSelectedChainId:a,useSelectedAccounts:u,useSelectedIsActivating:c,useSelectedAccount:d,useSelectedIsActive:m,useSelectedProvider:v,useSelectedENSNames:p,useSelectedENSName:x}=s,k=l(),E=r??k,w=a(E),_=u(E),O=c(E),B=d(E),j=m(E),$=v(E,n),H=p(E,i?$:void 0),ie=x(E,i?$:void 0);return ou.default.createElement(j1.Provider,{value:{connector:E,chainId:w,accounts:_,isActivating:O,account:B,isActive:j,provider:$,ENSNames:H,ENSName:ie,hooks:s}},t)}Do.Web3ReactProvider=xk;function Ak(){const t=(0,ou.useContext)(j1);if(!t)throw Error("useWeb3React can only be used within the Web3ReactProvider component");return t}Do.useWeb3React=Ak;(function(t){var e=Fe&&Fe.__createBinding||(Object.create?function(n,i,o,s){s===void 0&&(s=o);var l=Object.getOwnPropertyDescriptor(i,o);(!l||("get"in l?!i.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(n,s,l)}:function(n,i,o,s){s===void 0&&(s=o),n[s]=i[o]}),r=Fe&&Fe.__exportStar||function(n,i){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&e(i,n,o)};Object.defineProperty(t,"__esModule",{value:!0}),r(Cn,t),r(Vu,t),r(Do,t)})(qu);const of=[{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"approve",inputs:[{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"apps",inputs:[{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"balanceOf",inputs:[{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"contractURI",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"getApproved",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"getInitializedVersion",inputs:[],outputs:[{name:"",type:"uint64",internalType:"uint64"}],stateMutability:"view"},{type:"function",name:"getPackageId",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"pure"},{type:"function",name:"getPackageInfo",inputs:[{name:"package",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"tuple",internalType:"struct IKinodeAppStore.PackageInfo",components:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"getPackageInfo",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"tuple",internalType:"struct IKinodeAppStore.PackageInfo",components:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[{name:"_knsResolver",type:"address",internalType:"contract KNSRegistryResolver"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"isApprovedForAll",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"operator",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"knsResolver",inputs:[],outputs:[{name:"",type:"address",internalType:"contract KNSRegistryResolver"}],stateMutability:"view"},{type:"function",name:"name",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"ownerOf",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"proxiableUUID",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"registerApp",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setApprovalForAll",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"approved",type:"bool",internalType:"bool"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"symbol",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"tokenURI",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"transferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"unlistPacakge",inputs:[{name:"package",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateContractURI",inputs:[{name:"uri",type:"string",internalType:"string"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateMetadata",inputs:[{name:"package",type:"uint256",internalType:"uint256"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"upgradeToAndCall",inputs:[{name:"newImplementation",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"event",name:"AppMetadataUpdated",inputs:[{name:"package",type:"uint256",indexed:!0,internalType:"uint256"},{name:"metadataUrl",type:"string",indexed:!1,internalType:"string"},{name:"metadataHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"AppRegistered",inputs:[{name:"package",type:"uint256",indexed:!0,internalType:"uint256"},{name:"packageName",type:"string",indexed:!1,internalType:"string"},{name:"publisherName",type:"bytes",indexed:!1,internalType:"bytes"},{name:"metadataUrl",type:"string",indexed:!1,internalType:"string"},{name:"metadataHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"Approval",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"ApprovalForAll",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"operator",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint64",indexed:!1,internalType:"uint64"}],anonymous:!1},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Transfer",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"AddressEmptyCode",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{name:"implementation",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ERC721IncorrectOwner",inputs:[{name:"sender",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InsufficientApproval",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC721InvalidApprover",inputs:[{name:"approver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOperator",inputs:[{name:"operator",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidReceiver",inputs:[{name:"receiver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidSender",inputs:[{name:"sender",type:"address",internalType:"address"}]},{type:"error",name:"ERC721NonexistentToken",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"FailedInnerCall",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"OwnableInvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{name:"account",type:"address",internalType:"address"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{name:"slot",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"Unauthorized",inputs:[]}];class wd{static createInterface(){return new ad(of)}static connect(e,r){return new g3(e,of,r)}}zh(wd,"abi",of);var U1={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ym=qr.createContext&&qr.createContext(U1),bk=["attr","size","title"];function _k(t,e){if(t==null)return{};var r=Sk(t,e),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Sk(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,o;for(o=0;o=0)&&(r[i]=t[i]);return r}function su(){return su=Object.assign?Object.assign.bind():function(t){for(var e=1;eqr.createElement(e.tag,lu({key:r},e.attr),F1(e.child)))}function zn(t){return e=>qr.createElement(Ck,su({attr:lu({},t.attr)},e),F1(t.child))}function Ck(t){var e=r=>{var{attr:n,size:i,title:o}=t,s=_k(t,bk),l=i||r.size||"1em",a;return r.className&&(a=r.className),t.className&&(a=(a?a+" ":"")+t.className),qr.createElement("svg",su({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,n,s,{className:a,style:lu(lu({color:t.color||r.color},r.style),t.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),o&&qr.createElement("title",null,o),t.children)};return ym!==void 0?qr.createElement(ym.Consumer,null,r=>e(r)):e(U1)}function Mk(t){return zn({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"},child:[]}]})(t)}function Ik(t){return zn({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"},child:[]}]})(t)}function Rk(t){return zn({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"},child:[]}]})(t)}function Tk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(t)}function Ok(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"},child:[]}]})(t)}function Lk(t){return zn({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"},child:[]}]})(t)}function Bk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"},child:[]}]})(t)}function z1(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M296 384h-80c-13.3 0-24-10.7-24-24V192h-87.7c-17.8 0-26.7-21.5-14.1-34.1L242.3 5.7c7.5-7.5 19.8-7.5 27.3 0l152.2 152.2c12.6 12.6 3.7 34.1-14.1 34.1H320v168c0 13.3-10.7 24-24 24zm216-8v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h136v8c0 30.9 25.1 56 56 56h80c30.9 0 56-25.1 56-56v-8h136c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(t)}function Dk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm101.8-262.2L295.6 256l62.2 62.2c4.7 4.7 4.7 12.3 0 17l-22.6 22.6c-4.7 4.7-12.3 4.7-17 0L256 295.6l-62.2 62.2c-4.7 4.7-12.3 4.7-17 0l-22.6-22.6c-4.7-4.7-4.7-12.3 0-17l62.2-62.2-62.2-62.2c-4.7-4.7-4.7-12.3 0-17l22.6-22.6c4.7-4.7 12.3-4.7 17 0l62.2 62.2 62.2-62.2c4.7-4.7 12.3-4.7 17 0l22.6 22.6c4.7 4.7 4.7 12.3 0 17z"},child:[]}]})(t)}var jk={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Em=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??(typeof c!="object"||c===null)?c:Object.assign({},e,c),r.forEach(m=>m(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(jk?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},Uk=t=>t?Em(t):Em;var $1={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{useDebugValue:Fk}=qr,{useSyncExternalStoreWithSelector:zk}=Gu;let xm=!1;function $k(t,e=t.getState,r){($1?"production":void 0)!=="production"&&r&&!xm&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),xm=!0);const n=zk(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return Fk(n),n}const Am=t=>{($1?"production":void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof t=="function"?Uk(t):t,r=(n,i)=>$k(e,n,i);return Object.assign(r,e),r},Hk=t=>t?Am(t):Am;var qk={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function H1(t,e){let r;try{r=t()}catch{return}return{getItem:i=>{var o;const s=a=>a===null?null:JSON.parse(a,e==null?void 0:e.reviver),l=(o=r.getItem(i))!=null?o:null;return l instanceof Promise?l.then(s):s(l)},setItem:(i,o)=>r.setItem(i,JSON.stringify(o,e==null?void 0:e.replacer)),removeItem:i=>r.removeItem(i)}}const sl=t=>e=>{try{const r=t(e);return r instanceof Promise?r:{then(n){return sl(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return sl(n)(r)}}}},Wk=(t,e)=>(r,n,i)=>{let o={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:k=>k,version:0,merge:(k,E)=>({...E,...k}),...e},s=!1;const l=new Set,a=new Set;let u;try{u=o.getStorage()}catch{}if(!u)return t((...k)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...k)},n,i);const c=sl(o.serialize),d=()=>{const k=o.partialize({...n()});let E;const w=c({state:k,version:o.version}).then(_=>u.setItem(o.name,_)).catch(_=>{E=_});if(E)throw E;return w},m=i.setState;i.setState=(k,E)=>{m(k,E),d()};const v=t((...k)=>{r(...k),d()},n,i);let p;const x=()=>{var k;if(!u)return;s=!1,l.forEach(w=>w(n()));const E=((k=o.onRehydrateStorage)==null?void 0:k.call(o,n()))||void 0;return sl(u.getItem.bind(u))(o.name).then(w=>{if(w)return o.deserialize(w)}).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==o.version){if(o.migrate)return o.migrate(w.state,w.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return w.state}).then(w=>{var _;return p=o.merge(w,(_=n())!=null?_:v),r(p,!0),d()}).then(()=>{E==null||E(p,void 0),s=!0,a.forEach(w=>w(p))}).catch(w=>{E==null||E(void 0,w)})};return i.persist={setOptions:k=>{o={...o,...k},k.getStorage&&(u=k.getStorage())},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>x(),hasHydrated:()=>s,onHydrate:k=>(l.add(k),()=>{l.delete(k)}),onFinishHydration:k=>(a.add(k),()=>{a.delete(k)})},x(),p||v},Gk=(t,e)=>(r,n,i)=>{let o={storage:H1(()=>localStorage),partialize:x=>x,version:0,merge:(x,k)=>({...k,...x}),...e},s=!1;const l=new Set,a=new Set;let u=o.storage;if(!u)return t((...x)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...x)},n,i);const c=()=>{const x=o.partialize({...n()});return u.setItem(o.name,{state:x,version:o.version})},d=i.setState;i.setState=(x,k)=>{d(x,k),c()};const m=t((...x)=>{r(...x),c()},n,i);let v;const p=()=>{var x,k;if(!u)return;s=!1,l.forEach(w=>{var _;return w((_=n())!=null?_:m)});const E=((k=o.onRehydrateStorage)==null?void 0:k.call(o,(x=n())!=null?x:m))||void 0;return sl(u.getItem.bind(u))(o.name).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==o.version){if(o.migrate)return o.migrate(w.state,w.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return w.state}).then(w=>{var _;return v=o.merge(w,(_=n())!=null?_:m),r(v,!0),c()}).then(()=>{E==null||E(v,void 0),v=n(),s=!0,a.forEach(w=>w(v))}).catch(w=>{E==null||E(void 0,w)})};return i.persist={setOptions:x=>{o={...o,...x},x.storage&&(u=x.storage)},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>p(),hasHydrated:()=>s,onHydrate:x=>(l.add(x),()=>{l.delete(x)}),onFinishHydration:x=>(a.add(x),()=>{a.delete(x)})},o.skipHydration||p(),v||m},Vk=(t,e)=>"getStorage"in e||"serialize"in e||"deserialize"in e?((qk?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),Wk(t,e)):Gk(t,e),Kk=Vk;var Dr=(t=>(t[t.OK=200]="OK",t[t.CREATED=201]="CREATED",t[t.ACCEPTED=202]="ACCEPTED",t[t.NO_CONTENT=204]="NO_CONTENT",t[t.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",t[t.FOUND=302]="FOUND",t[t.SEE_OTHER=303]="SEE_OTHER",t[t.NOT_MODIFIED=304]="NOT_MODIFIED",t[t.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",t[t.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",t[t.BAD_REQUEST=400]="BAD_REQUEST",t[t.UNAUTHORIZED=401]="UNAUTHORIZED",t[t.FORBIDDEN=403]="FORBIDDEN",t[t.NOT_FOUND=404]="NOT_FOUND",t[t.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",t[t.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",t[t.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",t[t.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",t[t.BAD_GATEWAY=502]="BAD_GATEWAY",t[t.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",t))(Dr||{});const xe=t=>`${t.package}:${t.publisher}`,cs=t=>{var e;return((e=t.metadata)==null?void 0:e.name)||xe(t)},sf=t=>{var e,r;return t.publisher==="sys"?"system":(e=t.state)!=null&&e.our_version&&!((r=t.state)!=null&&r.capsApproved)?"downloaded":t.metadata?"installed":"local"},or="/main:app_store:sys",Xl=(t,e)=>t.package===e.package&&t.publisher===e.publisher,Qo=Hk()(Kk((t,e)=>({myApps:{downloaded:[],installed:[],local:[],system:[]},listedApps:[],searchResults:[],query:"",getMyApps:async()=>{const i=(await(await fetch(`${or}/apps`)).json()).reduce((o,s)=>{const l=sf(s);return o[l].push(s),o},{downloaded:[],installed:[],local:[],system:[]});return t(()=>({myApps:i})),i},getListedApps:async()=>{const n=await(await fetch(`${or}/apps/listed`)).json();return t({listedApps:n}),n},getMyApp:async r=>{const i=await(await fetch(`${or}/apps/${xe(r)}`)).json(),o=sf(i),s=e().myApps;s[o]=s[o].map(a=>Xl(a,i)?i:a);const l=[...e().listedApps].map(a=>Xl(a,i)?i:a);return t({myApps:s,listedApps:l}),i},installApp:async r=>{if((await fetch(`${or}/apps/${xe(r)}/caps`,{method:"POST"})).status!==Dr.OK)throw new Error(`Failed to approve caps for app: ${xe(r)}`);if((await fetch(`${or}/apps/${xe(r)}`,{method:"POST"})).status!==Dr.CREATED)throw new Error(`Failed to install app: ${xe(r)}`)},updateApp:async r=>{if((await fetch(`${or}/apps/${xe(r)}`,{method:"PUT"})).status!==Dr.NO_CONTENT)throw new Error(`Failed to update app: ${xe(r)}`)},uninstallApp:async r=>{if(!confirm(`Are you sure you want to remove ${xe(r)}?`))return;if((await fetch(`${or}/apps/${xe(r)}`,{method:"DELETE"})).status!==Dr.NO_CONTENT)throw new Error(`Failed to remove app: ${xe(r)}`);const i={...e().myApps},o=sf(r);i[o]=i[o].filter(l=>!Xl(l,r));const s=e().listedApps.map(l=>Xl(l,r)?{...l,state:void 0,installed:!1}:l);t({myApps:i,listedApps:s})},getListedApp:async r=>{const n=await fetch(`${or}/apps/listed/${r}`);if(n.status!==Dr.OK)throw new Error(`Failed to get app: ${r}`);return await n.json()},downloadApp:async r=>{if((await fetch(`${or}/apps/listed/${xe(r)}`,{method:"POST"})).status!==Dr.CREATED)throw new Error(`Failed to get app: ${xe(r)}`)},getCaps:async r=>{const n=await fetch(`${or}/apps/${xe(r)}/caps`);if(n.status!==Dr.OK)throw new Error(`Failed to get app: ${xe(r)}`);return(await n.json())[0]},approveCaps:async r=>{if((await fetch(`${or}/apps/${xe(r)}/caps`,{method:"POST"})).status!==Dr.OK)throw new Error(`Failed to get app: ${xe(r)}`)},setMirroring:async(r,n)=>{if((await fetch(`${or}/apps/${xe(r)}/mirror`,{method:n?"PUT":"DELETE"})).status!==Dr.OK)throw new Error(`Failed to start mirror: ${xe(r)}`);e().getMyApp(r)},setAutoUpdate:async(r,n)=>{if((await fetch(`${or}/apps/${xe(r)}/auto-update`,{method:n?"PUT":"DELETE"})).status!==Dr.OK)throw new Error(`Failed to change auto update: ${xe(r)}`);e().getMyApp(r)},get:e,set:t}),{name:"app_store",storage:H1(()=>sessionStorage)}));function q1({app:t,size:e="medium",...r}){var i,o,s,l,a;const n=Iu();return I.jsxs("div",{...r,className:`app-header row ${e} ${r.className||""}`,onClick:()=>n(`/app-details/${xe(t)}`),children:[I.jsx("img",{src:((i=t.metadata)==null?void 0:i.image)||"https://png.pngtree.com/png-vector/20190215/ourmid/pngtree-vector-question-mark-icon-png-image_515448.jpg",alt:"app icon"}),I.jsxs("div",{className:"col title",children:[I.jsx("div",{className:"app-name ellipsis",children:((o=t.metadata)==null?void 0:o.name)||xe(t)}),((s=t.metadata)==null?void 0:s.subtitle)&&I.jsx("div",{className:"ellipsis",children:(a=(l=t.metadata)==null?void 0:l.subtitle)==null?void 0:a.slice(0,100)})]})]})}const Qk=({show:t,hide:e,hideClose:r=!1,title:n,...i})=>{const o=s=>{s.stopPropagation()};return t?I.jsx("div",{className:`modal-backdrop ${t?"show":""}`,onClick:e,children:I.jsxs("div",{...i,className:`col modal ${i.className||""}`,onClick:o,children:[!!n&&I.jsx("h3",{className:"modal-title",children:n}),!r&&I.jsx(Lk,{className:"close",onClick:e}),I.jsx("div",{className:"col modal-content",onClick:o,children:i.children})]})}):null};function Ed({msg:t}){return I.jsxs("div",{id:"loading",className:"col center",children:[I.jsx("h3",{children:t}),I.jsxs("div",{id:"loader",children:[" ",I.jsx("div",{})," ",I.jsx("div",{})," ",I.jsx("div",{})," ",I.jsx("div",{})," "]})]})}function W1({app:t,...e}){var $,H,ie,X,G;const{updateApp:r,downloadApp:n,installApp:i,getCaps:o,getMyApp:s}=Qo(),[l,a]=L.useState(!1),[u,c]=L.useState(((H=($=t.metadata)==null?void 0:$.mirrors)==null?void 0:H[0])||""),[d,m]=L.useState([]),[v,p]=L.useState(""),{clean:x,installed:k,downloaded:E,updatable:w}=L.useMemo(()=>{var A,N,b,M,R;const J=((A=t.metadata)==null?void 0:A.versions)&&((b=t.metadata)==null?void 0:b.versions[((N=t.metadata)==null?void 0:N.versions.length)-1]),C=t.installed,f=!!t.state,g=!!((M=t.state)!=null&&M.our_version&&J)&&((R=t.state)==null?void 0:R.our_version)!==J&&t.publisher!==window.our.node;return{clean:!C&&!f&&!g,installed:C,downloaded:f,updatable:g}},[t]),_=L.useCallback(async()=>{k&&!w?window.alert("App is installed"):(E&&o(t).then(J=>{m(J.request_capabilities)}),a(!0))},[t,k,E,w,a,o]),O=L.useCallback(async()=>{try{p(`Downloading ${cs(t)}...`),await n(t);const J=setInterval(()=>{s(t).then(()=>{p(""),a(!1),clearInterval(J)}).catch(console.log)},2e3)}catch(J){console.error(J),window.alert(`Failed to download app from ${u}, please try a different mirror.`),p("")}},[u,t,n,s]),B=L.useCallback(async()=>{try{p(`Installing ${cs(t)}...`),await i(t);const J=setInterval(()=>{s(t).then(C=>{C.installed&&(p(""),a(!1),clearInterval(J))}).catch(console.log)},2e3)}catch(J){console.error(J),window.alert("Failed to install, please try again."),p("")}},[t,i,s]),j=L.useCallback(async()=>{try{p(`Updating ${cs(t)}...`),await r(t);const J=setInterval(()=>{s(t).then(C=>{C.installed&&(p(""),a(!1),clearInterval(J))}).catch(console.log)},2e3)}catch(J){console.error(J),window.alert("Failed to update, please try again."),p("")}},[t,r,s]);return I.jsxs(I.Fragment,{children:[I.jsx("button",{...e,type:"button",className:`unstyled action-btn ${e.className||""}`,onClick:_,children:k&&w?"Update":k?"Installed":E?"Install":"Download"}),I.jsx(Qk,{show:l,hide:()=>a(!1),children:v?I.jsx(Ed,{msg:v}):x?I.jsxs(I.Fragment,{children:[I.jsxs("h3",{children:["Download ",(ie=t.metadata)==null?void 0:ie.name,"?"]}),I.jsx("h4",{style:{margin:0},children:"Select Mirror"}),I.jsx("select",{style:{margin:"1em 0"},value:u,onChange:J=>c(J.target.value),children:(G=(X=t.metadata)==null?void 0:X.mirrors)==null?void 0:G.map(J=>I.jsx("option",{value:J,children:J},J))}),I.jsx("button",{type:"button",onClick:O,children:"Download"})]}):E?I.jsxs(I.Fragment,{children:[I.jsx("h3",{children:"Approve App Permissions"}),I.jsxs("h4",{style:{margin:0},children:[cs(t)," needs the following permissions:"]}),I.jsx("ul",{className:"col",style:{margin:"1em 0",alignItems:"flex-start"},children:d.map(J=>I.jsx("li",{children:J},J))}),I.jsx("button",{type:"button",onClick:B,children:"Approve & Install"})]}):I.jsxs(I.Fragment,{children:[I.jsx("h3",{children:"Approve App Permissions"}),I.jsxs("h4",{style:{margin:0},children:[cs(t)," needs the following permissions:"]}),I.jsx("br",{}),I.jsx("ul",{className:"col",style:{margin:"1em 0",alignItems:"flex-start"},children:d.map(J=>I.jsx("li",{children:J},J))}),I.jsx("button",{type:"button",onClick:j,children:"Approve & Update"})]})})]})}const G1=t=>!!t&&t[0]==="o",bm=Qs.unstable_batchedUpdates||(t=>t()),Vi=(t,e,r=1e-4)=>Math.abs(t-e)t===!0||!!(t&&t[e]),hr=(t,e)=>typeof t=="function"?t(e):t,V1="_szhsinMenu",Jk=t=>t[V1],Yk=(t,e)=>Object.defineProperty(e,V1,{value:t}),Ku=(t,e)=>(e&&Object.keys(e).forEach(r=>{const n=t[r],i=e[r];typeof i=="function"&&n?t[r]=(...o)=>{i(...o),n(...o)}:t[r]=i}),t),Xk=t=>{if(typeof t!="string")return{top:0,right:0,bottom:0,left:0};const e=t.trim().split(/\s+/,4).map(parseFloat),r=isNaN(e[0])?0:e[0],n=isNaN(e[1])?r:e[1];return{top:r,right:n,bottom:isNaN(e[2])?r:e[2],left:isNaN(e[3])?n:e[3]}},lf=t=>{for(;t;){if(t=t.parentNode,!t||t===document.body||!t.parentNode)return;const{overflow:e,overflowX:r,overflowY:n}=getComputedStyle(t);if(/auto|scroll|overlay|hidden/.test(e+n+r))return t}};function K1(t,e){return{"aria-disabled":t||void 0,tabIndex:e?0:-1}}function _m(t,e){for(let r=0;rL.useMemo(()=>{const i=e?`${t}__${e}`:t;let o=i;r&&Object.keys(r).forEach(l=>{const a=r[l];a&&(o+=` ${i}--${a===!0?l:`${l}-${a}`}`)});let s=typeof n=="function"?n(r):n;return typeof s=="string"&&(s=s.trim(),s&&(o+=` ${s}`)),o},[t,e,r,n]),Zk="szh-menu-container",Aa="szh-menu",e4="szh-menu-button",t4="arrow",r4="item",Q1=L.createContext(),J1=L.createContext({}),Sm=L.createContext({}),Y1=L.createContext({}),n4=L.createContext({}),jh=L.createContext({}),$r=Object.freeze({ENTER:"Enter",ESC:"Escape",SPACE:" ",HOME:"Home",END:"End",LEFT:"ArrowLeft",RIGHT:"ArrowRight",UP:"ArrowUp",DOWN:"ArrowDown"}),xt=Object.freeze({RESET:0,SET:1,UNSET:2,INCREASE:3,DECREASE:4,FIRST:5,LAST:6,SET_INDEX:7}),ul=Object.freeze({CLICK:"click",CANCEL:"cancel",BLUR:"blur",SCROLL:"scroll"}),Ms=Object.freeze({FIRST:"first",LAST:"last"}),i4=Object.freeze({entering:"opening",entered:"open",exiting:"closing",exited:"closed"}),af="absolute",o4="presentation",X1="menuitem",km={"aria-hidden":!0,role:X1},s4=Yk("MenuButton",L.forwardRef(function({className:e,isOpen:r,disabled:n,children:i,...o},s){const l=L.useMemo(()=>({open:r}),[r]);return I.jsx("button",{"aria-haspopup":!0,"aria-expanded":r,"aria-disabled":n||void 0,type:"button",disabled:n,...o,ref:s,className:al({block:e4,modifiers:l,className:e}),children:i})})),l4=({className:t,containerRef:e,containerProps:r,children:n,isOpen:i,theming:o,transition:s,onClose:l})=>{const a=ll(s,"item"),u=({key:d})=>{switch(d){case $r.ESC:hr(l,{key:d,reason:ul.CANCEL});break}},c=d=>{i&&!d.currentTarget.contains(d.relatedTarget)&&hr(l,{reason:ul.BLUR})};return I.jsx("div",{...Ku({onKeyDown:u,onBlur:c},r),className:al({block:Zk,modifiers:L.useMemo(()=>({theme:o,itemTransition:a}),[o,a]),className:t}),style:{position:"absolute",...r==null?void 0:r.style},ref:e,children:n})},a4=()=>{let t,e=0;return{toggle:r=>{r?e++:e--,e=Math.max(e,0)},on:(r,n,i)=>{e?t||(t=setTimeout(()=>{t=0,n()},r)):i==null||i()},off:()=>{t&&(clearTimeout(t),t=0)}}},u4=(t,e)=>{const[r,n]=L.useState(),o=L.useRef({items:[],hoverIndex:-1,sorted:!1}).current,s=L.useCallback((a,u)=>{const{items:c}=o;if(!a)o.items=[];else if(u)c.push(a);else{const d=c.indexOf(a);d>-1&&(c.splice(d,1),a.contains(document.activeElement)&&(e.current.focus(),n()))}o.hoverIndex=-1,o.sorted=!1},[o,e]),l=L.useCallback((a,u,c)=>{const{items:d,hoverIndex:m}=o,v=()=>{if(o.sorted)return;const k=t.current.querySelectorAll(".szh-menu__item");d.sort((E,w)=>_m(k,E)-_m(k,w)),o.sorted=!0};let p=-1,x;switch(a){case xt.RESET:break;case xt.SET:x=u;break;case xt.UNSET:x=k=>k===u?void 0:k;break;case xt.FIRST:v(),p=0,x=d[p];break;case xt.LAST:v(),p=d.length-1,x=d[p];break;case xt.SET_INDEX:v(),p=c,x=d[p];break;case xt.INCREASE:v(),p=m,p<0&&(p=d.indexOf(u)),p++,p>=d.length&&(p=0),x=d[p];break;case xt.DECREASE:v(),p=m,p<0&&(p=d.indexOf(u)),p--,p<0&&(p=d.length-1),x=d[p];break}x||(p=-1),n(x),o.hoverIndex=p},[t,o]);return{hoverItem:r,dispatch:l,updateItems:s}},c4=(t,e,r,n)=>{const i=e.current.getBoundingClientRect(),o=t.current.getBoundingClientRect(),s=r===window?{left:0,top:0,right:document.documentElement.clientWidth,bottom:window.innerHeight}:r.getBoundingClientRect(),l=Xk(n),a=p=>p+o.left-s.left-l.left,u=p=>p+o.left+i.width-s.right+l.right,c=p=>p+o.top-s.top-l.top,d=p=>p+o.top+i.height-s.bottom+l.bottom;return{menuRect:i,containerRect:o,getLeftOverflow:a,getRightOverflow:u,getTopOverflow:c,getBottomOverflow:d,confineHorizontally:p=>{let x=a(p);if(x<0)p-=x;else{const k=u(p);k>0&&(p-=k,x=a(p),x<0&&(p-=x))}return p},confineVertically:p=>{let x=c(p);if(x<0)p-=x;else{const k=d(p);k>0&&(p-=k,x=c(p),x<0&&(p-=x))}return p}}},f4=({arrowRef:t,menuY:e,anchorRect:r,containerRect:n,menuRect:i})=>{let o=r.top-n.top-e+r.height/2;const s=t.current.offsetHeight*1.25;return o=Math.max(s,o),o=Math.min(o,i.height-s),o},d4=({anchorRect:t,containerRect:e,menuRect:r,placeLeftorRightY:n,placeLeftX:i,placeRightX:o,getLeftOverflow:s,getRightOverflow:l,confineHorizontally:a,confineVertically:u,arrowRef:c,arrow:d,direction:m,position:v})=>{let p=m,x=n;v!=="initial"&&(x=u(x),v==="anchor"&&(x=Math.min(x,t.bottom-e.top),x=Math.max(x,t.top-e.top-r.height)));let k,E,w;return p==="left"?(k=i,v!=="initial"&&(E=s(k),E<0&&(w=l(o),(w<=0||-E>w)&&(k=o,p="right")))):(k=o,v!=="initial"&&(w=l(k),w>0&&(E=s(i),(E>=0||-E{let o=r.left-n.left-e+r.width/2;const s=t.current.offsetWidth*1.25;return o=Math.max(s,o),o=Math.min(o,i.width-s),o},p4=({anchorRect:t,containerRect:e,menuRect:r,placeToporBottomX:n,placeTopY:i,placeBottomY:o,getTopOverflow:s,getBottomOverflow:l,confineHorizontally:a,confineVertically:u,arrowRef:c,arrow:d,direction:m,position:v})=>{let p=m==="top"?"top":"bottom",x=n;v!=="initial"&&(x=a(x),v==="anchor"&&(x=Math.min(x,t.right-e.left),x=Math.max(x,t.left-e.left-r.width)));let k,E,w;return p==="top"?(k=i,v!=="initial"&&(E=s(k),E<0&&(w=l(o),(w<=0||-E>w)&&(k=o,p="bottom")))):(k=o,v!=="initial"&&(w=l(k),w>0&&(E=s(i),(E>=0||-E{const{menuRect:u,containerRect:c}=a,d=r==="left"||r==="right";let m=d?n:i,v=d?i:n;if(t){const B=l.current;d?m+=B.offsetWidth:v+=B.offsetHeight}const p=s.left-c.left-u.width-m,x=s.right-c.left+m,k=s.top-c.top-u.height-v,E=s.bottom-c.top+v;let w,_;e==="end"?(w=s.right-c.left-u.width,_=s.bottom-c.top-u.height):e==="center"?(w=s.left-c.left-(u.width-s.width)/2,_=s.top-c.top-(u.height-s.height)/2):(w=s.left-c.left,_=s.top-c.top),w+=m,_+=v;const O={...a,anchorRect:s,placeLeftX:p,placeRightX:x,placeLeftorRightY:_,placeTopY:k,placeBottomY:E,placeToporBottomX:w,arrowRef:l,arrow:t,direction:r,position:o};switch(r){case"left":case"right":return d4(O);case"top":case"bottom":default:return p4(O)}},ba=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?L.useLayoutEffect:L.useEffect;function Nm(t,e){typeof t=="function"?t(e):t.current=e}const Uh=(t,e)=>L.useMemo(()=>t?e?r=>{Nm(t,r),Nm(e,r)}:t:e,[t,e]),Pm=-9999,g4=({ariaLabel:t,menuClassName:e,menuStyle:r,arrow:n,arrowProps:i={},anchorPoint:o,anchorRef:s,containerRef:l,containerProps:a,focusProps:u,externalRef:c,parentScrollingRef:d,align:m="start",direction:v="bottom",position:p="auto",overflow:x="visible",setDownOverflow:k,repositionFlag:E,captureFocus:w=!0,state:_,endTransition:O,isDisabled:B,menuItemFocus:j,gap:$=0,shift:H=0,children:ie,onClose:X,...G})=>{const[J,C]=L.useState({x:Pm,y:Pm}),[f,g]=L.useState({}),[A,N]=L.useState(),[b,M]=L.useState(v),[R]=L.useState(a4),[S,h]=L.useReducer(ne=>ne+1,1),{transition:P,boundingBoxRef:te,boundingBoxPadding:y,rootMenuRef:D,rootAnchorRef:U,scrollNodesRef:F,reposition:W,viewScroll:oe,submenuCloseDelay:Y}=L.useContext(jh),{submenuCtx:K,reposSubmenu:Je=E}=L.useContext(Sm),Q=L.useRef(null),le=L.useRef(),Qr=L.useRef(),Te=L.useRef(!1),Ne=L.useRef({width:0,height:0}),Jr=L.useRef(()=>{}),{hoverItem:Pe,dispatch:ce,updateItems:wr}=u4(Q,le),fe=G1(_),Oe=ll(P,"open"),Yr=ll(P,"close"),me=F.current,ze=ne=>{switch(ne.key){case $r.HOME:ce(xt.FIRST);break;case $r.END:ce(xt.LAST);break;case $r.UP:ce(xt.DECREASE,Pe);break;case $r.DOWN:ce(xt.INCREASE,Pe);break;case $r.SPACE:ne.target&&ne.target.className.indexOf(Aa)!==-1&&ne.preventDefault();return;default:return}ne.preventDefault(),ne.stopPropagation()},gn=()=>{_==="closing"&&N(),hr(O)},$e=ne=>{ne.stopPropagation(),R.on(Y,()=>{ce(xt.RESET),le.current.focus()})},He=ne=>{ne.target===ne.currentTarget&&R.off()},Ht=L.useCallback(ne=>{var ot;const ge=s?(ot=s.current)==null?void 0:ot.getBoundingClientRect():o?{left:o.x,right:o.x,top:o.y,bottom:o.y,width:0,height:0}:null;if(!ge)return;me.menu||(me.menu=(te?te.current:lf(D.current))||window);const de=c4(l,Q,me.menu,y);let{arrowX:rt,arrowY:be,x:_e,y:Ct,computedDirection:Me}=m4({arrow:n,align:m,direction:v,gap:$,shift:H,position:p,anchorRect:ge,arrowRef:Qr,positionHelpers:de});const{menuRect:je}=de;let Kt=je.height;if(!ne&&x!=="visible"){const{getTopOverflow:Ve,getBottomOverflow:Ke}=de;let Qt,Ie;const Ue=Ne.current.height,Er=Ke(Ct);if(Er>0||Vi(Er,0)&&Vi(Kt,Ue))Qt=Kt-Er,Ie=Er;else{const ke=Ve(Ct);(ke<0||Vi(ke,0)&&Vi(Kt,Ue))&&(Qt=Kt+ke,Ie=0-ke,Qt>=0&&(Ct-=ke))}Qt>=0?(Kt=Qt,N({height:Qt,overflowAmt:Ie})):N()}n&&g({x:rt,y:be}),C({x:_e,y:Ct}),M(Me),Ne.current={width:je.width,height:Kt}},[n,m,y,v,$,H,p,x,o,s,l,te,D,me]);ba(()=>{fe&&(Ht(),Te.current&&h()),Te.current=fe,Jr.current=Ht},[fe,Ht,Je]),ba(()=>{A&&!k&&(Q.current.scrollTop=0)},[A,k]),ba(()=>wr,[wr]),L.useEffect(()=>{let{menu:ne}=me;if(!fe||!ne)return;if(ne=ne.addEventListener?ne:window,!me.anchors){me.anchors=[];let rt=lf(U&&U.current);for(;rt&&rt!==ne;)me.anchors.push(rt),rt=lf(rt)}let ot=oe;if(me.anchors.length&&ot==="initial"&&(ot="auto"),ot==="initial")return;const ge=()=>{ot==="auto"?bm(()=>Ht(!0)):hr(X,{reason:ul.SCROLL})},de=me.anchors.concat(oe!=="initial"?ne:[]);return de.forEach(rt=>rt.addEventListener("scroll",ge)),()=>de.forEach(rt=>rt.removeEventListener("scroll",ge))},[U,me,fe,X,oe,Ht]);const Le=!!A&&A.overflowAmt>0;L.useEffect(()=>{if(Le||!fe||!d)return;const ne=()=>bm(Ht),ot=d.current;return ot.addEventListener("scroll",ne),()=>ot.removeEventListener("scroll",ne)},[fe,Le,d,Ht]),L.useEffect(()=>{if(typeof ResizeObserver!="function"||W==="initial")return;const ne=new ResizeObserver(([ge])=>{const{borderBoxSize:de,target:rt}=ge;let be,_e;if(de){const{inlineSize:Ct,blockSize:Me}=de[0]||de;be=Ct,_e=Me}else{const Ct=rt.getBoundingClientRect();be=Ct.width,_e=Ct.height}be===0||_e===0||Vi(be,Ne.current.width,1)&&Vi(_e,Ne.current.height,1)||Qs.flushSync(()=>{Jr.current(),h()})}),ot=Q.current;return ne.observe(ot,{box:"border-box"}),()=>ne.unobserve(ot)},[W]),L.useEffect(()=>{if(!fe){ce(xt.RESET),Yr||N();return}const{position:ne,alwaysUpdate:ot}=j||{},ge=()=>{ne===Ms.FIRST?ce(xt.FIRST):ne===Ms.LAST?ce(xt.LAST):ne>=-1&&ce(xt.SET_INDEX,void 0,ne)};if(ot)ge();else if(w){const de=setTimeout(()=>{const rt=Q.current;rt&&!rt.contains(document.activeElement)&&(le.current.focus(),ge())},Oe?170:100);return()=>clearTimeout(de)}},[fe,Oe,Yr,w,j,ce]);const qe=L.useMemo(()=>({isParentOpen:fe,submenuCtx:R,dispatch:ce,updateItems:wr}),[fe,R,ce,wr]);let Rr,Ce;A&&(k?Ce=A.overflowAmt:Rr=A.height);const We=L.useMemo(()=>({reposSubmenu:S,submenuCtx:R,overflow:x,overflowAmt:Ce,parentMenuRef:Q,parentDir:b}),[S,R,x,Ce,b]),vn=Rr>=0?{maxHeight:Rr,overflow:x}:void 0,Be=L.useMemo(()=>({state:_,dir:b}),[_,b]),Ge=L.useMemo(()=>({dir:b}),[b]),yn=al({block:Aa,element:t4,modifiers:Ge,className:i.className}),De=I.jsxs("ul",{role:"menu","aria-label":t,...K1(B),...Ku({onPointerEnter:K==null?void 0:K.off,onPointerMove:$e,onPointerLeave:He,onKeyDown:ze,onAnimationEnd:gn},G),ref:Uh(c,Q),className:al({block:Aa,modifiers:Be,className:e}),style:{...r,...vn,margin:0,display:_==="closed"?"none":void 0,position:af,left:J.x,top:J.y},children:[I.jsx("li",{tabIndex:-1,style:{position:af,left:0,top:0,display:"block",outline:"none"},ref:le,...km,...u}),n&&I.jsx("li",{...km,...i,className:yn,style:{display:"block",position:af,left:f.x,top:f.y,...i.style},ref:Qr}),I.jsx(Sm.Provider,{value:We,children:I.jsx(J1.Provider,{value:qe,children:I.jsx(Q1.Provider,{value:Pe,children:hr(ie,Be)})})})]});return a?I.jsx(l4,{...a,isOpen:fe,children:De}):De},v4=L.forwardRef(function({"aria-label":e,className:r,containerProps:n,initialMounted:i,unmountOnClose:o,transition:s,transitionTimeout:l,boundingBoxRef:a,boundingBoxPadding:u,reposition:c="auto",submenuOpenDelay:d=300,submenuCloseDelay:m=150,viewScroll:v="initial",portal:p,theming:x,onItemClick:k,...E},w){const _=L.useRef(null),O=L.useRef({}),{anchorRef:B,state:j,onClose:$}=E,H=L.useMemo(()=>({initialMounted:i,unmountOnClose:o,transition:s,transitionTimeout:l,boundingBoxRef:a,boundingBoxPadding:u,rootMenuRef:_,rootAnchorRef:B,scrollNodesRef:O,reposition:c,viewScroll:v,submenuOpenDelay:d,submenuCloseDelay:m}),[i,o,s,l,B,a,u,c,v,d,m]),ie=L.useMemo(()=>({handleClick(G,J){G.stopPropagation||hr(k,G);let C=G.keepOpen;C===void 0&&(C=J&&G.key===$r.SPACE),C||hr($,{value:G.value,key:G.key,reason:ul.CLICK})},handleClose(G){hr($,{key:G,reason:ul.CLICK})}}),[k,$]);if(!j)return null;const X=I.jsx(jh.Provider,{value:H,children:I.jsx(Y1.Provider,{value:ie,children:I.jsx(g4,{...E,ariaLabel:e||"Menu",externalRef:w,containerRef:_,containerProps:{className:r,containerRef:_,containerProps:n,theming:x,transition:s,onClose:$}})})});return p===!0&&typeof document<"u"?Qs.createPortal(X,document.body):p?p.target?Qs.createPortal(X,p.target):p.stablePosition?null:X:X}),xd=0,Ad=1,au=2,uu=3,cu=4,y4=5,Z1=6,w4=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],ew=t=>({_s:t,status:w4[t],isEnter:tcu}),bd=t=>t?Z1:y4,E4=(t,e)=>{switch(t){case Ad:case xd:return au;case cu:case uu:return bd(e)}},x4=t=>typeof t=="object"?[t.enter,t.exit]:[t,t],A4=(t,e)=>setTimeout(()=>{isNaN(document.body.offsetTop)||t(e+1)},0),Cm=(t,e,r,n,i)=>{clearTimeout(n.current);const o=ew(t);e(o),r.current=o,i&&i({current:o})},b4=({enter:t=!0,exit:e=!0,preEnter:r,preExit:n,timeout:i,initialEntered:o,mountOnEnter:s,unmountOnExit:l,onStateChange:a}={})=>{const[u,c]=L.useState(()=>ew(o?au:bd(s))),d=L.useRef(u),m=L.useRef(),[v,p]=x4(i),x=L.useCallback(()=>{const E=E4(d.current._s,l);E&&Cm(E,c,d,m,a)},[a,l]),k=L.useCallback(E=>{const w=O=>{switch(Cm(O,c,d,m,a),O){case Ad:v>=0&&(m.current=setTimeout(x,v));break;case cu:p>=0&&(m.current=setTimeout(x,p));break;case xd:case uu:m.current=A4(w,O);break}},_=d.current.isEnter;typeof E!="boolean"&&(E=!_),E?!_&&w(t?r?xd:Ad:au):_&&w(e?n?uu:cu:bd(l))},[x,a,t,e,r,n,v,p,l]);return L.useEffect(()=>()=>clearTimeout(m.current),[]),[u,k,x]},_4=({initialOpen:t,initialMounted:e,unmountOnClose:r,transition:n,transitionTimeout:i=500}={})=>{const[{status:o},s,l]=b4({initialEntered:t,mountOnEnter:!e,unmountOnExit:r,timeout:i,enter:ll(n,"open"),exit:ll(n,"close")});return[{state:i4[o],endTransition:l},s]},S4=t=>{const[e,r]=_4(t),[n,i]=L.useState(),o=(s,l)=>{i({position:s,alwaysUpdate:l}),r(!0)};return[{menuItemFocus:n,...e},r,o]},k4=(t,e)=>{const[r]=L.useState({});return{onMouseDown:()=>{r.v=t&&t!=="closed"},onClick:n=>r.v?r.v=!1:e(!0,n)}},N4=(t,e)=>{const r=L.useRef(e);L.useEffect(()=>{r.current!==e&&hr(t,{open:e}),r.current=e},[t,e])},P4=L.forwardRef(function({"aria-label":e,captureFocus:r,initialOpen:n,menuButton:i,instanceRef:o,onMenuChange:s,...l},a){const[u,c,d]=S4(l),{state:m}=u,v=G1(m),p=L.useRef(null),x=k4(m,(B,j)=>d(j.detail?void 0:Ms.FIRST)),k=L.useCallback(B=>{c(!1),B.key&&p.current.focus()},[c]),E=B=>{switch(B.key){case $r.UP:d(Ms.LAST);break;case $r.DOWN:d(Ms.FIRST);break;default:return}B.preventDefault()},w=hr(i,{open:v});if(!w||!w.type)throw new Error("Menu requires a menuButton prop.");const _={ref:Uh(w.ref,p),...Ku({onKeyDown:E,...x},w.props)};Jk(w.type)==="MenuButton"&&(_.isOpen=v);const O=L.cloneElement(w,_);return N4(s,v),L.useImperativeHandle(o,()=>({openMenu:d,closeMenu:()=>c(!1)})),I.jsxs(L.Fragment,{children:[O,I.jsx(v4,{...l,...u,"aria-label":e||(typeof w.props.children=="string"?w.props.children:"Menu"),anchorRef:p,ref:a,onClose:k})]})}),C4=(t,e)=>{const r=L.memo(e),n=L.forwardRef((i,o)=>{const s=L.useRef(null);return I.jsx(r,{...i,itemRef:s,externalRef:o,isHovering:L.useContext(Q1)===s.current})});return n.displayName=`WithHovering(${t})`,n},M4=(t,e,r)=>{ba(()=>{if(t)return;const n=e.current;return r(n,!0),()=>{r(n)}},[t,e,r])},I4=(t,e,r,n)=>{const{submenuCloseDelay:i}=L.useContext(jh),{isParentOpen:o,submenuCtx:s,dispatch:l,updateItems:a}=L.useContext(J1),u=()=>{!r&&!n&&l(xt.SET,t.current)},c=()=>{!n&&l(xt.UNSET,t.current)},d=p=>{r&&!p.currentTarget.contains(p.relatedTarget)&&c()},m=p=>{n||(p.stopPropagation(),s.on(i,u,u))},v=(p,x)=>{s.off(),!x&&c()};return M4(n,t,a),L.useEffect(()=>{r&&o&&e.current&&e.current.focus()},[e,r,o]),{setHover:u,onBlur:d,onPointerMove:m,onPointerLeave:v}},Ki=C4("MenuItem",function({className:e,value:r,href:n,type:i,checked:o,disabled:s,children:l,onClick:a,isHovering:u,itemRef:c,externalRef:d,...m}){const v=!!s,{setHover:p,...x}=I4(c,c,u,v),k=L.useContext(Y1),E=L.useContext(n4),w=i==="radio",_=i==="checkbox",O=!!n&&!v&&!w&&!_,B=w?E.value===r:_?!!o:!1,j=G=>{if(v){G.stopPropagation(),G.preventDefault();return}const J={value:r,syntheticEvent:G};G.key!==void 0&&(J.key=G.key),_&&(J.checked=!B),w&&(J.name=E.name),hr(a,J),w&&hr(E.onRadioChange,J),k.handleClick(J,_||w)},$=G=>{if(u)switch(G.key){case $r.ENTER:G.preventDefault();case $r.SPACE:O?c.current.click():j(G)}},H=L.useMemo(()=>({type:i,disabled:v,hover:u,checked:B,anchor:O}),[i,v,u,B,O]),ie=Ku({...x,onPointerDown:p,onKeyDown:$,onClick:j},m),X={role:w?"menuitemradio":_?"menuitemcheckbox":X1,"aria-checked":w||_?B:void 0,...K1(v,u),...ie,ref:Uh(d,c),className:al({block:Aa,element:r4,modifiers:H,className:e}),children:L.useMemo(()=>hr(l,H),[l,H])};return O?I.jsx("li",{role:o4,children:I.jsx("a",{href:n,...X})}):I.jsx("li",{...X})});function Mm({...t}){return I.jsx(P4,{...t,className:"dropdown "+t.className,menuButton:I.jsx(s4,{className:"unstyled",children:I.jsx(Ok,{style:{marginBottom:"-0.125em"}})}),children:t.children})}function R4({app:t}){var s,l,a,u,c;const{uninstallApp:e,setMirroring:r,setAutoUpdate:n}=Qo(),i=Iu();return!t.state?t.metadata?I.jsxs(Mm,{children:[((s=t.metadata)==null?void 0:s.description)&&I.jsx(Ki,{className:"action-entry",onClick:()=>i(`/app-details/${xe(t)}`),children:"View Details"}),((l=t.metadata)==null?void 0:l.website)&&I.jsx(Ki,{children:I.jsx("a",{style:{color:"inherit",whiteSpace:"nowrap",cursor:"pointer",marginTop:"0.25em"},target:"_blank",href:(a=t.metadata)==null?void 0:a.website,children:"View Site"})})]}):I.jsx("div",{style:{width:24}}):I.jsxs(Mm,{children:[I.jsx(Ki,{className:"action-entry",onClick:()=>i(`/app-details/${xe(t)}`),children:"View Details"}),t.installed&&I.jsxs(I.Fragment,{children:[I.jsx(Ki,{className:"action-entry",onClick:()=>e(t),children:"Uninstall"}),I.jsxs(Ki,{className:"action-entry",onClick:()=>{var d;return r(t,!((d=t.state)!=null&&d.mirroring))},children:[(u=t.state)!=null&&u.mirroring?"Stop":"Start"," Mirroring"]}),I.jsxs(Ki,{className:"action-entry",onClick:()=>{var d;return n(t,!((d=t.state)!=null&&d.auto_update))},children:[(c=t.state)!=null&&c.auto_update?"Disable":"Enable"," Auto Update"]})]})]})}function ys({app:t,...e}){var r;return L.createElement("div",{...e,key:xe(t),className:"app-entry row between"},I.jsx(q1,{app:t,size:"small"}),I.jsxs("div",{className:"app-actions row",children:[!((r=t.state)!=null&&r.capsApproved)&&I.jsx(W1,{app:t,style:{marginRight:"1em"}}),I.jsx(R4,{app:t})]}))}const _d="/my-apps";function Qu({value:t="",onChange:e=()=>null,hideSearch:r=!1}){const n=Iu(),i=xh(),o=qr.useRef(null),s=i.key!=="default",l=i.pathname===_d;return I.jsxs("div",{className:"search-header row between",children:[i.pathname!=="/"?I.jsx("button",{className:"back-btn col center",onClick:()=>n(s?-1:"/"),children:I.jsx(Mk,{})}):I.jsx("button",{className:"back-btn col center",onClick:()=>n("/publish"),children:I.jsx(z1,{})}),!r&&I.jsxs("div",{className:"searchbar row",children:[I.jsx(Bk,{className:"search-icon",onClick:()=>{var a;return(a=o.current)==null?void 0:a.focus()}}),I.jsx("input",{ref:o,onChange:a=>e(a.target.value),value:t,placeholder:"Search for apps..."}),t.length>0&&I.jsx(Dk,{className:"search-icon",style:{margin:"0 -0.25em 0 0.25em"},onClick:()=>e("")})]}),I.jsx("div",{className:"row",children:I.jsxs("button",{className:`my-pkg-btn row ${l?"selected":""}`,onClick:()=>n(l?-1:_d),children:[I.jsx(Tk,{style:{marginRight:"0.5em"}}),"My Packages"]})})]})}function T4(t){const{listedApps:e,getListedApps:r}=Qo(),[n,i]=L.useState("Recently published"),[o,s]=L.useState(""),[l,a]=L.useState(e),[u,c]=L.useState(1),d=L.useMemo(()=>Array.from({length:Math.ceil(l.length/10)},(p,x)=>x+1),[l]);L.useEffect(()=>{const p=(u-1)*10,x=p+10;a(e.slice(p,x))},[e]),L.useEffect(()=>{r().then(p=>{a(Object.values(p))}).catch(p=>console.error(p))},[]);const m=L.useCallback(async p=>{},[]),v=L.useCallback(p=>{s(p);const x=e.filter(k=>{var E,w,_,O;return k.package.toLowerCase().includes(p.toLowerCase())||((w=(E=k.metadata)==null?void 0:E.description)==null?void 0:w.toLowerCase().includes(p.toLowerCase()))||((O=(_=k.metadata)==null?void 0:_.description)==null?void 0:O.toLowerCase().includes(p.toLowerCase()))},[e]);a(x)},[e]);return I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{value:o,onChange:v}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"New"}),I.jsxs("select",{value:n,onChange:p=>{i(p.target.value),m(p.target.value)},style:{marginBottom:"-1em"},children:[I.jsx("option",{children:"Recently published"}),I.jsx("option",{children:"Most popular"}),I.jsx("option",{children:"Best rating"}),I.jsx("option",{children:"Recently updated"})]})]}),I.jsxs("div",{className:"new card col",style:{flex:1,overflowY:"scroll"},children:[l.map(p=>{var x;return I.jsx(ys,{app:p},xe(p)+(((x=p.state)==null?void 0:x.our_version)||""))}),d.length>1&&I.jsxs("div",{className:"row",style:{alignSelf:"center"},children:[u!==d[0]&&I.jsx(Ik,{onClick:()=>c(u-1)}),d.map(p=>I.jsx("div",{className:`page-selector ${p===u?"selected":""}`,onClick:()=>c(p),children:p},`page-${p}`)),u!==d[d.length-1]&&I.jsx(Rk,{onClick:()=>c(u+1)})]})]})]})}function O4(t){const{myApps:e,getMyApps:r}=Qo(),n=Iu(),[i,o]=L.useState(""),[s,l]=L.useState(e);L.useEffect(()=>{r().then(l).catch(u=>console.error(u))},[]);const a=L.useCallback(u=>{o(u);const c=Object.keys(e).reduce((d,m)=>(d[m]=e[m].filter(v=>{var p,x,k,E;return v.package.toLowerCase().includes(u.toLowerCase())||((x=(p=v.metadata)==null?void 0:p.description)==null?void 0:x.toLowerCase().includes(u.toLowerCase()))||((E=(k=v.metadata)==null?void 0:k.description)==null?void 0:E.toLowerCase().includes(u.toLowerCase()))}),d),{downloaded:[],installed:[],local:[],system:[]});l(c)},[e]);return I.jsxs("div",{style:{width:"100%",height:"100%"},children:[I.jsx(Qu,{value:i,onChange:a}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"My Packages"}),I.jsxs("button",{className:"row",onClick:()=>n("/publish"),children:[I.jsx(z1,{style:{marginRight:"0.5em"}}),"Publish Package"]})]}),I.jsx("div",{className:"my-apps-list",children:I.jsxs("div",{className:"new card col",children:[I.jsx("h3",{children:"Downloaded"}),(s.downloaded||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"Installed"}),(s.installed||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"Local"}),(s.local||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"System"}),(s.system||[]).map(u=>I.jsx(ys,{app:u},xe(u)))]})})]})}function L4(t){var a,u,c,d,m;const{myApps:e,listedApps:r}=Qo(),n=lx(),[i,o]=L.useState(void 0);L.useEffect(()=>{const v=e.local.find(p=>xe(p)===n.id);if(v)return o(v);if(n.id){const p=r.find(x=>xe(x)===n.id);if(p)return o(p)}},[n,e,r]);const s=L.useMemo(()=>{var v;return((v=i==null?void 0:i.metadata)==null?void 0:v.version)||"Unknown"},[i]),l=((a=i==null?void 0:i.state)==null?void 0:a.our_version)||"";return i?I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{value:"",onChange:()=>null,hideSearch:!0}),I.jsx("div",{className:"card",style:{marginTop:"1em"},children:i?I.jsxs(I.Fragment,{children:[I.jsxs("div",{className:"row between",children:[I.jsx(q1,{app:i,size:"large"}),I.jsx(W1,{app:i,style:{marginRight:"0.5em"}})]}),I.jsxs("div",{className:"col",style:{marginTop:"1em"},children:[I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Description"}),I.jsx("div",{className:"value",children:(((u=i.metadata)==null?void 0:u.description)||"No description given").slice(0,2e3)})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Publisher"}),I.jsx("div",{className:"value underline",children:i.publisher})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Version"}),I.jsx("div",{className:"value",children:s})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Mirrors"}),I.jsx("div",{className:"col",children:(((c=i.metadata)==null?void 0:c.mirrors)||[]).map((v,p)=>I.jsx("div",{className:"value underline",children:v},p+v))})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Permissions"}),I.jsx("div",{className:"col",children:(d=i.permissions)==null?void 0:d.map((v,p)=>I.jsx("div",{className:"value permission",children:v},p+v))})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Hash"}),I.jsx("div",{className:"value",style:{wordBreak:"break-all"},children:l})]})]}),I.jsx("div",{className:"app-screenshots row",children:(((m=i.metadata)==null?void 0:m.screenshots)||[]).map((v,p)=>I.jsx("img",{src:v},p+v))})]}):I.jsx("h3",{children:"App not found"})})]}):I.jsx("div",{children:"Loading..."})}var _a=(t=>(t[t.SEPOLIA=11155111]="SEPOLIA",t[t.OPTIMISM=10]="OPTIMISM",t[t.OPTIMISM_GOERLI=420]="OPTIMISM_GOERLI",t[t.LOCAL=1337]="LOCAL",t))(_a||{});const fu="0xaa36a7",Im="0xa",Rm={11155111:"0x18c39eB547A0060C6034f8bEaFB947D1C16eADF1"},B4="4902",Tm={[fu]:{chainId:fu,chainName:"Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:["https://rpc.sepolia.org"],blockExplorerUrls:["https://sepolia.etherscan.io"]},[Im]:{chainId:Im,chainName:"Optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:["https://mainnet.optimism.io"],blockExplorerUrls:["https://optimistic.etherscan.io"]}},D4=t=>{switch(t){case"1":case"0x1":return"Ethereum";case"10":case"a":case"0xa":return"Optimism";case"42161":return"Arbitrum";case"11155111":case"aa36a7":case"0xaa36a7":return"Sepolia";default:return"Unknown"}},Om=async t=>{var r,n,i;let e=await((r=window.ethereum)==null?void 0:r.request({method:"net_version"}).catch(()=>"1"));if(e="0x"+(typeof e=="string"?e.replace(/^0x/,""):e.toString(16)),!Tm[t]){console.error(`Invalid chain ID: ${t}`);return}if(t!==e)try{await((n=window.ethereum)==null?void 0:n.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}))}catch(o){if(String(o).includes(B4))await((i=window.ethereum)==null?void 0:i.request({method:"wallet_addEthereumChain",params:[Tm[t]]}));else throw window.alert(`You must enable the ${D4(t)} network in your wallet.`),new Error(`User cancelled connection to ${t}`)}};var cl={},Ju={};Object.defineProperty(Ju,"__esModule",{value:!0});Ju.Connector=void 0;class j4{constructor(e,r){this.actions=e,this.onError=r}resetState(){this.actions.resetState()}}Ju.Connector=j4;var uf,Lm;function U4(){if(Lm)return uf;Lm=1;function t({mustBeMetaMask:e=!1,silent:r=!1,timeout:n=3e3}={}){o();let i=!1;return new Promise(s=>{window.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout(()=>{l()},n));function l(){if(i)return;i=!0,window.removeEventListener("ethereum#initialized",l);const{ethereum:a}=window;a&&(!e||a.isMetaMask)?s(a):(!r&&console.error("@metamask/detect-provider:",e&&a?"Non-MetaMask window.ethereum detected.":"Unable to detect window.ethereum."),s(null))}});function o(){if(typeof e!="boolean")throw new Error("@metamask/detect-provider: Expected option 'mustBeMetaMask' to be a boolean.");if(typeof r!="boolean")throw new Error("@metamask/detect-provider: Expected option 'silent' to be a boolean.");if(typeof n!="number")throw new Error("@metamask/detect-provider: Expected option 'timeout' to be a number.")}}return uf=t,uf}var F4=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z4=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$4=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&F4(e,t,r);return z4(e,t),e},Qi=Fe&&Fe.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(cl,"__esModule",{value:!0});var tw=cl.MetaMask=cl.NoMetaMaskError=void 0;const H4=Ju;class fl extends Error{constructor(){super("MetaMask not installed"),this.name=fl.name,Object.setPrototypeOf(this,fl.prototype)}}cl.NoMetaMaskError=fl;function Zl(t){return Number.parseInt(t,16)}class q4 extends H4.Connector{constructor({actions:e,options:r,onError:n}){super(e,n),this.options=r}isomorphicInitialize(){return Qi(this,void 0,void 0,function*(){if(!this.eagerConnection)return this.eagerConnection=Promise.resolve().then(()=>$4(U4())).then(e=>Qi(this,void 0,void 0,function*(){var r,n;const i=yield e.default(this.options);i&&(this.provider=i,!((r=this.provider.providers)===null||r===void 0)&&r.length&&(this.provider=(n=this.provider.providers.find(o=>o.isMetaMask))!==null&&n!==void 0?n:this.provider.providers[0]),this.provider.on("connect",({chainId:o})=>{this.actions.update({chainId:Zl(o)})}),this.provider.on("disconnect",o=>{var s;if(o.code===1013){console.debug('MetaMask logged connection error 1013: "Try again later"');return}this.actions.resetState(),(s=this.onError)===null||s===void 0||s.call(this,o)}),this.provider.on("chainChanged",o=>{this.actions.update({chainId:Zl(o)})}),this.provider.on("accountsChanged",o=>{o.length===0?this.actions.resetState():this.actions.update({accounts:o})}))}))})}connectEagerly(){return Qi(this,void 0,void 0,function*(){const e=this.actions.startActivation();try{if(yield this.isomorphicInitialize(),!this.provider)return e();const r=yield this.provider.request({method:"eth_accounts"});if(!r.length)throw new Error("No accounts returned");const n=yield this.provider.request({method:"eth_chainId"});this.actions.update({chainId:Zl(n),accounts:r})}catch(r){console.debug("Could not connect eagerly",r),this.actions.resetState()}})}activate(e){var r,n;return Qi(this,void 0,void 0,function*(){let i;return!((n=(r=this.provider)===null||r===void 0?void 0:r.isConnected)===null||n===void 0)&&n.call(r)||(i=this.actions.startActivation()),this.isomorphicInitialize().then(()=>Qi(this,void 0,void 0,function*(){if(!this.provider)throw new fl;const o=yield this.provider.request({method:"eth_requestAccounts"}),s=yield this.provider.request({method:"eth_chainId"}),l=Zl(s),a=typeof e=="number"?e:e==null?void 0:e.chainId;if(!a||l===a)return this.actions.update({chainId:l,accounts:o});const u=`0x${a.toString(16)}`;return this.provider.request({method:"wallet_switchEthereumChain",params:[{chainId:u}]}).catch(c=>{var d,m;if((((m=(d=c.data)===null||d===void 0?void 0:d.originalError)===null||m===void 0?void 0:m.code)||c.code)===4902&&typeof e!="number"){if(!this.provider)throw new Error("No provider");return this.provider.request({method:"wallet_addEthereumChain",params:[Object.assign(Object.assign({},e),{chainId:u})]})}throw c}).then(()=>this.activate(a))})).catch(o=>{throw i==null||i(),o})})}watchAsset({address:e,symbol:r,decimals:n,image:i}){return Qi(this,void 0,void 0,function*(){if(!this.provider)throw new Error("No provider");return this.provider.request({method:"wallet_watchAsset",params:{type:"ERC20",options:{address:e,symbol:r,decimals:n,image:i}}}).then(o=>{if(!o)throw new Error("Rejected");return!0})})}}tw=cl.MetaMask=q4;const[rw,Fh]=qu.initializeConnector(t=>new tw({actions:t}));function W4(t){const e=t.split("."),r=new Uint8Array(t.length+e.length);let n=0;for(const i of e){const o=i.length;r[n]=o,n++;for(let s=0;si.toString(16).padStart(2,"0")).join("")}`}const{useIsActivating:G4}=Fh;function V4({provider:t,packageAbi:e}){var X;const{listedApps:r}=Qo(),{account:n,isActive:i}=qu.useWeb3React(),o=G4(),[s,l]=L.useState(""),[a,u]=L.useState(),[c,d]=L.useState(!1),[m,v]=L.useState(""),[p,x]=L.useState(((X=window.our)==null?void 0:X.node)||""),[k,E]=L.useState(""),[w,_]=L.useState(""),[O,B]=L.useState(!1),j=L.useCallback(async()=>{await rw.activate().catch(()=>{});try{Om(fu)}catch(G){console.error(G)}},[]),$=L.useCallback(async()=>{if(!k){_("");return}try{const J=await(await fetch(k)).text();JSON.parse(J);const C=ut(mr(J));_(C)}catch{window.alert("Error calculating metadata hash. Please ensure the URL is valid and the metadata is in JSON format.")}},[k]),H=L.useCallback(async G=>{var C;G.preventDefault(),G.stopPropagation();let J=w;try{if(!J){const A=await fetch(k);await A.json();const N=await A.text();J=ut(mr(N))}l("Please confirm the transaction in your wallet");const f=W4(p);await Om(fu);const g=await(O?e.updateMetadata(V.from(mS(["string","bytes"],[m,f])),k,J):e.registerApp(m,f,k,J));await new Promise(A=>setTimeout(A,2e3)),l("Publishing package..."),await g.wait(),u({packageName:m,publisherId:p}),v(""),x(((C=window.our)==null?void 0:C.node)||p),E(""),_(""),B(!1)}catch(f){console.error(f),window.alert("Error publishing package. Please ensure the package name and publisher ID are valid, and the metadata is in JSON format.")}finally{l("")}},[m,O,p,k,w,e,u,v,x,E,_,B]),ie=L.useCallback(async()=>{O||m&&p&&r.find(G=>G.package===m&&G.publisher===p)&&B(!0)},[r,m,p,O,B]);return I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{hideSearch:!0}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"Publish Package"}),!!n&&I.jsxs("div",{style:{textAlign:"right",lineHeight:1.5},children:[" ","Connected as"," ",(n==null?void 0:n.slice(0,6))+"..."+(n==null?void 0:n.slice(n.length-6))]})]}),s?I.jsx("div",{className:"col center",children:I.jsx(Ed,{msg:s})}):a?I.jsxs("div",{className:"col center",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"Package Published!"}),I.jsxs("div",{style:{marginBottom:"0.5em"},children:[I.jsx("strong",{children:"Package Name:"})," ",a.packageName]}),I.jsxs("div",{style:{marginBottom:"0.5em"},children:[I.jsx("strong",{children:"Publisher ID:"})," ",a.publisherId]}),I.jsx("button",{className:"my-pkg-btn row",style:{marginTop:"1em"},onClick:()=>u(void 0),children:"Publish Another Package"})]}):!n||!i?I.jsxs(I.Fragment,{children:[I.jsx("h4",{style:{},children:"Please connect your wallet to publish a package"}),I.jsx("button",{className:"my-pkg-btn row",onClick:j,children:"Connect Wallet"})]}):o?I.jsx(Ed,{msg:"Approve connection in your wallet"}):I.jsxs("form",{className:"new card col",style:{flex:1,overflowY:"scroll"},onSubmit:H,children:[I.jsxs("div",{className:"row between",style:{cursor:"pointer",padding:"0.5em",margin:"0 0 0.5em -0.5em"},onClick:()=>B(!O),children:[I.jsx("input",{type:"checkbox",checked:O,readOnly:!0}),I.jsx("label",{htmlFor:"update",style:{cursor:"pointer"},children:"Update existing package"})]}),I.jsxs("div",{className:"col f-width",children:[I.jsx("label",{htmlFor:"package-name",children:"Package Name"}),I.jsx("input",{style:{minWidth:"80%"},id:"package-name",type:"text",required:!0,placeholder:"my-package",value:m,onChange:G=>v(G.target.value),onBlur:ie})]}),I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsx("label",{htmlFor:"publisher-id",children:"Publisher ID"}),I.jsx("input",{style:{minWidth:"80%"},id:"publisher-id",type:"text",required:!0,value:p,onChange:G=>x(G.target.value),onBlur:ie})]}),I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsxs("label",{htmlFor:"metadata-url",children:["Metadata URL",I.jsx("span",{style:{marginLeft:"2em",fontSize:"0.9em",textDecoration:"underline",cursor:"pointer"},onClick:()=>d(!c),children:"What is this?"})]}),c&&I.jsxs("div",{style:{textAlign:"left",marginBottom:"0.5em"},children:["Metadata is a JSON file that describes your package.",I.jsx("br",{})," You can"," ",I.jsx("a",{target:"_blank",href:"https://pongo-uploads.s3.us-east-2.amazonaws.com/sample_metadata.json",children:"download a template here"}),"."]}),I.jsx("input",{style:{minWidth:"80%"},id:"metadata-url",type:"text",required:!0,value:k,onChange:G=>E(G.target.value),onBlur:$,placeholder:"https://my-site/metadata.json"})]}),I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsx("label",{htmlFor:"metadata-hash",children:"Metadata Hash"}),I.jsx("input",{style:{minWidth:"80%"},readOnly:!0,id:"metadata-hash",type:"text",value:w,onChange:G=>_(G.target.value),placeholder:"Calculated automatically from metadata URL"})]}),I.jsx("button",{type:"submit",className:"primary",style:{marginTop:"1em"},children:"Publish"})]})]})}var K4={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Q4=[[rw,Fh]],{useProvider:J4}=Fh,Y4="https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",Is="/main:app_store:sys";window.our&&(window.our.process=Is==null?void 0:Is.replace("/",""));const X4=`${K4.VITE_NODE_URL||"http://localhost:8080"}${Is}`;function Z4(){const t=J4(),[e,r]=L.useState(!0),[n,i]=L.useState(wd.connect(Rm[_a.SEPOLIA],new vi(Y4)));if(L.useEffect(()=>{t==null||t.getNetwork().then(s=>{s.chainId===_a.SEPOLIA&&i(wd.connect(Rm[_a.SEPOLIA],t.getSigner()))})},[t]),L.useEffect(()=>{},[]),!e)return I.jsxs("div",{className:"node-not-connected",children:[I.jsx("h2",{style:{color:"red"},children:"Node not connected"}),I.jsxs("h4",{children:["You need to start a node at ",X4," before you can use this UI in development."]})]});const o={provider:t,packageAbi:n};return I.jsx(qu.Web3ReactProvider,{connectors:Q4,children:I.jsx(_x,{basename:Is,children:I.jsxs(Ax,{children:[I.jsx(ms,{path:"/",element:I.jsx(T4,{...o})}),I.jsx(ms,{path:_d,element:I.jsx(O4,{...o})}),I.jsx(ms,{path:"/app-details/:id",element:I.jsx(L4,{...o})}),I.jsx(ms,{path:"/publish",element:I.jsx(V4,{...o})})]})})})}cf.createRoot(document.getElementById("root")).render(I.jsx(qr.StrictMode,{children:I.jsx(Z4,{})})); diff --git a/kinode/packages/app_store/pkg/ui/index.html b/kinode/packages/app_store/pkg/ui/index.html index 62ed67cd3..ba5860101 100644 --- a/kinode/packages/app_store/pkg/ui/index.html +++ b/kinode/packages/app_store/pkg/ui/index.html @@ -18,7 +18,7 @@ content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1.00001, viewport-fit=cover" /> - + From 79b1a6f1f9edd7aa8b15cfc7b90a9c24e71c4bad Mon Sep 17 00:00:00 2001 From: hosted-fornet Date: Wed, 14 Feb 2024 21:37:53 -0800 Subject: [PATCH 068/171] build-release: use `uname -m` instead of `-p` --- scripts/build-release.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/build-release.py b/scripts/build-release.py index 353f386a8..b270ab379 100755 --- a/scripts/build-release.py +++ b/scripts/build-release.py @@ -8,7 +8,7 @@ def get_system_info(): # Get OS and architecture information os_info = subprocess.run(["uname"], capture_output=True, text=True, check=True).stdout.strip().lower() - arch_info = subprocess.run(["uname", "-p"], capture_output=True, text=True, check=True).stdout.strip().lower() + arch_info = subprocess.run(["uname", "-m"], capture_output=True, text=True, check=True).stdout.strip().lower() if os_info == "linux": os_info = "unknown-linux-gnu" From db50846909f757770d1be2b4ffa8e5b0cfb95420 Mon Sep 17 00:00:00 2001 From: Will Galebach Date: Thu, 15 Feb 2024 15:59:40 +0000 Subject: [PATCH 069/171] Incoming HTTP request updates --- Cargo.lock | 1 + kinode/Cargo.toml | 1 + kinode/src/http/server.rs | 12 +++++++++++- kinode/src/http/utils.rs | 4 ++++ lib/src/http/server_types.rs | 8 +++++--- 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c7285c74a..253110fd8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3139,6 +3139,7 @@ dependencies = [ "open", "public-ip", "rand 0.8.5", + "regex", "reqwest", "ring 0.16.20", "rmp-serde", diff --git a/kinode/Cargo.toml b/kinode/Cargo.toml index 7da207a90..092504c59 100644 --- a/kinode/Cargo.toml +++ b/kinode/Cargo.toml @@ -82,3 +82,4 @@ warp = "0.3.5" wasmtime = "15.0.1" wasmtime-wasi = "15.0.1" zip = "0.6" +regex = "1.10" diff --git a/kinode/src/http/server.rs b/kinode/src/http/server.rs index 0453af366..77e523b71 100644 --- a/kinode/src/http/server.rs +++ b/kinode/src/http/server.rs @@ -41,6 +41,7 @@ type WsPathBindings = Arc>>; struct BoundPath { pub app: ProcessId, + pub path: String, pub secure_subdomain: Option, pub authenticated: bool, pub local_only: bool, @@ -185,17 +186,19 @@ pub async fn http_server( let jwt_secret_bytes = Arc::new(jwt_secret_bytes); let http_response_senders: HttpResponseSenders = Arc::new(DashMap::new()); let ws_senders: WebSocketSenders = Arc::new(DashMap::new()); + let path = format!("/rpc:distro:sys/message"); // add RPC path let mut bindings_map: Router = Router::new(); let rpc_bound_path = BoundPath { app: ProcessId::new(Some("rpc"), "distro", "sys"), + path: path.clone(), secure_subdomain: None, // TODO maybe RPC should have subdomain? authenticated: false, local_only: true, static_content: None, }; - bindings_map.add("/rpc:distro:sys/message", rpc_bound_path); + bindings_map.add(&path, rpc_bound_path); let path_bindings: PathBindings = Arc::new(RwLock::new(bindings_map)); // ws path bindings @@ -584,6 +587,7 @@ async fn http_handler( } } else { // otherwise, make a message to the correct app + let url_params: HashMap = route.params().into_iter().map(|(key, value)| (key.to_string(), value.to_string())).collect(); ( KernelMessage { id, @@ -607,7 +611,9 @@ async fn http_handler( host.unwrap_or(Authority::from_static("localhost")), original_path ), + bound_path: bound_path.path.clone(), headers: serialized_headers, + url_params, query_params, })) .unwrap(), @@ -1138,6 +1144,7 @@ async fn handle_app_message( &normalize_path(&path), BoundPath { app: km.source.process.clone(), + path: path.clone(), secure_subdomain: None, authenticated, local_only, @@ -1160,6 +1167,7 @@ async fn handle_app_message( &normalize_path(&path), BoundPath { app: km.source.process.clone(), + path: path.clone(), secure_subdomain: None, authenticated, local_only, @@ -1183,6 +1191,7 @@ async fn handle_app_message( &normalize_path(&path), BoundPath { app: km.source.process.clone(), + path: path.clone(), secure_subdomain: Some(subdomain), authenticated: true, local_only: false, @@ -1205,6 +1214,7 @@ async fn handle_app_message( &normalize_path(&path), BoundPath { app: km.source.process.clone(), + path: path.clone(), secure_subdomain: Some(subdomain), authenticated: true, local_only: false, diff --git a/kinode/src/http/utils.rs b/kinode/src/http/utils.rs index 3f7f3c1f4..76cfec540 100644 --- a/kinode/src/http/utils.rs +++ b/kinode/src/http/utils.rs @@ -69,6 +69,10 @@ pub fn auth_cookie_valid(our_node: &str, cookie: &str, jwt_secret: &[u8]) -> boo } pub fn normalize_path(path: &str) -> String { + if path.starts_with("regex") { + return path.strip_prefix("regex").unwrap_or("").to_string(); + } + match path.strip_suffix('/') { Some(new) => new.to_string(), None => path.to_string(), diff --git a/lib/src/http/server_types.rs b/lib/src/http/server_types.rs index ed0a90f53..12d50843b 100644 --- a/lib/src/http/server_types.rs +++ b/lib/src/http/server_types.rs @@ -29,10 +29,12 @@ pub enum HttpServerRequest { #[derive(Debug, Serialize, Deserialize)] pub struct IncomingHttpRequest { - pub source_socket_addr: Option, // will parse to SocketAddr - pub method: String, // will parse to http::Method - pub url: String, // will parse to url::Url + pub source_socket_addr: Option, // will parse to SocketAddr + pub method: String, // will parse to http::Method + pub url: String, // will parse to url::Url + pub bound_path: String, // the path that was originally bound pub headers: HashMap, + pub url_params: HashMap, // comes from route-recognizer pub query_params: HashMap, // BODY is stored in the lazy_load_blob, as bytes } From f9039b5a28dc6c60505816fbeee0defee3a3305c Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 15 Feb 2024 16:00:05 +0000 Subject: [PATCH 070/171] Format Rust code using rustfmt --- kinode/src/http/server.rs | 6 +++++- lib/src/http/server_types.rs | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/kinode/src/http/server.rs b/kinode/src/http/server.rs index 77e523b71..51213efba 100644 --- a/kinode/src/http/server.rs +++ b/kinode/src/http/server.rs @@ -587,7 +587,11 @@ async fn http_handler( } } else { // otherwise, make a message to the correct app - let url_params: HashMap = route.params().into_iter().map(|(key, value)| (key.to_string(), value.to_string())).collect(); + let url_params: HashMap = route + .params() + .into_iter() + .map(|(key, value)| (key.to_string(), value.to_string())) + .collect(); ( KernelMessage { id, diff --git a/lib/src/http/server_types.rs b/lib/src/http/server_types.rs index 12d50843b..363b00e43 100644 --- a/lib/src/http/server_types.rs +++ b/lib/src/http/server_types.rs @@ -29,10 +29,10 @@ pub enum HttpServerRequest { #[derive(Debug, Serialize, Deserialize)] pub struct IncomingHttpRequest { - pub source_socket_addr: Option, // will parse to SocketAddr - pub method: String, // will parse to http::Method - pub url: String, // will parse to url::Url - pub bound_path: String, // the path that was originally bound + pub source_socket_addr: Option, // will parse to SocketAddr + pub method: String, // will parse to http::Method + pub url: String, // will parse to url::Url + pub bound_path: String, // the path that was originally bound pub headers: HashMap, pub url_params: HashMap, // comes from route-recognizer pub query_params: HashMap, From ae4a149984772c837270eab42e7da3aac9c970ea Mon Sep 17 00:00:00 2001 From: Will Galebach Date: Thu, 15 Feb 2024 16:10:17 +0000 Subject: [PATCH 071/171] remove regex --- kinode/Cargo.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/kinode/Cargo.toml b/kinode/Cargo.toml index 092504c59..7da207a90 100644 --- a/kinode/Cargo.toml +++ b/kinode/Cargo.toml @@ -82,4 +82,3 @@ warp = "0.3.5" wasmtime = "15.0.1" wasmtime-wasi = "15.0.1" zip = "0.6" -regex = "1.10" From f541f83d1eccee53f8b870ddfe07d14be90468cf Mon Sep 17 00:00:00 2001 From: Will Galebach Date: Thu, 15 Feb 2024 16:11:29 +0000 Subject: [PATCH 072/171] Remove unnecessary bit --- kinode/src/http/utils.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/kinode/src/http/utils.rs b/kinode/src/http/utils.rs index 76cfec540..3f7f3c1f4 100644 --- a/kinode/src/http/utils.rs +++ b/kinode/src/http/utils.rs @@ -69,10 +69,6 @@ pub fn auth_cookie_valid(our_node: &str, cookie: &str, jwt_secret: &[u8]) -> boo } pub fn normalize_path(path: &str) -> String { - if path.starts_with("regex") { - return path.strip_prefix("regex").unwrap_or("").to_string(); - } - match path.strip_suffix('/') { Some(new) => new.to_string(), None => path.to_string(), From 68bd51316ebd807d601c15eb7f2280803833e934 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Thu, 15 Feb 2024 11:41:56 -0500 Subject: [PATCH 073/171] unverified apps are downloadable with a warning --- .../app_store/app_store/src/http_api.rs | 1 + .../packages/app_store/app_store/src/lib.rs | 31 +++++++++++++++---- .../packages/app_store/app_store/src/types.rs | 17 +++++----- 3 files changed, 35 insertions(+), 14 deletions(-) diff --git a/kinode/packages/app_store/app_store/src/http_api.rs b/kinode/packages/app_store/app_store/src/http_api.rs index 3b4f6c40f..03a9b2318 100644 --- a/kinode/packages/app_store/app_store/src/http_api.rs +++ b/kinode/packages/app_store/app_store/src/http_api.rs @@ -81,6 +81,7 @@ fn gen_package_info( "caps_approved": state.caps_approved, "mirroring": state.mirroring, "auto_update": state.auto_update, + "verified": state.verified, }), None => json!(null), }, diff --git a/kinode/packages/app_store/app_store/src/lib.rs b/kinode/packages/app_store/app_store/src/lib.rs index e90f3ec30..e98141089 100644 --- a/kinode/packages/app_store/app_store/src/lib.rs +++ b/kinode/packages/app_store/app_store/src/lib.rs @@ -268,6 +268,7 @@ fn handle_local_request( mirrored_from: Some(our.node.clone()), our_version, installed: false, + verified: true, // side loaded apps are implicitly verified because there is no "source" to verify against caps_approved: true, // TODO see if we want to auto-approve local installs mirroring: *mirror, auto_update: false, // can't auto-update a local package @@ -403,12 +404,21 @@ fn handle_receive_download( // check the version hash for this download against requested!! // for now we can reject if it's not latest. let download_hash = generate_version_hash(&blob.bytes); + let mut verified = false; match requested_package.desired_version_hash { Some(hash) => { if download_hash != hash { - return Err(anyhow::anyhow!( - "app store: downloaded package is not latest version--rejecting download!" - )); + if hash.is_empty() { + println!( + "\x1b[33mwarning: downloaded package has no version hashes--cannot verify code integrity, proceeding anyways\x1b[0m" + ); + } else { + return Err(anyhow::anyhow!( + "downloaded package is not latest version--rejecting download!" + )); + } + } else { + verified = true; } } None => { @@ -433,9 +443,17 @@ fn handle_receive_download( )); }; if &download_hash != latest_hash { - return Err(anyhow::anyhow!( - "app store: downloaded package is not latest version--rejecting download!" - )); + if latest_hash.is_empty() { + println!( + "\x1b[33mwarning: downloaded package has no version hashes--cannot verify code integrity, proceeding anyways\x1b[0m" + ); + } else { + return Err(anyhow::anyhow!( + "downloaded package is not latest version--rejecting download!" + )); + } + } else { + verified = true; } } } @@ -446,6 +464,7 @@ fn handle_receive_download( mirrored_from: Some(requested_package.from), our_version: download_hash, installed: false, + verified, caps_approved: false, mirroring: requested_package.mirror, auto_update: requested_package.auto_update, diff --git a/kinode/packages/app_store/app_store/src/types.rs b/kinode/packages/app_store/app_store/src/types.rs index 81cd296e3..a5fa573fe 100644 --- a/kinode/packages/app_store/app_store/src/types.rs +++ b/kinode/packages/app_store/app_store/src/types.rs @@ -70,6 +70,7 @@ pub struct PackageState { /// the version of the package we have downloaded pub our_version: String, pub installed: bool, + pub verified: bool, pub caps_approved: bool, /// are we serving this package to others? pub mirroring: bool, @@ -290,6 +291,7 @@ impl State { mirrored_from: None, our_version, installed: true, + verified: true, // implicity verified caps_approved: true, // since it's already installed this must be true mirroring: false, auto_update: false, @@ -547,14 +549,13 @@ fn fetch_metadata(metadata_url: &str, metadata_hash: &str) -> anyhow::Result(&body.bytes)?) - // } else { - // Err(anyhow::anyhow!( - // "metadata hash mismatch: got {hash}, expected {metadata_hash}" - // )) - // } + if &hash == metadata_hash { + Ok(serde_json::from_slice::(&body.bytes)?) + } else { + Err(anyhow::anyhow!( + "metadata hash mismatch: got {hash}, expected {metadata_hash}" + )) + } } /// generate a Keccak-256 hash of the metadata bytes From 30f0543e63dabf96d13ffcbb0d5cf725883afe37 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Thu, 15 Feb 2024 11:42:59 -0500 Subject: [PATCH 074/171] app_store ui at b354024 --- .../app_store/pkg/ui/assets/index-BQDGz1Dy.js | 90 ------------------- .../app_store/pkg/ui/assets/index-Wv-dWa0C.js | 90 +++++++++++++++++++ kinode/packages/app_store/pkg/ui/index.html | 2 +- 3 files changed, 91 insertions(+), 91 deletions(-) delete mode 100644 kinode/packages/app_store/pkg/ui/assets/index-BQDGz1Dy.js create mode 100644 kinode/packages/app_store/pkg/ui/assets/index-Wv-dWa0C.js diff --git a/kinode/packages/app_store/pkg/ui/assets/index-BQDGz1Dy.js b/kinode/packages/app_store/pkg/ui/assets/index-BQDGz1Dy.js deleted file mode 100644 index 65adcd4f5..000000000 --- a/kinode/packages/app_store/pkg/ui/assets/index-BQDGz1Dy.js +++ /dev/null @@ -1,90 +0,0 @@ -var nw=Object.defineProperty;var iw=(t,e,r)=>e in t?nw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var zh=(t,e,r)=>(iw(t,typeof e!="symbol"?e+"":e,r),r);function ow(t,e){for(var r=0;rn[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=r(i);fetch(i.href,o)}})();var Fe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Uo(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Bm={exports:{}},du={},Dm={exports:{}},ye={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var dl=Symbol.for("react.element"),sw=Symbol.for("react.portal"),lw=Symbol.for("react.fragment"),aw=Symbol.for("react.strict_mode"),uw=Symbol.for("react.profiler"),cw=Symbol.for("react.provider"),fw=Symbol.for("react.context"),dw=Symbol.for("react.forward_ref"),hw=Symbol.for("react.suspense"),pw=Symbol.for("react.memo"),mw=Symbol.for("react.lazy"),$h=Symbol.iterator;function gw(t){return t===null||typeof t!="object"?null:(t=$h&&t[$h]||t["@@iterator"],typeof t=="function"?t:null)}var jm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Um=Object.assign,Fm={};function Fo(t,e,r){this.props=t,this.context=e,this.refs=Fm,this.updater=r||jm}Fo.prototype.isReactComponent={};Fo.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Fo.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function zm(){}zm.prototype=Fo.prototype;function Sd(t,e,r){this.props=t,this.context=e,this.refs=Fm,this.updater=r||jm}var kd=Sd.prototype=new zm;kd.constructor=Sd;Um(kd,Fo.prototype);kd.isPureReactComponent=!0;var Hh=Array.isArray,$m=Object.prototype.hasOwnProperty,Nd={current:null},Hm={key:!0,ref:!0,__self:!0,__source:!0};function qm(t,e,r){var n,i={},o=null,s=null;if(e!=null)for(n in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(o=""+e.key),e)$m.call(e,n)&&!Hm.hasOwnProperty(n)&&(i[n]=e[n]);var l=arguments.length-2;if(l===1)i.children=r;else if(1>>1,h=b[k];if(0>>1;ki(y,R))Di(U,y)?(b[k]=U,b[D]=R,k=D):(b[k]=y,b[ee]=R,k=ee);else if(Di(U,R))b[k]=U,b[D]=R,k=D;else break e}}return M}function i(b,M){var R=b.sortIndex-M.sortIndex;return R!==0?R:b.id-M.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,l=s.now();t.unstable_now=function(){return s.now()-l}}var a=[],u=[],c=1,d=null,p=3,v=!1,g=!1,x=!1,S=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(b){for(var M=r(u);M!==null;){if(M.callback===null)n(u);else if(M.startTime<=b)n(u),M.sortIndex=M.expirationTime,e(a,M);else break;M=r(u)}}function O(b){if(x=!1,_(b),!g)if(r(a)!==null)g=!0,A(B);else{var M=r(u);M!==null&&N(O,M.startTime-b)}}function B(b,M){g=!1,x&&(x=!1,E(q),q=-1),v=!0;var R=p;try{for(_(M),d=r(a);d!==null&&(!(d.expirationTime>M)||b&&!H());){var k=d.callback;if(typeof k=="function"){d.callback=null,p=d.priorityLevel;var h=k(d.expirationTime<=M);M=t.unstable_now(),typeof h=="function"?d.callback=h:d===r(a)&&n(a),_(M)}else n(a);d=r(a)}if(d!==null)var P=!0;else{var ee=r(u);ee!==null&&N(O,ee.startTime-M),P=!1}return P}finally{d=null,p=R,v=!1}}var j=!1,$=null,q=-1,ne=5,K=-1;function H(){return!(t.unstable_now()-Kb||125k?(b.sortIndex=R,e(u,b),r(a)===null&&b===r(u)&&(x?(E(q),q=-1):x=!0,N(O,R-k))):(b.sortIndex=h,e(a,b),g||v||(g=!0,A(B))),b},t.unstable_shouldYield=H,t.unstable_wrapCallback=function(b){var M=p;return function(){var R=p;p=M;try{return b.apply(this,arguments)}finally{p=R}}}})(Km);Vm.exports=Km;var Pw=Vm.exports;/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Qm=L,pr=Pw;function W(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ff=Object.prototype.hasOwnProperty,Cw=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Wh={},Gh={};function Mw(t){return ff.call(Gh,t)?!0:ff.call(Wh,t)?!1:Cw.test(t)?Gh[t]=!0:(Wh[t]=!0,!1)}function Iw(t,e,r,n){if(r!==null&&r.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function Rw(t,e,r,n){if(e===null||typeof e>"u"||Iw(t,e,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Vt(t,e,r,n,i,o,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=s}var Tt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Tt[t]=new Vt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Tt[e]=new Vt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Tt[t]=new Vt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Tt[t]=new Vt(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Tt[t]=new Vt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Tt[t]=new Vt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Tt[t]=new Vt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Tt[t]=new Vt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Tt[t]=new Vt(t,5,!1,t.toLowerCase(),null,!1,!1)});var Cd=/[\-:]([a-z])/g;function Md(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Cd,Md);Tt[e]=new Vt(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Cd,Md);Tt[e]=new Vt(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Cd,Md);Tt[e]=new Vt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Tt[t]=new Vt(t,1,!1,t.toLowerCase(),null,!1,!1)});Tt.xlinkHref=new Vt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Tt[t]=new Vt(t,1,!1,t.toLowerCase(),null,!0,!0)});function Id(t,e,r,n){var i=Tt.hasOwnProperty(e)?Tt[e]:null;(i!==null?i.type!==0:n||!(2l||i[s]!==o[l]){var a=` -`+i[s].replace(" at new "," at ");return t.displayName&&a.includes("")&&(a=a.replace("",t.displayName)),a}while(1<=s&&0<=l);break}}}finally{hc=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?fs(t):""}function Tw(t){switch(t.tag){case 5:return fs(t.type);case 16:return fs("Lazy");case 13:return fs("Suspense");case 19:return fs("SuspenseList");case 0:case 2:case 15:return t=pc(t.type,!1),t;case 11:return t=pc(t.type.render,!1),t;case 1:return t=pc(t.type,!0),t;default:return""}}function mf(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Zi:return"Fragment";case Xi:return"Portal";case df:return"Profiler";case Rd:return"StrictMode";case hf:return"Suspense";case pf:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Xm:return(t.displayName||"Context")+".Consumer";case Ym:return(t._context.displayName||"Context")+".Provider";case Td:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Od:return e=t.displayName||null,e!==null?e:mf(t.type)||"Memo";case Jn:e=t._payload,t=t._init;try{return mf(t(e))}catch{}}return null}function Ow(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return mf(e);case 8:return e===Rd?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function pi(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function eg(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Lw(t){var e=eg(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,o=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){n=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(s){n=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function kl(t){t._valueTracker||(t._valueTracker=Lw(t))}function tg(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=eg(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function Sa(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function gf(t,e){var r=e.checked;return ft({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function Kh(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=pi(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function rg(t,e){e=e.checked,e!=null&&Id(t,"checked",e,!1)}function vf(t,e){rg(t,e);var r=pi(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?yf(t,e.type,r):e.hasOwnProperty("defaultValue")&&yf(t,e.type,pi(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Qh(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function yf(t,e,r){(e!=="number"||Sa(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var ds=Array.isArray;function go(t,e,r,n){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Nl.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ts(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var ws={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Bw=["Webkit","ms","Moz","O"];Object.keys(ws).forEach(function(t){Bw.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ws[e]=ws[t]})});function sg(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||ws.hasOwnProperty(t)&&ws[t]?(""+e).trim():e+"px"}function lg(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=sg(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,i):t[r]=i}}var Dw=ft({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function xf(t,e){if(e){if(Dw[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(W(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(W(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(W(61))}if(e.style!=null&&typeof e.style!="object")throw Error(W(62))}}function Af(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var bf=null;function Ld(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var _f=null,vo=null,yo=null;function Xh(t){if(t=ml(t)){if(typeof _f!="function")throw Error(W(280));var e=t.stateNode;e&&(e=vu(e),_f(t.stateNode,t.type,e))}}function ag(t){vo?yo?yo.push(t):yo=[t]:vo=t}function ug(){if(vo){var t=vo,e=yo;if(yo=vo=null,Xh(t),e)for(t=0;t>>=0,t===0?32:31-(Kw(t)/Qw|0)|0}var Pl=64,Cl=4194304;function hs(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Ca(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,i=t.suspendedLanes,o=t.pingedLanes,s=r&268435455;if(s!==0){var l=s&~i;l!==0?n=hs(l):(o&=s,o!==0&&(n=hs(o)))}else s=r&~i,s!==0?n=hs(s):o!==0&&(n=hs(o));if(n===0)return 0;if(e!==0&&e!==n&&!(e&i)&&(i=n&-n,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0r;r++)e.push(t);return e}function hl(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Wr(e),t[e]=r}function Zw(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0=xs),l0=" ",a0=!1;function Cg(t,e){switch(t){case"keyup":return N2.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Mg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var eo=!1;function C2(t,e){switch(t){case"compositionend":return Mg(e);case"keypress":return e.which!==32?null:(a0=!0,l0);case"textInput":return t=e.data,t===l0&&a0?null:t;default:return null}}function M2(t,e){if(eo)return t==="compositionend"||!Hd&&Cg(t,e)?(t=Ng(),na=Fd=ri=null,eo=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=d0(r)}}function Og(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Og(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Lg(){for(var t=window,e=Sa();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=Sa(t.document)}return e}function qd(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function U2(t){var e=Lg(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&Og(r.ownerDocument.documentElement,r)){if(n!==null&&qd(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=r.textContent.length,o=Math.min(n.start,i);n=n.end===void 0?o:Math.min(n.end,i),!t.extend&&o>n&&(i=n,n=o,o=i),i=h0(r,o);var s=h0(r,n);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>n?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,to=null,Mf=null,bs=null,If=!1;function p0(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;If||to==null||to!==Sa(n)||(n=to,"selectionStart"in n&&qd(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),bs&&Us(bs,n)||(bs=n,n=Ra(Mf,"onSelect"),0io||(t.current=Df[io],Df[io]=null,io--)}function Qe(t,e){io++,Df[io]=t.current,t.current=e}var mi={},zt=wi(mi),er=wi(!1),Ri=mi;function ko(t,e){var r=t.type.contextTypes;if(!r)return mi;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in r)i[o]=e[o];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function tr(t){return t=t.childContextTypes,t!=null}function Oa(){tt(er),tt(zt)}function x0(t,e,r){if(zt.current!==mi)throw Error(W(168));Qe(zt,e),Qe(er,r)}function qg(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in e))throw Error(W(108,Ow(t)||"Unknown",i));return ft({},r,n)}function La(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||mi,Ri=zt.current,Qe(zt,t),Qe(er,er.current),!0}function A0(t,e,r){var n=t.stateNode;if(!n)throw Error(W(169));r?(t=qg(t,e,Ri),n.__reactInternalMemoizedMergedChildContext=t,tt(er),tt(zt),Qe(zt,t)):tt(er),Qe(er,r)}var An=null,yu=!1,Pc=!1;function Wg(t){An===null?An=[t]:An.push(t)}function Y2(t){yu=!0,Wg(t)}function Ei(){if(!Pc&&An!==null){Pc=!0;var t=0,e=Re;try{var r=An;for(Re=1;t>=s,i-=s,Sn=1<<32-Wr(e)+i|r<q?(ne=$,$=null):ne=$.sibling;var K=p(E,$,_[q],O);if(K===null){$===null&&($=ne);break}t&&$&&K.alternate===null&&e(E,$),w=o(K,w,q),j===null?B=K:j.sibling=K,j=K,$=ne}if(q===_.length)return r(E,$),nt&&bi(E,q),B;if($===null){for(;q<_.length;q++)$=d(E,_[q],O),$!==null&&(w=o($,w,q),j===null?B=$:j.sibling=$,j=$);return nt&&bi(E,q),B}for($=n(E,$);q<_.length;q++)ne=v($,E,q,_[q],O),ne!==null&&(t&&ne.alternate!==null&&$.delete(ne.key===null?q:ne.key),w=o(ne,w,q),j===null?B=ne:j.sibling=ne,j=ne);return t&&$.forEach(function(H){return e(E,H)}),nt&&bi(E,q),B}function x(E,w,_,O){var B=Jo(_);if(typeof B!="function")throw Error(W(150));if(_=B.call(_),_==null)throw Error(W(151));for(var j=B=null,$=w,q=w=0,ne=null,K=_.next();$!==null&&!K.done;q++,K=_.next()){$.index>q?(ne=$,$=null):ne=$.sibling;var H=p(E,$,K.value,O);if(H===null){$===null&&($=ne);break}t&&$&&H.alternate===null&&e(E,$),w=o(H,w,q),j===null?B=H:j.sibling=H,j=H,$=ne}if(K.done)return r(E,$),nt&&bi(E,q),B;if($===null){for(;!K.done;q++,K=_.next())K=d(E,K.value,O),K!==null&&(w=o(K,w,q),j===null?B=K:j.sibling=K,j=K);return nt&&bi(E,q),B}for($=n(E,$);!K.done;q++,K=_.next())K=v($,E,q,K.value,O),K!==null&&(t&&K.alternate!==null&&$.delete(K.key===null?q:K.key),w=o(K,w,q),j===null?B=K:j.sibling=K,j=K);return t&&$.forEach(function(se){return e(E,se)}),nt&&bi(E,q),B}function S(E,w,_,O){if(typeof _=="object"&&_!==null&&_.type===Zi&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case Sl:e:{for(var B=_.key,j=w;j!==null;){if(j.key===B){if(B=_.type,B===Zi){if(j.tag===7){r(E,j.sibling),w=i(j,_.props.children),w.return=E,E=w;break e}}else if(j.elementType===B||typeof B=="object"&&B!==null&&B.$$typeof===Jn&&C0(B)===j.type){r(E,j.sibling),w=i(j,_.props),w.ref=ts(E,j,_),w.return=E,E=w;break e}r(E,j);break}else e(E,j);j=j.sibling}_.type===Zi?(w=Mi(_.props.children,E.mode,O,_.key),w.return=E,E=w):(O=fa(_.type,_.key,_.props,null,E.mode,O),O.ref=ts(E,w,_),O.return=E,E=O)}return s(E);case Xi:e:{for(j=_.key;w!==null;){if(w.key===j)if(w.tag===4&&w.stateNode.containerInfo===_.containerInfo&&w.stateNode.implementation===_.implementation){r(E,w.sibling),w=i(w,_.children||[]),w.return=E,E=w;break e}else{r(E,w);break}else e(E,w);w=w.sibling}w=Bc(_,E.mode,O),w.return=E,E=w}return s(E);case Jn:return j=_._init,S(E,w,j(_._payload),O)}if(ds(_))return g(E,w,_,O);if(Jo(_))return x(E,w,_,O);Bl(E,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,w!==null&&w.tag===6?(r(E,w.sibling),w=i(w,_),w.return=E,E=w):(r(E,w),w=Lc(_,E.mode,O),w.return=E,E=w),s(E)):r(E,w)}return S}var Po=Zg(!0),ev=Zg(!1),gl={},an=wi(gl),Hs=wi(gl),qs=wi(gl);function Pi(t){if(t===gl)throw Error(W(174));return t}function Zd(t,e){switch(Qe(qs,e),Qe(Hs,t),Qe(an,gl),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Ef(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Ef(e,t)}tt(an),Qe(an,e)}function Co(){tt(an),tt(Hs),tt(qs)}function tv(t){Pi(qs.current);var e=Pi(an.current),r=Ef(e,t.type);e!==r&&(Qe(Hs,t),Qe(an,r))}function eh(t){Hs.current===t&&(tt(an),tt(Hs))}var at=wi(0);function za(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Cc=[];function th(){for(var t=0;tr?r:4,t(!0);var n=Mc.transition;Mc.transition={};try{t(!1),e()}finally{Re=r,Mc.transition=n}}function vv(){return Pr().memoizedState}function tE(t,e,r){var n=di(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},yv(t))wv(e,r);else if(r=Qg(t,e,r,n),r!==null){var i=Wt();Gr(r,t,n,i),Ev(r,e,n)}}function rE(t,e,r){var n=di(t),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(yv(t))wv(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,l=o(s,r);if(i.hasEagerState=!0,i.eagerState=l,Vr(l,s)){var a=e.interleaved;a===null?(i.next=i,Yd(e)):(i.next=a.next,a.next=i),e.interleaved=i;return}}catch{}finally{}r=Qg(t,e,i,n),r!==null&&(i=Wt(),Gr(r,t,n,i),Ev(r,e,n))}}function yv(t){var e=t.alternate;return t===ct||e!==null&&e===ct}function wv(t,e){_s=$a=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function Ev(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,Dd(t,r)}}var Ha={readContext:Nr,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useInsertionEffect:Lt,useLayoutEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useMutableSource:Lt,useSyncExternalStore:Lt,useId:Lt,unstable_isNewReconciler:!1},nE={readContext:Nr,useCallback:function(t,e){return Zr().memoizedState=[t,e===void 0?null:e],t},useContext:Nr,useEffect:I0,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,la(4194308,4,dv.bind(null,e,t),r)},useLayoutEffect:function(t,e){return la(4194308,4,t,e)},useInsertionEffect:function(t,e){return la(4,2,t,e)},useMemo:function(t,e){var r=Zr();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=Zr();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=tE.bind(null,ct,t),[n.memoizedState,t]},useRef:function(t){var e=Zr();return t={current:t},e.memoizedState=t},useState:M0,useDebugValue:sh,useDeferredValue:function(t){return Zr().memoizedState=t},useTransition:function(){var t=M0(!1),e=t[0];return t=eE.bind(null,t[1]),Zr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=ct,i=Zr();if(nt){if(r===void 0)throw Error(W(407));r=r()}else{if(r=e(),Nt===null)throw Error(W(349));Oi&30||iv(n,e,r)}i.memoizedState=r;var o={value:r,getSnapshot:e};return i.queue=o,I0(sv.bind(null,n,o,t),[t]),n.flags|=2048,Vs(9,ov.bind(null,n,o,r,e),void 0,null),r},useId:function(){var t=Zr(),e=Nt.identifierPrefix;if(nt){var r=kn,n=Sn;r=(n&~(1<<32-Wr(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=Ws++,0<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=s.createElement(r,{is:n.is}):(t=s.createElement(r),r==="select"&&(s=t,n.multiple?s.multiple=!0:n.size&&(s.size=n.size))):t=s.createElementNS(t,r),t[nn]=e,t[$s]=n,Cv(t,e,!1,!1),e.stateNode=t;e:{switch(s=Af(r,n),r){case"dialog":et("cancel",t),et("close",t),i=n;break;case"iframe":case"object":case"embed":et("load",t),i=n;break;case"video":case"audio":for(i=0;iIo&&(e.flags|=128,n=!0,rs(o,!1),e.lanes=4194304)}else{if(!n)if(t=za(s),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),rs(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!nt)return Bt(e),null}else 2*vt()-o.renderingStartTime>Io&&r!==1073741824&&(e.flags|=128,n=!0,rs(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(r=o.last,r!==null?r.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=vt(),e.sibling=null,r=at.current,Qe(at,n?r&1|2:r&1),e):(Bt(e),null);case 22:case 23:return dh(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?lr&1073741824&&(Bt(e),e.subtreeFlags&6&&(e.flags|=8192)):Bt(e),null;case 24:return null;case 25:return null}throw Error(W(156,e.tag))}function fE(t,e){switch(Gd(e),e.tag){case 1:return tr(e.type)&&Oa(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Co(),tt(er),tt(zt),th(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return eh(e),null;case 13:if(tt(at),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(W(340));No()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return tt(at),null;case 4:return Co(),null;case 10:return Jd(e.type._context),null;case 22:case 23:return dh(),null;case 24:return null;default:return null}}var jl=!1,Dt=!1,dE=typeof WeakSet=="function"?WeakSet:Set,X=null;function ao(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){ht(t,e,n)}else r.current=null}function Qf(t,e,r){try{r()}catch(n){ht(t,e,n)}}var F0=!1;function hE(t,e){if(Rf=Ma,t=Lg(),qd(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break e}var s=0,l=-1,a=-1,u=0,c=0,d=t,p=null;t:for(;;){for(var v;d!==r||i!==0&&d.nodeType!==3||(l=s+i),d!==o||n!==0&&d.nodeType!==3||(a=s+n),d.nodeType===3&&(s+=d.nodeValue.length),(v=d.firstChild)!==null;)p=d,d=v;for(;;){if(d===t)break t;if(p===r&&++u===i&&(l=s),p===o&&++c===n&&(a=s),(v=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=v}r=l===-1||a===-1?null:{start:l,end:a}}else r=null}r=r||{start:0,end:0}}else r=null;for(Tf={focusedElem:t,selectionRange:r},Ma=!1,X=e;X!==null;)if(e=X,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,X=t;else for(;X!==null;){e=X;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var x=g.memoizedProps,S=g.memoizedState,E=e.stateNode,w=E.getSnapshotBeforeUpdate(e.elementType===e.type?x:jr(e.type,x),S);E.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var _=e.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(W(163))}}catch(O){ht(e,e.return,O)}if(t=e.sibling,t!==null){t.return=e.return,X=t;break}X=e.return}return g=F0,F0=!1,g}function Ss(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&Qf(e,r,o)}i=i.next}while(i!==n)}}function xu(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function Jf(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function Rv(t){var e=t.alternate;e!==null&&(t.alternate=null,Rv(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[nn],delete e[$s],delete e[Bf],delete e[Q2],delete e[J2])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Tv(t){return t.tag===5||t.tag===3||t.tag===4}function z0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Tv(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Yf(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=Ta));else if(n!==4&&(t=t.child,t!==null))for(Yf(t,e,r),t=t.sibling;t!==null;)Yf(t,e,r),t=t.sibling}function Xf(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(Xf(t,e,r),t=t.sibling;t!==null;)Xf(t,e,r),t=t.sibling}var Mt=null,Fr=!1;function Vn(t,e,r){for(r=r.child;r!==null;)Ov(t,e,r),r=r.sibling}function Ov(t,e,r){if(ln&&typeof ln.onCommitFiberUnmount=="function")try{ln.onCommitFiberUnmount(hu,r)}catch{}switch(r.tag){case 5:Dt||ao(r,e);case 6:var n=Mt,i=Fr;Mt=null,Vn(t,e,r),Mt=n,Fr=i,Mt!==null&&(Fr?(t=Mt,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Mt.removeChild(r.stateNode));break;case 18:Mt!==null&&(Fr?(t=Mt,r=r.stateNode,t.nodeType===8?Nc(t.parentNode,r):t.nodeType===1&&Nc(t,r),Ds(t)):Nc(Mt,r.stateNode));break;case 4:n=Mt,i=Fr,Mt=r.stateNode.containerInfo,Fr=!0,Vn(t,e,r),Mt=n,Fr=i;break;case 0:case 11:case 14:case 15:if(!Dt&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&Qf(r,e,s),i=i.next}while(i!==n)}Vn(t,e,r);break;case 1:if(!Dt&&(ao(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){ht(r,e,l)}Vn(t,e,r);break;case 21:Vn(t,e,r);break;case 22:r.mode&1?(Dt=(n=Dt)||r.memoizedState!==null,Vn(t,e,r),Dt=n):Vn(t,e,r);break;default:Vn(t,e,r)}}function $0(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new dE),e.forEach(function(n){var i=AE.bind(null,t,n);r.has(n)||(r.add(n),n.then(i,i))})}}function Tr(t,e){var r=e.deletions;if(r!==null)for(var n=0;ni&&(i=s),n&=~o}if(n=i,n=vt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*mE(n/1960))-n,10t?16:t,ni===null)var n=!1;else{if(t=ni,ni=null,Ga=0,Ae&6)throw Error(W(331));var i=Ae;for(Ae|=4,X=t.current;X!==null;){var o=X,s=o.child;if(X.flags&16){var l=o.deletions;if(l!==null){for(var a=0;avt()-ch?Ci(t,0):uh|=r),rr(t,e)}function $v(t,e){e===0&&(t.mode&1?(e=Cl,Cl<<=1,!(Cl&130023424)&&(Cl=4194304)):e=1);var r=Wt();t=Rn(t,e),t!==null&&(hl(t,e,r),rr(t,r))}function xE(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),$v(t,r)}function AE(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,i=t.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(W(314))}n!==null&&n.delete(e),$v(t,r)}var Hv;Hv=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||er.current)Zt=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return Zt=!1,uE(t,e,r);Zt=!!(t.flags&131072)}else Zt=!1,nt&&e.flags&1048576&&Gg(e,Da,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;aa(t,e),t=e.pendingProps;var i=ko(e,zt.current);Eo(e,r),i=nh(null,e,n,t,i,r);var o=ih();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,tr(n)?(o=!0,La(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Xd(e),i.updater=wu,e.stateNode=i,i._reactInternals=e,$f(e,n,t,r),e=Wf(null,e,n,!0,o,r)):(e.tag=0,nt&&o&&Wd(e),qt(null,e,i,r),e=e.child),e;case 16:n=e.elementType;e:{switch(aa(t,e),t=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=_E(n),t=jr(n,t),i){case 0:e=qf(null,e,n,t,r);break e;case 1:e=D0(null,e,n,t,r);break e;case 11:e=L0(null,e,n,t,r);break e;case 14:e=B0(null,e,n,jr(n.type,t),r);break e}throw Error(W(306,n,""))}return e;case 0:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),qf(t,e,n,i,r);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),D0(t,e,n,i,r);case 3:e:{if(kv(e),t===null)throw Error(W(387));n=e.pendingProps,o=e.memoizedState,i=o.element,Jg(t,e),Fa(e,n,null,r);var s=e.memoizedState;if(n=s.element,o.isDehydrated)if(o={element:n,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=Mo(Error(W(423)),e),e=j0(t,e,n,r,i);break e}else if(n!==i){i=Mo(Error(W(424)),e),e=j0(t,e,n,r,i);break e}else for(cr=ui(e.stateNode.containerInfo.firstChild),dr=e,nt=!0,zr=null,r=ev(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(No(),n===i){e=Tn(t,e,r);break e}qt(t,e,n,r)}e=e.child}return e;case 5:return tv(e),t===null&&Uf(e),n=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,Of(n,i)?s=null:o!==null&&Of(n,o)&&(e.flags|=32),Sv(t,e),qt(t,e,s,r),e.child;case 6:return t===null&&Uf(e),null;case 13:return Nv(t,e,r);case 4:return Zd(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Po(e,null,n,r):qt(t,e,n,r),e.child;case 11:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),L0(t,e,n,i,r);case 7:return qt(t,e,e.pendingProps,r),e.child;case 8:return qt(t,e,e.pendingProps.children,r),e.child;case 12:return qt(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,Qe(ja,n._currentValue),n._currentValue=s,o!==null)if(Vr(o.value,s)){if(o.children===i.children&&!er.current){e=Tn(t,e,r);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var l=o.dependencies;if(l!==null){s=o.child;for(var a=l.firstContext;a!==null;){if(a.context===n){if(o.tag===1){a=Pn(-1,r&-r),a.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}o.lanes|=r,a=o.alternate,a!==null&&(a.lanes|=r),Ff(o.return,r,e),l.lanes|=r;break}a=a.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(W(341));s.lanes|=r,l=s.alternate,l!==null&&(l.lanes|=r),Ff(s,r,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}qt(t,e,i.children,r),e=e.child}return e;case 9:return i=e.type,n=e.pendingProps.children,Eo(e,r),i=Nr(i),n=n(i),e.flags|=1,qt(t,e,n,r),e.child;case 14:return n=e.type,i=jr(n,e.pendingProps),i=jr(n.type,i),B0(t,e,n,i,r);case 15:return bv(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),aa(t,e),e.tag=1,tr(n)?(t=!0,La(e)):t=!1,Eo(e,r),Xg(e,n,i),$f(e,n,i,r),Wf(null,e,n,!0,t,r);case 19:return Pv(t,e,r);case 22:return _v(t,e,r)}throw Error(W(156,e.tag))};function qv(t,e){return gg(t,e)}function bE(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sr(t,e,r,n){return new bE(t,e,r,n)}function ph(t){return t=t.prototype,!(!t||!t.isReactComponent)}function _E(t){if(typeof t=="function")return ph(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Td)return 11;if(t===Od)return 14}return 2}function hi(t,e){var r=t.alternate;return r===null?(r=Sr(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function fa(t,e,r,n,i,o){var s=2;if(n=t,typeof t=="function")ph(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case Zi:return Mi(r.children,i,o,e);case Rd:s=8,i|=8;break;case df:return t=Sr(12,r,e,i|2),t.elementType=df,t.lanes=o,t;case hf:return t=Sr(13,r,e,i),t.elementType=hf,t.lanes=o,t;case pf:return t=Sr(19,r,e,i),t.elementType=pf,t.lanes=o,t;case Zm:return bu(r,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Ym:s=10;break e;case Xm:s=9;break e;case Td:s=11;break e;case Od:s=14;break e;case Jn:s=16,n=null;break e}throw Error(W(130,t==null?t:typeof t,""))}return e=Sr(s,r,e,i),e.elementType=t,e.type=n,e.lanes=o,e}function Mi(t,e,r,n){return t=Sr(7,t,n,e),t.lanes=r,t}function bu(t,e,r,n){return t=Sr(22,t,n,e),t.elementType=Zm,t.lanes=r,t.stateNode={isHidden:!1},t}function Lc(t,e,r){return t=Sr(6,t,null,e),t.lanes=r,t}function Bc(t,e,r){return e=Sr(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function SE(t,e,r,n,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=gc(0),this.expirationTimes=gc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gc(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function mh(t,e,r,n,i,o,s,l,a){return t=new SE(t,e,r,l,a),e===1?(e=1,o===!0&&(e|=8)):e=0,o=Sr(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xd(o),t}function kE(t,e,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Kv)}catch(t){console.error(t)}}Kv(),Gm.exports=gr;var Qs=Gm.exports,J0=Qs;cf.createRoot=J0.createRoot,cf.hydrateRoot=J0.hydrateRoot;/** - * @remix-run/router v1.14.2 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Js(){return Js=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function wh(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function RE(){return Math.random().toString(36).substr(2,8)}function X0(t,e){return{usr:t.state,key:t.key,idx:e}}function nd(t,e,r,n){return r===void 0&&(r=null),Js({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Ho(e):e,{state:r,key:e&&e.key||n||RE()})}function Qv(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Ho(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function TE(t,e,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:o=!1}=n,s=i.history,l=ii.Pop,a=null,u=c();u==null&&(u=0,s.replaceState(Js({},s.state,{idx:u}),""));function c(){return(s.state||{idx:null}).idx}function d(){l=ii.Pop;let S=c(),E=S==null?null:S-u;u=S,a&&a({action:l,location:x.location,delta:E})}function p(S,E){l=ii.Push;let w=nd(x.location,S,E);r&&r(w,S),u=c()+1;let _=X0(w,u),O=x.createHref(w);try{s.pushState(_,"",O)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;i.location.assign(O)}o&&a&&a({action:l,location:x.location,delta:1})}function v(S,E){l=ii.Replace;let w=nd(x.location,S,E);r&&r(w,S),u=c();let _=X0(w,u),O=x.createHref(w);s.replaceState(_,"",O),o&&a&&a({action:l,location:x.location,delta:0})}function g(S){let E=i.location.origin!=="null"?i.location.origin:i.location.href,w=typeof S=="string"?S:Qv(S);return _t(E,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,E)}let x={get action(){return l},get location(){return t(i,s)},listen(S){if(a)throw new Error("A history only accepts one active listener");return i.addEventListener(Y0,d),a=S,()=>{i.removeEventListener(Y0,d),a=null}},createHref(S){return e(i,S)},createURL:g,encodeLocation(S){let E=g(S);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:p,replace:v,go(S){return s.go(S)}};return x}var Z0;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Z0||(Z0={}));function OE(t,e,r){r===void 0&&(r="/");let n=typeof e=="string"?Ho(e):e,i=Xv(n.pathname||"/",r);if(i==null)return null;let o=Jv(t);LE(o);let s=null;for(let l=0;s==null&&l{let a={relativePath:l===void 0?o.path||"":l,caseSensitive:o.caseSensitive===!0,childrenIndex:s,route:o};a.relativePath.startsWith("/")&&(_t(a.relativePath.startsWith(n),'Absolute route path "'+a.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),a.relativePath=a.relativePath.slice(n.length));let u=Ii([n,a.relativePath]),c=r.concat(a);o.children&&o.children.length>0&&(_t(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Jv(o.children,e,c,u)),!(o.path==null&&!o.index)&&e.push({path:u,score:$E(u,o.index),routesMeta:c})};return t.forEach((o,s)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))i(o,s);else for(let a of Yv(o.path))i(o,s,a)}),e}function Yv(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,i=r.endsWith("?"),o=r.replace(/\?$/,"");if(n.length===0)return i?[o,""]:[o];let s=Yv(n.join("/")),l=[];return l.push(...s.map(a=>a===""?o:[o,a].join("/"))),i&&l.push(...s),l.map(a=>t.startsWith("/")&&a===""?"/":a)}function LE(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:HE(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const BE=/^:[\w-]+$/,DE=3,jE=2,UE=1,FE=10,zE=-2,ep=t=>t==="*";function $E(t,e){let r=t.split("/"),n=r.length;return r.some(ep)&&(n+=zE),e&&(n+=jE),r.filter(i=>!ep(i)).reduce((i,o)=>i+(BE.test(o)?DE:o===""?UE:FE),n)}function HE(t,e){return t.length===e.length&&t.slice(0,-1).every((n,i)=>n===e[i])?t[t.length-1]-e[e.length-1]:0}function qE(t,e){let{routesMeta:r}=t,n={},i="/",o=[];for(let s=0;s{let{paramName:p,isOptional:v}=c;if(p==="*"){let x=l[d]||"";s=o.slice(0,o.length-x.length).replace(/(.)\/+$/,"$1")}const g=l[d];return v&&!g?u[p]=void 0:u[p]=KE(g||"",p),u},{}),pathname:o,pathnameBase:s,pattern:t}}function GE(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),wh(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,l,a)=>(n.push({paramName:l,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),n]}function VE(t){try{return decodeURI(t)}catch(e){return wh(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function KE(t,e){try{return decodeURIComponent(t)}catch(r){return wh(!1,'The value for the URL param "'+e+'" will not be decoded because'+(' the string "'+t+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+r+").")),t}}function Xv(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function QE(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:i=""}=typeof t=="string"?Ho(t):t;return{pathname:r?r.startsWith("/")?r:JE(r,e):e,search:tx(n),hash:rx(i)}}function JE(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function Dc(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function YE(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function XE(t,e){let r=YE(t);return e?r.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function ZE(t,e,r,n){n===void 0&&(n=!1);let i;typeof t=="string"?i=Ho(t):(i=Js({},t),_t(!i.pathname||!i.pathname.includes("?"),Dc("?","pathname","search",i)),_t(!i.pathname||!i.pathname.includes("#"),Dc("#","pathname","hash",i)),_t(!i.search||!i.search.includes("#"),Dc("#","search","hash",i)));let o=t===""||i.pathname==="",s=o?"/":i.pathname,l;if(s==null)l=r;else{let d=e.length-1;if(!n&&s.startsWith("..")){let p=s.split("/");for(;p[0]==="..";)p.shift(),d-=1;i.pathname=p.join("/")}l=d>=0?e[d]:"/"}let a=QE(i,l),u=s&&s!=="/"&&s.endsWith("/"),c=(o||s===".")&&r.endsWith("/");return!a.pathname.endsWith("/")&&(u||c)&&(a.pathname+="/"),a}const Ii=t=>t.join("/").replace(/\/\/+/g,"/"),ex=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),tx=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,rx=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function nx(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Zv=["post","put","patch","delete"];new Set(Zv);const ix=["get",...Zv];new Set(ix);/** - * React Router v6.21.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function Ys(){return Ys=Object.assign?Object.assign.bind():function(t){for(var e=1;e{l.current=!0}),L.useCallback(function(u,c){if(c===void 0&&(c={}),!l.current)return;if(typeof u=="number"){n.go(u);return}let d=ZE(u,JSON.parse(s),o,c.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:Ii([e,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[e,n,s,o,t])}function lx(){let{matches:t}=L.useContext($i),e=t[t.length-1];return e?e.params:{}}function ax(t,e){return ux(t,e)}function ux(t,e,r,n){Mu()||_t(!1);let{navigator:i}=L.useContext(Pu),{matches:o}=L.useContext($i),s=o[o.length-1],l=s?s.params:{};s&&s.pathname;let a=s?s.pathnameBase:"/";s&&s.route;let u=xh(),c;if(e){var d;let S=typeof e=="string"?Ho(e):e;a==="/"||(d=S.pathname)!=null&&d.startsWith(a)||_t(!1),c=S}else c=u;let p=c.pathname||"/",v=a==="/"?p:p.slice(a.length)||"/",g=OE(t,{pathname:v}),x=px(g&&g.map(S=>Object.assign({},S,{params:Object.assign({},l,S.params),pathname:Ii([a,i.encodeLocation?i.encodeLocation(S.pathname).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?a:Ii([a,i.encodeLocation?i.encodeLocation(S.pathnameBase).pathname:S.pathnameBase])})),o,r,n);return e&&x?L.createElement(Cu.Provider,{value:{location:Ys({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:ii.Pop}},x):x}function cx(){let t=yx(),e=nx(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},o=null;return L.createElement(L.Fragment,null,L.createElement("h2",null,"Unexpected Application Error!"),L.createElement("h3",{style:{fontStyle:"italic"}},e),r?L.createElement("pre",{style:i},r):null,o)}const fx=L.createElement(cx,null);class dx extends L.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?L.createElement($i.Provider,{value:this.props.routeContext},L.createElement(ey.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function hx(t){let{routeContext:e,match:r,children:n}=t,i=L.useContext(Eh);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),L.createElement($i.Provider,{value:e},n)}function px(t,e,r,n){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var o;if((o=r)!=null&&o.errors)t=r.matches;else return null}let s=t,l=(i=r)==null?void 0:i.errors;if(l!=null){let c=s.findIndex(d=>d.route.id&&(l==null?void 0:l[d.route.id]));c>=0||_t(!1),s=s.slice(0,Math.min(s.length,c+1))}let a=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let c=0;c=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((c,d,p)=>{let v,g=!1,x=null,S=null;r&&(v=l&&d.route.id?l[d.route.id]:void 0,x=d.route.errorElement||fx,a&&(u<0&&p===0?(Ex("route-fallback",!1),g=!0,S=null):u===p&&(g=!0,S=d.route.hydrateFallbackElement||null)));let E=e.concat(s.slice(0,p+1)),w=()=>{let _;return v?_=x:g?_=S:d.route.Component?_=L.createElement(d.route.Component,null):d.route.element?_=d.route.element:_=c,L.createElement(hx,{match:d,routeContext:{outlet:c,matches:E,isDataRoute:r!=null},children:_})};return r&&(d.route.ErrorBoundary||d.route.errorElement||p===0)?L.createElement(dx,{location:r.location,revalidation:r.revalidation,component:x,error:v,children:w(),routeContext:{outlet:null,matches:E,isDataRoute:!0}}):w()},null)}var ry=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(ry||{}),Qa=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Qa||{});function mx(t){let e=L.useContext(Eh);return e||_t(!1),e}function gx(t){let e=L.useContext(ox);return e||_t(!1),e}function vx(t){let e=L.useContext($i);return e||_t(!1),e}function ny(t){let e=vx(),r=e.matches[e.matches.length-1];return r.route.id||_t(!1),r.route.id}function yx(){var t;let e=L.useContext(ey),r=gx(Qa.UseRouteError),n=ny(Qa.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function wx(){let{router:t}=mx(ry.UseNavigateStable),e=ny(Qa.UseNavigateStable),r=L.useRef(!1);return ty(()=>{r.current=!0}),L.useCallback(function(i,o){o===void 0&&(o={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Ys({fromRouteId:e},o)))},[t,e])}const tp={};function Ex(t,e,r){!e&&!tp[t]&&(tp[t]=!0)}function ms(t){_t(!1)}function xx(t){let{basename:e="/",children:r=null,location:n,navigationType:i=ii.Pop,navigator:o,static:s=!1,future:l}=t;Mu()&&_t(!1);let a=e.replace(/^\/*/,"/"),u=L.useMemo(()=>({basename:a,navigator:o,static:s,future:Ys({v7_relativeSplatPath:!1},l)}),[a,l,o,s]);typeof n=="string"&&(n=Ho(n));let{pathname:c="/",search:d="",hash:p="",state:v=null,key:g="default"}=n,x=L.useMemo(()=>{let S=Xv(c,a);return S==null?null:{location:{pathname:S,search:d,hash:p,state:v,key:g},navigationType:i}},[a,c,d,p,v,g,i]);return x==null?null:L.createElement(Pu.Provider,{value:u},L.createElement(Cu.Provider,{children:r,value:x}))}function Ax(t){let{children:e,location:r}=t;return ax(id(e),r)}new Promise(()=>{});function id(t,e){e===void 0&&(e=[]);let r=[];return L.Children.forEach(t,(n,i)=>{if(!L.isValidElement(n))return;let o=[...e,i];if(n.type===L.Fragment){r.push.apply(r,id(n.props.children,o));return}n.type!==ms&&_t(!1),!n.props.index||!n.props.children||_t(!1);let s={id:n.props.id||o.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(s.children=id(n.props.children,o)),r.push(s)}),r}/** - * React Router DOM v6.21.3 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */const bx="startTransition",rp=xw[bx];function _x(t){let{basename:e,children:r,future:n,window:i}=t,o=L.useRef();o.current==null&&(o.current=IE({window:i,v5Compat:!0}));let s=o.current,[l,a]=L.useState({action:s.action,location:s.location}),{v7_startTransition:u}=n||{},c=L.useCallback(d=>{u&&rp?rp(()=>a(d)):a(d)},[a,u]);return L.useLayoutEffect(()=>s.listen(c),[s,c]),L.createElement(xx,{basename:e,children:r,location:l.location,navigationType:l.action,navigator:s,future:n})}var np;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(np||(np={}));var ip;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(ip||(ip={}));var Ah={exports:{}};const Sx={},kx=Object.freeze(Object.defineProperty({__proto__:null,default:Sx},Symbol.toStringTag,{value:"Module"})),Nx=Uo(kx);Ah.exports;(function(t){(function(e,r){function n(C,f){if(!C)throw new Error(f||"Assertion failed")}function i(C,f){C.super_=f;var m=function(){};m.prototype=f.prototype,C.prototype=new m,C.prototype.constructor=C}function o(C,f,m){if(o.isBN(C))return C;this.negative=0,this.words=null,this.length=0,this.red=null,C!==null&&((f==="le"||f==="be")&&(m=f,f=10),this._init(C||0,f||10,m||"be"))}typeof e=="object"?e.exports=o:r.BN=o,o.BN=o,o.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=Nx.Buffer}catch{}o.isBN=function(f){return f instanceof o?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===o.wordSize&&Array.isArray(f.words)},o.max=function(f,m){return f.cmp(m)>0?f:m},o.min=function(f,m){return f.cmp(m)<0?f:m},o.prototype._init=function(f,m,A){if(typeof f=="number")return this._initNumber(f,m,A);if(typeof f=="object")return this._initArray(f,m,A);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),f=f.toString().replace(/\s+/g,"");var N=0;f[0]==="-"&&(N++,this.negative=1),N=0;N-=3)M=f[N]|f[N-1]<<8|f[N-2]<<16,this.words[b]|=M<>>26-R&67108863,R+=24,R>=26&&(R-=26,b++);else if(A==="le")for(N=0,b=0;N>>26-R&67108863,R+=24,R>=26&&(R-=26,b++);return this._strip()};function l(C,f){var m=C.charCodeAt(f);if(m>=48&&m<=57)return m-48;if(m>=65&&m<=70)return m-55;if(m>=97&&m<=102)return m-87;n(!1,"Invalid character in "+C)}function a(C,f,m){var A=l(C,m);return m-1>=f&&(A|=l(C,m-1)<<4),A}o.prototype._parseHex=function(f,m,A){this.length=Math.ceil((f.length-m)/6),this.words=new Array(this.length);for(var N=0;N=m;N-=2)R=a(f,m,N)<=18?(b-=18,M+=1,this.words[M]|=R>>>26):b+=8;else{var k=f.length-m;for(N=k%2===0?m+1:m;N=18?(b-=18,M+=1,this.words[M]|=R>>>26):b+=8}this._strip()};function u(C,f,m,A){for(var N=0,b=0,M=Math.min(C.length,m),R=f;R=49?b=k-49+10:k>=17?b=k-17+10:b=k,n(k>=0&&b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch{o.prototype.inspect=d}else o.prototype.inspect=d;function d(){return(this.red?""}var p=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],v=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],g=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(f,m){f=f||10,m=m|0||1;var A;if(f===16||f==="hex"){A="";for(var N=0,b=0,M=0;M>>24-N&16777215,N+=2,N>=26&&(N-=26,M--),b!==0||M!==this.length-1?A=p[6-k.length]+k+A:A=k+A}for(b!==0&&(A=b.toString(16)+A);A.length%m!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}if(f===(f|0)&&f>=2&&f<=36){var h=v[f],P=g[f];A="";var ee=this.clone();for(ee.negative=0;!ee.isZero();){var y=ee.modrn(P).toString(f);ee=ee.idivn(P),ee.isZero()?A=y+A:A=p[h-y.length]+y+A}for(this.isZero()&&(A="0"+A);A.length%m!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(f,m){return this.toArrayLike(s,f,m)}),o.prototype.toArray=function(f,m){return this.toArrayLike(Array,f,m)};var x=function(f,m){return f.allocUnsafe?f.allocUnsafe(m):new f(m)};o.prototype.toArrayLike=function(f,m,A){this._strip();var N=this.byteLength(),b=A||Math.max(1,N);n(N<=b,"byte array longer than desired length"),n(b>0,"Requested array length <= 0");var M=x(f,b),R=m==="le"?"LE":"BE";return this["_toArrayLike"+R](M,N),M},o.prototype._toArrayLikeLE=function(f,m){for(var A=0,N=0,b=0,M=0;b>8&255),A>16&255),M===6?(A>24&255),N=0,M=0):(N=R>>>24,M+=2)}if(A=0&&(f[A--]=R>>8&255),A>=0&&(f[A--]=R>>16&255),M===6?(A>=0&&(f[A--]=R>>24&255),N=0,M=0):(N=R>>>24,M+=2)}if(A>=0)for(f[A--]=N;A>=0;)f[A--]=0},Math.clz32?o.prototype._countBits=function(f){return 32-Math.clz32(f)}:o.prototype._countBits=function(f){var m=f,A=0;return m>=4096&&(A+=13,m>>>=13),m>=64&&(A+=7,m>>>=7),m>=8&&(A+=4,m>>>=4),m>=2&&(A+=2,m>>>=2),A+m},o.prototype._zeroBits=function(f){if(f===0)return 26;var m=f,A=0;return m&8191||(A+=13,m>>>=13),m&127||(A+=7,m>>>=7),m&15||(A+=4,m>>>=4),m&3||(A+=2,m>>>=2),m&1||A++,A},o.prototype.bitLength=function(){var f=this.words[this.length-1],m=this._countBits(f);return(this.length-1)*26+m};function S(C){for(var f=new Array(C.bitLength()),m=0;m>>N&1}return f}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,m=0;mf.length?this.clone().ior(f):f.clone().ior(this)},o.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},o.prototype.iuand=function(f){var m;this.length>f.length?m=f:m=this;for(var A=0;Af.length?this.clone().iand(f):f.clone().iand(this)},o.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},o.prototype.iuxor=function(f){var m,A;this.length>f.length?(m=this,A=f):(m=f,A=this);for(var N=0;Nf.length?this.clone().ixor(f):f.clone().ixor(this)},o.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},o.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var m=Math.ceil(f/26)|0,A=f%26;this._expand(m),A>0&&m--;for(var N=0;N0&&(this.words[N]=~this.words[N]&67108863>>26-A),this._strip()},o.prototype.notn=function(f){return this.clone().inotn(f)},o.prototype.setn=function(f,m){n(typeof f=="number"&&f>=0);var A=f/26|0,N=f%26;return this._expand(A+1),m?this.words[A]=this.words[A]|1<f.length?(A=this,N=f):(A=f,N=this);for(var b=0,M=0;M>>26;for(;b!==0&&M>>26;if(this.length=A.length,b!==0)this.words[this.length]=b,this.length++;else if(A!==this)for(;Mf.length?this.clone().iadd(f):f.clone().iadd(this)},o.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var m=this.iadd(f);return f.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var A=this.cmp(f);if(A===0)return this.negative=0,this.length=1,this.words[0]=0,this;var N,b;A>0?(N=this,b=f):(N=f,b=this);for(var M=0,R=0;R>26,this.words[R]=m&67108863;for(;M!==0&&R>26,this.words[R]=m&67108863;if(M===0&&R>>26,ee=k&67108863,y=Math.min(h,f.length-1),D=Math.max(0,h-C.length+1);D<=y;D++){var U=h-D|0;N=C.words[U]|0,b=f.words[D]|0,M=N*b+ee,P+=M/67108864|0,ee=M&67108863}m.words[h]=ee|0,k=P|0}return k!==0?m.words[h]=k|0:m.length--,m._strip()}var w=function(f,m,A){var N=f.words,b=m.words,M=A.words,R=0,k,h,P,ee=N[0]|0,y=ee&8191,D=ee>>>13,U=N[1]|0,F=U&8191,G=U>>>13,ie=N[2]|0,Y=ie&8191,Q=ie>>>13,Je=N[3]|0,J=Je&8191,le=Je>>>13,Qr=N[4]|0,Te=Qr&8191,Ne=Qr>>>13,Jr=N[5]|0,Pe=Jr&8191,ce=Jr>>>13,wr=N[6]|0,fe=wr&8191,Oe=wr>>>13,Yr=N[7]|0,me=Yr&8191,ze=Yr>>>13,gn=N[8]|0,$e=gn&8191,He=gn>>>13,Ht=N[9]|0,Le=Ht&8191,qe=Ht>>>13,Rr=b[0]|0,Ce=Rr&8191,We=Rr>>>13,vn=b[1]|0,Be=vn&8191,Ge=vn>>>13,yn=b[2]|0,De=yn&8191,re=yn>>>13,ot=b[3]|0,ge=ot&8191,de=ot>>>13,rt=b[4]|0,be=rt&8191,_e=rt>>>13,Ct=b[5]|0,Me=Ct&8191,je=Ct>>>13,Kt=b[6]|0,Ve=Kt&8191,Ke=Kt>>>13,Qt=b[7]|0,Ie=Qt&8191,Ue=Qt>>>13,Er=b[8]|0,ke=Er&8191,Ye=Er>>>13,Ai=b[9]|0,Xe=Ai&8191,Ze=Ai>>>13;A.negative=f.negative^m.negative,A.length=19,k=Math.imul(y,Ce),h=Math.imul(y,We),h=h+Math.imul(D,Ce)|0,P=Math.imul(D,We);var $n=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+($n>>>26)|0,$n&=67108863,k=Math.imul(F,Ce),h=Math.imul(F,We),h=h+Math.imul(G,Ce)|0,P=Math.imul(G,We),k=k+Math.imul(y,Be)|0,h=h+Math.imul(y,Ge)|0,h=h+Math.imul(D,Be)|0,P=P+Math.imul(D,Ge)|0;var Hn=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Hn>>>26)|0,Hn&=67108863,k=Math.imul(Y,Ce),h=Math.imul(Y,We),h=h+Math.imul(Q,Ce)|0,P=Math.imul(Q,We),k=k+Math.imul(F,Be)|0,h=h+Math.imul(F,Ge)|0,h=h+Math.imul(G,Be)|0,P=P+Math.imul(G,Ge)|0,k=k+Math.imul(y,De)|0,h=h+Math.imul(y,re)|0,h=h+Math.imul(D,De)|0,P=P+Math.imul(D,re)|0;var qn=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(qn>>>26)|0,qn&=67108863,k=Math.imul(J,Ce),h=Math.imul(J,We),h=h+Math.imul(le,Ce)|0,P=Math.imul(le,We),k=k+Math.imul(Y,Be)|0,h=h+Math.imul(Y,Ge)|0,h=h+Math.imul(Q,Be)|0,P=P+Math.imul(Q,Ge)|0,k=k+Math.imul(F,De)|0,h=h+Math.imul(F,re)|0,h=h+Math.imul(G,De)|0,P=P+Math.imul(G,re)|0,k=k+Math.imul(y,ge)|0,h=h+Math.imul(y,de)|0,h=h+Math.imul(D,ge)|0,P=P+Math.imul(D,de)|0;var Wn=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,k=Math.imul(Te,Ce),h=Math.imul(Te,We),h=h+Math.imul(Ne,Ce)|0,P=Math.imul(Ne,We),k=k+Math.imul(J,Be)|0,h=h+Math.imul(J,Ge)|0,h=h+Math.imul(le,Be)|0,P=P+Math.imul(le,Ge)|0,k=k+Math.imul(Y,De)|0,h=h+Math.imul(Y,re)|0,h=h+Math.imul(Q,De)|0,P=P+Math.imul(Q,re)|0,k=k+Math.imul(F,ge)|0,h=h+Math.imul(F,de)|0,h=h+Math.imul(G,ge)|0,P=P+Math.imul(G,de)|0,k=k+Math.imul(y,be)|0,h=h+Math.imul(y,_e)|0,h=h+Math.imul(D,be)|0,P=P+Math.imul(D,_e)|0;var Gn=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Gn>>>26)|0,Gn&=67108863,k=Math.imul(Pe,Ce),h=Math.imul(Pe,We),h=h+Math.imul(ce,Ce)|0,P=Math.imul(ce,We),k=k+Math.imul(Te,Be)|0,h=h+Math.imul(Te,Ge)|0,h=h+Math.imul(Ne,Be)|0,P=P+Math.imul(Ne,Ge)|0,k=k+Math.imul(J,De)|0,h=h+Math.imul(J,re)|0,h=h+Math.imul(le,De)|0,P=P+Math.imul(le,re)|0,k=k+Math.imul(Y,ge)|0,h=h+Math.imul(Y,de)|0,h=h+Math.imul(Q,ge)|0,P=P+Math.imul(Q,de)|0,k=k+Math.imul(F,be)|0,h=h+Math.imul(F,_e)|0,h=h+Math.imul(G,be)|0,P=P+Math.imul(G,_e)|0,k=k+Math.imul(y,Me)|0,h=h+Math.imul(y,je)|0,h=h+Math.imul(D,Me)|0,P=P+Math.imul(D,je)|0;var Yu=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Yu>>>26)|0,Yu&=67108863,k=Math.imul(fe,Ce),h=Math.imul(fe,We),h=h+Math.imul(Oe,Ce)|0,P=Math.imul(Oe,We),k=k+Math.imul(Pe,Be)|0,h=h+Math.imul(Pe,Ge)|0,h=h+Math.imul(ce,Be)|0,P=P+Math.imul(ce,Ge)|0,k=k+Math.imul(Te,De)|0,h=h+Math.imul(Te,re)|0,h=h+Math.imul(Ne,De)|0,P=P+Math.imul(Ne,re)|0,k=k+Math.imul(J,ge)|0,h=h+Math.imul(J,de)|0,h=h+Math.imul(le,ge)|0,P=P+Math.imul(le,de)|0,k=k+Math.imul(Y,be)|0,h=h+Math.imul(Y,_e)|0,h=h+Math.imul(Q,be)|0,P=P+Math.imul(Q,_e)|0,k=k+Math.imul(F,Me)|0,h=h+Math.imul(F,je)|0,h=h+Math.imul(G,Me)|0,P=P+Math.imul(G,je)|0,k=k+Math.imul(y,Ve)|0,h=h+Math.imul(y,Ke)|0,h=h+Math.imul(D,Ve)|0,P=P+Math.imul(D,Ke)|0;var Xu=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,k=Math.imul(me,Ce),h=Math.imul(me,We),h=h+Math.imul(ze,Ce)|0,P=Math.imul(ze,We),k=k+Math.imul(fe,Be)|0,h=h+Math.imul(fe,Ge)|0,h=h+Math.imul(Oe,Be)|0,P=P+Math.imul(Oe,Ge)|0,k=k+Math.imul(Pe,De)|0,h=h+Math.imul(Pe,re)|0,h=h+Math.imul(ce,De)|0,P=P+Math.imul(ce,re)|0,k=k+Math.imul(Te,ge)|0,h=h+Math.imul(Te,de)|0,h=h+Math.imul(Ne,ge)|0,P=P+Math.imul(Ne,de)|0,k=k+Math.imul(J,be)|0,h=h+Math.imul(J,_e)|0,h=h+Math.imul(le,be)|0,P=P+Math.imul(le,_e)|0,k=k+Math.imul(Y,Me)|0,h=h+Math.imul(Y,je)|0,h=h+Math.imul(Q,Me)|0,P=P+Math.imul(Q,je)|0,k=k+Math.imul(F,Ve)|0,h=h+Math.imul(F,Ke)|0,h=h+Math.imul(G,Ve)|0,P=P+Math.imul(G,Ke)|0,k=k+Math.imul(y,Ie)|0,h=h+Math.imul(y,Ue)|0,h=h+Math.imul(D,Ie)|0,P=P+Math.imul(D,Ue)|0;var Zu=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Zu>>>26)|0,Zu&=67108863,k=Math.imul($e,Ce),h=Math.imul($e,We),h=h+Math.imul(He,Ce)|0,P=Math.imul(He,We),k=k+Math.imul(me,Be)|0,h=h+Math.imul(me,Ge)|0,h=h+Math.imul(ze,Be)|0,P=P+Math.imul(ze,Ge)|0,k=k+Math.imul(fe,De)|0,h=h+Math.imul(fe,re)|0,h=h+Math.imul(Oe,De)|0,P=P+Math.imul(Oe,re)|0,k=k+Math.imul(Pe,ge)|0,h=h+Math.imul(Pe,de)|0,h=h+Math.imul(ce,ge)|0,P=P+Math.imul(ce,de)|0,k=k+Math.imul(Te,be)|0,h=h+Math.imul(Te,_e)|0,h=h+Math.imul(Ne,be)|0,P=P+Math.imul(Ne,_e)|0,k=k+Math.imul(J,Me)|0,h=h+Math.imul(J,je)|0,h=h+Math.imul(le,Me)|0,P=P+Math.imul(le,je)|0,k=k+Math.imul(Y,Ve)|0,h=h+Math.imul(Y,Ke)|0,h=h+Math.imul(Q,Ve)|0,P=P+Math.imul(Q,Ke)|0,k=k+Math.imul(F,Ie)|0,h=h+Math.imul(F,Ue)|0,h=h+Math.imul(G,Ie)|0,P=P+Math.imul(G,Ue)|0,k=k+Math.imul(y,ke)|0,h=h+Math.imul(y,Ye)|0,h=h+Math.imul(D,ke)|0,P=P+Math.imul(D,Ye)|0;var ec=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ec>>>26)|0,ec&=67108863,k=Math.imul(Le,Ce),h=Math.imul(Le,We),h=h+Math.imul(qe,Ce)|0,P=Math.imul(qe,We),k=k+Math.imul($e,Be)|0,h=h+Math.imul($e,Ge)|0,h=h+Math.imul(He,Be)|0,P=P+Math.imul(He,Ge)|0,k=k+Math.imul(me,De)|0,h=h+Math.imul(me,re)|0,h=h+Math.imul(ze,De)|0,P=P+Math.imul(ze,re)|0,k=k+Math.imul(fe,ge)|0,h=h+Math.imul(fe,de)|0,h=h+Math.imul(Oe,ge)|0,P=P+Math.imul(Oe,de)|0,k=k+Math.imul(Pe,be)|0,h=h+Math.imul(Pe,_e)|0,h=h+Math.imul(ce,be)|0,P=P+Math.imul(ce,_e)|0,k=k+Math.imul(Te,Me)|0,h=h+Math.imul(Te,je)|0,h=h+Math.imul(Ne,Me)|0,P=P+Math.imul(Ne,je)|0,k=k+Math.imul(J,Ve)|0,h=h+Math.imul(J,Ke)|0,h=h+Math.imul(le,Ve)|0,P=P+Math.imul(le,Ke)|0,k=k+Math.imul(Y,Ie)|0,h=h+Math.imul(Y,Ue)|0,h=h+Math.imul(Q,Ie)|0,P=P+Math.imul(Q,Ue)|0,k=k+Math.imul(F,ke)|0,h=h+Math.imul(F,Ye)|0,h=h+Math.imul(G,ke)|0,P=P+Math.imul(G,Ye)|0,k=k+Math.imul(y,Xe)|0,h=h+Math.imul(y,Ze)|0,h=h+Math.imul(D,Xe)|0,P=P+Math.imul(D,Ze)|0;var tc=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(tc>>>26)|0,tc&=67108863,k=Math.imul(Le,Be),h=Math.imul(Le,Ge),h=h+Math.imul(qe,Be)|0,P=Math.imul(qe,Ge),k=k+Math.imul($e,De)|0,h=h+Math.imul($e,re)|0,h=h+Math.imul(He,De)|0,P=P+Math.imul(He,re)|0,k=k+Math.imul(me,ge)|0,h=h+Math.imul(me,de)|0,h=h+Math.imul(ze,ge)|0,P=P+Math.imul(ze,de)|0,k=k+Math.imul(fe,be)|0,h=h+Math.imul(fe,_e)|0,h=h+Math.imul(Oe,be)|0,P=P+Math.imul(Oe,_e)|0,k=k+Math.imul(Pe,Me)|0,h=h+Math.imul(Pe,je)|0,h=h+Math.imul(ce,Me)|0,P=P+Math.imul(ce,je)|0,k=k+Math.imul(Te,Ve)|0,h=h+Math.imul(Te,Ke)|0,h=h+Math.imul(Ne,Ve)|0,P=P+Math.imul(Ne,Ke)|0,k=k+Math.imul(J,Ie)|0,h=h+Math.imul(J,Ue)|0,h=h+Math.imul(le,Ie)|0,P=P+Math.imul(le,Ue)|0,k=k+Math.imul(Y,ke)|0,h=h+Math.imul(Y,Ye)|0,h=h+Math.imul(Q,ke)|0,P=P+Math.imul(Q,Ye)|0,k=k+Math.imul(F,Xe)|0,h=h+Math.imul(F,Ze)|0,h=h+Math.imul(G,Xe)|0,P=P+Math.imul(G,Ze)|0;var rc=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(rc>>>26)|0,rc&=67108863,k=Math.imul(Le,De),h=Math.imul(Le,re),h=h+Math.imul(qe,De)|0,P=Math.imul(qe,re),k=k+Math.imul($e,ge)|0,h=h+Math.imul($e,de)|0,h=h+Math.imul(He,ge)|0,P=P+Math.imul(He,de)|0,k=k+Math.imul(me,be)|0,h=h+Math.imul(me,_e)|0,h=h+Math.imul(ze,be)|0,P=P+Math.imul(ze,_e)|0,k=k+Math.imul(fe,Me)|0,h=h+Math.imul(fe,je)|0,h=h+Math.imul(Oe,Me)|0,P=P+Math.imul(Oe,je)|0,k=k+Math.imul(Pe,Ve)|0,h=h+Math.imul(Pe,Ke)|0,h=h+Math.imul(ce,Ve)|0,P=P+Math.imul(ce,Ke)|0,k=k+Math.imul(Te,Ie)|0,h=h+Math.imul(Te,Ue)|0,h=h+Math.imul(Ne,Ie)|0,P=P+Math.imul(Ne,Ue)|0,k=k+Math.imul(J,ke)|0,h=h+Math.imul(J,Ye)|0,h=h+Math.imul(le,ke)|0,P=P+Math.imul(le,Ye)|0,k=k+Math.imul(Y,Xe)|0,h=h+Math.imul(Y,Ze)|0,h=h+Math.imul(Q,Xe)|0,P=P+Math.imul(Q,Ze)|0;var nc=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(nc>>>26)|0,nc&=67108863,k=Math.imul(Le,ge),h=Math.imul(Le,de),h=h+Math.imul(qe,ge)|0,P=Math.imul(qe,de),k=k+Math.imul($e,be)|0,h=h+Math.imul($e,_e)|0,h=h+Math.imul(He,be)|0,P=P+Math.imul(He,_e)|0,k=k+Math.imul(me,Me)|0,h=h+Math.imul(me,je)|0,h=h+Math.imul(ze,Me)|0,P=P+Math.imul(ze,je)|0,k=k+Math.imul(fe,Ve)|0,h=h+Math.imul(fe,Ke)|0,h=h+Math.imul(Oe,Ve)|0,P=P+Math.imul(Oe,Ke)|0,k=k+Math.imul(Pe,Ie)|0,h=h+Math.imul(Pe,Ue)|0,h=h+Math.imul(ce,Ie)|0,P=P+Math.imul(ce,Ue)|0,k=k+Math.imul(Te,ke)|0,h=h+Math.imul(Te,Ye)|0,h=h+Math.imul(Ne,ke)|0,P=P+Math.imul(Ne,Ye)|0,k=k+Math.imul(J,Xe)|0,h=h+Math.imul(J,Ze)|0,h=h+Math.imul(le,Xe)|0,P=P+Math.imul(le,Ze)|0;var ic=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ic>>>26)|0,ic&=67108863,k=Math.imul(Le,be),h=Math.imul(Le,_e),h=h+Math.imul(qe,be)|0,P=Math.imul(qe,_e),k=k+Math.imul($e,Me)|0,h=h+Math.imul($e,je)|0,h=h+Math.imul(He,Me)|0,P=P+Math.imul(He,je)|0,k=k+Math.imul(me,Ve)|0,h=h+Math.imul(me,Ke)|0,h=h+Math.imul(ze,Ve)|0,P=P+Math.imul(ze,Ke)|0,k=k+Math.imul(fe,Ie)|0,h=h+Math.imul(fe,Ue)|0,h=h+Math.imul(Oe,Ie)|0,P=P+Math.imul(Oe,Ue)|0,k=k+Math.imul(Pe,ke)|0,h=h+Math.imul(Pe,Ye)|0,h=h+Math.imul(ce,ke)|0,P=P+Math.imul(ce,Ye)|0,k=k+Math.imul(Te,Xe)|0,h=h+Math.imul(Te,Ze)|0,h=h+Math.imul(Ne,Xe)|0,P=P+Math.imul(Ne,Ze)|0;var oc=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(oc>>>26)|0,oc&=67108863,k=Math.imul(Le,Me),h=Math.imul(Le,je),h=h+Math.imul(qe,Me)|0,P=Math.imul(qe,je),k=k+Math.imul($e,Ve)|0,h=h+Math.imul($e,Ke)|0,h=h+Math.imul(He,Ve)|0,P=P+Math.imul(He,Ke)|0,k=k+Math.imul(me,Ie)|0,h=h+Math.imul(me,Ue)|0,h=h+Math.imul(ze,Ie)|0,P=P+Math.imul(ze,Ue)|0,k=k+Math.imul(fe,ke)|0,h=h+Math.imul(fe,Ye)|0,h=h+Math.imul(Oe,ke)|0,P=P+Math.imul(Oe,Ye)|0,k=k+Math.imul(Pe,Xe)|0,h=h+Math.imul(Pe,Ze)|0,h=h+Math.imul(ce,Xe)|0,P=P+Math.imul(ce,Ze)|0;var sc=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(sc>>>26)|0,sc&=67108863,k=Math.imul(Le,Ve),h=Math.imul(Le,Ke),h=h+Math.imul(qe,Ve)|0,P=Math.imul(qe,Ke),k=k+Math.imul($e,Ie)|0,h=h+Math.imul($e,Ue)|0,h=h+Math.imul(He,Ie)|0,P=P+Math.imul(He,Ue)|0,k=k+Math.imul(me,ke)|0,h=h+Math.imul(me,Ye)|0,h=h+Math.imul(ze,ke)|0,P=P+Math.imul(ze,Ye)|0,k=k+Math.imul(fe,Xe)|0,h=h+Math.imul(fe,Ze)|0,h=h+Math.imul(Oe,Xe)|0,P=P+Math.imul(Oe,Ze)|0;var lc=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(lc>>>26)|0,lc&=67108863,k=Math.imul(Le,Ie),h=Math.imul(Le,Ue),h=h+Math.imul(qe,Ie)|0,P=Math.imul(qe,Ue),k=k+Math.imul($e,ke)|0,h=h+Math.imul($e,Ye)|0,h=h+Math.imul(He,ke)|0,P=P+Math.imul(He,Ye)|0,k=k+Math.imul(me,Xe)|0,h=h+Math.imul(me,Ze)|0,h=h+Math.imul(ze,Xe)|0,P=P+Math.imul(ze,Ze)|0;var ac=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ac>>>26)|0,ac&=67108863,k=Math.imul(Le,ke),h=Math.imul(Le,Ye),h=h+Math.imul(qe,ke)|0,P=Math.imul(qe,Ye),k=k+Math.imul($e,Xe)|0,h=h+Math.imul($e,Ze)|0,h=h+Math.imul(He,Xe)|0,P=P+Math.imul(He,Ze)|0;var uc=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(uc>>>26)|0,uc&=67108863,k=Math.imul(Le,Xe),h=Math.imul(Le,Ze),h=h+Math.imul(qe,Xe)|0,P=Math.imul(qe,Ze);var cc=(R+k|0)+((h&8191)<<13)|0;return R=(P+(h>>>13)|0)+(cc>>>26)|0,cc&=67108863,M[0]=$n,M[1]=Hn,M[2]=qn,M[3]=Wn,M[4]=Gn,M[5]=Yu,M[6]=Xu,M[7]=Zu,M[8]=ec,M[9]=tc,M[10]=rc,M[11]=nc,M[12]=ic,M[13]=oc,M[14]=sc,M[15]=lc,M[16]=ac,M[17]=uc,M[18]=cc,R!==0&&(M[19]=R,A.length++),A};Math.imul||(w=E);function _(C,f,m){m.negative=f.negative^C.negative,m.length=C.length+f.length;for(var A=0,N=0,b=0;b>>26)|0,N+=M>>>26,M&=67108863}m.words[b]=R,A=M,M=N}return A!==0?m.words[b]=A:m.length--,m._strip()}function O(C,f,m){return _(C,f,m)}o.prototype.mulTo=function(f,m){var A,N=this.length+f.length;return this.length===10&&f.length===10?A=w(this,f,m):N<63?A=E(this,f,m):N<1024?A=_(this,f,m):A=O(this,f,m),A},o.prototype.mul=function(f){var m=new o(null);return m.words=new Array(this.length+f.length),this.mulTo(f,m)},o.prototype.mulf=function(f){var m=new o(null);return m.words=new Array(this.length+f.length),O(this,f,m)},o.prototype.imul=function(f){return this.clone().mulTo(f,this)},o.prototype.imuln=function(f){var m=f<0;m&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var A=0,N=0;N>=26,A+=b/67108864|0,A+=M>>>26,this.words[N]=M&67108863}return A!==0&&(this.words[N]=A,this.length++),m?this.ineg():this},o.prototype.muln=function(f){return this.clone().imuln(f)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(f){var m=S(f);if(m.length===0)return new o(1);for(var A=this,N=0;N=0);var m=f%26,A=(f-m)/26,N=67108863>>>26-m<<26-m,b;if(m!==0){var M=0;for(b=0;b>>26-m}M&&(this.words[b]=M,this.length++)}if(A!==0){for(b=this.length-1;b>=0;b--)this.words[b+A]=this.words[b];for(b=0;b=0);var N;m?N=(m-m%26)/26:N=0;var b=f%26,M=Math.min((f-b)/26,this.length),R=67108863^67108863>>>b<M)for(this.length-=M,h=0;h=0&&(P!==0||h>=N);h--){var ee=this.words[h]|0;this.words[h]=P<<26-b|ee>>>b,P=ee&R}return k&&P!==0&&(k.words[k.length++]=P),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(f,m,A){return n(this.negative===0),this.iushrn(f,m,A)},o.prototype.shln=function(f){return this.clone().ishln(f)},o.prototype.ushln=function(f){return this.clone().iushln(f)},o.prototype.shrn=function(f){return this.clone().ishrn(f)},o.prototype.ushrn=function(f){return this.clone().iushrn(f)},o.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var m=f%26,A=(f-m)/26,N=1<=0);var m=f%26,A=(f-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=A)return this;if(m!==0&&A++,this.length=Math.min(A,this.length),m!==0){var N=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},o.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(k/67108864|0),this.words[b+A]=M&67108863}for(;b>26,this.words[b+A]=M&67108863;if(R===0)return this._strip();for(n(R===-1),R=0,b=0;b>26,this.words[b]=M&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(f,m){var A=this.length-f.length,N=this.clone(),b=f,M=b.words[b.length-1]|0,R=this._countBits(M);A=26-R,A!==0&&(b=b.ushln(A),N.iushln(A),M=b.words[b.length-1]|0);var k=N.length-b.length,h;if(m!=="mod"){h=new o(null),h.length=k+1,h.words=new Array(h.length);for(var P=0;P=0;y--){var D=(N.words[b.length+y]|0)*67108864+(N.words[b.length+y-1]|0);for(D=Math.min(D/M|0,67108863),N._ishlnsubmul(b,D,y);N.negative!==0;)D--,N.negative=0,N._ishlnsubmul(b,1,y),N.isZero()||(N.negative^=1);h&&(h.words[y]=D)}return h&&h._strip(),N._strip(),m!=="div"&&A!==0&&N.iushrn(A),{div:h||null,mod:N}},o.prototype.divmod=function(f,m,A){if(n(!f.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var N,b,M;return this.negative!==0&&f.negative===0?(M=this.neg().divmod(f,m),m!=="mod"&&(N=M.div.neg()),m!=="div"&&(b=M.mod.neg(),A&&b.negative!==0&&b.iadd(f)),{div:N,mod:b}):this.negative===0&&f.negative!==0?(M=this.divmod(f.neg(),m),m!=="mod"&&(N=M.div.neg()),{div:N,mod:M.mod}):this.negative&f.negative?(M=this.neg().divmod(f.neg(),m),m!=="div"&&(b=M.mod.neg(),A&&b.negative!==0&&b.isub(f)),{div:M.div,mod:b}):f.length>this.length||this.cmp(f)<0?{div:new o(0),mod:this}:f.length===1?m==="div"?{div:this.divn(f.words[0]),mod:null}:m==="mod"?{div:null,mod:new o(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new o(this.modrn(f.words[0]))}:this._wordDiv(f,m)},o.prototype.div=function(f){return this.divmod(f,"div",!1).div},o.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},o.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},o.prototype.divRound=function(f){var m=this.divmod(f);if(m.mod.isZero())return m.div;var A=m.div.negative!==0?m.mod.isub(f):m.mod,N=f.ushrn(1),b=f.andln(1),M=A.cmp(N);return M<0||b===1&&M===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},o.prototype.modrn=function(f){var m=f<0;m&&(f=-f),n(f<=67108863);for(var A=(1<<26)%f,N=0,b=this.length-1;b>=0;b--)N=(A*N+(this.words[b]|0))%f;return m?-N:N},o.prototype.modn=function(f){return this.modrn(f)},o.prototype.idivn=function(f){var m=f<0;m&&(f=-f),n(f<=67108863);for(var A=0,N=this.length-1;N>=0;N--){var b=(this.words[N]|0)+A*67108864;this.words[N]=b/f|0,A=b%f}return this._strip(),m?this.ineg():this},o.prototype.divn=function(f){return this.clone().idivn(f)},o.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var m=this,A=f.clone();m.negative!==0?m=m.umod(f):m=m.clone();for(var N=new o(1),b=new o(0),M=new o(0),R=new o(1),k=0;m.isEven()&&A.isEven();)m.iushrn(1),A.iushrn(1),++k;for(var h=A.clone(),P=m.clone();!m.isZero();){for(var ee=0,y=1;!(m.words[0]&y)&&ee<26;++ee,y<<=1);if(ee>0)for(m.iushrn(ee);ee-- >0;)(N.isOdd()||b.isOdd())&&(N.iadd(h),b.isub(P)),N.iushrn(1),b.iushrn(1);for(var D=0,U=1;!(A.words[0]&U)&&D<26;++D,U<<=1);if(D>0)for(A.iushrn(D);D-- >0;)(M.isOdd()||R.isOdd())&&(M.iadd(h),R.isub(P)),M.iushrn(1),R.iushrn(1);m.cmp(A)>=0?(m.isub(A),N.isub(M),b.isub(R)):(A.isub(m),M.isub(N),R.isub(b))}return{a:M,b:R,gcd:A.iushln(k)}},o.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var m=this,A=f.clone();m.negative!==0?m=m.umod(f):m=m.clone();for(var N=new o(1),b=new o(0),M=A.clone();m.cmpn(1)>0&&A.cmpn(1)>0;){for(var R=0,k=1;!(m.words[0]&k)&&R<26;++R,k<<=1);if(R>0)for(m.iushrn(R);R-- >0;)N.isOdd()&&N.iadd(M),N.iushrn(1);for(var h=0,P=1;!(A.words[0]&P)&&h<26;++h,P<<=1);if(h>0)for(A.iushrn(h);h-- >0;)b.isOdd()&&b.iadd(M),b.iushrn(1);m.cmp(A)>=0?(m.isub(A),N.isub(b)):(A.isub(m),b.isub(N))}var ee;return m.cmpn(1)===0?ee=N:ee=b,ee.cmpn(0)<0&&ee.iadd(f),ee},o.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var m=this.clone(),A=f.clone();m.negative=0,A.negative=0;for(var N=0;m.isEven()&&A.isEven();N++)m.iushrn(1),A.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;A.isEven();)A.iushrn(1);var b=m.cmp(A);if(b<0){var M=m;m=A,A=M}else if(b===0||A.cmpn(1)===0)break;m.isub(A)}while(!0);return A.iushln(N)},o.prototype.invm=function(f){return this.egcd(f).a.umod(f)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(f){return this.words[0]&f},o.prototype.bincn=function(f){n(typeof f=="number");var m=f%26,A=(f-m)/26,N=1<>>26,R&=67108863,this.words[M]=R}return b!==0&&(this.words[M]=b,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(f){var m=f<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this._strip();var A;if(this.length>1)A=1;else{m&&(f=-f),n(f<=67108863,"Number is too big");var N=this.words[0]|0;A=N===f?0:Nf.length)return 1;if(this.length=0;A--){var N=this.words[A]|0,b=f.words[A]|0;if(N!==b){Nb&&(m=1);break}}return m},o.prototype.gtn=function(f){return this.cmpn(f)===1},o.prototype.gt=function(f){return this.cmp(f)===1},o.prototype.gten=function(f){return this.cmpn(f)>=0},o.prototype.gte=function(f){return this.cmp(f)>=0},o.prototype.ltn=function(f){return this.cmpn(f)===-1},o.prototype.lt=function(f){return this.cmp(f)===-1},o.prototype.lten=function(f){return this.cmpn(f)<=0},o.prototype.lte=function(f){return this.cmp(f)<=0},o.prototype.eqn=function(f){return this.cmpn(f)===0},o.prototype.eq=function(f){return this.cmp(f)===0},o.red=function(f){return new H(f)},o.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(f){return this.red=f,this},o.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},o.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},o.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},o.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},o.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},o.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},o.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},o.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var B={k256:null,p224:null,p192:null,p25519:null};function j(C,f){this.name=C,this.p=new o(f,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}j.prototype._tmp=function(){var f=new o(null);return f.words=new Array(Math.ceil(this.n/13)),f},j.prototype.ireduce=function(f){var m=f,A;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),A=m.bitLength();while(A>this.n);var N=A0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},j.prototype.split=function(f,m){f.iushrn(this.n,0,m)},j.prototype.imulK=function(f){return f.imul(this.k)};function $(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i($,j),$.prototype.split=function(f,m){for(var A=4194303,N=Math.min(f.length,9),b=0;b>>22,M=R}M>>>=22,f.words[b-10]=M,M===0&&f.length>10?f.length-=10:f.length-=9},$.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var m=0,A=0;A>>=26,f.words[A]=b,m=N}return m!==0&&(f.words[f.length++]=m),f},o._prime=function(f){if(B[f])return B[f];var m;if(f==="k256")m=new $;else if(f==="p224")m=new q;else if(f==="p192")m=new ne;else if(f==="p25519")m=new K;else throw new Error("Unknown prime "+f);return B[f]=m,m};function H(C){if(typeof C=="string"){var f=o._prime(C);this.m=f.p,this.prime=f}else n(C.gtn(1),"modulus must be greater than 1"),this.m=C,this.prime=null}H.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},H.prototype._verify2=function(f,m){n((f.negative|m.negative)===0,"red works only with positives"),n(f.red&&f.red===m.red,"red works only with red numbers")},H.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(c(f,f.umod(this.m)._forceRed(this)),f)},H.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},H.prototype.add=function(f,m){this._verify2(f,m);var A=f.add(m);return A.cmp(this.m)>=0&&A.isub(this.m),A._forceRed(this)},H.prototype.iadd=function(f,m){this._verify2(f,m);var A=f.iadd(m);return A.cmp(this.m)>=0&&A.isub(this.m),A},H.prototype.sub=function(f,m){this._verify2(f,m);var A=f.sub(m);return A.cmpn(0)<0&&A.iadd(this.m),A._forceRed(this)},H.prototype.isub=function(f,m){this._verify2(f,m);var A=f.isub(m);return A.cmpn(0)<0&&A.iadd(this.m),A},H.prototype.shl=function(f,m){return this._verify1(f),this.imod(f.ushln(m))},H.prototype.imul=function(f,m){return this._verify2(f,m),this.imod(f.imul(m))},H.prototype.mul=function(f,m){return this._verify2(f,m),this.imod(f.mul(m))},H.prototype.isqr=function(f){return this.imul(f,f.clone())},H.prototype.sqr=function(f){return this.mul(f,f)},H.prototype.sqrt=function(f){if(f.isZero())return f.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var A=this.m.add(new o(1)).iushrn(2);return this.pow(f,A)}for(var N=this.m.subn(1),b=0;!N.isZero()&&N.andln(1)===0;)b++,N.iushrn(1);n(!N.isZero());var M=new o(1).toRed(this),R=M.redNeg(),k=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);this.pow(h,k).cmp(R)!==0;)h.redIAdd(R);for(var P=this.pow(h,N),ee=this.pow(f,N.addn(1).iushrn(1)),y=this.pow(f,N),D=b;y.cmp(M)!==0;){for(var U=y,F=0;U.cmp(M)!==0;F++)U=U.redSqr();n(F=0;b--){for(var P=m.words[b],ee=h-1;ee>=0;ee--){var y=P>>ee&1;if(M!==N[0]&&(M=this.sqr(M)),y===0&&R===0){k=0;continue}R<<=1,R|=y,k++,!(k!==A&&(b!==0||ee!==0))&&(M=this.mul(M,N[R]),k=0,R=0)}h=26}return M},H.prototype.convertTo=function(f){var m=f.umod(this.m);return m===f?m.clone():m},H.prototype.convertFrom=function(f){var m=f.clone();return m.red=null,m},o.mont=function(f){return new se(f)};function se(C){H.call(this,C),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(se,H),se.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},se.prototype.convertFrom=function(f){var m=this.imod(f.mul(this.rinv));return m.red=null,m},se.prototype.imul=function(f,m){if(f.isZero()||m.isZero())return f.words[0]=0,f.length=1,f;var A=f.imul(m),N=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=A.isub(N).iushrn(this.shift),M=b;return b.cmp(this.m)>=0?M=b.isub(this.m):b.cmpn(0)<0&&(M=b.iadd(this.m)),M._forceRed(this)},se.prototype.mul=function(f,m){if(f.isZero()||m.isZero())return new o(0)._forceRed(this);var A=f.mul(m),N=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=A.isub(N).iushrn(this.shift),M=b;return b.cmp(this.m)>=0?M=b.isub(this.m):b.cmpn(0)<0&&(M=b.iadd(this.m)),M._forceRed(this)},se.prototype.invm=function(f){var m=this.imod(f._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,Fe)})(Ah);var Px=Ah.exports;const ue=jo(Px),Cx="logger/5.7.0";let op=!1,sp=!1;const da={debug:1,default:2,info:2,warning:3,error:4,off:5};let lp=da.default,jc=null;function Mx(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const ap=Mx();var od;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(od||(od={}));var Ur;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(Ur||(Ur={}));const up="0123456789abcdef";class T{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();da[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(lp>da[n])&&console.log.apply(console,r)}debug(...e){this._log(T.levels.DEBUG,e)}info(...e){this._log(T.levels.INFO,e)}warn(...e){this._log(T.levels.WARNING,e)}makeError(e,r,n){if(sp)return this.makeError("censored error",r,{});r||(r=T.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(a=>{const u=n[a];try{if(u instanceof Uint8Array){let c="";for(let d=0;d>4],c+=up[u[d]&15];i.push(a+"=Uint8Array(0x"+c+")")}else i.push(a+"="+JSON.stringify(u))}catch{i.push(a+"="+JSON.stringify(n[a].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const o=e;let s="";switch(r){case Ur.NUMERIC_FAULT:{s="NUMERIC_FAULT";const a=e;switch(a){case"overflow":case"underflow":case"division-by-zero":s+="-"+a;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result";break}break}case Ur.CALL_EXCEPTION:case Ur.INSUFFICIENT_FUNDS:case Ur.MISSING_NEW:case Ur.NONCE_EXPIRED:case Ur.REPLACEMENT_UNDERPRICED:case Ur.TRANSACTION_REPLACED:case Ur.UNPREDICTABLE_GAS_LIMIT:s=r;break}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const l=new Error(e);return l.reason=o,l.code=r,Object.keys(n).forEach(function(a){l[a]=n[a]}),l}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,T.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){ap&&this.throwError("platform missing String.prototype.normalize",T.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ap})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,T.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,T.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,T.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",T.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",T.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",T.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return jc||(jc=new T(Cx)),jc}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",T.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),op){if(!e)return;this.globalLogger().throwError("error censorship permanent",T.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}sp=!!e,op=!!r}static setLogLevel(e){const r=da[e.toLowerCase()];if(r==null){T.globalLogger().warn("invalid log level - "+e);return}lp=r}static from(e){return new T(e)}}T.errors=Ur;T.levels=od;const Ix="bytes/5.7.0",dt=new T(Ix);function iy(t){return!!t.toHexString}function Ao(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Ao(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function bh(t){return pe(t)&&!(t.length%2)||Ru(t)}function cp(t){return typeof t=="number"&&t==t&&t%1===0}function Ru(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!cp(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function oe(t,e){if(e||(e={}),typeof t=="number"){dt.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Ao(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),iy(t)&&(t=t.toHexString()),pe(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":dt.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ioe(i)),r=e.reduce((i,o)=>i+o.length,0),n=new Uint8Array(r);return e.reduce((i,o)=>(n.set(o,i),i+o.length),0),Ao(n)}function Ro(t){let e=oe(t);if(e.length===0)return e;let r=0;for(;re&&dt.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),Ao(r)}function pe(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const Uc="0123456789abcdef";function te(t,e){if(e||(e={}),typeof t=="number"){dt.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=Uc[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),iy(t))return t.toHexString();if(pe(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":dt.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Ru(t)){let r="0x";for(let n=0;n>4]+Uc[i&15]}return r}return dt.throwArgumentError("invalid hexlify value","value",t)}function On(t){if(typeof t!="string")t=te(t);else if(!pe(t)||t.length%2)return null;return(t.length-2)/2}function It(t,e,r){return typeof t!="string"?t=te(t):(!pe(t)||t.length%2)&&dt.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Xt(t){let e="0x";return t.forEach(r=>{e+=te(r).substring(2)}),e}function Tu(t){const e=Rx(te(t,{hexPad:"left"}));return e==="0x"?"0x0":e}function Rx(t){typeof t!="string"&&(t=te(t)),pe(t)||dt.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e2*e+2&&dt.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Ou(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(bh(t)){let r=oe(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=te(r.slice(0,32)),e.s=te(r.slice(32,64))):r.length===65?(e.r=te(r.slice(0,32)),e.s=te(r.slice(32,64)),e.v=r[64]):dt.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:dt.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=te(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=ha(oe(e._vs),32);e._vs=te(i);const o=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=o:e.recoveryParam!==o&&dt.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const s=te(i);e.s==null?e.s=s:e.s!==s&&dt.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?dt.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&dt.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!pe(e.r)?dt.throwArgumentError("signature missing or invalid r","signature",t):e.r=pt(e.r,32),e.s==null||!pe(e.s)?dt.throwArgumentError("signature missing or invalid s","signature",t):e.s=pt(e.s,32);const r=oe(e.s);r[0]>=128&&dt.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=te(r);e._vs&&(pe(e._vs)||dt.throwArgumentError("signature invalid _vs","signature",t),e._vs=pt(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&dt.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const Tx="bignumber/5.7.0";var Xs=ue.BN;const En=new T(Tx),Fc={},fp=9007199254740991;let dp=!1;class V{constructor(e,r){e!==Fc&&En.throwError("cannot call constructor directly; use BigNumber.from",T.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Jt(ve(this).fromTwos(e))}toTwos(e){return Jt(ve(this).toTwos(e))}abs(){return this._hex[0]==="-"?V.from(this._hex.substring(1)):this}add(e){return Jt(ve(this).add(ve(e)))}sub(e){return Jt(ve(this).sub(ve(e)))}div(e){return V.from(e).isZero()&&xr("division-by-zero","div"),Jt(ve(this).div(ve(e)))}mul(e){return Jt(ve(this).mul(ve(e)))}mod(e){const r=ve(e);return r.isNeg()&&xr("division-by-zero","mod"),Jt(ve(this).umod(r))}pow(e){const r=ve(e);return r.isNeg()&&xr("negative-power","pow"),Jt(ve(this).pow(r))}and(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","and"),Jt(ve(this).and(r))}or(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","or"),Jt(ve(this).or(r))}xor(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","xor"),Jt(ve(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&xr("negative-width","mask"),Jt(ve(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&xr("negative-width","shl"),Jt(ve(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&xr("negative-width","shr"),Jt(ve(this).shrn(e))}eq(e){return ve(this).eq(ve(e))}lt(e){return ve(this).lt(ve(e))}lte(e){return ve(this).lte(ve(e))}gt(e){return ve(this).gt(ve(e))}gte(e){return ve(this).gte(ve(e))}isNegative(){return this._hex[0]==="-"}isZero(){return ve(this).isZero()}toNumber(){try{return ve(this).toNumber()}catch{xr("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return En.throwError("this platform does not support BigInt",T.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?dp||(dp=!0,En.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?En.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",T.errors.UNEXPECTED_ARGUMENT,{}):En.throwError("BigNumber.toString does not accept parameters",T.errors.UNEXPECTED_ARGUMENT,{})),ve(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof V)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new V(Fc,Zs(e)):e.match(/^-?[0-9]+$/)?new V(Fc,Zs(new Xs(e))):En.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&xr("underflow","BigNumber.from",e),(e>=fp||e<=-fp)&&xr("overflow","BigNumber.from",e),V.from(String(e));const r=e;if(typeof r=="bigint")return V.from(r.toString());if(Ru(r))return V.from(te(r));if(r)if(r.toHexString){const n=r.toHexString();if(typeof n=="string")return V.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(pe(n)||n[0]==="-"&&pe(n.substring(1))))return V.from(n)}return En.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function Zs(t){if(typeof t!="string")return Zs(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&En.throwArgumentError("invalid hex","value",t),t=Zs(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function Jt(t){return V.from(Zs(t))}function ve(t){const e=V.from(t).toHexString();return e[0]==="-"?new Xs("-"+e.substring(3),16):new Xs(e.substring(2),16)}function xr(t,e,r){const n={fault:t,operation:e};return r!=null&&(n.value=r),En.throwError(t,T.errors.NUMERIC_FAULT,n)}function Ox(t){return new Xs(t,36).toString(16)}function Lx(t){return new Xs(t,16).toString(36)}const Bx="properties/5.7.0";var Dx=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Ja=new T(Bx);function z(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function fr(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||typeof t.prototype!="object")break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function yt(t){return Dx(this,void 0,void 0,function*(){const e=Object.keys(t).map(n=>{const i=t[n];return Promise.resolve(i).then(o=>({key:n,value:o}))});return(yield Promise.all(e)).reduce((n,i)=>(n[i.key]=i.value,n),{})})}function jx(t,e){(!t||typeof t!="object")&&Ja.throwArgumentError("invalid object","object",t),Object.keys(t).forEach(r=>{e[r]||Ja.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)})}function it(t){const e={};for(const r in t)e[r]=t[r];return e}const Ux={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function oy(t){if(t==null||Ux[typeof t])return!0;if(Array.isArray(t)||typeof t=="object"){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;rnr(e)));if(typeof t=="object"){const e={};for(const r in t){const n=t[r];n!==void 0&&z(e,r,nr(n))}return e}return Ja.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function nr(t){return Fx(t)}class vl{constructor(e){for(const r in e)this[r]=nr(e[r])}}const yl="abi/5.7.0",Ee=new T(yl),Di={};let hp={calldata:!0,memory:!0,storage:!0},zx={calldata:!0,memory:!0};function zl(t,e){if(t==="bytes"||t==="string"){if(hp[e])return!0}else if(t==="address"){if(e==="payable")return!0}else if((t.indexOf("[")>=0||t==="tuple")&&zx[e])return!0;return(hp[e]||e==="payable")&&Ee.throwArgumentError("invalid modifier","name",e),!1}function $x(t,e){let r=t;function n(l){Ee.throwArgumentError(`unexpected character at position ${l}`,"param",t)}t=t.replace(/\s/g," ");function i(l){let a={type:"",name:"",parent:l,state:{allowType:!0}};return e&&(a.indexed=!1),a}let o={type:"",name:"",state:{allowType:!0}},s=o;for(let l=0;lJSON.parse(i.format(e)))),JSON.stringify(n)}let r="";return this.baseType==="array"?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==Se.sighash&&(r+=this.type),r+="("+this.components.map(n=>n.format(e)).join(e===Se.full?", ":",")+")"):r+=this.type,e!==Se.sighash&&(this.indexed===!0&&(r+=" indexed"),e===Se.full&&this.name&&(r+=" "+this.name)),r}static from(e,r){return typeof e=="string"?kt.fromString(e,r):kt.fromObject(e)}static fromObject(e){return kt.isParamType(e)?e:new kt(Di,{name:e.name||null,type:Ji(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(kt.fromObject):null})}static fromString(e,r){function n(i){return kt.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return n($x(e,!!r))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function el(t,e){return Wx(t).map(r=>kt.fromString(r,e))}class Nn{constructor(e,r){e!==Di&&Ee.throwError("use a static from method",T.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),pa(this,r),this._isFragment=!0,Object.freeze(this)}static from(e){return Nn.isFragment(e)?e:typeof e=="string"?Nn.fromString(e):Nn.fromObject(e)}static fromObject(e){if(Nn.isFragment(e))return e;switch(e.type){case"function":return sn.fromObject(e);case"event":return _n.fromObject(e);case"constructor":return on.fromObject(e);case"error":return ei.fromObject(e);case"fallback":case"receive":return null}return Ee.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?_n.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?sn.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?on.fromString(e.trim()):e.split(" ")[0]==="error"?ei.fromString(e.substring(5).trim()):Ee.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class _n extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",e!==Se.sighash&&this.anonymous&&(r+="anonymous "),r.trim()}static from(e){return typeof e=="string"?_n.fromString(e):_n.fromObject(e)}static fromObject(e){if(_n.isEventFragment(e))return e;e.type!=="event"&&Ee.throwArgumentError("invalid event object","value",e);const r={name:tl(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(kt.fromObject):[],type:"event"};return new _n(Di,r)}static fromString(e){let r=e.match(rl);r||Ee.throwArgumentError("invalid event string","value",e);let n=!1;return r[3].split(" ").forEach(i=>{switch(i.trim()){case"anonymous":n=!0;break;case"":break;default:Ee.warn("unknown modifier: "+i)}}),_n.fromObject({name:r[1].trim(),anonymous:n,inputs:el(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function sy(t,e){e.gas=null;let r=t.split("@");return r.length!==1?(r.length>2&&Ee.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||Ee.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=V.from(r[1]),r[0]):t}function ly(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach(r=>{switch(r.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+r)}})}function ay(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return t.stateMutability!=null?(e.stateMutability=t.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",t.constant!=null&&!!t.constant!==e.constant&&Ee.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable=e.stateMutability==="payable",t.payable!=null&&!!t.payable!==e.payable&&Ee.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):t.payable!=null?(e.payable=!!t.payable,t.constant==null&&!e.payable&&t.type!=="constructor"&&Ee.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Ee.throwArgumentError("cannot have constant payable function","value",t)):t.constant!=null?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):t.type!=="constructor"&&Ee.throwArgumentError("unable to determine stateMutability","value",t),e}class on extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});e===Se.sighash&&Ee.throwError("cannot format a constructor for sighash",T.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let r="constructor("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "),r.trim()}static from(e){return typeof e=="string"?on.fromString(e):on.fromObject(e)}static fromObject(e){if(on.isConstructorFragment(e))return e;e.type!=="constructor"&&Ee.throwArgumentError("invalid constructor object","value",e);let r=ay(e);r.constant&&Ee.throwArgumentError("constructor cannot be constant","value",e);const n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(kt.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?V.from(e.gas):null};return new on(Di,n)}static fromString(e){let r={type:"constructor"};e=sy(e,r);let n=e.match(rl);return(!n||n[1].trim()!=="constructor")&&Ee.throwArgumentError("invalid constructor string","value",e),r.inputs=el(n[2].trim(),!1),ly(n[3].trim(),r),on.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class sn extends on{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e))),outputs:this.outputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",e!==Se.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "):this.constant&&(r+="view "),this.outputs&&this.outputs.length&&(r+="returns ("+this.outputs.map(n=>n.format(e)).join(", ")+") "),this.gas!=null&&(r+="@"+this.gas.toString()+" ")),r.trim()}static from(e){return typeof e=="string"?sn.fromString(e):sn.fromObject(e)}static fromObject(e){if(sn.isFunctionFragment(e))return e;e.type!=="function"&&Ee.throwArgumentError("invalid function object","value",e);let r=ay(e);const n={type:e.type,name:tl(e.name),constant:r.constant,inputs:e.inputs?e.inputs.map(kt.fromObject):[],outputs:e.outputs?e.outputs.map(kt.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?V.from(e.gas):null};return new sn(Di,n)}static fromString(e){let r={type:"function"};e=sy(e,r);let n=e.split(" returns ");n.length>2&&Ee.throwArgumentError("invalid function string","value",e);let i=n[0].match(rl);if(i||Ee.throwArgumentError("invalid function signature","value",e),r.name=i[1].trim(),r.name&&tl(r.name),r.inputs=el(i[2],!1),ly(i[3].trim(),r),n.length>1){let o=n[1].match(rl);(o[1].trim()!=""||o[3].trim()!="")&&Ee.throwArgumentError("unexpected tokens","value",e),r.outputs=el(o[2],!1)}else r.outputs=[];return sn.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function pp(t){const e=t.format();return(e==="Error(string)"||e==="Panic(uint256)")&&Ee.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class ei extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",r.trim()}static from(e){return typeof e=="string"?ei.fromString(e):ei.fromObject(e)}static fromObject(e){if(ei.isErrorFragment(e))return e;e.type!=="error"&&Ee.throwArgumentError("invalid error object","value",e);const r={type:e.type,name:tl(e.name),inputs:e.inputs?e.inputs.map(kt.fromObject):[]};return pp(new ei(Di,r))}static fromString(e){let r={type:"error"},n=e.match(rl);return n||Ee.throwArgumentError("invalid error signature","value",e),r.name=n[1].trim(),r.name&&tl(r.name),r.inputs=el(n[2],!1),pp(ei.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function Ji(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const qx=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function tl(t){return(!t||!t.match(qx))&&Ee.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const rl=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function Wx(t){t=t.trim();let e=[],r="",n=0;for(let i=0;ithis.wordSize&&_h.throwError("value out-of-bounds",T.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=Ut([this._padding.slice(r.length%this.wordSize),r])),r}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,r=>{this._data[e]=this._getValue(r)}}}class Ya{constructor(e,r,n,i){z(this,"_data",oe(e)),z(this,"wordSize",r||32),z(this,"_coerceFunc",n),z(this,"allowLoose",i),this._offset=0}get data(){return te(this._data)}get consumed(){return this._offset}static coerce(e,r){let n=e.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(r=r.toNumber()),r}coerce(e,r){return this._coerceFunc?this._coerceFunc(e,r):Ya.coerce(e,r)}_peekBytes(e,r,n){let i=Math.ceil(r/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&n&&this._offset+r<=this._data.length?i=r:_h.throwError("data out-of-bounds",T.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new Ya(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,r){let n=this._peekBytes(0,e,!!r);return this._offset+=n.length,n.slice(0,e)}readValue(){return V.from(this.readBytes(this.wordSize))}}var uy={exports:{}};/** - * [js-sha3]{@link https://github.com/emn178/js-sha3} - * - * @version 0.8.0 - * @author Chen, Yi-Cyuan [emn178@gmail.com] - * @copyright Chen, Yi-Cyuan 2015-2018 - * @license MIT - */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&typeof self=="object",s=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;s?i=Fe:o&&(i=self);var l=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,a=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),c=[31,7936,2031616,520093696],d=[4,1024,262144,67108864],p=[1,256,65536,16777216],v=[6,1536,393216,100663296],g=[0,8,16,24],x=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],S=[224,256,384,512],E=[128,256],w=["hex","buffer","arrayBuffer","array","digest"],_={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(y){return Object.prototype.toString.call(y)==="[object Array]"}),a&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(y){return typeof y=="object"&&y.buffer&&y.buffer.constructor===ArrayBuffer});for(var O=function(y,D,U){return function(F){return new h(y,D,y).update(F)[U]()}},B=function(y,D,U){return function(F,G){return new h(y,D,G).update(F)[U]()}},j=function(y,D,U){return function(F,G,ie,Y){return f["cshake"+y].update(F,G,ie,Y)[U]()}},$=function(y,D,U){return function(F,G,ie,Y){return f["kmac"+y].update(F,G,ie,Y)[U]()}},q=function(y,D,U,F){for(var G=0;G>5,this.byteCount=this.blockCount<<2,this.outputBlocks=U>>5,this.extraBytes=(U&31)>>3;for(var F=0;F<50;++F)this.s[F]=0}h.prototype.update=function(y){if(this.finalized)throw new Error(r);var D,U=typeof y;if(U!=="string"){if(U==="object"){if(y===null)throw new Error(e);if(a&&y.constructor===ArrayBuffer)y=new Uint8Array(y);else if(!Array.isArray(y)&&(!a||!ArrayBuffer.isView(y)))throw new Error(e)}else throw new Error(e);D=!0}for(var F=this.blocks,G=this.byteCount,ie=y.length,Y=this.blockCount,Q=0,Je=this.s,J,le;Q>2]|=y[Q]<>2]|=le<>2]|=(192|le>>6)<>2]|=(128|le&63)<=57344?(F[J>>2]|=(224|le>>12)<>2]|=(128|le>>6&63)<>2]|=(128|le&63)<>2]|=(240|le>>18)<>2]|=(128|le>>12&63)<>2]|=(128|le>>6&63)<>2]|=(128|le&63)<=G){for(this.start=J-G,this.block=F[Y],J=0;J>8,U=y&255;U>0;)G.unshift(U),y=y>>8,U=y&255,++F;return D?G.push(F):G.unshift(F),this.update(G),G.length},h.prototype.encodeString=function(y){var D,U=typeof y;if(U!=="string"){if(U==="object"){if(y===null)throw new Error(e);if(a&&y.constructor===ArrayBuffer)y=new Uint8Array(y);else if(!Array.isArray(y)&&(!a||!ArrayBuffer.isView(y)))throw new Error(e)}else throw new Error(e);D=!0}var F=0,G=y.length;if(D)F=G;else for(var ie=0;ie=57344?F+=3:(Y=65536+((Y&1023)<<10|y.charCodeAt(++ie)&1023),F+=4)}return F+=this.encode(F*8),this.update(y),F},h.prototype.bytepad=function(y,D){for(var U=this.encode(D),F=0;F>2]|=this.padding[D&3],this.lastByteIndex===this.byteCount)for(y[0]=y[U],D=1;D>4&15]+u[Q&15]+u[Q>>12&15]+u[Q>>8&15]+u[Q>>20&15]+u[Q>>16&15]+u[Q>>28&15]+u[Q>>24&15];ie%y===0&&(ee(D),G=0)}return F&&(Q=D[G],Y+=u[Q>>4&15]+u[Q&15],F>1&&(Y+=u[Q>>12&15]+u[Q>>8&15]),F>2&&(Y+=u[Q>>20&15]+u[Q>>16&15])),Y},h.prototype.arrayBuffer=function(){this.finalize();var y=this.blockCount,D=this.s,U=this.outputBlocks,F=this.extraBytes,G=0,ie=0,Y=this.outputBits>>3,Q;F?Q=new ArrayBuffer(U+1<<2):Q=new ArrayBuffer(Y);for(var Je=new Uint32Array(Q);ie>8&255,Y[Q+2]=Je>>16&255,Y[Q+3]=Je>>24&255;ie%y===0&&ee(D)}return F&&(Q=ie<<2,Je=D[G],Y[Q]=Je&255,F>1&&(Y[Q+1]=Je>>8&255),F>2&&(Y[Q+2]=Je>>16&255)),Y};function P(y,D,U){h.call(this,y,D,U)}P.prototype=new h,P.prototype.finalize=function(){return this.encode(this.outputBits,!0),h.prototype.finalize.call(this)};var ee=function(y){var D,U,F,G,ie,Y,Q,Je,J,le,Qr,Te,Ne,Jr,Pe,ce,wr,fe,Oe,Yr,me,ze,gn,$e,He,Ht,Le,qe,Rr,Ce,We,vn,Be,Ge,yn,De,re,ot,ge,de,rt,be,_e,Ct,Me,je,Kt,Ve,Ke,Qt,Ie,Ue,Er,ke,Ye,Ai,Xe,Ze,$n,Hn,qn,Wn,Gn;for(F=0;F<48;F+=2)G=y[0]^y[10]^y[20]^y[30]^y[40],ie=y[1]^y[11]^y[21]^y[31]^y[41],Y=y[2]^y[12]^y[22]^y[32]^y[42],Q=y[3]^y[13]^y[23]^y[33]^y[43],Je=y[4]^y[14]^y[24]^y[34]^y[44],J=y[5]^y[15]^y[25]^y[35]^y[45],le=y[6]^y[16]^y[26]^y[36]^y[46],Qr=y[7]^y[17]^y[27]^y[37]^y[47],Te=y[8]^y[18]^y[28]^y[38]^y[48],Ne=y[9]^y[19]^y[29]^y[39]^y[49],D=Te^(Y<<1|Q>>>31),U=Ne^(Q<<1|Y>>>31),y[0]^=D,y[1]^=U,y[10]^=D,y[11]^=U,y[20]^=D,y[21]^=U,y[30]^=D,y[31]^=U,y[40]^=D,y[41]^=U,D=G^(Je<<1|J>>>31),U=ie^(J<<1|Je>>>31),y[2]^=D,y[3]^=U,y[12]^=D,y[13]^=U,y[22]^=D,y[23]^=U,y[32]^=D,y[33]^=U,y[42]^=D,y[43]^=U,D=Y^(le<<1|Qr>>>31),U=Q^(Qr<<1|le>>>31),y[4]^=D,y[5]^=U,y[14]^=D,y[15]^=U,y[24]^=D,y[25]^=U,y[34]^=D,y[35]^=U,y[44]^=D,y[45]^=U,D=Je^(Te<<1|Ne>>>31),U=J^(Ne<<1|Te>>>31),y[6]^=D,y[7]^=U,y[16]^=D,y[17]^=U,y[26]^=D,y[27]^=U,y[36]^=D,y[37]^=U,y[46]^=D,y[47]^=U,D=le^(G<<1|ie>>>31),U=Qr^(ie<<1|G>>>31),y[8]^=D,y[9]^=U,y[18]^=D,y[19]^=U,y[28]^=D,y[29]^=U,y[38]^=D,y[39]^=U,y[48]^=D,y[49]^=U,Jr=y[0],Pe=y[1],je=y[11]<<4|y[10]>>>28,Kt=y[10]<<4|y[11]>>>28,qe=y[20]<<3|y[21]>>>29,Rr=y[21]<<3|y[20]>>>29,Hn=y[31]<<9|y[30]>>>23,qn=y[30]<<9|y[31]>>>23,be=y[40]<<18|y[41]>>>14,_e=y[41]<<18|y[40]>>>14,Ge=y[2]<<1|y[3]>>>31,yn=y[3]<<1|y[2]>>>31,ce=y[13]<<12|y[12]>>>20,wr=y[12]<<12|y[13]>>>20,Ve=y[22]<<10|y[23]>>>22,Ke=y[23]<<10|y[22]>>>22,Ce=y[33]<<13|y[32]>>>19,We=y[32]<<13|y[33]>>>19,Wn=y[42]<<2|y[43]>>>30,Gn=y[43]<<2|y[42]>>>30,ke=y[5]<<30|y[4]>>>2,Ye=y[4]<<30|y[5]>>>2,De=y[14]<<6|y[15]>>>26,re=y[15]<<6|y[14]>>>26,fe=y[25]<<11|y[24]>>>21,Oe=y[24]<<11|y[25]>>>21,Qt=y[34]<<15|y[35]>>>17,Ie=y[35]<<15|y[34]>>>17,vn=y[45]<<29|y[44]>>>3,Be=y[44]<<29|y[45]>>>3,$e=y[6]<<28|y[7]>>>4,He=y[7]<<28|y[6]>>>4,Ai=y[17]<<23|y[16]>>>9,Xe=y[16]<<23|y[17]>>>9,ot=y[26]<<25|y[27]>>>7,ge=y[27]<<25|y[26]>>>7,Yr=y[36]<<21|y[37]>>>11,me=y[37]<<21|y[36]>>>11,Ue=y[47]<<24|y[46]>>>8,Er=y[46]<<24|y[47]>>>8,Ct=y[8]<<27|y[9]>>>5,Me=y[9]<<27|y[8]>>>5,Ht=y[18]<<20|y[19]>>>12,Le=y[19]<<20|y[18]>>>12,Ze=y[29]<<7|y[28]>>>25,$n=y[28]<<7|y[29]>>>25,de=y[38]<<8|y[39]>>>24,rt=y[39]<<8|y[38]>>>24,ze=y[48]<<14|y[49]>>>18,gn=y[49]<<14|y[48]>>>18,y[0]=Jr^~ce&fe,y[1]=Pe^~wr&Oe,y[10]=$e^~Ht&qe,y[11]=He^~Le&Rr,y[20]=Ge^~De&ot,y[21]=yn^~re&ge,y[30]=Ct^~je&Ve,y[31]=Me^~Kt&Ke,y[40]=ke^~Ai&Ze,y[41]=Ye^~Xe&$n,y[2]=ce^~fe&Yr,y[3]=wr^~Oe&me,y[12]=Ht^~qe&Ce,y[13]=Le^~Rr&We,y[22]=De^~ot&de,y[23]=re^~ge&rt,y[32]=je^~Ve&Qt,y[33]=Kt^~Ke&Ie,y[42]=Ai^~Ze&Hn,y[43]=Xe^~$n&qn,y[4]=fe^~Yr&ze,y[5]=Oe^~me&gn,y[14]=qe^~Ce&vn,y[15]=Rr^~We&Be,y[24]=ot^~de&be,y[25]=ge^~rt&_e,y[34]=Ve^~Qt&Ue,y[35]=Ke^~Ie&Er,y[44]=Ze^~Hn&Wn,y[45]=$n^~qn&Gn,y[6]=Yr^~ze&Jr,y[7]=me^~gn&Pe,y[16]=Ce^~vn&$e,y[17]=We^~Be&He,y[26]=de^~be&Ge,y[27]=rt^~_e&yn,y[36]=Qt^~Ue&Ct,y[37]=Ie^~Er&Me,y[46]=Hn^~Wn&ke,y[47]=qn^~Gn&Ye,y[8]=ze^~Jr&ce,y[9]=gn^~Pe&wr,y[18]=vn^~$e&Ht,y[19]=Be^~He&Le,y[28]=be^~Ge&De,y[29]=_e^~yn&re,y[38]=Ue^~Ct&je,y[39]=Er^~Me&Kt,y[48]=Wn^~ke&Ai,y[49]=Gn^~Ye&Xe,y[0]^=x[F],y[1]^=x[F+1]};if(l)t.exports=f;else for(A=0;A>=8;return e}function gp(t,e,r){let n=0;for(let i=0;ie+1+n&&tn.throwError("child data too short",T.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function fy(t,e){if(t.length===0&&tn.throwError("data too short",T.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&tn.throwError("data short segment too short",T.errors.BUFFER_OVERRUN,{});const n=gp(t,e+1,r);return e+1+r+n>t.length&&tn.throwError("data long segment too short",T.errors.BUFFER_OVERRUN,{}),vp(t,e,e+1+r,r+n)}else if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{}),vp(t,e,e+1,r)}else if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{});const n=gp(t,e+1,r);e+1+r+n>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{});const i=te(t.slice(e+1+r,e+1+r+n));return{consumed:1+r+n,result:i}}else if(t[e]>=128){const r=t[e]-128;e+1+r>t.length&&tn.throwError("data too short",T.errors.BUFFER_OVERRUN,{});const n=te(t.slice(e+1,e+1+r));return{consumed:1+r,result:n}}return{consumed:1,result:te(t[e])}}function Sh(t){const e=oe(t),r=fy(e,0);return r.consumed!==e.length&&tn.throwArgumentError("invalid rlp data","data",t),r.result}const Jx="address/5.7.0",oi=new T(Jx);function yp(t){pe(t,20)||oi.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=oe(ut(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const Yx=9007199254740991;function Xx(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const kh={};for(let t=0;t<10;t++)kh[String(t)]=String(t);for(let t=0;t<26;t++)kh[String.fromCharCode(65+t)]=String(10+t);const wp=Math.floor(Xx(Yx));function dy(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>kh[n]).join("");for(;e.length>=wp;){let n=e.substring(0,wp);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function mt(t){let e=null;if(typeof t!="string"&&oi.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=yp(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&oi.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==dy(t)&&oi.throwArgumentError("bad icap checksum","address",t),e=Ox(t.substring(4));e.length<40;)e="0"+e;e=yp("0x"+e)}else oi.throwArgumentError("invalid address","address",t);return e}function Zx(t){try{return mt(t),!0}catch{}return!1}function eA(t){let e=Lx(mt(t).substring(2)).toUpperCase();for(;e.length<30;)e="0"+e;return"XE"+dy("XE00"+e)+e}function Nh(t){let e=null;try{e=mt(t.from)}catch{oi.throwArgumentError("missing from address","transaction",t)}const r=Ro(oe(V.from(t.nonce).toHexString()));return mt(It(ut(Lu([e,r])),12))}function tA(t,e,r){return On(e)!==32&&oi.throwArgumentError("salt must be 32 bytes","salt",e),On(r)!==32&&oi.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),mt(It(ut(Ut(["0xff",mt(t),e,r])),12))}const rA=Object.freeze(Object.defineProperty({__proto__:null,getAddress:mt,getContractAddress:Nh,getCreate2Address:tA,getIcapAddress:eA,isAddress:Zx},Symbol.toStringTag,{value:"Module"}));class nA extends jn{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){try{r=mt(r)}catch(n){this._throwError(n.message,r)}return e.writeValue(r)}decode(e){return mt(pt(e.readValue().toHexString(),20))}}class iA extends jn{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,r){return this.coder.encode(e,r)}decode(e){return this.coder.decode(e)}}const co=new T(yl);function hy(t,e,r){let n=null;if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let a={};n=e.map(u=>{const c=u.localName;return c||co.throwError("cannot encode object for signature with missing names",T.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),a[c]&&co.throwError("cannot encode object for signature with duplicate names",T.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),a[c]=!0,r[c]})}else co.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&co.throwArgumentError("types/value length mismatch","tuple",r);let i=new sd(t.wordSize),o=new sd(t.wordSize),s=[];e.forEach((a,u)=>{let c=n[u];if(a.dynamic){let d=o.length;a.encode(o,c);let p=i.writeUpdatableValue();s.push(v=>{p(v+d)})}else a.encode(i,c)}),s.forEach(a=>{a(i.length)});let l=t.appendWriter(i);return l+=t.appendWriter(o),l}function py(t,e){let r=[],n=t.subReader(0);e.forEach(o=>{let s=null;if(o.dynamic){let l=t.readValue(),a=n.subReader(l.toNumber());try{s=o.decode(a)}catch(u){if(u.code===T.errors.BUFFER_OVERRUN)throw u;s=u,s.baseType=o.name,s.name=o.localName,s.type=o.type}}else try{s=o.decode(t)}catch(l){if(l.code===T.errors.BUFFER_OVERRUN)throw l;s=l,s.baseType=o.name,s.name=o.localName,s.type=o.type}s!=null&&r.push(s)});const i=e.reduce((o,s)=>{const l=s.localName;return l&&(o[l]||(o[l]=0),o[l]++),o},{});e.forEach((o,s)=>{let l=o.localName;if(!l||i[l]!==1||(l==="length"&&(l="_length"),r[l]!=null))return;const a=r[s];a instanceof Error?Object.defineProperty(r,l,{enumerable:!0,get:()=>{throw a}}):r[l]=a});for(let o=0;o{throw s}})}return Object.freeze(r)}class oA extends jn{constructor(e,r,n){const i=e.type+"["+(r>=0?r:"")+"]",o=r===-1||e.dynamic;super("array",i,n,o),this.coder=e,this.length=r}defaultValue(){const e=this.coder.defaultValue(),r=[];for(let n=0;ne._data.length&&co.throwError("insufficient data length",T.errors.BUFFER_OVERRUN,{length:e._data.length,count:r}));let n=[];for(let i=0;i>6===2;s++)o++;return o}return t===ar.OVERRUN?r.length-e-1:0}function yA(t,e,r,n,i){return t===ar.OVERLONG?(n.push(i),0):(n.push(65533),yy(t,e,r))}const wA=Object.freeze({error:vA,ignore:yy,replace:yA});function wy(t,e){e==null&&(e=wA.error),t=oe(t);const r=[];let n=0;for(;n>7)){r.push(i);continue}let o=null,s=null;if((i&224)===192)o=1,s=127;else if((i&240)===224)o=2,s=2047;else if((i&248)===240)o=3,s=65535;else{(i&192)===128?n+=e(ar.UNEXPECTED_CONTINUE,n-1,t,r):n+=e(ar.BAD_PREFIX,n-1,t,r);continue}if(n-1+o>=t.length){n+=e(ar.OVERRUN,n-1,t,r);continue}let l=i&(1<<8-o-1)-1;for(let a=0;a1114111){n+=e(ar.OUT_OF_RANGE,n-1-o,t,r,l);continue}if(l>=55296&&l<=57343){n+=e(ar.UTF16_SURROGATE,n-1-o,t,r,l);continue}if(l<=s){n+=e(ar.OVERLONG,n-1-o,t,r,l);continue}r.push(l)}}return r}function mr(t,e=nl.current){e!=nl.current&&(vy.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const o=t.charCodeAt(n);if(n>=t.length||(o&64512)!==56320)throw new Error("invalid utf-8 string");const s=65536+((i&1023)<<10)+(o&1023);r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return oe(r)}function EA(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function wl(t,e){return EA(wy(t,e))}function xA(t,e=nl.current){return wy(mr(t,e))}class AA extends my{constructor(e){super("string",e)}defaultValue(){return""}encode(e,r){return super.encode(e,mr(r))}decode(e){return wl(super.decode(e))}}class $l extends jn{constructor(e,r){let n=!1;const i=[];e.forEach(s=>{s.dynamic&&(n=!0),i.push(s.type)});const o="tuple("+i.join(",")+")";super("tuple",o,r,n),this.coders=e}defaultValue(){const e=[];this.coders.forEach(n=>{e.push(n.defaultValue())});const r=this.coders.reduce((n,i)=>{const o=i.localName;return o&&(n[o]||(n[o]=0),n[o]++),n},{});return this.coders.forEach((n,i)=>{let o=n.localName;!o||r[o]!==1||(o==="length"&&(o="_length"),e[o]==null&&(e[o]=e[i]))}),Object.freeze(e)}encode(e,r){return hy(e,this.coders,r)}decode(e){return e.coerce(this.name,py(e,this.coders))}}const Hl=new T(yl),bA=new RegExp(/^bytes([0-9]*)$/),_A=new RegExp(/^(u?int)([0-9]*)$/);class SA{constructor(e){z(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new nA(e.name);case"bool":return new sA(e.name);case"string":return new AA(e.name);case"bytes":return new lA(e.name);case"array":return new oA(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new $l((e.components||[]).map(n=>this._getCoder(n)),e.name);case"":return new uA(e.name)}let r=e.type.match(_A);if(r){let n=parseInt(r[2]||"256");return(n===0||n>256||n%8!==0)&&Hl.throwArgumentError("invalid "+r[1]+" bit length","param",e),new mA(n/8,r[1]==="int",e.name)}if(r=e.type.match(bA),r){let n=parseInt(r[1]);return(n===0||n>32)&&Hl.throwArgumentError("invalid bytes length","param",e),new aA(n,e.name)}return Hl.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,r){return new Ya(e,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new sd(this._getWordSize())}getDefaultValue(e){const r=e.map(i=>this._getCoder(kt.from(i)));return new $l(r,"_").defaultValue()}encode(e,r){e.length!==r.length&&Hl.throwError("types/values length mismatch",T.errors.INVALID_ARGUMENT,{count:{types:e.length,values:r.length},value:{types:e,values:r}});const n=e.map(s=>this._getCoder(kt.from(s))),i=new $l(n,"_"),o=this._getWriter();return i.encode(o,r),o.data}decode(e,r,n){const i=e.map(s=>this._getCoder(kt.from(s)));return new $l(i,"_").decode(this._getReader(oe(r),n))}}const kA=new SA;function fo(t){return ut(mr(t))}const Ey="hash/5.7.0";function xy(t){t=atob(t);const e=[];for(let r=0;r0&&Array.isArray(l)?i(l,s-1):r.push(l)})};return i(t,e),r}function NA(t){const e={};for(let r=0;r>--a&1}const d=31,p=Math.pow(2,d),v=p>>>1,g=v>>1,x=p-1;let S=0;for(let B=0;B1;){let K=j+$>>>1;B>>1|c(),q=q<<1^v,ne=(ne^v)<<1|v|1;w=q,_=1+ne-q}let O=n-4;return E.map(B=>{switch(B-O){case 3:return O+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return O+256+(t[l++]<<8|t[l++]);case 1:return O+t[l++];default:return B-1}})}function CA(t){let e=0;return()=>t[e++]}function MA(t){return CA(PA(t))}function IA(t){return t&1?~t>>1:t>>1}function RA(t,e){let r=Array(t);for(let n=0;ne[s]):r}function OA(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(BA(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(DA(r,t))}return NA(by(e))}function LA(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function _y(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;in[s].push(o));return n}function BA(t,e){let r=1+e(),n=e(),i=LA(e),o=_y(i.length,1+t,e);return by(o.map((s,l)=>{const a=s[0],u=s.slice(1);return Array(i[l]).fill(void 0).map((c,d)=>{let p=d*n;return[a+d*r,u.map(v=>v+p)]})}))}function DA(t,e){let r=1+e();return _y(r,1+t,e).map(i=>[i[0],i.slice(1)])}function jA(t){let e=Xa(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let u=Xa(t,e);if(u.length==0)break;n.push({set:new Set(u),node:r()})}n.sort((u,c)=>c.set.size-u.set.size);let i=t(),o=i%3;i=i/3|0;let s=!!(i&1);i>>=1;let l=i==1,a=i==2;return{branches:n,valid:o,fe0f:s,save:l,check:a}}}function UA(){return MA(xy("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const Bu=UA(),FA=new Set(Xa(Bu)),zA=new Set(Xa(Bu)),$A=OA(Bu),HA=jA(Bu),xp=45,Ap=95;function Sy(t){return xA(t)}function qA(t){return t.filter(e=>e!=65039)}function ky(t){for(let e of t.split(".")){let r=Sy(e);try{for(let n=r.lastIndexOf(Ap)-1;n>=0;n--)if(r[n]!==Ap)throw new Error("underscore only allowed at start");if(r.length>=4&&r.every(n=>n<128)&&r[2]===xp&&r[3]===xp)throw new Error("invalid label extension")}catch(n){throw new Error(`Invalid label "${e}": ${n.message}`)}}return t}function WA(t){return ky(GA(t,qA))}function GA(t,e){let r=Sy(t).reverse(),n=[];for(;r.length;){let i=KA(r);if(i){n.push(...e(i));continue}let o=r.pop();if(FA.has(o)){n.push(o);continue}if(zA.has(o))continue;let s=$A[o];if(s){n.push(...s);continue}throw new Error(`Disallowed codepoint: 0x${o.toString(16).toUpperCase()}`)}return ky(VA(String.fromCodePoint(...n)))}function VA(t){return t.normalize("NFC")}function KA(t,e){var r;let n=HA,i,o,s=[],l=t.length;for(e&&(e.length=0);l;){let a=t[--l];if(n=(r=n.branches.find(u=>u.set.has(a)))===null||r===void 0?void 0:r.node,!n)break;if(n.save)o=a;else if(n.check&&a===o)break;s.push(a),n.fe0f&&(s.push(65039),l>0&&t[l-1]==65039&&l--),n.valid&&(i=s.slice(),n.valid==2&&i.splice(1,1),e&&e.push(...t.slice(l).reverse()),t.length=l)}return i}const QA=new T(Ey),Ny=new Uint8Array(32);Ny.fill(0);function bp(t){if(t.length===0)throw new Error("invalid ENS name; empty component");return t}function Py(t){const e=mr(WA(t)),r=[];if(t.length===0)return r;let n=0;for(let i=0;i=e.length)throw new Error("invalid ENS name; empty component");return r.push(bp(e.slice(n))),r}function ma(t){typeof t!="string"&&QA.throwArgumentError("invalid ENS name; not a string","name",t);let e=Ny;const r=Py(t);for(;r.length;)e=ut(Ut([e,ut(r.pop())]));return te(e)}function JA(t){return te(Ut(Py(t).map(e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const r=new Uint8Array(e.length+1);return r.set(e,1),r[0]=r.length-1,r})))+"00"}var YA=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const lt=new T(Ey),Cy=new Uint8Array(32);Cy.fill(0);const XA=V.from(-1),My=V.from(0),Iy=V.from(1),ZA=V.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function eb(t){const e=oe(t),r=e.length%32;return r?Xt([e,Cy.slice(r)]):te(e)}const tb=pt(Iy.toHexString(),32),rb=pt(My.toHexString(),32),_p={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},zc=["name","version","chainId","verifyingContract","salt"];function Sp(t){return function(e){return typeof e!="string"&<.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const nb={name:Sp("name"),version:Sp("version"),chainId:function(t){try{return V.from(t).toString()}catch{}return lt.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return mt(t).toLowerCase()}catch{}return lt.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=oe(t);if(e.length!==32)throw new Error("bad length");return te(e)}catch{}return lt.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function $c(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=e[1]==="",n=parseInt(e[2]||"256");(n%8!==0||n>256||e[2]&&e[2]!==String(n))&<.throwArgumentError("invalid numeric width","type",t);const i=ZA.mask(r?n-1:n),o=r?i.add(Iy).mul(XA):My;return function(s){const l=V.from(s);return(l.lt(o)||l.gt(i))&<.throwArgumentError(`value out-of-bounds for ${t}`,"value",s),pt(l.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(r===0||r>32||e[1]!==String(r))&<.throwArgumentError("invalid bytes width","type",t),function(n){return oe(n).length!==r&<.throwArgumentError(`invalid length for ${t}`,"value",n),eb(n)}}}switch(t){case"address":return function(e){return pt(mt(e),32)};case"bool":return function(e){return e?tb:rb};case"bytes":return function(e){return ut(e)};case"string":return function(e){return fo(e)}}return null}function kp(t,e){return`${t}(${e.map(({name:r,type:n})=>n+" "+r).join(",")})`}class sr{constructor(e){z(this,"types",Object.freeze(nr(e))),z(this,"_encoderCache",{}),z(this,"_types",{});const r={},n={},i={};Object.keys(e).forEach(l=>{r[l]={},n[l]=[],i[l]={}});for(const l in e){const a={};e[l].forEach(u=>{a[u.name]&<.throwArgumentError(`duplicate variable name ${JSON.stringify(u.name)} in ${JSON.stringify(l)}`,"types",e),a[u.name]=!0;const c=u.type.match(/^([^\x5b]*)(\x5b|$)/)[1];c===l&<.throwArgumentError(`circular type reference to ${JSON.stringify(c)}`,"types",e),!$c(c)&&(n[c]||lt.throwArgumentError(`unknown type ${JSON.stringify(c)}`,"types",e),n[c].push(l),r[l][c]=!0)})}const o=Object.keys(n).filter(l=>n[l].length===0);o.length===0?lt.throwArgumentError("missing primary type","types",e):o.length>1&<.throwArgumentError(`ambiguous primary types or unused types: ${o.map(l=>JSON.stringify(l)).join(", ")}`,"types",e),z(this,"primaryType",o[0]);function s(l,a){a[l]&<.throwArgumentError(`circular type reference to ${JSON.stringify(l)}`,"types",e),a[l]=!0,Object.keys(r[l]).forEach(u=>{n[u]&&(s(u,a),Object.keys(a).forEach(c=>{i[c][u]=!0}))}),delete a[l]}s(this.primaryType,{});for(const l in i){const a=Object.keys(i[l]);a.sort(),this._types[l]=kp(l,e[l])+a.map(u=>kp(u,e[u])).join("")}}getEncoder(e){let r=this._encoderCache[e];return r||(r=this._encoderCache[e]=this._getEncoder(e)),r}_getEncoder(e){{const i=$c(e);if(i)return i}const r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const i=r[1],o=this.getEncoder(i),s=parseInt(r[3]);return l=>{s>=0&&l.length!==s&<.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",l);let a=l.map(o);return this._types[i]&&(a=a.map(ut)),ut(Xt(a))}}const n=this.types[e];if(n){const i=fo(this._types[e]);return o=>{const s=n.map(({name:l,type:a})=>{const u=this.getEncoder(a)(o[l]);return this._types[a]?ut(u):u});return s.unshift(i),Xt(s)}}return lt.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const r=this._types[e];return r||lt.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return ut(this.encodeData(e,r))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,r,n){if($c(e))return n(e,r);const i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const s=i[1],l=parseInt(i[3]);return l>=0&&r.length!==l&<.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map(a=>this._visit(s,a,n))}const o=this.types[e];return o?o.reduce((s,{name:l,type:a})=>(s[l]=this._visit(a,r[l],n),s),{}):lt.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new sr(e)}static getPrimaryType(e){return sr.from(e).primaryType}static hashStruct(e,r,n){return sr.from(r).hashStruct(e,n)}static hashDomain(e){const r=[];for(const n in e){const i=_p[n];i||lt.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),r.push({name:n,type:i})}return r.sort((n,i)=>zc.indexOf(n.name)-zc.indexOf(i.name)),sr.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,n){return Xt(["0x1901",sr.hashDomain(e),sr.from(r).hash(n)])}static hash(e,r,n){return ut(sr.encode(e,r,n))}static resolveNames(e,r,n,i){return YA(this,void 0,void 0,function*(){e=it(e);const o={};e.verifyingContract&&!pe(e.verifyingContract,20)&&(o[e.verifyingContract]="0x");const s=sr.from(r);s.visit(n,(l,a)=>(l==="address"&&!pe(a,20)&&(o[a]="0x"),a));for(const l in o)o[l]=yield i(l);return e.verifyingContract&&o[e.verifyingContract]&&(e.verifyingContract=o[e.verifyingContract]),n=s.visit(n,(l,a)=>l==="address"&&o[a]?o[a]:a),{domain:e,value:n}})}static getPayload(e,r,n){sr.hashDomain(e);const i={},o=[];zc.forEach(a=>{const u=e[a];u!=null&&(i[a]=nb[a](u),o.push({name:a,type:_p[a]}))});const s=sr.from(r),l=it(r);return l.EIP712Domain?lt.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):l.EIP712Domain=o,s.encode(n),{types:l,domain:i,primaryType:s.primaryType,message:s.visit(n,(a,u)=>{if(a.match(/^bytes(\d*)/))return te(oe(u));if(a.match(/^u?int/))return V.from(u).toString();switch(a){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return typeof u!="string"&<.throwArgumentError("invalid string","value",u),u}return lt.throwArgumentError("unsupported type","type",a)})}}}const st=new T(yl);class ib extends vl{}class ob extends vl{}class sb extends vl{}class ld extends vl{static isIndexed(e){return!!(e&&e._isIndexed)}}const lb={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Np(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class ad{constructor(e){let r=[];typeof e=="string"?r=JSON.parse(e):r=e,z(this,"fragments",r.map(n=>Nn.from(n)).filter(n=>n!=null)),z(this,"_abiCoder",fr(new.target,"getAbiCoder")()),z(this,"functions",{}),z(this,"errors",{}),z(this,"events",{}),z(this,"structs",{}),this.fragments.forEach(n=>{let i=null;switch(n.type){case"constructor":if(this.deploy){st.warn("duplicate definition - constructor");return}z(this,"deploy",n);return;case"function":i=this.functions;break;case"event":i=this.events;break;case"error":i=this.errors;break;default:return}let o=n.format();if(i[o]){st.warn("duplicate definition - "+o);return}i[o]=n}),this.deploy||z(this,"deploy",on.from({payable:!1,type:"constructor"})),z(this,"_isInterface",!0)}format(e){e||(e=Se.full),e===Se.sighash&&st.throwArgumentError("interface does not support formatting sighash","format",e);const r=this.fragments.map(n=>n.format(e));return e===Se.json?JSON.stringify(r.map(n=>JSON.parse(n))):r}static getAbiCoder(){return kA}static getAddress(e){return mt(e)}static getSighash(e){return It(fo(e.format()),0,4)}static getEventTopic(e){return fo(e.format())}getFunction(e){if(pe(e)){for(const n in this.functions)if(e===this.getSighash(n))return this.functions[n];st.throwArgumentError("no matching function","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.functions).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching function","name",n):i.length>1&&st.throwArgumentError("multiple matching functions","name",n),this.functions[i[0]]}const r=this.functions[sn.fromString(e).format()];return r||st.throwArgumentError("no matching function","signature",e),r}getEvent(e){if(pe(e)){const n=e.toLowerCase();for(const i in this.events)if(n===this.getEventTopic(i))return this.events[i];st.throwArgumentError("no matching event","topichash",n)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.events).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching event","name",n):i.length>1&&st.throwArgumentError("multiple matching events","name",n),this.events[i[0]]}const r=this.events[_n.fromString(e).format()];return r||st.throwArgumentError("no matching event","signature",e),r}getError(e){if(pe(e)){const n=fr(this.constructor,"getSighash");for(const i in this.errors){const o=this.errors[i];if(e===n(o))return this.errors[i]}st.throwArgumentError("no matching error","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.errors).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching error","name",n):i.length>1&&st.throwArgumentError("multiple matching errors","name",n),this.errors[i[0]]}const r=this.errors[sn.fromString(e).format()];return r||st.throwArgumentError("no matching error","signature",e),r}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e)}catch(r){try{e=this.getError(e)}catch{throw r}}return fr(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),fr(this.constructor,"getEventTopic")(e)}_decodeParams(e,r){return this._abiCoder.decode(e,r)}_encodeParams(e,r){return this._abiCoder.encode(e,r)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,r){typeof e=="string"&&(e=this.getError(e));const n=oe(r);return te(n.slice(0,4))!==this.getSighash(e)&&st.throwArgumentError(`data signature does not match error ${e.name}.`,"data",te(n)),this._decodeParams(e.inputs,n.slice(4))}encodeErrorResult(e,r){return typeof e=="string"&&(e=this.getError(e)),te(Ut([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionData(e,r){typeof e=="string"&&(e=this.getFunction(e));const n=oe(r);return te(n.slice(0,4))!==this.getSighash(e)&&st.throwArgumentError(`data signature does not match function ${e.name}.`,"data",te(n)),this._decodeParams(e.inputs,n.slice(4))}encodeFunctionData(e,r){return typeof e=="string"&&(e=this.getFunction(e)),te(Ut([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionResult(e,r){typeof e=="string"&&(e=this.getFunction(e));let n=oe(r),i=null,o="",s=null,l=null,a=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,n)}catch{}break;case 4:{const u=te(n.slice(0,4)),c=lb[u];if(c)s=this._abiCoder.decode(c.inputs,n.slice(4)),l=c.name,a=c.signature,c.reason&&(i=s[0]),l==="Error"?o=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(s[0])}`:l==="Panic"&&(o=`; VM Exception while processing transaction: reverted with panic code ${s[0]}`);else try{const d=this.getError(u);s=this._abiCoder.decode(d.inputs,n.slice(4)),l=d.name,a=d.format()}catch{}break}}return st.throwError("call revert exception"+o,T.errors.CALL_EXCEPTION,{method:e.format(),data:te(r),errorArgs:s,errorName:l,errorSignature:a,reason:i})}encodeFunctionResult(e,r){return typeof e=="string"&&(e=this.getFunction(e)),te(this._abiCoder.encode(e.outputs,r||[]))}encodeFilterTopics(e,r){typeof e=="string"&&(e=this.getEvent(e)),r.length>e.inputs.length&&st.throwError("too many arguments for "+e.format(),T.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:r});let n=[];e.anonymous||n.push(this.getEventTopic(e));const i=(o,s)=>o.type==="string"?fo(s):o.type==="bytes"?ut(te(s)):(o.type==="bool"&&typeof s=="boolean"&&(s=s?"0x01":"0x00"),o.type.match(/^u?int/)&&(s=V.from(s).toHexString()),o.type==="address"&&this._abiCoder.encode(["address"],[s]),pt(te(s),32));for(r.forEach((o,s)=>{let l=e.inputs[s];if(!l.indexed){o!=null&&st.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+l.name,o);return}o==null?n.push(null):l.baseType==="array"||l.baseType==="tuple"?st.throwArgumentError("filtering with tuples or arrays not supported","contract."+l.name,o):Array.isArray(o)?n.push(o.map(a=>i(l,a))):n.push(i(l,o))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,r){typeof e=="string"&&(e=this.getEvent(e));const n=[],i=[],o=[];return e.anonymous||n.push(this.getEventTopic(e)),r.length!==e.inputs.length&&st.throwArgumentError("event arguments/values mismatch","values",r),e.inputs.forEach((s,l)=>{const a=r[l];if(s.indexed)if(s.type==="string")n.push(fo(a));else if(s.type==="bytes")n.push(ut(a));else{if(s.baseType==="tuple"||s.baseType==="array")throw new Error("not implemented");n.push(this._abiCoder.encode([s.type],[a]))}else i.push(s),o.push(a)}),{data:this._abiCoder.encode(i,o),topics:n}}decodeEventLog(e,r,n){if(typeof e=="string"&&(e=this.getEvent(e)),n!=null&&!e.anonymous){let p=this.getEventTopic(e);(!pe(n[0],32)||n[0].toLowerCase()!==p)&&st.throwError("fragment/topic mismatch",T.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:p,value:n[0]}),n=n.slice(1)}let i=[],o=[],s=[];e.inputs.forEach((p,v)=>{p.indexed?p.type==="string"||p.type==="bytes"||p.baseType==="tuple"||p.baseType==="array"?(i.push(kt.fromObject({type:"bytes32",name:p.name})),s.push(!0)):(i.push(p),s.push(!1)):(o.push(p),s.push(!1))});let l=n!=null?this._abiCoder.decode(i,Ut(n)):null,a=this._abiCoder.decode(o,r,!0),u=[],c=0,d=0;e.inputs.forEach((p,v)=>{if(p.indexed)if(l==null)u[v]=new ld({_isIndexed:!0,hash:null});else if(s[v])u[v]=new ld({_isIndexed:!0,hash:l[d++]});else try{u[v]=l[d++]}catch(g){u[v]=g}else try{u[v]=a[c++]}catch(g){u[v]=g}if(p.name&&u[p.name]==null){const g=u[v];g instanceof Error?Object.defineProperty(u,p.name,{enumerable:!0,get:()=>{throw Np(`property ${JSON.stringify(p.name)}`,g)}}):u[p.name]=g}});for(let p=0;p{throw Np(`index ${p}`,v)}})}return Object.freeze(u)}parseTransaction(e){let r=this.getFunction(e.data.substring(0,10).toLowerCase());return r?new ob({args:this._abiCoder.decode(r.inputs,"0x"+e.data.substring(10)),functionFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r),value:V.from(e.value||"0")}):null}parseLog(e){let r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new ib({eventFragment:r,name:r.name,signature:r.format(),topic:this.getEventTopic(r),args:this.decodeEventLog(r,e.data,e.topics)})}parseError(e){const r=te(e);let n=this.getError(r.substring(0,10).toLowerCase());return n?new sb({args:this._abiCoder.decode(n.inputs,"0x"+r.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(e){return!!(e&&e._isInterface)}}const ab="abstract-provider/5.7.0";var ub=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const cb=new T(ab);class fb extends vl{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class qo{constructor(){cb.checkAbstract(new.target,qo),z(this,"_isProvider",!0)}getFeeData(){return ub(this,void 0,void 0,function*(){const{block:e,gasPrice:r}=yield yt({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(s=>null)});let n=null,i=null,o=null;return e&&e.baseFeePerGas&&(n=e.baseFeePerGas,o=V.from("1500000000"),i=e.baseFeePerGas.mul(2).add(o)),{lastBaseFeePerGas:n,maxFeePerGas:i,maxPriorityFeePerGas:o,gasPrice:r}})}addListener(e,r){return this.on(e,r)}removeListener(e,r){return this.off(e,r)}static isProvider(e){return!!(e&&e._isProvider)}}const db="abstract-signer/5.7.0";var Or=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Ar=new T(db),hb=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],pb=[T.errors.INSUFFICIENT_FUNDS,T.errors.NONCE_EXPIRED,T.errors.REPLACEMENT_UNDERPRICED];class El{constructor(){Ar.checkAbstract(new.target,El),z(this,"_isSigner",!0)}getBalance(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return Or(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const r=yield yt(this.checkTransaction(e));return yield this.provider.estimateGas(r)})}call(e,r){return Or(this,void 0,void 0,function*(){this._checkProvider("call");const n=yield yt(this.checkTransaction(e));return yield this.provider.call(n,r)})}sendTransaction(e){return Or(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const r=yield this.populateTransaction(e),n=yield this.signTransaction(r);return yield this.provider.sendTransaction(n)})}getChainId(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const n in e)hb.indexOf(n)===-1&&Ar.throwArgumentError("invalid transaction key: "+n,"transaction",e);const r=it(e);return r.from==null?r.from=this.getAddress():r.from=Promise.all([Promise.resolve(r.from),this.getAddress()]).then(n=>(n[0].toLowerCase()!==n[1].toLowerCase()&&Ar.throwArgumentError("from address mismatch","transaction",e),n[0])),r}populateTransaction(e){return Or(this,void 0,void 0,function*(){const r=yield yt(this.checkTransaction(e));r.to!=null&&(r.to=Promise.resolve(r.to).then(i=>Or(this,void 0,void 0,function*(){if(i==null)return null;const o=yield this.resolveName(i);return o==null&&Ar.throwArgumentError("provided ENS name resolves to null","tx.to",i),o})),r.to.catch(i=>{}));const n=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||n)?Ar.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(r.type===0||r.type===1)&&n&&Ar.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1)r.gasPrice==null&&(r.gasPrice=this.getGasPrice());else{const i=yield this.getFeeData();if(r.type==null)if(i.maxFeePerGas!=null&&i.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){const o=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=o,r.maxPriorityFeePerGas=o}else r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas);else i.gasPrice!=null?(n&&Ar.throwError("network does not support EIP-1559",T.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=i.gasPrice),r.type=0):Ar.throwError("failed to get consistent fee data",T.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else r.type===2&&(r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas))}return r.nonce==null&&(r.nonce=this.getTransactionCount("pending")),r.gasLimit==null&&(r.gasLimit=this.estimateGas(r).catch(i=>{if(pb.indexOf(i.code)>=0)throw i;return Ar.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:i,tx:r})})),r.chainId==null?r.chainId=this.getChainId():r.chainId=Promise.all([Promise.resolve(r.chainId),this.getChainId()]).then(i=>(i[1]!==0&&i[0]!==i[1]&&Ar.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield yt(r)})}_checkProvider(e){this.provider||Ar.throwError("missing provider",T.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class Ph extends El{constructor(e,r){super(),z(this,"address",e),z(this,"provider",r||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,r){return Promise.resolve().then(()=>{Ar.throwError(e,T.errors.UNSUPPORTED_OPERATION,{operation:r})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,r,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new Ph(this.address,e)}}var Ry={},we={},xl=Ty;function Ty(t,e){if(!t)throw new Error(e||"Assertion failed")}Ty.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var ud={exports:{}};typeof Object.create=="function"?ud.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ud.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var mb=ud.exports,gb=xl,vb=mb;we.inherits=vb;function yb(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function wb(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=o&63|128):yb(t,i)?(o=65536+((o&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=o&63|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=o&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}we.htonl=Oy;function xb(t,e){for(var r="",n=0;n>>0}return o}we.join32=Ab;function bb(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=o&255):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=o&255)}return r}we.split32=bb;function _b(t,e){return t>>>e|t<<32-e}we.rotr32=_b;function Sb(t,e){return t<>>32-e}we.rotl32=Sb;function kb(t,e){return t+e>>>0}we.sum32=kb;function Nb(t,e,r){return t+e+r>>>0}we.sum32_3=Nb;function Pb(t,e,r,n){return t+e+r+n>>>0}we.sum32_4=Pb;function Cb(t,e,r,n,i){return t+e+r+n+i>>>0}we.sum32_5=Cb;function Mb(t,e,r,n){var i=t[e],o=t[e+1],s=n+o>>>0,l=(s>>0,t[e+1]=s}we.sum64=Mb;function Ib(t,e,r,n){var i=e+n>>>0,o=(i>>0}we.sum64_hi=Ib;function Rb(t,e,r,n){var i=e+n;return i>>>0}we.sum64_lo=Rb;function Tb(t,e,r,n,i,o,s,l){var a=0,u=e;u=u+n>>>0,a+=u>>0,a+=u>>0,a+=u>>0}we.sum64_4_hi=Tb;function Ob(t,e,r,n,i,o,s,l){var a=e+n+o+l;return a>>>0}we.sum64_4_lo=Ob;function Lb(t,e,r,n,i,o,s,l,a,u){var c=0,d=e;d=d+n>>>0,c+=d>>0,c+=d>>0,c+=d>>0,c+=d>>0}we.sum64_5_hi=Lb;function Bb(t,e,r,n,i,o,s,l,a,u){var c=e+n+o+l+u;return c>>>0}we.sum64_5_lo=Bb;function Db(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}we.rotr64_hi=Db;function jb(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}we.rotr64_lo=jb;function Ub(t,e,r){return t>>>r}we.shr64_hi=Ub;function Fb(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}we.shr64_lo=Fb;var Wo={},Pp=we,zb=xl;function Du(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Wo.BlockHash=Du;Du.prototype.update=function(e,r){if(e=Pp.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Pp.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[o++]=e>>>16&255,i[o++]=e>>>8&255,i[o++]=e&255}else for(i[o++]=e&255,i[o++]=e>>>8&255,i[o++]=e>>>16&255,i[o++]=e>>>24&255,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,s=8;s>>3}mn.g0_256=Gb;function Vb(t){return un(t,17)^un(t,19)^t>>>10}mn.g1_256=Vb;var To=we,Kb=Wo,Qb=mn,Hc=To.rotl32,is=To.sum32,Jb=To.sum32_5,Yb=Qb.ft_1,Fy=Kb.BlockHash,Xb=[1518500249,1859775393,2400959708,3395469782];function dn(){if(!(this instanceof dn))return new dn;Fy.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}To.inherits(dn,Fy);var Zb=dn;dn.blockSize=512;dn.outSize=160;dn.hmacStrength=80;dn.padLength=64;dn.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),F_(e.length<=this.blockSize);for(var r=e.length;r>8,p=c&255;d?a.push(d,p):a.push(p)}return a}r.toArray=n;function i(s){return s.length===1?"0"+s:s}r.zero2=i;function o(s){for(var l="",a=0;a(p>>1)-1?x=(p>>1)-S:x=S,v.isubn(x)):x=0,d[g]=x,v.iushrn(1)}return d}r.getNAF=n;function i(a,u){var c=[[],[]];a=a.clone(),u=u.clone();for(var d=0,p=0,v;a.cmpn(-d)>0||u.cmpn(-p)>0;){var g=a.andln(3)+d&3,x=u.andln(3)+p&3;g===3&&(g=-1),x===3&&(x=-1);var S;g&1?(v=a.andln(7)+d&7,(v===3||v===5)&&x===2?S=-g:S=g):S=0,c[0].push(S);var E;x&1?(v=u.andln(7)+p&7,(v===3||v===5)&&g===2?E=-x:E=x):E=0,c[1].push(E),2*d===S+1&&(d=1-d),2*p===E+1&&(p=1-p),a.iushrn(1),u.iushrn(1)}return c}r.getJSF=i;function o(a,u,c){var d="_"+u;a.prototype[u]=function(){return this[d]!==void 0?this[d]:this[d]=c.call(this)}}r.cachedProperty=o;function s(a){return typeof a=="string"?r.toArray(a,"hex"):a}r.parseBytes=s;function l(a){return new ue(a,"hex","le")}r.intFromLE=l}),Za=yr.getNAF,H_=yr.getJSF,eu=yr.assert;function xi(t,e){this.type=t,this.p=new ue(e.p,16),this.red=e.prime?ue.red(e.prime):ue.mont(this.p),this.zero=new ue(0).toRed(this.red),this.one=new ue(1).toRed(this.red),this.two=new ue(2).toRed(this.red),this.n=e.n&&new ue(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Hi=xi;xi.prototype.point=function(){throw new Error("Not implemented")};xi.prototype.validate=function(){throw new Error("Not implemented")};xi.prototype._fixedNafMul=function(e,r){eu(e.precomputed);var n=e._getDoubles(),i=Za(r,1,this._bitLength),o=(1<=l;u--)a=(a<<1)+i[u];s.push(a)}for(var c=this.jpoint(null,null,null),d=this.jpoint(null,null,null),p=o;p>0;p--){for(l=0;l=0;a--){for(var u=0;a>=0&&s[a]===0;a--)u++;if(a>=0&&u++,l=l.dblp(u),a<0)break;var c=s[a];eu(c!==0),e.type==="affine"?c>0?l=l.mixedAdd(o[c-1>>1]):l=l.mixedAdd(o[-c-1>>1].neg()):c>0?l=l.add(o[c-1>>1]):l=l.add(o[-c-1>>1].neg())}return e.type==="affine"?l.toP():l};xi.prototype._wnafMulAdd=function(e,r,n,i,o){var s=this._wnafT1,l=this._wnafT2,a=this._wnafT3,u=0,c,d,p;for(c=0;c=1;c-=2){var g=c-1,x=c;if(s[g]!==1||s[x]!==1){a[g]=Za(n[g],s[g],this._bitLength),a[x]=Za(n[x],s[x],this._bitLength),u=Math.max(a[g].length,u),u=Math.max(a[x].length,u);continue}var S=[r[g],null,null,r[x]];r[g].y.cmp(r[x].y)===0?(S[1]=r[g].add(r[x]),S[2]=r[g].toJ().mixedAdd(r[x].neg())):r[g].y.cmp(r[x].y.redNeg())===0?(S[1]=r[g].toJ().mixedAdd(r[x]),S[2]=r[g].add(r[x].neg())):(S[1]=r[g].toJ().mixedAdd(r[x]),S[2]=r[g].toJ().mixedAdd(r[x].neg()));var E=[-3,-1,-5,-7,0,7,5,1,3],w=H_(n[g],n[x]);for(u=Math.max(w[0].length,u),a[g]=new Array(u),a[x]=new Array(u),d=0;d=0;c--){for(var $=0;c>=0;){var q=!0;for(d=0;d=0&&$++,B=B.dblp($),c<0)break;for(d=0;d0?p=l[d][ne-1>>1]:ne<0&&(p=l[d][-ne-1>>1].neg()),p.type==="affine"?B=B.mixedAdd(p):B=B.add(p))}}for(c=0;c=Math.ceil((e.bitLength()+1)/r.step):!1};Mr.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,o=0;o=0&&(v=u,g=c),d.negative&&(d=d.neg(),p=p.neg()),v.negative&&(v=v.neg(),g=g.neg()),[{a:d,b:p},{a:v,b:g}]};Ir.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],o=i.b.mul(e).divRound(this.n),s=n.b.neg().mul(e).divRound(this.n),l=o.mul(n.a),a=s.mul(i.a),u=o.mul(n.b),c=s.mul(i.b),d=e.sub(l).sub(a),p=u.add(c).neg();return{k1:d,k2:p}};Ir.prototype.pointFromX=function(e,r){e=new ue(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var o=i.fromRed().isOdd();return(r&&!o||!r&&o)&&(i=i.redNeg()),this.point(e,i)};Ir.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),o=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(o).cmpn(0)===0};Ir.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,o=this._endoWnafT2,s=0;s":""};Pt.prototype.isInfinity=function(){return this.inf};Pt.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};Pt.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),s=o.redSqr().redISub(this.x.redAdd(this.x)),l=o.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,l)};Pt.prototype.getX=function(){return this.x.fromRed()};Pt.prototype.getY=function(){return this.y.fromRed()};Pt.prototype.mul=function(e){return e=new ue(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Pt.prototype.mulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o):this.curve._wnafMulAdd(1,i,o,2)};Pt.prototype.jmulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o,!0):this.curve._wnafMulAdd(1,i,o,2,!0)};Pt.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Pt.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(o){return o.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};Pt.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Ot(t,e,r,n){Hi.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new ue(0)):(this.x=new ue(e,16),this.y=new ue(r,16),this.z=new ue(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Mh(Ot,Hi.BasePoint);Ir.prototype.jpoint=function(e,r,n){return new Ot(this,e,r,n)};Ot.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};Ot.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Ot.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),o=e.x.redMul(n),s=this.y.redMul(r.redMul(e.z)),l=e.y.redMul(n.redMul(this.z)),a=i.redSub(o),u=s.redSub(l);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),d=c.redMul(a),p=i.redMul(c),v=u.redSqr().redIAdd(d).redISub(p).redISub(p),g=u.redMul(p.redISub(v)).redISub(s.redMul(d)),x=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(v,g,x)};Ot.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),o=this.y,s=e.y.redMul(r).redMul(this.z),l=n.redSub(i),a=o.redSub(s);if(l.cmpn(0)===0)return a.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=l.redSqr(),c=u.redMul(l),d=n.redMul(u),p=a.redSqr().redIAdd(c).redISub(d).redISub(d),v=a.redMul(d.redISub(p)).redISub(o.redMul(c)),g=this.z.redMul(l);return this.curve.jpoint(p,v,g)};Ot.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(o),this.x.cmp(n)===0)return!0}};Ot.prototype.inspect=function(){return this.isInfinity()?"":""};Ot.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var ga=Ko(function(t,e){var r=e;r.base=Hi,r.short=W_,r.mont=null,r.edwards=null}),va=Ko(function(t,e){var r=e,n=yr.assert;function i(l){l.type==="short"?this.curve=new ga.short(l):l.type==="edwards"?this.curve=new ga.edwards(l):this.curve=new ga.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function o(l,a){Object.defineProperty(r,l,{configurable:!0,enumerable:!0,get:function(){var u=new i(a);return Object.defineProperty(r,l,{configurable:!0,enumerable:!0,value:u}),u}})}o("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:en.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:en.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:en.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:en.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),o("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:en.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:en.sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:en.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var s;try{s=null.crash()}catch{s=void 0}o("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:en.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",s]})});function gi(t){if(!(this instanceof gi))return new gi(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Hr.toArray(t.entropy,t.entropyEnc||"hex"),r=Hr.toArray(t.nonce,t.nonceEnc||"hex"),n=Hr.toArray(t.pers,t.persEnc||"hex");Ch(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Xy=gi;gi.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};gi.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Hr.toArray(n,i||"hex"),this._update(n));for(var o=[];o.length"};var G_=yr.assert;function ju(t,e){if(t instanceof ju)return t;this._importDER(t,e)||(G_(t.r&&t.s,"Signature without r or s"),this.r=new ue(t.r,16),this.s=new ue(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Uu=ju;function V_(){this.place=0}function Gc(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,o=0,s=e.place;o>>=0;return i<=127?!1:(e.place=s,i)}function Rp(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}ju.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=Rp(r),n=Rp(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Vc(i,r.length),i=i.concat(r),i.push(2),Vc(i,n.length);var o=i.concat(n),s=[48];return Vc(s,o.length),s=s.concat(o),yr.encode(s,e)};var K_=function(){throw new Error("unsupported")},Zy=yr.assert;function Cr(t){if(!(this instanceof Cr))return new Cr(t);typeof t=="string"&&(Zy(Object.prototype.hasOwnProperty.call(va,t),"Unknown curve "+t),t=va[t]),t instanceof va.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Q_=Cr;Cr.prototype.keyPair=function(e){return new Ih(this,e)};Cr.prototype.keyFromPrivate=function(e,r){return Ih.fromPrivate(this,e,r)};Cr.prototype.keyFromPublic=function(e,r){return Ih.fromPublic(this,e,r)};Cr.prototype.genKeyPair=function(e){e||(e={});for(var r=new Xy({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||K_(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new ue(2));;){var o=new ue(r.generate(n));if(!(o.cmp(i)>0))return o.iaddn(1),this.keyFromPrivate(o)}};Cr.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};Cr.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new ue(e,16));for(var o=this.n.byteLength(),s=r.getPrivate().toArray("be",o),l=e.toArray("be",o),a=new Xy({hash:this.hash,entropy:s,nonce:l,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new ue(1)),c=0;;c++){var d=i.k?i.k(c):new ue(a.generate(this.n.byteLength()));if(d=this._truncateToN(d,!0),!(d.cmpn(1)<=0||d.cmp(u)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var v=p.getX(),g=v.umod(this.n);if(g.cmpn(0)!==0){var x=d.invm(this.n).mul(g.mul(r.getPrivate()).iadd(e));if(x=x.umod(this.n),x.cmpn(0)!==0){var S=(p.getY().isOdd()?1:0)|(v.cmp(g)!==0?2:0);return i.canonical&&x.cmp(this.nh)>0&&(x=this.n.sub(x),S^=1),new Uu({r:g,s:x,recoveryParam:S})}}}}}};Cr.prototype.verify=function(e,r,n,i){e=this._truncateToN(new ue(e,16)),n=this.keyFromPublic(n,i),r=new Uu(r,"hex");var o=r.r,s=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var l=s.invm(this.n),a=l.mul(e).umod(this.n),u=l.mul(o).umod(this.n),c;return this.curve._maxwellTrick?(c=this.g.jmulAdd(a,n.getPublic(),u),c.isInfinity()?!1:c.eqXToP(o)):(c=this.g.mulAdd(a,n.getPublic(),u),c.isInfinity()?!1:c.getX().umod(this.n).cmp(o)===0)};Cr.prototype.recoverPubKey=function(t,e,r,n){Zy((3&r)===r,"The recovery param is more than two bits"),e=new Uu(e,n);var i=this.n,o=new ue(t),s=e.r,l=e.s,a=r&1,u=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?s=this.curve.pointFromX(s.add(this.curve.n),a):s=this.curve.pointFromX(s,a);var c=e.r.invm(i),d=i.sub(o).mul(c).umod(i),p=l.mul(c).umod(i);return this.g.mulAdd(d,s,p)};Cr.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Uu(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch{continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var J_=Ko(function(t,e){var r=e;r.version="6.5.4",r.utils=yr,r.rand=function(){throw new Error("unsupported")},r.curve=ga,r.curves=va,r.ec=Q_,r.eddsa=null}),Y_=J_.ec;const X_="signing-key/5.7.0",hd=new T(X_);let Kc=null;function rn(){return Kc||(Kc=new Y_("secp256k1")),Kc}class Z_{constructor(e){z(this,"curve","secp256k1"),z(this,"privateKey",te(e)),On(this.privateKey)!==32&&hd.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=rn().keyFromPrivate(oe(this.privateKey));z(this,"publicKey","0x"+r.getPublic(!1,"hex")),z(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),z(this,"_isSigningKey",!0)}_addPoint(e){const r=rn().keyFromPublic(oe(this.publicKey)),n=rn().keyFromPublic(oe(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=rn().keyFromPrivate(oe(this.privateKey)),n=oe(e);n.length!==32&&hd.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Ou({recoveryParam:i.recoveryParam,r:pt("0x"+i.r.toString(16),32),s:pt("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=rn().keyFromPrivate(oe(this.privateKey)),n=rn().keyFromPublic(oe(e1(e)));return pt("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function e3(t,e){const r=Ou(e),n={r:oe(r.r),s:oe(r.s)};return"0x"+rn().recoverPubKey(oe(t),n,r.recoveryParam).encode("hex",!1)}function e1(t,e){const r=oe(t);if(r.length===32){const n=new Z_(r);return e?"0x"+rn().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return e?te(r):"0x"+rn().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+rn().keyFromPublic(r).getPublic(!0,"hex"):te(r)}return hd.throwArgumentError("invalid public or private key","key","[REDACTED]")}const t3="transactions/5.7.0",Un=new T(t3);var Tp;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(Tp||(Tp={}));function Rh(t){return t==="0x"?null:mt(t)}function jt(t){return t==="0x"?gy:V.from(t)}function r3(t){const e=e1(t);return mt(It(ut(It(e,1)),12))}function t1(t,e){return r3(e3(oe(t),e))}function ur(t,e){const r=Ro(V.from(t).toHexString());return r.length>32&&Un.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function Qc(t,e){return{address:mt(t),storageKeys:(e||[]).map((r,n)=>(On(r)!==32&&Un.throwArgumentError("invalid access list storageKey",`accessList[${t}:${n}]`,r),r.toLowerCase()))}}function qi(t){if(Array.isArray(t))return t.map((r,n)=>Array.isArray(r)?(r.length>2&&Un.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${n}]`,r),Qc(r[0],r[1])):Qc(r.address,r.storageKeys));const e=Object.keys(t).map(r=>{const n=t[r].reduce((i,o)=>(i[o]=!0,i),{});return Qc(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function r1(t){return qi(t).map(e=>[e.address,e.storageKeys])}function n3(t,e){if(t.gasPrice!=null){const n=V.from(t.gasPrice),i=V.from(t.maxFeePerGas||0);n.eq(i)||Un.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:n,maxFeePerGas:i})}const r=[ur(t.chainId||0,"chainId"),ur(t.nonce||0,"nonce"),ur(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ur(t.maxFeePerGas||0,"maxFeePerGas"),ur(t.gasLimit||0,"gasLimit"),t.to!=null?mt(t.to):"0x",ur(t.value||0,"value"),t.data||"0x",r1(t.accessList||[])];if(e){const n=Ou(e);r.push(ur(n.recoveryParam,"recoveryParam")),r.push(Ro(n.r)),r.push(Ro(n.s))}return Xt(["0x02",Lu(r)])}function i3(t,e){const r=[ur(t.chainId||0,"chainId"),ur(t.nonce||0,"nonce"),ur(t.gasPrice||0,"gasPrice"),ur(t.gasLimit||0,"gasLimit"),t.to!=null?mt(t.to):"0x",ur(t.value||0,"value"),t.data||"0x",r1(t.accessList||[])];if(e){const n=Ou(e);r.push(ur(n.recoveryParam,"recoveryParam")),r.push(Ro(n.r)),r.push(Ro(n.s))}return Xt(["0x01",Lu(r)])}function n1(t,e,r){try{const n=jt(e[0]).toNumber();if(n!==0&&n!==1)throw new Error("bad recid");t.v=n}catch{Un.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=pt(e[1],32),t.s=pt(e[2],32);try{const n=ut(r(t));t.from=t1(n,{r:t.r,s:t.s,recoveryParam:t.v})}catch{}}function o3(t){const e=Sh(t.slice(1));e.length!==9&&e.length!==12&&Un.throwArgumentError("invalid component count for transaction type: 2","payload",te(t));const r=jt(e[2]),n=jt(e[3]),i={type:2,chainId:jt(e[0]).toNumber(),nonce:jt(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:jt(e[4]),to:Rh(e[5]),value:jt(e[6]),data:e[7],accessList:qi(e[8])};return e.length===9||(i.hash=ut(t),n1(i,e.slice(9),n3)),i}function s3(t){const e=Sh(t.slice(1));e.length!==8&&e.length!==11&&Un.throwArgumentError("invalid component count for transaction type: 1","payload",te(t));const r={type:1,chainId:jt(e[0]).toNumber(),nonce:jt(e[1]).toNumber(),gasPrice:jt(e[2]),gasLimit:jt(e[3]),to:Rh(e[4]),value:jt(e[5]),data:e[6],accessList:qi(e[7])};return e.length===8||(r.hash=ut(t),n1(r,e.slice(8),i3)),r}function l3(t){const e=Sh(t);e.length!==9&&e.length!==6&&Un.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:jt(e[0]).toNumber(),gasPrice:jt(e[1]),gasLimit:jt(e[2]),to:Rh(e[3]),value:jt(e[4]),data:e[5],chainId:0};if(e.length===6)return r;try{r.v=V.from(e[6]).toNumber()}catch{return r}if(r.r=pt(e[7],32),r.s=pt(e[8],32),V.from(r.r).isZero()&&V.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=e.slice(0,6);r.chainId!==0&&(i.push(te(r.chainId)),i.push("0x"),i.push("0x"),n-=r.chainId*2+8);const o=ut(Lu(i));try{r.from=t1(o,{r:te(r.r),s:te(r.s),recoveryParam:n})}catch{}r.hash=ut(t)}return r.type=null,r}function a3(t){const e=oe(t);if(e[0]>127)return l3(e);switch(e[0]){case 1:return s3(e);case 2:return o3(e)}return Un.throwError(`unsupported transaction type: ${e[0]}`,T.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const u3="contracts/5.7.0";var Ui=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const gt=new T(u3);function tu(t,e){return Ui(this,void 0,void 0,function*(){const r=yield e;typeof r!="string"&>.throwArgumentError("invalid address or ENS name","name",r);try{return mt(r)}catch{}t||gt.throwError("a provider or signer is needed to resolve ENS names",T.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield t.resolveName(r);return n==null&>.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n})}function ya(t,e,r){return Ui(this,void 0,void 0,function*(){return Array.isArray(r)?yield Promise.all(r.map((n,i)=>ya(t,Array.isArray(e)?e[i]:e[n.name],n))):r.type==="address"?yield tu(t,e):r.type==="tuple"?yield ya(t,e,r.components):r.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(n=>ya(t,n,r.arrayChildren))):Promise.reject(gt.makeError("invalid value for array",T.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function Fu(t,e,r){return Ui(this,void 0,void 0,function*(){let n={};r.length===e.inputs.length+1&&typeof r[r.length-1]=="object"&&(n=it(r.pop())),gt.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?n.from?n.from=yt({override:tu(t.signer,n.from),signer:t.signer.getAddress()}).then(u=>Ui(this,void 0,void 0,function*(){return mt(u.signer)!==u.override&>.throwError("Contract with a Signer cannot override from",T.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),u.override})):n.from=t.signer.getAddress():n.from&&(n.from=tu(t.provider,n.from));const i=yield yt({args:ya(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:yt(n)||{}}),o=t.interface.encodeFunctionData(e,i.args),s={data:o,to:i.address},l=i.overrides;if(l.nonce!=null&&(s.nonce=V.from(l.nonce).toNumber()),l.gasLimit!=null&&(s.gasLimit=V.from(l.gasLimit)),l.gasPrice!=null&&(s.gasPrice=V.from(l.gasPrice)),l.maxFeePerGas!=null&&(s.maxFeePerGas=V.from(l.maxFeePerGas)),l.maxPriorityFeePerGas!=null&&(s.maxPriorityFeePerGas=V.from(l.maxPriorityFeePerGas)),l.from!=null&&(s.from=l.from),l.type!=null&&(s.type=l.type),l.accessList!=null&&(s.accessList=qi(l.accessList)),s.gasLimit==null&&e.gas!=null){let u=21e3;const c=oe(o);for(let d=0;dn[u]!=null);return a.length&>.throwError(`cannot override ${a.map(u=>JSON.stringify(u)).join(",")}`,T.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:a}),s})}function c3(t,e){return function(...r){return Fu(t,e,r)}}function f3(t,e){const r=t.signer||t.provider;return function(...n){return Ui(this,void 0,void 0,function*(){r||gt.throwError("estimate require a provider or signer",T.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield Fu(t,e,n);return yield r.estimateGas(i)})}}function d3(t,e){const r=e.wait.bind(e);e.wait=n=>r(n).then(i=>(i.events=i.logs.map(o=>{let s=nr(o),l=null;try{l=t.interface.parseLog(o)}catch{}return l&&(s.args=l.args,s.decode=(a,u)=>t.interface.decodeEventLog(l.eventFragment,a,u),s.event=l.name,s.eventSignature=l.signature),s.removeListener=()=>t.provider,s.getBlock=()=>t.provider.getBlock(i.blockHash),s.getTransaction=()=>t.provider.getTransaction(i.transactionHash),s.getTransactionReceipt=()=>Promise.resolve(i),s}),i))}function i1(t,e,r){const n=t.signer||t.provider;return function(...i){return Ui(this,void 0,void 0,function*(){let o;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const a=it(i.pop());a.blockTag!=null&&(o=yield a.blockTag),delete a.blockTag,i.push(a)}t.deployTransaction!=null&&(yield t._deployed(o));const s=yield Fu(t,e,i),l=yield n.call(s,o);try{let a=t.interface.decodeFunctionResult(e,l);return r&&e.outputs.length===1&&(a=a[0]),a}catch(a){throw a.code===T.errors.CALL_EXCEPTION&&(a.address=t.address,a.args=i,a.transaction=s),a}})}}function h3(t,e){return function(...r){return Ui(this,void 0,void 0,function*(){t.signer||gt.throwError("sending a transaction requires a signer",T.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),t.deployTransaction!=null&&(yield t._deployed());const n=yield Fu(t,e,r),i=yield t.signer.sendTransaction(n);return d3(t,i),i})}}function Op(t,e,r){return e.constant?i1(t,e,r):h3(t,e)}function o1(t){return t.address&&(t.topics==null||t.topics.length===0)?"*":(t.address||"*")+"@"+(t.topics?t.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):"")}class il{constructor(e,r){z(this,"tag",e),z(this,"filter",r),this._listeners=[]}addListener(e,r){this._listeners.push({listener:e,once:r})}removeListener(e){let r=!1;this._listeners=this._listeners.filter(n=>r||n.listener!==e?!0:(r=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){const r=this.listenerCount();return this._listeners=this._listeners.filter(n=>{const i=e.slice();return setTimeout(()=>{n.listener.apply(this,i)},0),!n.once}),r}prepareEvent(e){}getEmit(e){return[e]}}class p3 extends il{constructor(){super("error",null)}}class Lp extends il{constructor(e,r,n,i){const o={address:e};let s=r.getEventTopic(n);i?(s!==i[0]&>.throwArgumentError("topic mismatch","topics",i),o.topics=i.slice()):o.topics=[s],super(o1(o),o),z(this,"address",e),z(this,"interface",r),z(this,"fragment",n)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(r,n)=>this.interface.decodeEventLog(this.fragment,r,n);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(r){e.args=null,e.decodeError=r}}getEmit(e){const r=Gx(e.args);if(r.length)throw r[0].error;const n=(e.args||[]).slice();return n.push(e),n}}class Bp extends il{constructor(e,r){super("*",{address:e}),z(this,"address",e),z(this,"interface",r)}prepareEvent(e){super.prepareEvent(e);try{const r=this.interface.parseLog(e);e.event=r.name,e.eventSignature=r.signature,e.decode=(n,i)=>this.interface.decodeEventLog(r.eventFragment,n,i),e.args=r.args}catch{}}}class m3{constructor(e,r,n){z(this,"interface",fr(new.target,"getInterface")(r)),n==null?(z(this,"provider",null),z(this,"signer",null)):El.isSigner(n)?(z(this,"provider",n.provider||null),z(this,"signer",n)):qo.isProvider(n)?(z(this,"provider",n),z(this,"signer",null)):gt.throwArgumentError("invalid signer or provider","signerOrProvider",n),z(this,"callStatic",{}),z(this,"estimateGas",{}),z(this,"functions",{}),z(this,"populateTransaction",{}),z(this,"filters",{});{const s={};Object.keys(this.interface.events).forEach(l=>{const a=this.interface.events[l];z(this.filters,l,(...u)=>({address:this.address,topics:this.interface.encodeFilterTopics(a,u)})),s[a.name]||(s[a.name]=[]),s[a.name].push(l)}),Object.keys(s).forEach(l=>{const a=s[l];a.length===1?z(this.filters,l,this.filters[a[0]]):gt.warn(`Duplicate definition of ${l} (${a.join(", ")})`)})}if(z(this,"_runningEvents",{}),z(this,"_wrappedEmits",{}),e==null&>.throwArgumentError("invalid contract address or ENS name","addressOrName",e),z(this,"address",e),this.provider)z(this,"resolvedAddress",tu(this.provider,e));else try{z(this,"resolvedAddress",Promise.resolve(mt(e)))}catch{gt.throwError("provider is required to use ENS name as contract address",T.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(s=>{});const i={},o={};Object.keys(this.interface.functions).forEach(s=>{const l=this.interface.functions[s];if(o[s]){gt.warn(`Duplicate ABI entry for ${JSON.stringify(s)}`);return}o[s]=!0;{const a=l.name;i[`%${a}`]||(i[`%${a}`]=[]),i[`%${a}`].push(s)}this[s]==null&&z(this,s,Op(this,l,!0)),this.functions[s]==null&&z(this.functions,s,Op(this,l,!1)),this.callStatic[s]==null&&z(this.callStatic,s,i1(this,l,!0)),this.populateTransaction[s]==null&&z(this.populateTransaction,s,c3(this,l)),this.estimateGas[s]==null&&z(this.estimateGas,s,f3(this,l))}),Object.keys(i).forEach(s=>{const l=i[s];if(l.length>1)return;s=s.substring(1);const a=l[0];try{this[s]==null&&z(this,s,this[a])}catch{}this.functions[s]==null&&z(this.functions,s,this.functions[a]),this.callStatic[s]==null&&z(this.callStatic,s,this.callStatic[a]),this.populateTransaction[s]==null&&z(this.populateTransaction,s,this.populateTransaction[a]),this.estimateGas[s]==null&&z(this.estimateGas,s,this.estimateGas[a])})}static getContractAddress(e){return Nh(e)}static getInterface(e){return ad.isInterface(e)?e:new ad(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(r=>(r==="0x"&>.throwError("contract not deployed",T.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||gt.throwError("sending a transactions require a signer",T.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const r=it(e||{});return["from","to"].forEach(function(n){r[n]!=null&>.throwError("cannot override "+n,T.errors.UNSUPPORTED_OPERATION,{operation:n})}),r.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(r))}connect(e){typeof e=="string"&&(e=new Ph(e,this.provider));const r=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&z(r,"deployTransaction",this.deployTransaction),r}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return ld.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if(typeof e=="string"){if(e==="error")return this._normalizeRunningEvent(new p3);if(e==="event")return this._normalizeRunningEvent(new il("event",null));if(e==="*")return this._normalizeRunningEvent(new Bp(this.address,this.interface));const r=this.interface.getEvent(e);return this._normalizeRunningEvent(new Lp(this.address,this.interface,r))}if(e.topics&&e.topics.length>0){try{const n=e.topics[0];if(typeof n!="string")throw new Error("invalid topic");const i=this.interface.getEvent(n);return this._normalizeRunningEvent(new Lp(this.address,this.interface,i,e.topics))}catch{}const r={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new il(o1(r),r))}return this._normalizeRunningEvent(new Bp(this.address,this.interface))}_checkRunningEvents(e){if(e.listenerCount()===0){delete this._runningEvents[e.tag];const r=this._wrappedEmits[e.tag];r&&e.filter&&(this.provider.off(e.filter,r),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,r,n){const i=nr(r);return i.removeListener=()=>{n&&(e.removeListener(n),this._checkRunningEvents(e))},i.getBlock=()=>this.provider.getBlock(r.blockHash),i.getTransaction=()=>this.provider.getTransaction(r.transactionHash),i.getTransactionReceipt=()=>this.provider.getTransactionReceipt(r.transactionHash),e.prepareEvent(i),i}_addEventListener(e,r,n){if(this.provider||gt.throwError("events require a provider or a signer with a provider",T.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(r,n),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const i=o=>{let s=this._wrapEvent(e,o,r);if(s.decodeError==null)try{const l=e.getEmit(s);this.emit(e.filter,...l)}catch(l){s.decodeError=l.error}e.filter!=null&&this.emit("event",s),s.decodeError!=null&&this.emit("error",s.decodeError,s)};this._wrappedEmits[e.tag]=i,e.filter!=null&&this.provider.on(e.filter,i)}}queryFilter(e,r,n){const i=this._getRunningEvent(e),o=it(i.filter);return typeof r=="string"&&pe(r,32)?(n!=null&>.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),o.blockHash=r):(o.fromBlock=r??0,o.toBlock=n??"latest"),this.provider.getLogs(o).then(s=>s.map(l=>this._wrapEvent(i,l,null)))}on(e,r){return this._addEventListener(this._getRunningEvent(e),r,!1),this}once(e,r){return this._addEventListener(this._getRunningEvent(e),r,!0),this}emit(e,...r){if(!this.provider)return!1;const n=this._getRunningEvent(e),i=n.run(r)>0;return this._checkRunningEvents(n),i}listenerCount(e){return this.provider?e==null?Object.keys(this._runningEvents).reduce((r,n)=>r+this._runningEvents[n].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(e==null){const r=[];for(let n in this._runningEvents)this._runningEvents[n].listeners().forEach(i=>{r.push(i)});return r}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(e==null){for(const n in this._runningEvents){const i=this._runningEvents[n];i.removeAllListeners(),this._checkRunningEvents(i)}return this}const r=this._getRunningEvent(e);return r.removeAllListeners(),this._checkRunningEvents(r),this}off(e,r){if(!this.provider)return this;const n=this._getRunningEvent(e);return n.removeListener(r),this._checkRunningEvents(n),this}removeListener(e,r){return this.off(e,r)}}class g3 extends m3{}class s1{constructor(e){z(this,"alphabet",e),z(this,"base",e.length),z(this,"_alphabetMap",{}),z(this,"_leader",e.charAt(0));for(let r=0;r0;)n.push(s%this.base),s=s/this.base|0}let i="";for(let o=0;r[o]===0&&o=0;--o)i+=this.alphabet[n[o]];return i}decode(e){if(typeof e!="string")throw new TypeError("Expected String");let r=[];if(e.length===0)return new Uint8Array(r);r.push(0);for(let n=0;n>=8;for(;o>0;)r.push(o&255),o>>=8}for(let n=0;e[n]===this._leader&&n0;e--){const r=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[r],t[r]=n}return t}const y3="networks/5.7.1",jp=new T(y3);function w3(t){return t&&typeof t.renetwork=="function"}function bn(t){const e=function(r,n){n==null&&(n={});const i=[];if(r.InfuraProvider&&n.infura!=="-")try{i.push(new r.InfuraProvider(t,n.infura))}catch{}if(r.EtherscanProvider&&n.etherscan!=="-")try{i.push(new r.EtherscanProvider(t,n.etherscan))}catch{}if(r.AlchemyProvider&&n.alchemy!=="-")try{i.push(new r.AlchemyProvider(t,n.alchemy))}catch{}if(r.PocketProvider&&n.pocket!=="-"){const o=["goerli","ropsten","rinkeby","sepolia"];try{const s=new r.PocketProvider(t,n.pocket);s.network&&o.indexOf(s.network.name)===-1&&i.push(s)}catch{}}if(r.CloudflareProvider&&n.cloudflare!=="-")try{i.push(new r.CloudflareProvider(t))}catch{}if(r.AnkrProvider&&n.ankr!=="-")try{const o=["ropsten"],s=new r.AnkrProvider(t,n.ankr);s.network&&o.indexOf(s.network.name)===-1&&i.push(s)}catch{}if(i.length===0)return null;if(r.FallbackProvider){let o=1;return n.quorum!=null?o=n.quorum:t==="homestead"&&(o=2),new r.FallbackProvider(i,o)}return i[0]};return e.renetwork=function(r){return bn(r)},e}function ru(t,e){const r=function(n,i){return n.JsonRpcProvider?new n.JsonRpcProvider(t,e):null};return r.renetwork=function(n){return ru(t,n)},r}const Up={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:bn("homestead")},Fp={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:bn("ropsten")},zp={chainId:63,name:"classicMordor",_defaultProvider:ru("https://www.ethercluster.com/mordor","classicMordor")},Wl={unspecified:{chainId:0,name:"unspecified"},homestead:Up,mainnet:Up,morden:{chainId:2,name:"morden"},ropsten:Fp,testnet:Fp,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:bn("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:bn("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:bn("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:bn("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:ru("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:zp,classicTestnet:zp,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:ru("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:bn("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:bn("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function Th(t){if(t==null)return null;if(typeof t=="number"){for(const n in Wl){const i=Wl[n];if(i.chainId===t)return{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress||null,_defaultProvider:i._defaultProvider||null}}return{chainId:t,name:"unknown"}}if(typeof t=="string"){const n=Wl[t];return n==null?null:{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress,_defaultProvider:n._defaultProvider||null}}const e=Wl[t.name];if(!e)return typeof t.chainId!="number"&&jp.throwArgumentError("invalid network chainId","network",t),t;t.chainId!==0&&t.chainId!==e.chainId&&jp.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;return r==null&&e._defaultProvider&&(w3(e._defaultProvider)?r=e._defaultProvider.renetwork(t):r=e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}const E3="web/5.7.1";var x3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};function A3(t,e){return x3(this,void 0,void 0,function*(){e==null&&(e={});const r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};if(e.skipFetchSetup!==!0&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),e.fetchOptions!=null){const s=e.fetchOptions;s.mode&&(r.mode=s.mode),s.cache&&(r.cache=s.cache),s.credentials&&(r.credentials=s.credentials),s.redirect&&(r.redirect=s.redirect),s.referrer&&(r.referrer=s.referrer)}const n=yield fetch(t,r),i=yield n.arrayBuffer(),o={};return n.headers.forEach?n.headers.forEach((s,l)=>{o[l.toLowerCase()]=s}):n.headers.keys().forEach(s=>{o[s.toLowerCase()]=n.headers.get(s)}),{headers:o,statusCode:n.status,statusMessage:n.statusText,body:oe(new Uint8Array(i))}})}var b3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Br=new T(E3);function $p(t){return new Promise(e=>{setTimeout(e,t)})}function Qn(t,e){if(t==null)return null;if(typeof t=="string")return t;if(bh(t)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return wl(t)}catch{}return te(t)}return t}function _3(t){return mr(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function S3(t,e,r){const n=typeof t=="object"&&t.throttleLimit!=null?t.throttleLimit:12;Br.assertArgument(n>0&&n%1===0,"invalid connection throttle limit","connection.throttleLimit",n);const i=typeof t=="object"?t.throttleCallback:null,o=typeof t=="object"&&typeof t.throttleSlotInterval=="number"?t.throttleSlotInterval:100;Br.assertArgument(o>0&&o%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const s=typeof t=="object"?!!t.errorPassThrough:!1,l={};let a=null;const u={method:"GET"};let c=!1,d=2*60*1e3;if(typeof t=="string")a=t;else if(typeof t=="object"){if((t==null||t.url==null)&&Br.throwArgumentError("missing URL","connection.url",t),a=t.url,typeof t.timeout=="number"&&t.timeout>0&&(d=t.timeout),t.headers)for(const E in t.headers)l[E.toLowerCase()]={key:E,value:String(t.headers[E])},["if-none-match","if-modified-since"].indexOf(E.toLowerCase())>=0&&(c=!0);if(u.allowGzip=!!t.allowGzip,t.user!=null&&t.password!=null){a.substring(0,6)!=="https:"&&t.allowInsecureAuthentication!==!0&&Br.throwError("basic authentication requires a secure https url",T.errors.INVALID_ARGUMENT,{argument:"url",url:a,user:t.user,password:"[REDACTED]"});const E=t.user+":"+t.password;l.authorization={key:"Authorization",value:"Basic "+Ay(mr(E))}}t.skipFetchSetup!=null&&(u.skipFetchSetup=!!t.skipFetchSetup),t.fetchOptions!=null&&(u.fetchOptions=it(t.fetchOptions))}const p=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),v=a?a.match(p):null;if(v)try{const E={statusCode:200,statusMessage:"OK",headers:{"content-type":v[1]||"text/plain"},body:v[2]?xy(v[3]):_3(v[3])};let w=E.body;return r&&(w=r(E.body,E)),Promise.resolve(w)}catch(E){Br.throwError("processing response error",T.errors.SERVER_ERROR,{body:Qn(v[1],v[2]),error:E,requestBody:null,requestMethod:"GET",url:a})}e&&(u.method="POST",u.body=e,l["content-type"]==null&&(l["content-type"]={key:"Content-Type",value:"application/octet-stream"}),l["content-length"]==null&&(l["content-length"]={key:"Content-Length",value:String(e.length)}));const g={};Object.keys(l).forEach(E=>{const w=l[E];g[w.key]=w.value}),u.headers=g;const x=function(){let E=null;return{promise:new Promise(function(O,B){d&&(E=setTimeout(()=>{E!=null&&(E=null,B(Br.makeError("timeout",T.errors.TIMEOUT,{requestBody:Qn(u.body,g["content-type"]),requestMethod:u.method,timeout:d,url:a})))},d))}),cancel:function(){E!=null&&(clearTimeout(E),E=null)}}}(),S=function(){return b3(this,void 0,void 0,function*(){for(let E=0;E=300)&&(x.cancel(),Br.throwError("bad response",T.errors.SERVER_ERROR,{status:w.statusCode,headers:w.headers,body:Qn(_,w.headers?w.headers["content-type"]:null),requestBody:Qn(u.body,g["content-type"]),requestMethod:u.method,url:a})),r)try{const O=yield r(_,w);return x.cancel(),O}catch(O){if(O.throttleRetry&&E{let l=null;if(o!=null)try{l=JSON.parse(wl(o))}catch(a){Br.throwError("invalid JSON",T.errors.SERVER_ERROR,{body:o,error:a})}return r&&(l=r(l,s)),l},i=null;if(e!=null){i=mr(e);const o=typeof t=="string"?{url:t}:it(t);o.headers?Object.keys(o.headers).filter(l=>l.toLowerCase()==="content-type").length!==0||(o.headers=it(o.headers),o.headers["content-type"]="application/json"):o.headers={"content-type":"application/json"},t=o}return S3(t,i,n)}function ho(t,e){return e||(e={}),e=it(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(r,n){let i=null,o=!1;const s=()=>o?!1:(o=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout(()=>{s()&&n(new Error("timeout"))},e.timeout));const l=e.retryLimit;let a=0;function u(){return t().then(function(c){if(c!==void 0)s()&&r(c);else if(e.oncePoll)e.oncePoll.once("poll",u);else if(e.onceBlock)e.onceBlock.once("block",u);else if(!o){if(a++,a>l){s()&&n(new Error("retry limit reached"));return}let d=e.interval*parseInt(String(Math.random()*Math.pow(2,a)));de.ceiling&&(d=e.ceiling),setTimeout(u,d)}return null},function(c){s()&&n(c)})}u()})}var nu="qpzry9x8gf2tvdw0s3jn54khce6mua7l",md={};for(var Gl=0;Gl>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function l1(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=bo(e)^n>>5}for(e=bo(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=l1(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",o=0;o>5)throw new Error("Non 5-bit word");n=bo(n)^s,i+=nu.charAt(s)}for(o=0;o<6;++o)n=bo(n);for(n^=1,o=0;o<6;++o){var l=n>>(5-o)*5&31;i+=nu.charAt(l)}return i}function a1(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var o=t.slice(0,i),s=t.slice(i+1);if(s.length<6)return"Data too short";var l=l1(o);if(typeof l=="string")return l;for(var a=[],u=0;u=s.length)&&a.push(d)}return l!==1?"Invalid checksum for "+t:{prefix:o,words:a}}function N3(){var t=a1.apply(null,arguments);if(typeof t=="object")return t}function P3(t){var e=a1.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function zu(t,e,r,n){for(var i=0,o=0,s=(1<=r;)o-=r,l.push(i>>o&s);if(n)o>0&&l.push(i<=e)return"Excess padding";if(i<this.data(d,!0);return e.transaction={hash:s,type:u,accessList:Z.allowNull(this.accessList.bind(this),null),blockHash:Z.allowNull(s,null),blockNumber:Z.allowNull(a,null),transactionIndex:Z.allowNull(a,null),confirmations:Z.allowNull(a,null),from:r,gasPrice:Z.allowNull(n),maxPriorityFeePerGas:Z.allowNull(n),maxFeePerGas:Z.allowNull(n),gasLimit:n,to:Z.allowNull(r,null),value:n,nonce:a,data:o,r:Z.allowNull(this.uint256),s:Z.allowNull(this.uint256),v:Z.allowNull(a),creates:Z.allowNull(r,null),raw:Z.allowNull(o)},e.transactionRequest={from:Z.allowNull(r),nonce:Z.allowNull(a),gasLimit:Z.allowNull(n),gasPrice:Z.allowNull(n),maxPriorityFeePerGas:Z.allowNull(n),maxFeePerGas:Z.allowNull(n),to:Z.allowNull(r),value:Z.allowNull(n),data:Z.allowNull(c),type:Z.allowNull(a),accessList:Z.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:s,address:r,topics:Z.arrayOf(s),data:o,logIndex:a,blockHash:s},e.receipt={to:Z.allowNull(this.address,null),from:Z.allowNull(this.address,null),contractAddress:Z.allowNull(r,null),transactionIndex:a,root:Z.allowNull(l),gasUsed:n,logsBloom:Z.allowNull(o),blockHash:s,transactionHash:s,logs:Z.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:Z.allowNull(a,null),cumulativeGasUsed:n,effectiveGasPrice:Z.allowNull(n),status:Z.allowNull(a),type:u},e.block={hash:Z.allowNull(s),parentHash:s,number:a,timestamp:a,nonce:Z.allowNull(l),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:Z.allowNull(r),extraData:o,transactions:Z.allowNull(Z.arrayOf(s)),baseFeePerGas:Z.allowNull(n)},e.blockWithTransactions=it(e.block),e.blockWithTransactions.transactions=Z.allowNull(Z.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:Z.allowNull(i,void 0),toBlock:Z.allowNull(i,void 0),blockHash:Z.allowNull(s,void 0),address:Z.allowNull(r,void 0),topics:Z.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:Z.allowNull(a),blockHash:Z.allowNull(s),transactionIndex:a,removed:Z.allowNull(this.boolean.bind(this)),address:r,data:Z.allowFalsish(o,"0x"),topics:Z.arrayOf(s),transactionHash:s,logIndex:a},e}accessList(e){return qi(e||[])}number(e){return e==="0x"?0:V.from(e).toNumber()}type(e){return e==="0x"||e==null?0:V.from(e).toNumber()}bigNumber(e){return V.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,r){return typeof e=="string"&&(!r&&e.substring(0,2)!=="0x"&&(e="0x"+e),pe(e))?e.toLowerCase():ss.throwArgumentError("invalid hash","value",e)}data(e,r){const n=this.hex(e,r);if(n.length%2!==0)throw new Error("invalid data; odd-length - "+e);return n}address(e){return mt(e)}callAddress(e){if(!pe(e,32))return null;const r=mt(It(e,12));return r===cA?null:r}contractAddress(e){return Nh(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||pe(e))return Tu(e);throw new Error("invalid blockTag")}hash(e,r){const n=this.hex(e,r);return On(n)!==32?ss.throwArgumentError("invalid hash","value",e):n}difficulty(e){if(e==null)return null;const r=V.from(e);try{return r.toNumber()}catch{}return null}uint256(e){if(!pe(e))throw new Error("invalid uint256");return pt(e,32)}_block(e,r){e.author!=null&&e.miner==null&&(e.miner=e.author);const n=e._difficulty!=null?e._difficulty:e.difficulty,i=Z.check(r,e);return i._difficulty=n==null?null:V.from(n),i}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return Z.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&V.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);const r=Z.check(this.formats.transaction,e);if(e.chainId!=null){let n=e.chainId;pe(n)&&(n=V.from(n).toNumber()),r.chainId=n}else{let n=e.networkId;n==null&&r.v==null&&(n=e.chainId),pe(n)&&(n=V.from(n).toNumber()),typeof n!="number"&&r.v!=null&&(n=(r.v-35)/2,n<0&&(n=0),n=parseInt(n)),typeof n!="number"&&(n=0),r.chainId=n}return r.blockHash&&r.blockHash.replace(/0/g,"")==="x"&&(r.blockHash=null),r}transaction(e){return a3(e)}receiptLog(e){return Z.check(this.formats.receiptLog,e)}receipt(e){const r=Z.check(this.formats.receipt,e);if(r.root!=null)if(r.root.length<=4){const n=V.from(r.root).toNumber();n===0||n===1?(r.status!=null&&r.status!==n&&ss.throwArgumentError("alt-root-status/status mismatch","value",{root:r.root,status:r.status}),r.status=n,delete r.root):ss.throwArgumentError("invalid alt-root-status","value.root",r.root)}else r.root.length!==66&&ss.throwArgumentError("invalid root hash","value.root",r.root);return r.status!=null&&(r.byzantium=!0),r}topics(e){return Array.isArray(e)?e.map(r=>this.topics(r)):e!=null?this.hash(e,!0):null}filter(e){return Z.check(this.formats.filter,e)}filterLog(e){return Z.check(this.formats.filterLog,e)}static check(e,r){const n={};for(const i in e)try{const o=e[i](r[i]);o!==void 0&&(n[i]=o)}catch(o){throw o.checkKey=i,o.checkValue=r[i],o}return n}static allowNull(e,r){return function(n){return n==null?r:e(n)}}static allowFalsish(e,r){return function(n){return n?e(n):r}}static arrayOf(e){return function(r){if(!Array.isArray(r))throw new Error("not an array");const n=[];return r.forEach(function(i){n.push(e(i))}),n}}}function u1(t){return t&&typeof t.isCommunityResource=="function"}function gd(t){return u1(t)&&t.isCommunityResource()}let qp=!1;function bl(){qp||(qp=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var ae=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const he=new T($t),O3=10;function Wp(t){return t==null?"null":(On(t)!==32&&he.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function Gp(t){for(t=t.slice();t.length>0&&t[t.length-1]==null;)t.pop();return t.map(e=>{if(Array.isArray(e)){const r={};e.forEach(i=>{r[Wp(i)]=!0});const n=Object.keys(r);return n.sort(),n.join("|")}else return Wp(e)}).join("&")}function L3(t){return t===""?[]:t.split(/&/g).map(e=>{if(e==="")return[];const r=e.split("|").map(n=>n==="null"?null:n);return r.length===1?r[0]:r})}function Gi(t){if(typeof t=="string"){if(t=t.toLowerCase(),On(t)===32)return"tx:"+t;if(t.indexOf(":")===-1)return t}else{if(Array.isArray(t))return"filter:*:"+Gp(t);if(fb.isForkEvent(t))throw he.warn("not implemented"),new Error("not implemented");if(t&&typeof t=="object")return"filter:"+(t.address||"*")+":"+Gp(t.topics||[])}throw new Error("invalid event - "+t)}function ls(){return new Date().getTime()}function Vp(t){return new Promise(e=>{setTimeout(e,t)})}const B3=["block","network","pending","poll"];class D3{constructor(e,r,n){z(this,"tag",e),z(this,"listener",r),z(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){const e=this.tag.split(":");if(e[0]!=="filter")return null;const r=e[1],n=L3(e[2]),i={};return n.length>0&&(i.topics=n),r&&r!=="*"&&(i.address=r),i}pollable(){return this.tag.indexOf(":")>=0||B3.indexOf(this.tag)>=0}}const j3={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Yc(t){return pt(V.from(t).toHexString(),32)}function Kp(t){return pd.encode(Ut([t,It(Dp(Dp(t)),0,4)]))}const c1=new RegExp("^(ipfs)://(.*)$","i"),Qp=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),c1,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function wa(t,e){try{return wl(ol(t,e))}catch{}return null}function ol(t,e){if(t==="0x")return null;const r=V.from(It(t,e,e+32)).toNumber(),n=V.from(It(t,r,r+32)).toNumber();return It(t,r+32,r+32+n)}function Xc(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):he.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function Jp(t){const e=oe(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function U3(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}function f1(t){const e=[];let r=0;for(let n=0;nV.from(e).eq(1)).catch(e=>{if(e.code===T.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,r){return ae(this,void 0,void 0,function*(){const n={to:this.address,ccipReadEnabled:!0,data:Xt([e,ma(this.name),r||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,n.data=Xt(["0x9061b923",f1([JA(this.name),n.data])]));try{let o=yield this.provider.call(n);return oe(o).length%32===4&&he.throwError("resolver threw error",T.errors.CALL_EXCEPTION,{transaction:n,data:o}),i&&(o=ol(o,0)),o}catch(o){if(o.code===T.errors.CALL_EXCEPTION)return null;throw o}})}_fetchBytes(e,r){return ae(this,void 0,void 0,function*(){const n=yield this._fetch(e,r);return n!=null?ol(n,0):null})}_getAddress(e,r){const n=j3[String(e)];if(n==null&&he.throwError(`unsupported coin type: ${e}`,T.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),n.ilk==="eth")return this.provider.formatter.address(r);const i=oe(r);if(n.p2pkh!=null){const o=r.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(o){const s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return Kp(Ut([[n.p2pkh],"0x"+o[2]]))}}if(n.p2sh!=null){const o=r.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(o){const s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return Kp(Ut([[n.p2sh],"0x"+o[2]]))}}if(n.prefix!=null){const o=i[1];let s=i[0];if(s===0?o!==20&&o!==32&&(s=-1):s=-1,s>=0&&i.length===2+o&&o>=1&&o<=75){const l=Hp.toWords(i.slice(2));return l.unshift(s),Hp.encode(n.prefix,l)}}return null}getAddress(e){return ae(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===pA?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===T.errors.CALL_EXCEPTION)return null;throw i}const r=yield this._fetchBytes("0xf1cb7e06",Yc(e));if(r==null||r==="0x")return null;const n=this._getAddress(e,r);return n==null&&he.throwError("invalid or unsupported coin data",T.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:r}),n})}getAvatar(){return ae(this,void 0,void 0,function*(){const e=[{type:"name",content:this.name}];try{const r=yield this.getText("avatar");if(r==null)return null;for(let n=0;ns[a])}return he.throwError("invalid or unsupported content hash data",T.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return ae(this,void 0,void 0,function*(){let r=mr(e);r=Ut([Yc(64),Yc(r.length),r]),r.length%32!==0&&(r=Ut([r,pt("0x",32-e.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",te(r));return n==null||n==="0x"?null:wl(n)})}}let Zc=null,F3=1;class $u extends qo{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),z(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(r=>{}),this._ready().catch(r=>{});else{const r=fr(new.target,"getNetwork")(e);r?(z(this,"_network",r),this.emit("network",r,null)):he.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return ae(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||he.throwError("no network detected",T.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:z(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return ho(()=>this._ready().then(e=>e,e=>{if(!(e.code===T.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return Zc==null&&(Zc=new Z),Zc}static getNetwork(e){return Th(e??"homestead")}ccipReadFetch(e,r,n){return ae(this,void 0,void 0,function*(){if(this.disableCcipRead||n.length===0)return null;const i=e.to.toLowerCase(),o=r.toLowerCase(),s=[];for(let l=0;l=0?null:JSON.stringify({data:o,sender:i}),d=yield Al({url:u,errorPassThrough:!0},c,(v,g)=>(v.status=g.statusCode,v));if(d.data)return d.data;const p=d.message||"unknown error";if(d.status>=400&&d.status<500)return he.throwError(`response not found during CCIP fetch: ${p}`,T.errors.SERVER_ERROR,{url:a,errorMessage:p});s.push(p)}return he.throwError(`error encountered during CCIP fetch: ${s.map(l=>JSON.stringify(l)).join(", ")}`,T.errors.SERVER_ERROR,{urls:n,errorMessages:s})})}_getInternalBlockNumber(e){return ae(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const i=this._internalBlockNumber;try{const o=yield i;if(ls()-o.respTime<=e)return o.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const r=ls(),n=yt({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(i=>null,i=>i)}).then(({blockNumber:i,networkError:o})=>{if(o)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),o;const s=ls();return i=V.from(i).toNumber(),i{this._internalBlockNumber===n&&(this._internalBlockNumber=null)}),(yield n).blockNumber})}poll(){return ae(this,void 0,void 0,function*(){const e=F3++,r=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(i){this.emit("error",i);return}if(this._setFastBlockNumber(n),this.emit("poll",e,n),n===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)he.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",he.makeError("network block skew detected",T.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let i=this._emitted.block+1;i<=n;i++)this.emit("block",i);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach(i=>{if(i==="block")return;const o=this._emitted[i];o!=="pending"&&n-o>12&&delete this._emitted[i]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=n-1),this._events.forEach(i=>{switch(i.type){case"tx":{const o=i.hash;let s=this.getTransactionReceipt(o).then(l=>(!l||l.blockNumber==null||(this._emitted["t:"+o]=l.blockNumber,this.emit(o,l)),null)).catch(l=>{this.emit("error",l)});r.push(s);break}case"filter":{if(!i._inflight){i._inflight=!0,i._lastBlockNumber===-2&&(i._lastBlockNumber=n-1);const o=i.filter;o.fromBlock=i._lastBlockNumber+1,o.toBlock=n;const s=o.toBlock-this._maxFilterBlockRange;s>o.fromBlock&&(o.fromBlock=s),o.fromBlock<0&&(o.fromBlock=0);const l=this.getLogs(o).then(a=>{i._inflight=!1,a.length!==0&&a.forEach(u=>{u.blockNumber>i._lastBlockNumber&&(i._lastBlockNumber=u.blockNumber),this._emitted["b:"+u.blockHash]=u.blockNumber,this._emitted["t:"+u.transactionHash]=u.blockNumber,this.emit(o,u)})}).catch(a=>{this.emit("error",a),i._inflight=!1});r.push(l)}break}}}),this._lastBlockNumber=n,Promise.all(r).then(()=>{this.emit("didPoll",e)}).catch(i=>{this.emit("error",i)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return ae(this,void 0,void 0,function*(){return he.throwError("provider does not support network detection",T.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return ae(this,void 0,void 0,function*(){const e=yield this._ready(),r=yield this.detectNetwork();if(e.chainId!==r.chainId){if(this.anyNetwork)return this._network=r,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",r,e),yield Vp(0),this._network;const n=he.makeError("underlying network changed",T.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:r});throw this.emit("error",n),n}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const e=ls();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(r=>((this._fastBlockNumber==null||r>this._fastBlockNumber)&&(this._fastBlockNumber=r),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,r,n){return ae(this,void 0,void 0,function*(){return this._waitForTransaction(e,r??1,n||0,null)})}_waitForTransaction(e,r,n,i){return ae(this,void 0,void 0,function*(){const o=yield this.getTransactionReceipt(e);return(o?o.confirmations:0)>=r?o:new Promise((s,l)=>{const a=[];let u=!1;const c=function(){return u?!0:(u=!0,a.forEach(p=>{p()}),!1)},d=p=>{p.confirmations{this.removeListener(e,d)}),i){let p=i.startBlock,v=null;const g=x=>ae(this,void 0,void 0,function*(){u||(yield Vp(1e3),this.getTransactionCount(i.from).then(S=>ae(this,void 0,void 0,function*(){if(!u){if(S<=i.nonce)p=x;else{{const E=yield this.getTransaction(e);if(E&&E.blockNumber!=null)return}for(v==null&&(v=p-3,v{u||this.once("block",g)}))});if(u)return;this.once("block",g),a.push(()=>{this.removeListener("block",g)})}if(typeof n=="number"&&n>0){const p=setTimeout(()=>{c()||l(he.makeError("timeout exceeded",T.errors.TIMEOUT,{timeout:n}))},n);p.unref&&p.unref(),a.push(()=>{clearTimeout(p)})}})})}getBlockNumber(){return ae(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return V.from(e)}catch(r){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:r})}})}getBalance(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getBalance",n);try{return V.from(i)}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getBalance",params:n,result:i,error:o})}})}getTransactionCount(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getTransactionCount",n);try{return V.from(i).toNumber()}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:i,error:o})}})}getCode(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getCode",n);try{return te(i)}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getCode",params:n,result:i,error:o})}})}getStorageAt(e,r,n){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(n),position:Promise.resolve(r).then(s=>Tu(s))}),o=yield this.perform("getStorageAt",i);try{return te(o)}catch(s){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:o,error:s})}})}_wrapTransaction(e,r,n){if(r!=null&&On(r)!==32)throw new Error("invalid response - sendTransaction");const i=e;return r!=null&&e.hash!==r&&he.throwError("Transaction hash mismatch from Provider.sendTransaction.",T.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:r}),i.wait=(o,s)=>ae(this,void 0,void 0,function*(){o==null&&(o=1),s==null&&(s=0);let l;o!==0&&n!=null&&(l={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:n});const a=yield this._waitForTransaction(e.hash,o,s,l);return a==null&&o===0?null:(this._emitted["t:"+e.hash]=a.blockNumber,a.status===0&&he.throwError("transaction failed",T.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:a}),a)}),i}sendTransaction(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield Promise.resolve(e).then(o=>te(o)),n=this.formatter.transaction(e);n.confirmations==null&&(n.confirmations=0);const i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const o=yield this.perform("sendTransaction",{signedTransaction:r});return this._wrapTransaction(n,o,i)}catch(o){throw o.transaction=n,o.transactionHash=n.hash,o}})}_getTransactionRequest(e){return ae(this,void 0,void 0,function*(){const r=yield e,n={};return["from","to"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?this._getAddress(o):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?V.from(o):null))}),["type"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o??null))}),r.accessList&&(n.accessList=this.formatter.accessList(r.accessList)),["data"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?te(o):null))}),this.formatter.transactionRequest(yield yt(n))})}_getFilter(e){return ae(this,void 0,void 0,function*(){e=yield e;const r={};return e.address!=null&&(r.address=this._getAddress(e.address)),["blockHash","topics"].forEach(n=>{e[n]!=null&&(r[n]=e[n])}),["fromBlock","toBlock"].forEach(n=>{e[n]!=null&&(r[n]=this._getBlockTag(e[n]))}),this.formatter.filter(yield yt(r))})}_call(e,r,n){return ae(this,void 0,void 0,function*(){n>=O3&&he.throwError("CCIP read exceeded maximum redirections",T.errors.SERVER_ERROR,{redirects:n,transaction:e});const i=e.to,o=yield this.perform("call",{transaction:e,blockTag:r});if(n>=0&&r==="latest"&&i!=null&&o.substring(0,10)==="0x556f1830"&&On(o)%32===4)try{const s=It(o,4),l=It(s,0,32);V.from(l).eq(i)||he.throwError("CCIP Read sender did not match",T.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o});const a=[],u=V.from(It(s,32,64)).toNumber(),c=V.from(It(s,u,u+32)).toNumber(),d=It(s,u+32);for(let E=0;Eae(this,void 0,void 0,function*(){const o=yield this.perform("getBlock",i);if(o==null)return i.blockHash!=null&&this._emitted["b:"+i.blockHash]==null||i.blockTag!=null&&n>this._emitted.block?null:void 0;if(r){let s=null;for(let a=0;athis._wrapTransaction(a)),l}return this.formatter.block(o)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return ho(()=>ae(this,void 0,void 0,function*(){const n=yield this.perform("getTransaction",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;const i=this.formatter.transactionResponse(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;s<=0&&(s=1),i.confirmations=s}return this._wrapTransaction(i)}),{oncePoll:this})})}getTransactionReceipt(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return ho(()=>ae(this,void 0,void 0,function*(){const n=yield this.perform("getTransactionReceipt",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;if(n.blockHash==null)return;const i=this.formatter.receipt(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;s<=0&&(s=1),i.confirmations=s}return i}),{oncePoll:this})})}getLogs(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield yt({filter:this._getFilter(e)}),n=yield this.perform("getLogs",r);return n.forEach(i=>{i.removed==null&&(i.removed=!1)}),Z.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)})}getEtherPrice(){return ae(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return ae(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&he.throwArgumentError("invalid BlockTag","blockTag",e);let r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return r+=e,r<0&&(r=0),this.formatter.blockTag(r)}return this.formatter.blockTag(e)})}getResolver(e){return ae(this,void 0,void 0,function*(){let r=e;for(;;){if(r===""||r==="."||e!=="eth"&&r==="eth")return null;const n=yield this._getResolver(r,"getResolver");if(n!=null){const i=new vd(this,n,e);return r!==e&&!(yield i.supportsWildcard())?null:i}r=r.split(".").slice(1).join(".")}})}_getResolver(e,r){return ae(this,void 0,void 0,function*(){r==null&&(r="ENS");const n=yield this.getNetwork();n.ensAddress||he.throwError("network does not support ENS",T.errors.UNSUPPORTED_OPERATION,{operation:r,network:n.name});try{const i=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+ma(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return ae(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(n){if(pe(e))throw n}typeof e!="string"&&he.throwArgumentError("invalid ENS name","name",e);const r=yield this.getResolver(e);return r?yield r.getAddress():null})}lookupAddress(e){return ae(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);const r=e.substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"lookupAddress");if(n==null)return null;const i=wa(yield this.call({to:n,data:"0x691f3431"+ma(r).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return ae(this,void 0,void 0,function*(){let r=null;if(pe(e)){const o=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",s=yield this._getResolver(o,"getAvatar");if(!s)return null;r=new vd(this,s,o);try{const l=yield r.getAvatar();if(l)return l.url}catch(l){if(l.code!==T.errors.CALL_EXCEPTION)throw l}try{const l=wa(yield this.call({to:s,data:"0x691f3431"+ma(o).substring(2)}),0);r=yield this.getResolver(l)}catch(l){if(l.code!==T.errors.CALL_EXCEPTION)throw l;return null}}else if(r=yield this.getResolver(e),!r)return null;const n=yield r.getAvatar();return n==null?null:n.url})}perform(e,r){return he.throwError(e+" not implemented",T.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_addEventListener(e,r,n){const i=new D3(Gi(e),r,n);return this._events.push(i),this._startEvent(i),this}on(e,r){return this._addEventListener(e,r,!1)}once(e,r){return this._addEventListener(e,r,!0)}emit(e,...r){let n=!1,i=[],o=Gi(e);return this._events=this._events.filter(s=>s.tag!==o?!0:(setTimeout(()=>{s.listener.apply(this,r)},0),n=!0,s.once?(i.push(s),!1):!0)),i.forEach(s=>{this._stopEvent(s)}),n}listenerCount(e){if(!e)return this._events.length;let r=Gi(e);return this._events.filter(n=>n.tag===r).length}listeners(e){if(e==null)return this._events.map(n=>n.listener);let r=Gi(e);return this._events.filter(n=>n.tag===r).map(n=>n.listener)}off(e,r){if(r==null)return this.removeAllListeners(e);const n=[];let i=!1,o=Gi(e);return this._events=this._events.filter(s=>s.tag!==o||s.listener!=r||i?!0:(i=!0,n.push(s),!1)),n.forEach(s=>{this._stopEvent(s)}),this}removeAllListeners(e){let r=[];if(e==null)r=this._events,this._events=[];else{const n=Gi(e);this._events=this._events.filter(i=>i.tag!==n?!0:(r.push(i),!1))}return r.forEach(n=>{this._stopEvent(n)}),this}}var xn=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const wt=new T($t),z3=["call","estimateGas"];function Ps(t,e){if(t==null)return null;if(typeof t.message=="string"&&t.message.match("reverted")){const r=pe(t.data)?t.data:null;if(!e||r)return{message:t.message,data:r}}if(typeof t=="object"){for(const r in t){const n=Ps(t[r],e);if(n)return n}return null}if(typeof t=="string")try{return Ps(JSON.parse(t),e)}catch{}return null}function d1(t,e,r){const n=r.transaction||r.signedTransaction;if(t==="call"){const o=Ps(e,!0);if(o)return o.data;wt.throwError("missing revert data in call exception; Transaction reverted without a reason string",T.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:e})}if(t==="estimateGas"){let o=Ps(e.body,!1);o==null&&(o=Ps(e,!1)),o&&wt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{reason:o.message,method:t,transaction:n,error:e})}let i=e.message;throw e.code===T.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&wt.throwError("insufficient funds for intrinsic transaction cost",T.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:n}),i.match(/nonce (is )?too low/i)&&wt.throwError("nonce has already been used",T.errors.NONCE_EXPIRED,{error:e,method:t,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&wt.throwError("replacement fee too low",T.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:n}),i.match(/only replay-protected/i)&&wt.throwError("legacy pre-eip-155 transactions not supported",T.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:n}),z3.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&wt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:n}),e}function Yp(t){return new Promise(function(e){setTimeout(e,t)})}function $3(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function as(t){return t&&t.toLowerCase()}const yd={};class Oh extends El{constructor(e,r,n){if(super(),e!==yd)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");z(this,"provider",r),n==null&&(n=0),typeof n=="string"?(z(this,"_address",this.provider.formatter.address(n)),z(this,"_index",null)):typeof n=="number"?(z(this,"_index",n),z(this,"_address",null)):wt.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(e){return wt.throwError("cannot alter JSON-RPC Signer connection",T.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new H3(yd,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&wt.throwError("unknown account #"+this._index,T.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=it(e);const r=this.getAddress().then(n=>(n&&(n=n.toLowerCase()),n));if(e.gasLimit==null){const n=it(e);n.from=r,e.gasLimit=this.provider.estimateGas(n)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(n=>xn(this,void 0,void 0,function*(){if(n==null)return null;const i=yield this.provider.resolveName(n);return i==null&&wt.throwArgumentError("provided ENS name resolves to null","tx.to",n),i}))),yt({tx:yt(e),sender:r}).then(({tx:n,sender:i})=>{n.from!=null?n.from.toLowerCase()!==i&&wt.throwArgumentError("from address mismatch","transaction",e):n.from=i;const o=this.provider.constructor.hexlifyTransaction(n,{from:!0});return this.provider.send("eth_sendTransaction",[o]).then(s=>s,s=>(typeof s.message=="string"&&s.message.match(/user denied/i)&&wt.throwError("user rejected transaction",T.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:n}),d1("sendTransaction",s,o)))})}signTransaction(e){return wt.throwError("signing transactions is unsupported",T.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return xn(this,void 0,void 0,function*(){const r=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(e);try{return yield ho(()=>xn(this,void 0,void 0,function*(){const i=yield this.provider.getTransaction(n);if(i!==null)return this.provider._wrapTransaction(i,n,r)}),{oncePoll:this.provider})}catch(i){throw i.transactionHash=n,i}})}signMessage(e){return xn(this,void 0,void 0,function*(){const r=typeof e=="string"?mr(e):e,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[te(r),n.toLowerCase()])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),i}})}_legacySignMessage(e){return xn(this,void 0,void 0,function*(){const r=typeof e=="string"?mr(e):e,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),te(r)])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),i}})}_signTypedData(e,r,n){return xn(this,void 0,void 0,function*(){const i=yield sr.resolveNames(e,r,n,s=>this.provider.resolveName(s)),o=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[o.toLowerCase(),JSON.stringify(sr.getPayload(i.domain,r,i.value))])}catch(s){throw typeof s.message=="string"&&s.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"_signTypedData",from:o,messageData:{domain:i.domain,types:r,value:i.value}}),s}})}unlock(e){return xn(this,void 0,void 0,function*(){const r=this.provider,n=yield this.getAddress();return r.send("personal_unlockAccount",[n.toLowerCase(),e,null])})}}class H3 extends Oh{sendTransaction(e){return this.sendUncheckedTransaction(e).then(r=>({hash:r,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:n=>this.provider.waitForTransaction(r,n)}))}}const q3={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class vi extends $u{constructor(e,r){let n=r;n==null&&(n=new Promise((i,o)=>{setTimeout(()=>{this.detectNetwork().then(s=>{i(s)},s=>{o(s)})},0)})),super(n),e||(e=fr(this.constructor,"defaultUrl")()),typeof e=="string"?z(this,"connection",Object.freeze({url:e})):z(this,"connection",Object.freeze(it(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return xn(this,void 0,void 0,function*(){yield Yp(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){const r=fr(this.constructor,"getNetwork");try{return r(V.from(e).toNumber())}catch(n){return wt.throwError("could not detect network",T.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:n})}}return wt.throwError("could not detect network",T.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new Oh(yd,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(r=>this.formatter.address(r)))}send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:nr(n),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const o=Al(this.connection,JSON.stringify(n),$3).then(s=>(this.emit("debug",{action:"response",request:n,response:s,provider:this}),s),s=>{throw this.emit("debug",{action:"response",error:s,request:n,provider:this}),s});return i&&(this._cache[e]=o,setTimeout(()=>{this._cache[e]=null},0)),o}prepareRequest(e,r){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[as(r.address),r.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[as(r.address),r.blockTag]];case"getCode":return["eth_getCode",[as(r.address),r.blockTag]];case"getStorageAt":return["eth_getStorageAt",[as(r.address),pt(r.position,32),r.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[r.signedTransaction]];case"getBlock":return r.blockTag?["eth_getBlockByNumber",[r.blockTag,!!r.includeTransactions]]:r.blockHash?["eth_getBlockByHash",[r.blockHash,!!r.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[r.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[r.transactionHash]];case"call":return["eth_call",[fr(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0}),r.blockTag]];case"estimateGas":return["eth_estimateGas",[fr(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0})]];case"getLogs":return r.filter&&r.filter.address!=null&&(r.filter.address=as(r.filter.address)),["eth_getLogs",[r.filter]]}return null}perform(e,r){return xn(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){const i=r.transaction;if(i&&i.type!=null&&V.from(i.type).isZero()&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const o=yield this.getFeeData();o.maxFeePerGas==null&&o.maxPriorityFeePerGas==null&&(r=it(r),r.transaction=it(i),delete r.transaction.type)}}const n=this.prepareRequest(e,r);n==null&&wt.throwError(e+" not implemented",T.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(n[0],n[1])}catch(i){return d1(e,i,r)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;const e=this,r=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=r,r.then(function(n){function i(){e.send("eth_getFilterChanges",[n]).then(function(o){if(e._pendingFilter!=r)return null;let s=Promise.resolve();return o.forEach(function(l){e._emitted["t:"+l.toLowerCase()]="pending",s=s.then(function(){return e.getTransaction(l).then(function(a){return e.emit("pending",a),null})})}),s.then(function(){return Yp(1e3)})}).then(function(){if(e._pendingFilter!=r){e.send("eth_uninstallFilter",[n]);return}return setTimeout(function(){i()},0),null}).catch(o=>{})}return i(),n}).catch(n=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,r){const n=it(q3);if(r)for(const o in r)r[o]&&(n[o]=!0);jx(e,n);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(o){if(e[o]==null)return;const s=Tu(V.from(e[o]));o==="gasLimit"&&(o="gas"),i[o]=s}),["from","to","data"].forEach(function(o){e[o]!=null&&(i[o]=te(e[o]))}),e.accessList&&(i.accessList=qi(e.accessList)),i}}let Cs=null;try{if(Cs=WebSocket,Cs==null)throw new Error("inject please")}catch{const e=new T($t);Cs=function(){e.throwError("WebSockets not supported in this environment",T.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var ef=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Vl=new T($t);let W3=1;class Hu extends vi{constructor(e,r){r==="any"&&Vl.throwError("WebSocketProvider does not support 'any' network yet",T.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,r):super("_websocket",r),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?z(this,"_websocket",new Cs(this.connection.url)):z(this,"_websocket",e),z(this,"_requests",{}),z(this,"_subs",{}),z(this,"_subIds",{}),z(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(i=>{this.websocket.send(this._requests[i].payload)})},this.websocket.onmessage=i=>{const o=i.data,s=JSON.parse(o);if(s.id!=null){const l=String(s.id),a=this._requests[l];if(delete this._requests[l],s.result!==void 0)a.callback(null,s.result),this.emit("debug",{action:"response",request:JSON.parse(a.payload),response:s.result,provider:this});else{let u=null;s.error?(u=new Error(s.error.message||"unknown error"),z(u,"code",s.error.code||null),z(u,"response",o)):u=new Error("unknown error"),a.callback(u,void 0),this.emit("debug",{action:"response",error:u,request:JSON.parse(a.payload),provider:this})}}else if(s.method==="eth_subscription"){const l=this._subs[s.params.subscription];l&&l.processFunc(s.params.result)}else console.warn("this should not happen")};const n=setInterval(()=>{this.emit("poll")},1e3);n.unref&&n.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){Vl.throwError("cannot reset events block on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){Vl.throwError("cannot set polling interval on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return ef(this,void 0,void 0,function*(){return null})}set polling(e){e&&Vl.throwError("cannot set polling on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,r){const n=W3++;return new Promise((i,o)=>{function s(a,u){return a?o(a):i(u)}const l=JSON.stringify({method:e,params:r,id:n,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(l),provider:this}),this._requests[String(n)]={callback:s,payload:l},this._wsReady&&this.websocket.send(l)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,r,n){return ef(this,void 0,void 0,function*(){let i=this._subIds[e];i==null&&(i=Promise.all(r).then(s=>this.send("eth_subscribe",s)),this._subIds[e]=i);const o=yield i;this._subs[o]={tag:e,processFunc:n}})}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],r=>{const n=V.from(r.number).toNumber();this._emitted.block=n,this.emit("block",n)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],r=>{this.emit("pending",r)});break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],r=>{r.removed==null&&(r.removed=!1),this.emit(e.filter,this.formatter.filterLog(r))});break;case"tx":{const r=n=>{const i=n.hash;this.getTransactionReceipt(i).then(o=>{o&&this.emit(i,o)})};r(e),this._subscribe("tx",["newHeads"],n=>{this._events.filter(i=>i.type==="tx").forEach(r)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e);break}}_stopEvent(e){let r=e.tag;if(e.type==="tx"){if(this._events.filter(i=>i.type==="tx").length)return;r="tx"}else if(this.listenerCount(e.event))return;const n=this._subIds[r];n&&(delete this._subIds[r],n.then(i=>{this._subs[i]&&(delete this._subs[i],this.send("eth_unsubscribe",[i]))}))}destroy(){return ef(this,void 0,void 0,function*(){this.websocket.readyState===Cs.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}var G3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const gs=new T($t);class h1 extends vi{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return G3(this,void 0,void 0,function*(){let r=this.network;return r==null&&(r=yield e.detectNetwork.call(this),r||gs.throwError("no network detected",T.errors.UNKNOWN_ERROR,{}),this._network==null&&(z(this,"_network",r),this.emit("network",r,null))),r})}}class Fn extends h1{constructor(e,r){gs.checkAbstract(new.target,Fn),e=fr(new.target,"getNetwork")(e),r=fr(new.target,"getApiKey")(r);const n=fr(new.target,"getUrl")(e,r);super(n,e),typeof r=="string"?z(this,"apiKey",r):r!=null&&Object.keys(r).forEach(i=>{z(this,i,r[i])})}_startPending(){gs.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return gs.throwError("API provider does not support signing",T.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,r){return gs.throwError("not implemented; sub-classes must override getUrl",T.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const Xp=new T($t),Ea="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class p1 extends Hu{constructor(e,r){const n=new Lh(e,r),i=n.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(i,n.network),z(this,"apiKey",n.apiKey)}isCommunityResource(){return this.apiKey===Ea}}class Lh extends Fn{static getWebSocketProvider(e,r){return new p1(e,r)}static getApiKey(e){return e==null?Ea:(e&&typeof e!="string"&&Xp.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,r){let n=null;switch(e.name){case"homestead":n="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":n="eth-goerli.g.alchemy.com/v2/";break;case"matic":n="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":n="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":n="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":n="arb-goerli.g.alchemy.com/v2/";break;case"optimism":n="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":n="opt-goerli.g.alchemy.com/v2/";break;default:Xp.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+n+r,throttleCallback:(i,o)=>(r===Ea&&bl(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===Ea}}const V3=new T($t),Kl="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function K3(t){switch(t){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return V3.throwArgumentError("unsupported network","name",t)}class m1 extends Fn{isCommunityResource(){return this.apiKey===Kl}static getApiKey(e){return e??Kl}static getUrl(e,r){r==null&&(r=Kl);const n={allowGzip:!0,url:"https://"+K3(e.name)+r,throttleCallback:(i,o)=>(r.apiKey===Kl&&bl(),Promise.resolve(!0))};return r.projectSecret!=null&&(n.user="",n.password=r.projectSecret),n}}var Q3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Zp=new T($t);class g1 extends Fn{static getApiKey(e){return e!=null&&Zp.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,r){let n=null;switch(e.name){case"homestead":n="https://cloudflare-eth.com/";break;default:Zp.throwArgumentError("unsupported network","network",arguments[0])}return n}perform(e,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return Q3(this,void 0,void 0,function*(){return e==="getBlockNumber"?(yield n.perform.call(this,"getBlock",{blockTag:"latest"})).number:n.perform.call(this,e,r)})}}var Ql=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const ti=new T($t);function em(t){const e={};for(let r in t){if(t[r]==null)continue;let n=t[r];r==="type"&&n===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?n=Tu(te(n)):r==="accessList"?n="["+qi(n).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":n=te(n),e[r]=n)}return e}function J3(t){if(t.status==0&&(t.message==="No records found"||t.message==="No transactions found"))return t.result;if(t.status!=1||typeof t.message!="string"||!t.message.match(/^OK/)){const e=new Error("invalid response");throw e.result=JSON.stringify(t),(t.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return t.result}function tm(t){if(t&&t.status==0&&t.message=="NOTOK"&&(t.result||"").toLowerCase().indexOf("rate limit")>=0){const e=new Error("throttled response");throw e.result=JSON.stringify(t),e.throttleRetry=!0,e}if(t.jsonrpc!="2.0"){const e=new Error("invalid response");throw e.result=JSON.stringify(t),e}if(t.error){const e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function rm(t){if(t==="pending")throw new Error("pending not supported");return t==="latest"?t:parseInt(t.substring(2),16)}function tf(t,e,r){if(t==="call"&&e.code===T.errors.SERVER_ERROR){const i=e.error;if(i&&(i.message.match(/reverted/i)||i.message.match(/VM execution error/i))){let o=i.data;if(o&&(o="0x"+o.replace(/^.*0x/i,"")),pe(o))return o;ti.throwError("missing revert data in call exception",T.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let n=e.message;throw e.code===T.errors.SERVER_ERROR&&(e.error&&typeof e.error.message=="string"?n=e.error.message:typeof e.body=="string"?n=e.body:typeof e.responseText=="string"&&(n=e.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&ti.throwError("insufficient funds for intrinsic transaction cost",T.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&ti.throwError("nonce has already been used",T.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),n.match(/another transaction with same nonce/)&&ti.throwError("replacement fee too low",T.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&ti.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}class v1 extends $u{constructor(e,r){super(e),z(this,"baseUrl",this.getBaseUrl()),z(this,"apiKey",r||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return ti.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,r){const n=Object.keys(r).reduce((o,s)=>{const l=r[s];return l!=null&&(o+=`&${s}=${l}`),o},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${n}${i}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,r){return r.module=e,r.apikey=this.apiKey,r}fetch(e,r,n){return Ql(this,void 0,void 0,function*(){const i=n?this.getPostUrl():this.getUrl(e,r),o=n?this.getPostData(e,r):null,s=e==="proxy"?tm:J3;this.emit("debug",{action:"request",request:i,provider:this});const l={url:i,throttleSlotInterval:1e3,throttleCallback:(c,d)=>(this.isCommunityResource()&&bl(),Promise.resolve(!0))};let a=null;o&&(l.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},a=Object.keys(o).map(c=>`${c}=${o[c]}`).join("&"));const u=yield Al(l,a,s||tm);return this.emit("debug",{action:"response",request:i,response:nr(u),provider:this}),u})}detectNetwork(){return Ql(this,void 0,void 0,function*(){return this.network})}perform(e,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return Ql(this,void 0,void 0,function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:r.address,tag:r.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:r.address,tag:r.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:r.address,tag:r.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:r.address,position:r.position,tag:r.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:r.signedTransaction},!0).catch(i=>tf("sendTransaction",i,r.signedTransaction));case"getBlock":if(r.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:r.blockTag,boolean:r.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:r.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:r.transactionHash});case"call":{if(r.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const i=em(r.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(o){return tf("call",o,r.transaction)}}case"estimateGas":{const i=em(r.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(o){return tf("estimateGas",o,r.transaction)}}case"getLogs":{const i={action:"getLogs"};if(r.filter.fromBlock&&(i.fromBlock=rm(r.filter.fromBlock)),r.filter.toBlock&&(i.toBlock=rm(r.filter.toBlock)),r.filter.address&&(i.address=r.filter.address),r.filter.topics&&r.filter.topics.length>0&&(r.filter.topics.length>1&&ti.throwError("unsupported topic count",T.errors.UNSUPPORTED_OPERATION,{topics:r.filter.topics}),r.filter.topics.length===1)){const l=r.filter.topics[0];(typeof l!="string"||l.length!==66)&&ti.throwError("unsupported topic format",T.errors.UNSUPPORTED_OPERATION,{topic0:l}),i.topic0=l}const o=yield this.fetch("logs",i);let s={};for(let l=0;l{["contractAddress","to"].forEach(function(a){s[a]==""&&delete s[a]}),s.creates==null&&s.contractAddress!=null&&(s.creates=s.contractAddress);const l=this.formatter.transactionResponse(s);return s.timeStamp&&(l.timestamp=parseInt(s.timeStamp)),l})})}isCommunityResource(){return this.apiKey==null}}var iu=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Si=new T($t);function Jl(){return new Date().getTime()}function nm(t){let e=null;for(let r=0;re?null:(n+i)/2}function po(t){if(t===null)return"null";if(typeof t=="number"||typeof t=="boolean")return JSON.stringify(t);if(typeof t=="string")return t;if(V.isBigNumber(t))return t.toString();if(Array.isArray(t))return JSON.stringify(t.map(e=>po(e)));if(typeof t=="object"){const e=Object.keys(t);return e.sort(),"{"+e.map(r=>{let n=t[r];return typeof n=="function"?n="[function]":n=po(n),JSON.stringify(r)+":"+n}).join(",")+"}"}throw new Error("unknown value type: "+typeof t)}let Y3=1;function om(t){let e=null,r=null,n=new Promise(s=>{e=function(){r&&(clearTimeout(r),r=null),s()},r=setTimeout(e,t)});const i=s=>(n=n.then(s),n);function o(){return n}return{cancel:e,getPromise:o,wait:i}}const X3=[T.errors.CALL_EXCEPTION,T.errors.INSUFFICIENT_FUNDS,T.errors.NONCE_EXPIRED,T.errors.REPLACEMENT_UNDERPRICED,T.errors.UNPREDICTABLE_GAS_LIMIT],Z3=["address","args","errorArgs","errorSignature","method","transaction"];function Yl(t,e){const r={weight:t.weight};return Object.defineProperty(r,"provider",{get:()=>t.provider}),t.start&&(r.start=t.start),e&&(r.duration=e-t.start),t.done&&(t.error?r.error=t.error:r.result=t.result||null),r}function eS(t,e){return function(r){const n={};r.forEach(o=>{const s=t(o.result);n[s]||(n[s]={count:0,result:o.result}),n[s].count++});const i=Object.keys(n);for(let o=0;o=e)return s.result}}}function tS(t,e,r){let n=po;switch(e){case"getBlockNumber":return function(i){const o=i.map(l=>l.result);let s=im(i.map(l=>l.result),2);if(s!=null)return s=Math.ceil(s),o.indexOf(s+1)>=0&&s++,s>=t._highestBlockNumber&&(t._highestBlockNumber=s),t._highestBlockNumber};case"getGasPrice":return function(i){const o=i.map(s=>s.result);return o.sort(),o[Math.floor(o.length/2)]};case"getEtherPrice":return function(i){return im(i.map(o=>o.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(i){return i==null?null:(i=it(i),i.confirmations=-1,po(i))};break;case"getBlock":r.includeTransactions?n=function(i){return i==null?null:(i=it(i),i.transactions=i.transactions.map(o=>(o=it(o),o.confirmations=-1,o)),po(i))}:n=function(i){return i==null?null:po(i)};break;default:throw new Error("unknown method: "+e)}return eS(n,t.quorum)}function us(t,e){return iu(this,void 0,void 0,function*(){const r=t.provider;return r.blockNumber!=null&&r.blockNumber>=e||e===-1?r:ho(()=>new Promise((n,i)=>{setTimeout(function(){return r.blockNumber>=e?n(r):t.cancelled?n(null):n(void 0)},0)}),{oncePoll:r})})}function rS(t,e,r,n){return iu(this,void 0,void 0,function*(){let i=t.provider;switch(r){case"getBlockNumber":case"getGasPrice":return i[r]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),r==="call"&&n.blockTag?i[r](n.transaction,n.blockTag):i[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return i[r](n.transactionHash);case"getLogs":{let o=n.filter;return(o.fromBlock&&pe(o.fromBlock)||o.toBlock&&pe(o.toBlock))&&(i=yield us(t,e)),i.getLogs(o)}}return Si.throwError("unknown method error",T.errors.UNKNOWN_ERROR,{method:r,params:n})})}class y1 extends $u{constructor(e,r){e.length===0&&Si.throwArgumentError("missing providers","providers",e);const n=e.map((s,l)=>{if(qo.isProvider(s)){const c=gd(s)?2e3:750;return Object.freeze({provider:s,weight:1,stallTimeout:c,priority:1})}const a=it(s);a.priority==null&&(a.priority=1),a.stallTimeout==null&&(a.stallTimeout=gd(s)?2e3:750),a.weight==null&&(a.weight=1);const u=a.weight;return(u%1||u>512||u<1)&&Si.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${l}].weight`,u),Object.freeze(a)}),i=n.reduce((s,l)=>s+l.weight,0);r==null?r=i/2:r>i&&Si.throwArgumentError("quorum will always fail; larger than total weight","quorum",r);let o=nm(n.map(s=>s.provider.network));o==null&&(o=new Promise((s,l)=>{setTimeout(()=>{this.detectNetwork().then(s,l)},0)})),super(o),z(this,"providerConfigs",Object.freeze(n)),z(this,"quorum",r),this._highestBlockNumber=-1}detectNetwork(){return iu(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(r=>r.provider.getNetwork()));return nm(e)})}perform(e,r){return iu(this,void 0,void 0,function*(){if(e==="sendTransaction"){const a=yield Promise.all(this.providerConfigs.map(u=>u.provider.sendTransaction(r.signedTransaction).then(c=>c.hash,c=>c)));for(let u=0;ua.priority-u.priority);const o=this._highestBlockNumber;let s=0,l=!0;for(;;){const a=Jl();let u=i.filter(v=>v.runner&&a-v.startv+g.weight,0);for(;u{v.staller=null}),v.runner=rS(v,o,e,r).then(x=>{v.done=!0,v.result=x,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:g,backend:Yl(v,Jl()),request:{method:e,params:nr(r)},provider:this})},x=>{v.done=!0,v.error=x,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:g,backend:Yl(v,Jl()),request:{method:e,params:nr(r)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:g,backend:Yl(v,null),request:{method:e,params:nr(r)},provider:this}),u+=v.weight}const c=[];i.forEach(v=>{v.done||!v.runner||(c.push(v.runner),v.staller&&c.push(v.staller.getPromise()))}),c.length&&(yield Promise.race(c));const d=i.filter(v=>v.done&&v.error==null);if(d.length>=this.quorum){const v=n(d);if(v!==void 0)return i.forEach(g=>{g.staller&&g.staller.cancel(),g.cancelled=!0}),v;l||(yield om(100).getPromise()),l=!1}const p=i.reduce((v,g)=>{if(!g.done||g.error==null)return v;const x=g.error.code;return X3.indexOf(x)>=0&&(v[x]||(v[x]={error:g.error,weight:0}),v[x].weight+=g.weight),v},{});if(Object.keys(p).forEach(v=>{const g=p[v];if(g.weight{E.staller&&E.staller.cancel(),E.cancelled=!0});const x=g.error,S={};Z3.forEach(E=>{x[E]!=null&&(S[E]=x[E])}),Si.throwError(x.reason||x.message,v,S)}),i.filter(v=>!v.done).length===0)break}return i.forEach(a=>{a.staller&&a.staller.cancel(),a.cancelled=!0}),Si.throwError("failed to meet quorum",T.errors.SERVER_ERROR,{method:e,params:r,results:i.map(a=>Yl(a)),provider:this})})}}const w1=null,xa=new T($t),vs="84842078b09946638c03157f83405213";class E1 extends Hu{constructor(e,r){const n=new Bh(e,r),i=n.connection;i.password&&xa.throwError("INFURA WebSocket project secrets unsupported",T.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const o=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(o,e),z(this,"apiKey",n.projectId),z(this,"projectId",n.projectId),z(this,"projectSecret",n.projectSecret)}isCommunityResource(){return this.projectId===vs}}class Bh extends Fn{static getWebSocketProvider(e,r){return new E1(e,r)}static getApiKey(e){const r={apiKey:vs,projectId:vs,projectSecret:null};return e==null||(typeof e=="string"?r.projectId=e:e.projectSecret!=null?(xa.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),xa.assertArgument(typeof e.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),r.projectId=e.projectId,r.projectSecret=e.projectSecret):e.projectId&&(r.projectId=e.projectId),r.apiKey=r.projectId),r}static getUrl(e,r){let n=null;switch(e?e.name:"unknown"){case"homestead":n="mainnet.infura.io";break;case"goerli":n="goerli.infura.io";break;case"sepolia":n="sepolia.infura.io";break;case"matic":n="polygon-mainnet.infura.io";break;case"maticmum":n="polygon-mumbai.infura.io";break;case"optimism":n="optimism-mainnet.infura.io";break;case"optimism-goerli":n="optimism-goerli.infura.io";break;case"arbitrum":n="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":n="arbitrum-goerli.infura.io";break;default:xa.throwError("unsupported network",T.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+n+"/v3/"+r.projectId,throttleCallback:(o,s)=>(r.projectId===vs&&bl(),Promise.resolve(!0))};return r.projectSecret!=null&&(i.user="",i.password=r.projectSecret),i}isCommunityResource(){return this.projectId===vs}}class nS extends vi{send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this._pendingBatch==null&&(this._pendingBatch=[]);const i={request:n,resolve:null,reject:null},o=new Promise((s,l)=>{i.resolve=s,i.reject=l});return this._pendingBatch.push(i),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout(()=>{const s=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const l=s.map(a=>a.request);return this.emit("debug",{action:"requestBatch",request:nr(l),provider:this}),Al(this.connection,JSON.stringify(l)).then(a=>{this.emit("debug",{action:"response",request:l,response:a,provider:this}),s.forEach((u,c)=>{const d=a[c];if(d.error){const p=new Error(d.error.message);p.code=d.error.code,p.data=d.error.data,u.reject(p)}else u.resolve(d.result)})},a=>{this.emit("debug",{action:"response",error:a,request:l,provider:this}),s.forEach(u=>{u.reject(a)})})},10)),o}}const rf=new T($t),iS="ETHERS_JS_SHARED";class x1 extends Fn{static getApiKey(e){return e&&typeof e!="string"&&rf.throwArgumentError("invalid apiKey","apiKey",e),e||iS}static getUrl(e,r){rf.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let n=null;switch(e.name){case"homestead":n="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":n="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":n="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":n="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":n="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:rf.throwArgumentError("unsupported network","network",arguments[0])}return n+"?apiKey="+r}}const sm=new T($t),lm="62e1ad51b37b8e00394bda3b";class A1 extends Fn{static getApiKey(e){const r={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?r.applicationId=lm:typeof e=="string"?r.applicationId=e:e.applicationSecretKey!=null?(r.applicationId=e.applicationId,r.applicationSecretKey=e.applicationSecretKey):e.applicationId?r.applicationId=e.applicationId:sm.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),r}static getUrl(e,r){let n=null;switch(e?e.name:"unknown"){case"goerli":n="eth-goerli.gateway.pokt.network";break;case"homestead":n="eth-mainnet.gateway.pokt.network";break;case"kovan":n="poa-kovan.gateway.pokt.network";break;case"matic":n="poly-mainnet.gateway.pokt.network";break;case"maticmum":n="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":n="eth-rinkeby.gateway.pokt.network";break;case"ropsten":n="eth-ropsten.gateway.pokt.network";break;default:sm.throwError("unsupported network",T.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i=`https://${n}/v1/lb/${r.applicationId}`,o={headers:{},url:i};return r.applicationSecretKey!=null&&(o.user="",o.password=r.applicationSecretKey),o}isCommunityResource(){return this.applicationId===lm}}const am=new T($t);let oS=1;function um(t,e){const r="Web3LegacyFetcher";return function(n,i){const o={method:n,params:i,id:oS++,jsonrpc:"2.0"};return new Promise((s,l)=>{this.emit("debug",{action:"request",fetcher:r,request:nr(o),provider:this}),e(o,(a,u)=>{if(a)return this.emit("debug",{action:"response",fetcher:r,error:a,request:o,provider:this}),l(a);if(this.emit("debug",{action:"response",fetcher:r,request:o,response:u,provider:this}),u.error){const c=new Error(u.error.message);return c.code=u.error.code,c.data=u.error.data,l(c)}s(u.result)})})}}function sS(t){return function(e,r){r==null&&(r=[]);const n={method:e,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:nr(n),provider:this}),t.request(n).then(i=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,response:i,provider:this}),i),i=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,error:i,provider:this}),i})}}class b1 extends vi{constructor(e,r){e==null&&am.throwArgumentError("missing provider","provider",e);let n=null,i=null,o=null;typeof e=="function"?(n="unknown:",i=e):(n=e.host||e.path||"",!n&&e.isMetaMask&&(n="metamask"),o=e,e.request?(n===""&&(n="eip-1193:"),i=sS(e)):e.sendAsync?i=um(e,e.sendAsync.bind(e)):e.send?i=um(e,e.send.bind(e)):am.throwArgumentError("unsupported provider","provider",e),n||(n="unknown:")),super(n,r),z(this,"jsonRpcFetchFunc",i),z(this,"provider",o)}send(e,r){return this.jsonRpcFetchFunc(e,r)}}const cm=new T($t);function lS(t,e){if(t==null&&(t="homestead"),typeof t=="string"){const n=t.match(/^(ws|http)s?:/i);if(n)switch(n[1].toLowerCase()){case"http":case"https":return new vi(t);case"ws":case"wss":return new Hu(t);default:cm.throwArgumentError("unsupported URL scheme","network",t)}}const r=Th(t);return(!r||!r._defaultProvider)&&cm.throwError("unsupported getDefaultProvider network",T.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:t}),r._defaultProvider({FallbackProvider:y1,AlchemyProvider:Lh,AnkrProvider:m1,CloudflareProvider:g1,EtherscanProvider:v1,InfuraProvider:Bh,JsonRpcProvider:vi,NodesmithProvider:x1,PocketProvider:A1,Web3Provider:b1,IpcProvider:w1},e)}const aS=Object.freeze(Object.defineProperty({__proto__:null,AlchemyProvider:Lh,AlchemyWebSocketProvider:p1,AnkrProvider:m1,BaseProvider:$u,CloudflareProvider:g1,EtherscanProvider:v1,FallbackProvider:y1,Formatter:Z,InfuraProvider:Bh,InfuraWebSocketProvider:E1,IpcProvider:w1,JsonRpcBatchProvider:nS,JsonRpcProvider:vi,JsonRpcSigner:Oh,NodesmithProvider:x1,PocketProvider:A1,Provider:qo,Resolver:vd,StaticJsonRpcProvider:h1,UrlJsonRpcProvider:Fn,Web3Provider:b1,WebSocketProvider:Hu,getDefaultProvider:lS,getNetwork:Th,isCommunityResourcable:u1,isCommunityResource:gd,showThrottleMessage:bl},Symbol.toStringTag,{value:"Module"})),uS="solidity/5.7.0",cS=new RegExp("^bytes([0-9]+)$"),fS=new RegExp("^(u?int)([0-9]*)$"),dS=new RegExp("^(.*)\\[([0-9]*)\\]$"),hS="0000000000000000000000000000000000000000000000000000000000000000",Yi=new T(uS);function _1(t,e,r){switch(t){case"address":return r?ha(e,32):oe(e);case"string":return mr(e);case"bytes":return oe(e);case"bool":return e=e?"0x01":"0x00",r?ha(e,32):oe(e)}let n=t.match(fS);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!==0||i===0||i>256)&&Yi.throwArgumentError("invalid number type","type",t),r&&(i=256),e=V.from(e).toTwos(i),ha(e,i/8)}if(n=t.match(cS),n){const i=parseInt(n[1]);return(String(i)!==n[1]||i===0||i>32)&&Yi.throwArgumentError("invalid bytes type","type",t),oe(e).byteLength!==i&&Yi.throwArgumentError(`invalid value for ${t}`,"value",e),r?oe((e+hS).substring(0,66)):e}if(n=t.match(dS),n&&Array.isArray(e)){const i=n[1];parseInt(n[2]||String(e.length))!=e.length&&Yi.throwArgumentError(`invalid array length for ${t}`,"value",e);const s=[];return e.forEach(function(l){s.push(_1(i,l,!0))}),Ut(s)}return Yi.throwArgumentError("invalid type","type",t)}function pS(t,e){t.length!=e.length&&Yi.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);const r=[];return t.forEach(function(n,i){r.push(_1(n,e[i]))}),te(Ut(r))}function mS(t,e){return ut(pS(t,e))}var qu={},Cn={},S1={};const gS=Uo(rA);var vS={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const fm=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??typeof c!="object"?c:Object.assign({},e,c),r.forEach(p=>p(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(vS?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},k1=t=>t?fm(t):fm;var N1={exports:{}},P1={},C1={exports:{}},M1={};/** - * @license React - * use-sync-external-store-shim.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Bo=L;function yS(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var wS=typeof Object.is=="function"?Object.is:yS,ES=Bo.useState,xS=Bo.useEffect,AS=Bo.useLayoutEffect,bS=Bo.useDebugValue;function _S(t,e){var r=e(),n=ES({inst:{value:r,getSnapshot:e}}),i=n[0].inst,o=n[1];return AS(function(){i.value=r,i.getSnapshot=e,nf(i)&&o({inst:i})},[t,r,e]),xS(function(){return nf(i)&&o({inst:i}),t(function(){nf(i)&&o({inst:i})})},[t]),bS(r),r}function nf(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!wS(t,r)}catch{return!0}}function SS(t,e){return e()}var kS=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?SS:_S;M1.useSyncExternalStore=Bo.useSyncExternalStore!==void 0?Bo.useSyncExternalStore:kS;C1.exports=M1;var NS=C1.exports;/** - * @license React - * use-sync-external-store-shim/with-selector.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Wu=L,PS=NS;function CS(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var MS=typeof Object.is=="function"?Object.is:CS,IS=PS.useSyncExternalStore,RS=Wu.useRef,TS=Wu.useEffect,OS=Wu.useMemo,LS=Wu.useDebugValue;P1.useSyncExternalStoreWithSelector=function(t,e,r,n,i){var o=RS(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=OS(function(){function a(v){if(!u){if(u=!0,c=v,v=n(v),i!==void 0&&s.hasValue){var g=s.value;if(i(g,v))return d=g}return d=v}if(g=d,MS(c,v))return g;var x=n(v);return i!==void 0&&i(g,x)?g:(c=v,d=x)}var u=!1,c,d,p=r===void 0?null:r;return[function(){return a(e())},p===null?void 0:function(){return a(p())}]},[e,r,n,i]);var l=IS(t,o[0],o[1]);return TS(function(){s.hasValue=!0,s.value=l},[l]),LS(l),l};N1.exports=P1;var BS=N1.exports;const Gu=jo(BS),{useSyncExternalStoreWithSelector:DS}=Gu;function I1(t,e=t.getState,r){const n=DS(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const dm=t=>{const e=typeof t=="function"?k1(t):t,r=(n,i)=>I1(e,n,i);return Object.assign(r,e),r},R1=t=>t?dm(t):dm;var jS=t=>R1(t);const US=Object.freeze(Object.defineProperty({__proto__:null,create:R1,createStore:k1,default:jS,useStore:I1},Symbol.toStringTag,{value:"Module"})),FS=Uo(US);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createWeb3ReactStoreAndActions=t.MAX_SAFE_CHAIN_ID=void 0;const e=gS,r=FS;t.MAX_SAFE_CHAIN_ID=0xfffffffffffec;function n(l){if(!Number.isInteger(l)||l<=0||l>t.MAX_SAFE_CHAIN_ID)throw new Error(`Invalid chainId ${l}`)}function i(l){return(0,e.getAddress)(l)}const o={chainId:void 0,accounts:void 0,activating:!1};function s(){const l=(0,r.createStore)()(()=>o);let a=0;function u(){const p=++a;return l.setState(Object.assign(Object.assign({},o),{activating:!0})),()=>{a===p&&l.setState({activating:!1})}}function c(p){if(p.chainId!==void 0&&n(p.chainId),p.accounts!==void 0)for(let v=0;v{var g,x;const S=(g=p.chainId)!==null&&g!==void 0?g:v.chainId,E=(x=p.accounts)!==null&&x!==void 0?x:v.accounts;let w=v.activating;return w&&S&&E&&(w=!1),{chainId:S,accounts:E,activating:w}})}function d(){a++,l.setState(o)}return[l,{startActivation:u,update:c,resetState:d}]}t.createWeb3ReactStoreAndActions=s})(S1);var zS={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const hm=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??typeof c!="object"?c:Object.assign({},e,c),r.forEach(p=>p(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(zS?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},Dh=t=>t?hm(t):hm,{useSyncExternalStoreWithSelector:$S}=Gu;function T1(t,e=t.getState,r){const n=$S(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const pm=t=>{const e=typeof t=="function"?Dh(t):t,r=(n,i)=>T1(e,n,i);return Object.assign(r,e),r},O1=t=>t?pm(t):pm;var HS=t=>O1(t);const qS=Object.freeze(Object.defineProperty({__proto__:null,create:O1,createStore:Dh,default:HS,useStore:T1},Symbol.toStringTag,{value:"Module"})),WS=Uo(qS),{useSyncExternalStoreWithSelector:GS}=Gu;function L1(t,e=t.getState,r){const n=GS(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const mm=(t,e)=>{const r=Dh(t),n=(i,o=e)=>L1(r,i,o);return Object.assign(n,r),n},VS=(t,e)=>t?mm(t,e):mm,KS=Object.freeze(Object.defineProperty({__proto__:null,createWithEqualityFn:VS,useStoreWithEqualityFn:L1},Symbol.toStringTag,{value:"Module"})),QS=Uo(KS),JS=Uo(aS);var YS=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XS=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZS=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&YS(e,t,r);return XS(e,t),e},ek=Fe&&Fe.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(Cn,"__esModule",{value:!0});Cn.getPriorityConnector=Cn.getSelectedConnector=Cn.initializeConnector=void 0;const tk=S1,mo=L,gm=WS,rk=QS;let _o;function nk(){return ek(this,void 0,void 0,function*(){if(_o===void 0)try{const{Web3Provider:t}=yield Promise.resolve().then(()=>ZS(JS));_o=t}catch{console.debug("@ethersproject/providers not available"),_o=null}})}function ik(t){const[e,r]=(0,tk.createWeb3ReactStoreAndActions)(),n=t(r),i=fk(e),o=dk(i),s=hk(n,i,o);return[n,Object.assign(Object.assign(Object.assign({},i),o),s),e]}Cn.initializeConnector=ik;function ok({chainId:t,accounts:e,activating:r}){return!!(t&&e&&!r)}function B1(...t){function e(d){const p=t.findIndex(([v])=>d===v);if(p===-1)throw new Error("Connector not found");return p}function r(d){const p=t[e(d)][2];if(!p)throw new Error("Stores not passed");return p}function n(d){return t.map(([,{useChainId:v}])=>v())[e(d)]}function i(d){return t.map(([,{useAccounts:v}])=>v())[e(d)]}function o(d){return t.map(([,{useIsActivating:v}])=>v())[e(d)]}function s(d){return t.map(([,{useAccount:v}])=>v())[e(d)]}function l(d){return t.map(([,{useIsActive:v}])=>v())[e(d)]}function a(d,p){const v=e(d);return t.map(([,{useProvider:x}],S)=>x(p,S===v))[v]}function u(d,p){const v=e(d);return t.map(([,{useENSNames:x}],S)=>x(S===v?p:void 0))[v]}function c(d,p){const v=e(d);return t.map(([,{useENSName:x}],S)=>x(S===v?p:void 0))[v]}return{useSelectedStore:r,useSelectedChainId:n,useSelectedAccounts:i,useSelectedIsActivating:o,useSelectedAccount:s,useSelectedIsActive:l,useSelectedProvider:a,useSelectedENSNames:u,useSelectedENSName:c}}Cn.getSelectedConnector=B1;function sk(...t){const{useSelectedStore:e,useSelectedChainId:r,useSelectedAccounts:n,useSelectedIsActivating:i,useSelectedAccount:o,useSelectedIsActive:s,useSelectedProvider:l,useSelectedENSNames:a,useSelectedENSName:u}=B1(...t);function c(){const B=t.map(([,{useIsActive:j}])=>j()).findIndex(j=>j);return t[B===-1?0:B][0]}function d(){return e(c())}function p(){return r(c())}function v(){return n(c())}function g(){return i(c())}function x(){return o(c())}function S(){return s(c())}function E(O){return l(c(),O)}function w(O){return a(c(),O)}function _(O){return u(c(),O)}return{useSelectedStore:e,useSelectedChainId:r,useSelectedAccounts:n,useSelectedIsActivating:i,useSelectedAccount:o,useSelectedIsActive:s,useSelectedProvider:l,useSelectedENSNames:a,useSelectedENSName:u,usePriorityConnector:c,usePriorityStore:d,usePriorityChainId:p,usePriorityAccounts:v,usePriorityIsActivating:g,usePriorityAccount:x,usePriorityIsActive:S,usePriorityProvider:E,usePriorityENSNames:w,usePriorityENSName:_}}Cn.getPriorityConnector=sk;const lk=({chainId:t})=>t,ak=({accounts:t})=>t,uk=({activating:t})=>t,ck=(t,e)=>t===void 0&&e===void 0||t!==void 0&&t.length===(e==null?void 0:e.length)&&t.every((r,n)=>r===e[n]);function fk(t){function e(){return(0,gm.useStore)(t,lk)}function r(){return(0,rk.useStoreWithEqualityFn)(t,ak,ck)}function n(){return(0,gm.useStore)(t,uk)}return{useChainId:e,useAccounts:r,useIsActivating:n}}function dk({useChainId:t,useAccounts:e,useIsActivating:r}){function n(){var o;return(o=e())===null||o===void 0?void 0:o[0]}function i(){const o=t(),s=e(),l=r();return ok({chainId:o,accounts:s,activating:l})}return{useAccount:n,useIsActive:i}}function vm(t,e=[]){const[r,n]=(0,mo.useState)();return(0,mo.useEffect)(()=>{if(t&&e.length){let i=!1;return Promise.all(e.map(o=>t.lookupAddress(o))).then(o=>{i||n(o)}).catch(o=>{i||(console.debug("Could not fetch ENS names",o),n(new Array(e.length).fill(null)))}),()=>{i=!0,n(void 0)}}},[t,e]),r??new Array(e.length).fill(void 0)}function hk(t,{useAccounts:e,useChainId:r},{useAccount:n,useIsActive:i}){function o(a,u=!0){const c=i(),d=r(),[p,v]=(0,mo.useState)(_o!==void 0);return(0,mo.useEffect)(()=>{if(p)return;let g=!1;return nk().then(()=>{g||v(!0)}),()=>{g=!0}},[p]),(0,mo.useMemo)(()=>{if(u){if(t.customProvider)return t.customProvider;if(_o&&t.provider)return new _o(t.provider,a)}},[p,u,c,d,a])}function s(a){const u=e();return vm(a,u)}function l(a){var u;const c=n(),d=(0,mo.useMemo)(()=>c===void 0?void 0:[c],[c]);return(u=vm(a,d))===null||u===void 0?void 0:u[0]}return{useProvider:o,useENSNames:s,useENSName:l}}var Vu={},D1={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(a,u,c){this.fn=a,this.context=u,this.once=c||!1}function o(a,u,c,d,p){if(typeof c!="function")throw new TypeError("The listener must be a function");var v=new i(c,d||a,p),g=r?r+u:u;return a._events[g]?a._events[g].fn?a._events[g]=[a._events[g],v]:a._events[g].push(v):(a._events[g]=v,a._eventsCount++),a}function s(a,u){--a._eventsCount===0?a._events=new n:delete a._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],c,d;if(this._eventsCount===0)return u;for(d in c=this._events)e.call(c,d)&&u.push(r?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},l.prototype.listeners=function(u){var c=r?r+u:u,d=this._events[c];if(!d)return[];if(d.fn)return[d.fn];for(var p=0,v=d.length,g=new Array(v);pe),this.eth_accounts=jest.fn(e=>e),this.eth_requestAccounts=jest.fn(e=>e)}request(e){if(!this.chainId)return Promise.reject(new Error);switch(e.method){case"eth_chainId":return Promise.resolve(this.eth_chainId(this.chainId));case"eth_accounts":return Promise.resolve(this.eth_accounts(this.accounts));case"eth_requestAccounts":return Promise.resolve(this.eth_requestAccounts(this.accounts));default:throw new Error(`Method not supported on mock: ${JSON.stringify(e)}`)}}emitConnect(e){this.emit("connect",{chainId:e})}emitDisconnect(e){this.emit("disconnect",e)}emitChainChanged(e){this.emit("chainChanged",e)}emitAccountsChanged(e){this.emit("accountsChanged",e)}}Vu.MockEIP1193Provider=gk;var Do={},vk=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yk=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wk=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vk(e,t,r);return yk(e,t),e};Object.defineProperty(Do,"__esModule",{value:!0});Do.useWeb3React=Do.Web3ReactProvider=void 0;const ou=wk(L),Ek=Cn,j1=(0,ou.createContext)(void 0);function xk({children:t,connectors:e,connectorOverride:r,network:n,lookupENS:i=!0}){const o=(0,ou.useRef)(e);if(e.length!=o.current.length||e.some((K,H)=>{const se=o.current[H];return K[0]!==se[0]}))throw new Error("The connectors prop passed to Web3ReactProvider must be referentially static. If connectors is changing, try providing a key prop to Web3ReactProvider that changes every time connectors changes.");const s=(0,Ek.getPriorityConnector)(...e),{usePriorityConnector:l,useSelectedChainId:a,useSelectedAccounts:u,useSelectedIsActivating:c,useSelectedAccount:d,useSelectedIsActive:p,useSelectedProvider:v,useSelectedENSNames:g,useSelectedENSName:x}=s,S=l(),E=r??S,w=a(E),_=u(E),O=c(E),B=d(E),j=p(E),$=v(E,n),q=g(E,i?$:void 0),ne=x(E,i?$:void 0);return ou.default.createElement(j1.Provider,{value:{connector:E,chainId:w,accounts:_,isActivating:O,account:B,isActive:j,provider:$,ENSNames:q,ENSName:ne,hooks:s}},t)}Do.Web3ReactProvider=xk;function Ak(){const t=(0,ou.useContext)(j1);if(!t)throw Error("useWeb3React can only be used within the Web3ReactProvider component");return t}Do.useWeb3React=Ak;(function(t){var e=Fe&&Fe.__createBinding||(Object.create?function(n,i,o,s){s===void 0&&(s=o);var l=Object.getOwnPropertyDescriptor(i,o);(!l||("get"in l?!i.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(n,s,l)}:function(n,i,o,s){s===void 0&&(s=o),n[s]=i[o]}),r=Fe&&Fe.__exportStar||function(n,i){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&e(i,n,o)};Object.defineProperty(t,"__esModule",{value:!0}),r(Cn,t),r(Vu,t),r(Do,t)})(qu);const of=[{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"approve",inputs:[{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"apps",inputs:[{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"balanceOf",inputs:[{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"contractURI",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"getApproved",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"getInitializedVersion",inputs:[],outputs:[{name:"",type:"uint64",internalType:"uint64"}],stateMutability:"view"},{type:"function",name:"getPackageId",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"pure"},{type:"function",name:"getPackageInfo",inputs:[{name:"package",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"tuple",internalType:"struct IKinodeAppStore.PackageInfo",components:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"getPackageInfo",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"tuple",internalType:"struct IKinodeAppStore.PackageInfo",components:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[{name:"_knsResolver",type:"address",internalType:"contract KNSRegistryResolver"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"isApprovedForAll",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"operator",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"knsResolver",inputs:[],outputs:[{name:"",type:"address",internalType:"contract KNSRegistryResolver"}],stateMutability:"view"},{type:"function",name:"name",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"ownerOf",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"proxiableUUID",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"registerApp",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setApprovalForAll",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"approved",type:"bool",internalType:"bool"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"symbol",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"tokenURI",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"transferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"unlistPacakge",inputs:[{name:"package",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateContractURI",inputs:[{name:"uri",type:"string",internalType:"string"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateMetadata",inputs:[{name:"package",type:"uint256",internalType:"uint256"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"upgradeToAndCall",inputs:[{name:"newImplementation",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"event",name:"AppMetadataUpdated",inputs:[{name:"package",type:"uint256",indexed:!0,internalType:"uint256"},{name:"metadataUrl",type:"string",indexed:!1,internalType:"string"},{name:"metadataHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"AppRegistered",inputs:[{name:"package",type:"uint256",indexed:!0,internalType:"uint256"},{name:"packageName",type:"string",indexed:!1,internalType:"string"},{name:"publisherName",type:"bytes",indexed:!1,internalType:"bytes"},{name:"metadataUrl",type:"string",indexed:!1,internalType:"string"},{name:"metadataHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"Approval",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"ApprovalForAll",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"operator",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint64",indexed:!1,internalType:"uint64"}],anonymous:!1},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Transfer",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"AddressEmptyCode",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{name:"implementation",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ERC721IncorrectOwner",inputs:[{name:"sender",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InsufficientApproval",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC721InvalidApprover",inputs:[{name:"approver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOperator",inputs:[{name:"operator",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidReceiver",inputs:[{name:"receiver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidSender",inputs:[{name:"sender",type:"address",internalType:"address"}]},{type:"error",name:"ERC721NonexistentToken",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"FailedInnerCall",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"OwnableInvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{name:"account",type:"address",internalType:"address"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{name:"slot",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"Unauthorized",inputs:[]}];class wd{static createInterface(){return new ad(of)}static connect(e,r){return new g3(e,of,r)}}zh(wd,"abi",of);var U1={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ym=qr.createContext&&qr.createContext(U1),bk=["attr","size","title"];function _k(t,e){if(t==null)return{};var r=Sk(t,e),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Sk(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,o;for(o=0;o=0)&&(r[i]=t[i]);return r}function su(){return su=Object.assign?Object.assign.bind():function(t){for(var e=1;eqr.createElement(e.tag,lu({key:r},e.attr),F1(e.child)))}function zn(t){return e=>qr.createElement(Ck,su({attr:lu({},t.attr)},e),F1(t.child))}function Ck(t){var e=r=>{var{attr:n,size:i,title:o}=t,s=_k(t,bk),l=i||r.size||"1em",a;return r.className&&(a=r.className),t.className&&(a=(a?a+" ":"")+t.className),qr.createElement("svg",su({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,n,s,{className:a,style:lu(lu({color:t.color||r.color},r.style),t.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),o&&qr.createElement("title",null,o),t.children)};return ym!==void 0?qr.createElement(ym.Consumer,null,r=>e(r)):e(U1)}function Mk(t){return zn({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"},child:[]}]})(t)}function Ik(t){return zn({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"},child:[]}]})(t)}function Rk(t){return zn({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"},child:[]}]})(t)}function Tk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(t)}function Ok(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"},child:[]}]})(t)}function Lk(t){return zn({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"},child:[]}]})(t)}function Bk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"},child:[]}]})(t)}function z1(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M296 384h-80c-13.3 0-24-10.7-24-24V192h-87.7c-17.8 0-26.7-21.5-14.1-34.1L242.3 5.7c7.5-7.5 19.8-7.5 27.3 0l152.2 152.2c12.6 12.6 3.7 34.1-14.1 34.1H320v168c0 13.3-10.7 24-24 24zm216-8v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h136v8c0 30.9 25.1 56 56 56h80c30.9 0 56-25.1 56-56v-8h136c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(t)}function Dk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm101.8-262.2L295.6 256l62.2 62.2c4.7 4.7 4.7 12.3 0 17l-22.6 22.6c-4.7 4.7-12.3 4.7-17 0L256 295.6l-62.2 62.2c-4.7 4.7-12.3 4.7-17 0l-22.6-22.6c-4.7-4.7-4.7-12.3 0-17l62.2-62.2-62.2-62.2c-4.7-4.7-4.7-12.3 0-17l22.6-22.6c4.7-4.7 12.3-4.7 17 0l62.2 62.2 62.2-62.2c4.7-4.7 12.3-4.7 17 0l22.6 22.6c4.7 4.7 4.7 12.3 0 17z"},child:[]}]})(t)}var jk={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Em=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??(typeof c!="object"||c===null)?c:Object.assign({},e,c),r.forEach(p=>p(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(jk?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},Uk=t=>t?Em(t):Em;var $1={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{useDebugValue:Fk}=qr,{useSyncExternalStoreWithSelector:zk}=Gu;let xm=!1;function $k(t,e=t.getState,r){($1?"production":void 0)!=="production"&&r&&!xm&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),xm=!0);const n=zk(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return Fk(n),n}const Am=t=>{($1?"production":void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof t=="function"?Uk(t):t,r=(n,i)=>$k(e,n,i);return Object.assign(r,e),r},Hk=t=>t?Am(t):Am;var qk={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function H1(t,e){let r;try{r=t()}catch{return}return{getItem:i=>{var o;const s=a=>a===null?null:JSON.parse(a,e==null?void 0:e.reviver),l=(o=r.getItem(i))!=null?o:null;return l instanceof Promise?l.then(s):s(l)},setItem:(i,o)=>r.setItem(i,JSON.stringify(o,e==null?void 0:e.replacer)),removeItem:i=>r.removeItem(i)}}const sl=t=>e=>{try{const r=t(e);return r instanceof Promise?r:{then(n){return sl(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return sl(n)(r)}}}},Wk=(t,e)=>(r,n,i)=>{let o={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:S=>S,version:0,merge:(S,E)=>({...E,...S}),...e},s=!1;const l=new Set,a=new Set;let u;try{u=o.getStorage()}catch{}if(!u)return t((...S)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...S)},n,i);const c=sl(o.serialize),d=()=>{const S=o.partialize({...n()});let E;const w=c({state:S,version:o.version}).then(_=>u.setItem(o.name,_)).catch(_=>{E=_});if(E)throw E;return w},p=i.setState;i.setState=(S,E)=>{p(S,E),d()};const v=t((...S)=>{r(...S),d()},n,i);let g;const x=()=>{var S;if(!u)return;s=!1,l.forEach(w=>w(n()));const E=((S=o.onRehydrateStorage)==null?void 0:S.call(o,n()))||void 0;return sl(u.getItem.bind(u))(o.name).then(w=>{if(w)return o.deserialize(w)}).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==o.version){if(o.migrate)return o.migrate(w.state,w.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return w.state}).then(w=>{var _;return g=o.merge(w,(_=n())!=null?_:v),r(g,!0),d()}).then(()=>{E==null||E(g,void 0),s=!0,a.forEach(w=>w(g))}).catch(w=>{E==null||E(void 0,w)})};return i.persist={setOptions:S=>{o={...o,...S},S.getStorage&&(u=S.getStorage())},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>x(),hasHydrated:()=>s,onHydrate:S=>(l.add(S),()=>{l.delete(S)}),onFinishHydration:S=>(a.add(S),()=>{a.delete(S)})},x(),g||v},Gk=(t,e)=>(r,n,i)=>{let o={storage:H1(()=>localStorage),partialize:x=>x,version:0,merge:(x,S)=>({...S,...x}),...e},s=!1;const l=new Set,a=new Set;let u=o.storage;if(!u)return t((...x)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...x)},n,i);const c=()=>{const x=o.partialize({...n()});return u.setItem(o.name,{state:x,version:o.version})},d=i.setState;i.setState=(x,S)=>{d(x,S),c()};const p=t((...x)=>{r(...x),c()},n,i);let v;const g=()=>{var x,S;if(!u)return;s=!1,l.forEach(w=>{var _;return w((_=n())!=null?_:p)});const E=((S=o.onRehydrateStorage)==null?void 0:S.call(o,(x=n())!=null?x:p))||void 0;return sl(u.getItem.bind(u))(o.name).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==o.version){if(o.migrate)return o.migrate(w.state,w.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return w.state}).then(w=>{var _;return v=o.merge(w,(_=n())!=null?_:p),r(v,!0),c()}).then(()=>{E==null||E(v,void 0),v=n(),s=!0,a.forEach(w=>w(v))}).catch(w=>{E==null||E(void 0,w)})};return i.persist={setOptions:x=>{o={...o,...x},x.storage&&(u=x.storage)},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>g(),hasHydrated:()=>s,onHydrate:x=>(l.add(x),()=>{l.delete(x)}),onFinishHydration:x=>(a.add(x),()=>{a.delete(x)})},o.skipHydration||g(),v||p},Vk=(t,e)=>"getStorage"in e||"serialize"in e||"deserialize"in e?((qk?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),Wk(t,e)):Gk(t,e),Kk=Vk;var Dr=(t=>(t[t.OK=200]="OK",t[t.CREATED=201]="CREATED",t[t.ACCEPTED=202]="ACCEPTED",t[t.NO_CONTENT=204]="NO_CONTENT",t[t.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",t[t.FOUND=302]="FOUND",t[t.SEE_OTHER=303]="SEE_OTHER",t[t.NOT_MODIFIED=304]="NOT_MODIFIED",t[t.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",t[t.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",t[t.BAD_REQUEST=400]="BAD_REQUEST",t[t.UNAUTHORIZED=401]="UNAUTHORIZED",t[t.FORBIDDEN=403]="FORBIDDEN",t[t.NOT_FOUND=404]="NOT_FOUND",t[t.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",t[t.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",t[t.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",t[t.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",t[t.BAD_GATEWAY=502]="BAD_GATEWAY",t[t.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",t))(Dr||{});const xe=t=>`${t.package}:${t.publisher}`,cs=t=>{var e;return((e=t.metadata)==null?void 0:e.name)||xe(t)},sf=t=>{var e,r;return t.publisher==="sys"?"system":(e=t.state)!=null&&e.our_version&&!((r=t.state)!=null&&r.capsApproved)?"downloaded":t.metadata?"installed":"local"},or="/main:app_store:sys",Xl=(t,e)=>t.package===e.package&&t.publisher===e.publisher,Qo=Hk()(Kk((t,e)=>({myApps:{downloaded:[],installed:[],local:[],system:[]},listedApps:[],searchResults:[],query:"",getMyApps:async()=>{const i=(await(await fetch(`${or}/apps`)).json()).reduce((o,s)=>{const l=sf(s);return o[l].push(s),o},{downloaded:[],installed:[],local:[],system:[]});return t(()=>({myApps:i})),i},getListedApps:async()=>{const n=await(await fetch(`${or}/apps/listed`)).json();return t({listedApps:n}),n},getMyApp:async r=>{const i=await(await fetch(`${or}/apps/${xe(r)}`)).json(),o=sf(i),s=e().myApps;s[o]=s[o].map(a=>Xl(a,i)?i:a);const l=[...e().listedApps].map(a=>Xl(a,i)?i:a);return t({myApps:s,listedApps:l}),i},installApp:async r=>{if((await fetch(`${or}/apps/${xe(r)}/caps`,{method:"POST"})).status!==Dr.OK)throw new Error(`Failed to approve caps for app: ${xe(r)}`);if((await fetch(`${or}/apps/${xe(r)}`,{method:"POST"})).status!==Dr.CREATED)throw new Error(`Failed to install app: ${xe(r)}`)},updateApp:async r=>{if((await fetch(`${or}/apps/${xe(r)}`,{method:"PUT"})).status!==Dr.NO_CONTENT)throw new Error(`Failed to update app: ${xe(r)}`)},uninstallApp:async r=>{if(!confirm(`Are you sure you want to remove ${xe(r)}?`))return;if((await fetch(`${or}/apps/${xe(r)}`,{method:"DELETE"})).status!==Dr.NO_CONTENT)throw new Error(`Failed to remove app: ${xe(r)}`);const i={...e().myApps},o=sf(r);i[o]=i[o].filter(l=>!Xl(l,r));const s=e().listedApps.map(l=>Xl(l,r)?{...l,state:void 0,installed:!1}:l);t({myApps:i,listedApps:s})},getListedApp:async r=>{const n=await fetch(`${or}/apps/listed/${r}`);if(n.status!==Dr.OK)throw new Error(`Failed to get app: ${r}`);return await n.json()},downloadApp:async r=>{if((await fetch(`${or}/apps/listed/${xe(r)}`,{method:"POST"})).status!==Dr.CREATED)throw new Error(`Failed to get app: ${xe(r)}`)},getCaps:async r=>{const n=await fetch(`${or}/apps/${xe(r)}/caps`);if(n.status!==Dr.OK)throw new Error(`Failed to get app: ${xe(r)}`);return(await n.json())[0]},approveCaps:async r=>{if((await fetch(`${or}/apps/${xe(r)}/caps`,{method:"POST"})).status!==Dr.OK)throw new Error(`Failed to get app: ${xe(r)}`)},setMirroring:async(r,n)=>{if((await fetch(`${or}/apps/${xe(r)}/mirror`,{method:n?"PUT":"DELETE"})).status!==Dr.OK)throw new Error(`Failed to start mirror: ${xe(r)}`);e().getMyApp(r)},setAutoUpdate:async(r,n)=>{if((await fetch(`${or}/apps/${xe(r)}/auto-update`,{method:n?"PUT":"DELETE"})).status!==Dr.OK)throw new Error(`Failed to change auto update: ${xe(r)}`);e().getMyApp(r)},get:e,set:t}),{name:"app_store",storage:H1(()=>sessionStorage)}));function q1({app:t,size:e="medium",...r}){var i,o;const n=Iu();return I.jsxs("div",{...r,className:`app-header row ${e} ${r.className||""}`,onClick:()=>n(`/app-details/${xe(t)}`),children:[I.jsx("img",{src:((i=t.metadata)==null?void 0:i.image)||"https://png.pngtree.com/png-vector/20190215/ourmid/pngtree-vector-question-mark-icon-png-image_515448.jpg",alt:"app icon"}),I.jsx("div",{className:"col title",children:I.jsx("div",{className:"app-name ellipsis",children:((o=t.metadata)==null?void 0:o.name)||xe(t)})})]})}const Qk=({show:t,hide:e,hideClose:r=!1,title:n,...i})=>{const o=s=>{s.stopPropagation()};return t?I.jsx("div",{className:`modal-backdrop ${t?"show":""}`,onClick:e,children:I.jsxs("div",{...i,className:`col modal ${i.className||""}`,onClick:o,children:[!!n&&I.jsx("h3",{className:"modal-title",children:n}),!r&&I.jsx(Lk,{className:"close",onClick:e}),I.jsx("div",{className:"col modal-content",onClick:o,children:i.children})]})}):null};function Ed({msg:t}){return I.jsxs("div",{id:"loading",className:"col center",children:[I.jsx("h3",{children:t}),I.jsxs("div",{id:"loader",children:[" ",I.jsx("div",{})," ",I.jsx("div",{})," ",I.jsx("div",{})," ",I.jsx("div",{})," "]})]})}function W1({app:t,...e}){var $,q,ne,K;const{updateApp:r,downloadApp:n,installApp:i,getCaps:o,getMyApp:s}=Qo(),[l,a]=L.useState(!1),[u,c]=L.useState(((q=($=t.metadata)==null?void 0:$.properties.mirrors)==null?void 0:q[0])||""),[d,p]=L.useState([]),[v,g]=L.useState(""),{clean:x,installed:S,downloaded:E,updatable:w}=L.useMemo(()=>{var m,A,N,b,M;const H=((m=t.metadata)==null?void 0:m.properties.current_version)&&((N=t.metadata)==null?void 0:N.properties.code_hashes[(A=t.metadata)==null?void 0:A.properties.current_version]),se=t.installed,C=!!t.state,f=!!((b=t.state)!=null&&b.our_version&&H)&&((M=t.state)==null?void 0:M.our_version)!==H&&t.publisher!==window.our.node;return{clean:!se&&!C&&!f,installed:se,downloaded:C,updatable:f}},[t]),_=L.useCallback(async()=>{S&&!w?window.alert("App is installed"):(E&&o(t).then(H=>{p(H.request_capabilities)}),a(!0))},[t,S,E,w,a,o]),O=L.useCallback(async()=>{try{g(`Downloading ${cs(t)}...`),await n(t);const H=setInterval(()=>{s(t).then(()=>{g(""),a(!1),clearInterval(H)}).catch(console.log)},2e3)}catch(H){console.error(H),window.alert(`Failed to download app from ${u}, please try a different mirror.`),g("")}},[u,t,n,s]),B=L.useCallback(async()=>{try{g(`Installing ${cs(t)}...`),await i(t);const H=setInterval(()=>{s(t).then(se=>{se.installed&&(g(""),a(!1),clearInterval(H))}).catch(console.log)},2e3)}catch(H){console.error(H),window.alert("Failed to install, please try again."),g("")}},[t,i,s]),j=L.useCallback(async()=>{try{g(`Updating ${cs(t)}...`),await r(t);const H=setInterval(()=>{s(t).then(se=>{se.installed&&(g(""),a(!1),clearInterval(H))}).catch(console.log)},2e3)}catch(H){console.error(H),window.alert("Failed to update, please try again."),g("")}},[t,r,s]);return I.jsxs(I.Fragment,{children:[I.jsx("button",{...e,type:"button",className:`unstyled action-btn ${e.className||""}`,onClick:_,children:S&&w?"Update":S?"Installed":E?"Install":"Download"}),I.jsx(Qk,{show:l,hide:()=>a(!1),children:v?I.jsx(Ed,{msg:v}):x?I.jsxs(I.Fragment,{children:[I.jsxs("h3",{children:["Download ",(ne=t.metadata)==null?void 0:ne.name,"?"]}),I.jsx("h4",{style:{margin:0},children:"Select Mirror"}),I.jsx("select",{style:{margin:"1em 0"},value:u,onChange:H=>c(H.target.value),children:(K=t.metadata)==null?void 0:K.properties.mirrors.map(H=>I.jsx("option",{value:H,children:H},H))}),I.jsx("button",{type:"button",onClick:O,children:"Download"})]}):E?I.jsxs(I.Fragment,{children:[I.jsx("h3",{children:"Approve App Permissions"}),I.jsxs("h4",{style:{margin:0},children:[cs(t)," needs the following permissions:"]}),I.jsx("ul",{className:"col",style:{margin:"1em 0",alignItems:"flex-start"},children:d.map(H=>I.jsx("li",{children:H},H))}),I.jsx("button",{type:"button",onClick:B,children:"Approve & Install"})]}):I.jsxs(I.Fragment,{children:[I.jsx("h3",{children:"Approve App Permissions"}),I.jsxs("h4",{style:{margin:0},children:[cs(t)," needs the following permissions:"]}),I.jsx("br",{}),I.jsx("ul",{className:"col",style:{margin:"1em 0",alignItems:"flex-start"},children:d.map(H=>I.jsx("li",{children:H},H))}),I.jsx("button",{type:"button",onClick:j,children:"Approve & Update"})]})})]})}const G1=t=>!!t&&t[0]==="o",bm=Qs.unstable_batchedUpdates||(t=>t()),Vi=(t,e,r=1e-4)=>Math.abs(t-e)t===!0||!!(t&&t[e]),hr=(t,e)=>typeof t=="function"?t(e):t,V1="_szhsinMenu",Jk=t=>t[V1],Yk=(t,e)=>Object.defineProperty(e,V1,{value:t}),Ku=(t,e)=>(e&&Object.keys(e).forEach(r=>{const n=t[r],i=e[r];typeof i=="function"&&n?t[r]=(...o)=>{i(...o),n(...o)}:t[r]=i}),t),Xk=t=>{if(typeof t!="string")return{top:0,right:0,bottom:0,left:0};const e=t.trim().split(/\s+/,4).map(parseFloat),r=isNaN(e[0])?0:e[0],n=isNaN(e[1])?r:e[1];return{top:r,right:n,bottom:isNaN(e[2])?r:e[2],left:isNaN(e[3])?n:e[3]}},lf=t=>{for(;t;){if(t=t.parentNode,!t||t===document.body||!t.parentNode)return;const{overflow:e,overflowX:r,overflowY:n}=getComputedStyle(t);if(/auto|scroll|overlay|hidden/.test(e+n+r))return t}};function K1(t,e){return{"aria-disabled":t||void 0,tabIndex:e?0:-1}}function _m(t,e){for(let r=0;rL.useMemo(()=>{const i=e?`${t}__${e}`:t;let o=i;r&&Object.keys(r).forEach(l=>{const a=r[l];a&&(o+=` ${i}--${a===!0?l:`${l}-${a}`}`)});let s=typeof n=="function"?n(r):n;return typeof s=="string"&&(s=s.trim(),s&&(o+=` ${s}`)),o},[t,e,r,n]),Zk="szh-menu-container",Aa="szh-menu",e4="szh-menu-button",t4="arrow",r4="item",Q1=L.createContext(),J1=L.createContext({}),Sm=L.createContext({}),Y1=L.createContext({}),n4=L.createContext({}),jh=L.createContext({}),$r=Object.freeze({ENTER:"Enter",ESC:"Escape",SPACE:" ",HOME:"Home",END:"End",LEFT:"ArrowLeft",RIGHT:"ArrowRight",UP:"ArrowUp",DOWN:"ArrowDown"}),xt=Object.freeze({RESET:0,SET:1,UNSET:2,INCREASE:3,DECREASE:4,FIRST:5,LAST:6,SET_INDEX:7}),ul=Object.freeze({CLICK:"click",CANCEL:"cancel",BLUR:"blur",SCROLL:"scroll"}),Ms=Object.freeze({FIRST:"first",LAST:"last"}),i4=Object.freeze({entering:"opening",entered:"open",exiting:"closing",exited:"closed"}),af="absolute",o4="presentation",X1="menuitem",km={"aria-hidden":!0,role:X1},s4=Yk("MenuButton",L.forwardRef(function({className:e,isOpen:r,disabled:n,children:i,...o},s){const l=L.useMemo(()=>({open:r}),[r]);return I.jsx("button",{"aria-haspopup":!0,"aria-expanded":r,"aria-disabled":n||void 0,type:"button",disabled:n,...o,ref:s,className:al({block:e4,modifiers:l,className:e}),children:i})})),l4=({className:t,containerRef:e,containerProps:r,children:n,isOpen:i,theming:o,transition:s,onClose:l})=>{const a=ll(s,"item"),u=({key:d})=>{switch(d){case $r.ESC:hr(l,{key:d,reason:ul.CANCEL});break}},c=d=>{i&&!d.currentTarget.contains(d.relatedTarget)&&hr(l,{reason:ul.BLUR})};return I.jsx("div",{...Ku({onKeyDown:u,onBlur:c},r),className:al({block:Zk,modifiers:L.useMemo(()=>({theme:o,itemTransition:a}),[o,a]),className:t}),style:{position:"absolute",...r==null?void 0:r.style},ref:e,children:n})},a4=()=>{let t,e=0;return{toggle:r=>{r?e++:e--,e=Math.max(e,0)},on:(r,n,i)=>{e?t||(t=setTimeout(()=>{t=0,n()},r)):i==null||i()},off:()=>{t&&(clearTimeout(t),t=0)}}},u4=(t,e)=>{const[r,n]=L.useState(),o=L.useRef({items:[],hoverIndex:-1,sorted:!1}).current,s=L.useCallback((a,u)=>{const{items:c}=o;if(!a)o.items=[];else if(u)c.push(a);else{const d=c.indexOf(a);d>-1&&(c.splice(d,1),a.contains(document.activeElement)&&(e.current.focus(),n()))}o.hoverIndex=-1,o.sorted=!1},[o,e]),l=L.useCallback((a,u,c)=>{const{items:d,hoverIndex:p}=o,v=()=>{if(o.sorted)return;const S=t.current.querySelectorAll(".szh-menu__item");d.sort((E,w)=>_m(S,E)-_m(S,w)),o.sorted=!0};let g=-1,x;switch(a){case xt.RESET:break;case xt.SET:x=u;break;case xt.UNSET:x=S=>S===u?void 0:S;break;case xt.FIRST:v(),g=0,x=d[g];break;case xt.LAST:v(),g=d.length-1,x=d[g];break;case xt.SET_INDEX:v(),g=c,x=d[g];break;case xt.INCREASE:v(),g=p,g<0&&(g=d.indexOf(u)),g++,g>=d.length&&(g=0),x=d[g];break;case xt.DECREASE:v(),g=p,g<0&&(g=d.indexOf(u)),g--,g<0&&(g=d.length-1),x=d[g];break}x||(g=-1),n(x),o.hoverIndex=g},[t,o]);return{hoverItem:r,dispatch:l,updateItems:s}},c4=(t,e,r,n)=>{const i=e.current.getBoundingClientRect(),o=t.current.getBoundingClientRect(),s=r===window?{left:0,top:0,right:document.documentElement.clientWidth,bottom:window.innerHeight}:r.getBoundingClientRect(),l=Xk(n),a=g=>g+o.left-s.left-l.left,u=g=>g+o.left+i.width-s.right+l.right,c=g=>g+o.top-s.top-l.top,d=g=>g+o.top+i.height-s.bottom+l.bottom;return{menuRect:i,containerRect:o,getLeftOverflow:a,getRightOverflow:u,getTopOverflow:c,getBottomOverflow:d,confineHorizontally:g=>{let x=a(g);if(x<0)g-=x;else{const S=u(g);S>0&&(g-=S,x=a(g),x<0&&(g-=x))}return g},confineVertically:g=>{let x=c(g);if(x<0)g-=x;else{const S=d(g);S>0&&(g-=S,x=c(g),x<0&&(g-=x))}return g}}},f4=({arrowRef:t,menuY:e,anchorRect:r,containerRect:n,menuRect:i})=>{let o=r.top-n.top-e+r.height/2;const s=t.current.offsetHeight*1.25;return o=Math.max(s,o),o=Math.min(o,i.height-s),o},d4=({anchorRect:t,containerRect:e,menuRect:r,placeLeftorRightY:n,placeLeftX:i,placeRightX:o,getLeftOverflow:s,getRightOverflow:l,confineHorizontally:a,confineVertically:u,arrowRef:c,arrow:d,direction:p,position:v})=>{let g=p,x=n;v!=="initial"&&(x=u(x),v==="anchor"&&(x=Math.min(x,t.bottom-e.top),x=Math.max(x,t.top-e.top-r.height)));let S,E,w;return g==="left"?(S=i,v!=="initial"&&(E=s(S),E<0&&(w=l(o),(w<=0||-E>w)&&(S=o,g="right")))):(S=o,v!=="initial"&&(w=l(S),w>0&&(E=s(i),(E>=0||-E{let o=r.left-n.left-e+r.width/2;const s=t.current.offsetWidth*1.25;return o=Math.max(s,o),o=Math.min(o,i.width-s),o},p4=({anchorRect:t,containerRect:e,menuRect:r,placeToporBottomX:n,placeTopY:i,placeBottomY:o,getTopOverflow:s,getBottomOverflow:l,confineHorizontally:a,confineVertically:u,arrowRef:c,arrow:d,direction:p,position:v})=>{let g=p==="top"?"top":"bottom",x=n;v!=="initial"&&(x=a(x),v==="anchor"&&(x=Math.min(x,t.right-e.left),x=Math.max(x,t.left-e.left-r.width)));let S,E,w;return g==="top"?(S=i,v!=="initial"&&(E=s(S),E<0&&(w=l(o),(w<=0||-E>w)&&(S=o,g="bottom")))):(S=o,v!=="initial"&&(w=l(S),w>0&&(E=s(i),(E>=0||-E{const{menuRect:u,containerRect:c}=a,d=r==="left"||r==="right";let p=d?n:i,v=d?i:n;if(t){const B=l.current;d?p+=B.offsetWidth:v+=B.offsetHeight}const g=s.left-c.left-u.width-p,x=s.right-c.left+p,S=s.top-c.top-u.height-v,E=s.bottom-c.top+v;let w,_;e==="end"?(w=s.right-c.left-u.width,_=s.bottom-c.top-u.height):e==="center"?(w=s.left-c.left-(u.width-s.width)/2,_=s.top-c.top-(u.height-s.height)/2):(w=s.left-c.left,_=s.top-c.top),w+=p,_+=v;const O={...a,anchorRect:s,placeLeftX:g,placeRightX:x,placeLeftorRightY:_,placeTopY:S,placeBottomY:E,placeToporBottomX:w,arrowRef:l,arrow:t,direction:r,position:o};switch(r){case"left":case"right":return d4(O);case"top":case"bottom":default:return p4(O)}},ba=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?L.useLayoutEffect:L.useEffect;function Nm(t,e){typeof t=="function"?t(e):t.current=e}const Uh=(t,e)=>L.useMemo(()=>t?e?r=>{Nm(t,r),Nm(e,r)}:t:e,[t,e]),Pm=-9999,g4=({ariaLabel:t,menuClassName:e,menuStyle:r,arrow:n,arrowProps:i={},anchorPoint:o,anchorRef:s,containerRef:l,containerProps:a,focusProps:u,externalRef:c,parentScrollingRef:d,align:p="start",direction:v="bottom",position:g="auto",overflow:x="visible",setDownOverflow:S,repositionFlag:E,captureFocus:w=!0,state:_,endTransition:O,isDisabled:B,menuItemFocus:j,gap:$=0,shift:q=0,children:ne,onClose:K,...H})=>{const[se,C]=L.useState({x:Pm,y:Pm}),[f,m]=L.useState({}),[A,N]=L.useState(),[b,M]=L.useState(v),[R]=L.useState(a4),[k,h]=L.useReducer(re=>re+1,1),{transition:P,boundingBoxRef:ee,boundingBoxPadding:y,rootMenuRef:D,rootAnchorRef:U,scrollNodesRef:F,reposition:G,viewScroll:ie,submenuCloseDelay:Y}=L.useContext(jh),{submenuCtx:Q,reposSubmenu:Je=E}=L.useContext(Sm),J=L.useRef(null),le=L.useRef(),Qr=L.useRef(),Te=L.useRef(!1),Ne=L.useRef({width:0,height:0}),Jr=L.useRef(()=>{}),{hoverItem:Pe,dispatch:ce,updateItems:wr}=u4(J,le),fe=G1(_),Oe=ll(P,"open"),Yr=ll(P,"close"),me=F.current,ze=re=>{switch(re.key){case $r.HOME:ce(xt.FIRST);break;case $r.END:ce(xt.LAST);break;case $r.UP:ce(xt.DECREASE,Pe);break;case $r.DOWN:ce(xt.INCREASE,Pe);break;case $r.SPACE:re.target&&re.target.className.indexOf(Aa)!==-1&&re.preventDefault();return;default:return}re.preventDefault(),re.stopPropagation()},gn=()=>{_==="closing"&&N(),hr(O)},$e=re=>{re.stopPropagation(),R.on(Y,()=>{ce(xt.RESET),le.current.focus()})},He=re=>{re.target===re.currentTarget&&R.off()},Ht=L.useCallback(re=>{var ot;const ge=s?(ot=s.current)==null?void 0:ot.getBoundingClientRect():o?{left:o.x,right:o.x,top:o.y,bottom:o.y,width:0,height:0}:null;if(!ge)return;me.menu||(me.menu=(ee?ee.current:lf(D.current))||window);const de=c4(l,J,me.menu,y);let{arrowX:rt,arrowY:be,x:_e,y:Ct,computedDirection:Me}=m4({arrow:n,align:p,direction:v,gap:$,shift:q,position:g,anchorRect:ge,arrowRef:Qr,positionHelpers:de});const{menuRect:je}=de;let Kt=je.height;if(!re&&x!=="visible"){const{getTopOverflow:Ve,getBottomOverflow:Ke}=de;let Qt,Ie;const Ue=Ne.current.height,Er=Ke(Ct);if(Er>0||Vi(Er,0)&&Vi(Kt,Ue))Qt=Kt-Er,Ie=Er;else{const ke=Ve(Ct);(ke<0||Vi(ke,0)&&Vi(Kt,Ue))&&(Qt=Kt+ke,Ie=0-ke,Qt>=0&&(Ct-=ke))}Qt>=0?(Kt=Qt,N({height:Qt,overflowAmt:Ie})):N()}n&&m({x:rt,y:be}),C({x:_e,y:Ct}),M(Me),Ne.current={width:je.width,height:Kt}},[n,p,y,v,$,q,g,x,o,s,l,ee,D,me]);ba(()=>{fe&&(Ht(),Te.current&&h()),Te.current=fe,Jr.current=Ht},[fe,Ht,Je]),ba(()=>{A&&!S&&(J.current.scrollTop=0)},[A,S]),ba(()=>wr,[wr]),L.useEffect(()=>{let{menu:re}=me;if(!fe||!re)return;if(re=re.addEventListener?re:window,!me.anchors){me.anchors=[];let rt=lf(U&&U.current);for(;rt&&rt!==re;)me.anchors.push(rt),rt=lf(rt)}let ot=ie;if(me.anchors.length&&ot==="initial"&&(ot="auto"),ot==="initial")return;const ge=()=>{ot==="auto"?bm(()=>Ht(!0)):hr(K,{reason:ul.SCROLL})},de=me.anchors.concat(ie!=="initial"?re:[]);return de.forEach(rt=>rt.addEventListener("scroll",ge)),()=>de.forEach(rt=>rt.removeEventListener("scroll",ge))},[U,me,fe,K,ie,Ht]);const Le=!!A&&A.overflowAmt>0;L.useEffect(()=>{if(Le||!fe||!d)return;const re=()=>bm(Ht),ot=d.current;return ot.addEventListener("scroll",re),()=>ot.removeEventListener("scroll",re)},[fe,Le,d,Ht]),L.useEffect(()=>{if(typeof ResizeObserver!="function"||G==="initial")return;const re=new ResizeObserver(([ge])=>{const{borderBoxSize:de,target:rt}=ge;let be,_e;if(de){const{inlineSize:Ct,blockSize:Me}=de[0]||de;be=Ct,_e=Me}else{const Ct=rt.getBoundingClientRect();be=Ct.width,_e=Ct.height}be===0||_e===0||Vi(be,Ne.current.width,1)&&Vi(_e,Ne.current.height,1)||Qs.flushSync(()=>{Jr.current(),h()})}),ot=J.current;return re.observe(ot,{box:"border-box"}),()=>re.unobserve(ot)},[G]),L.useEffect(()=>{if(!fe){ce(xt.RESET),Yr||N();return}const{position:re,alwaysUpdate:ot}=j||{},ge=()=>{re===Ms.FIRST?ce(xt.FIRST):re===Ms.LAST?ce(xt.LAST):re>=-1&&ce(xt.SET_INDEX,void 0,re)};if(ot)ge();else if(w){const de=setTimeout(()=>{const rt=J.current;rt&&!rt.contains(document.activeElement)&&(le.current.focus(),ge())},Oe?170:100);return()=>clearTimeout(de)}},[fe,Oe,Yr,w,j,ce]);const qe=L.useMemo(()=>({isParentOpen:fe,submenuCtx:R,dispatch:ce,updateItems:wr}),[fe,R,ce,wr]);let Rr,Ce;A&&(S?Ce=A.overflowAmt:Rr=A.height);const We=L.useMemo(()=>({reposSubmenu:k,submenuCtx:R,overflow:x,overflowAmt:Ce,parentMenuRef:J,parentDir:b}),[k,R,x,Ce,b]),vn=Rr>=0?{maxHeight:Rr,overflow:x}:void 0,Be=L.useMemo(()=>({state:_,dir:b}),[_,b]),Ge=L.useMemo(()=>({dir:b}),[b]),yn=al({block:Aa,element:t4,modifiers:Ge,className:i.className}),De=I.jsxs("ul",{role:"menu","aria-label":t,...K1(B),...Ku({onPointerEnter:Q==null?void 0:Q.off,onPointerMove:$e,onPointerLeave:He,onKeyDown:ze,onAnimationEnd:gn},H),ref:Uh(c,J),className:al({block:Aa,modifiers:Be,className:e}),style:{...r,...vn,margin:0,display:_==="closed"?"none":void 0,position:af,left:se.x,top:se.y},children:[I.jsx("li",{tabIndex:-1,style:{position:af,left:0,top:0,display:"block",outline:"none"},ref:le,...km,...u}),n&&I.jsx("li",{...km,...i,className:yn,style:{display:"block",position:af,left:f.x,top:f.y,...i.style},ref:Qr}),I.jsx(Sm.Provider,{value:We,children:I.jsx(J1.Provider,{value:qe,children:I.jsx(Q1.Provider,{value:Pe,children:hr(ne,Be)})})})]});return a?I.jsx(l4,{...a,isOpen:fe,children:De}):De},v4=L.forwardRef(function({"aria-label":e,className:r,containerProps:n,initialMounted:i,unmountOnClose:o,transition:s,transitionTimeout:l,boundingBoxRef:a,boundingBoxPadding:u,reposition:c="auto",submenuOpenDelay:d=300,submenuCloseDelay:p=150,viewScroll:v="initial",portal:g,theming:x,onItemClick:S,...E},w){const _=L.useRef(null),O=L.useRef({}),{anchorRef:B,state:j,onClose:$}=E,q=L.useMemo(()=>({initialMounted:i,unmountOnClose:o,transition:s,transitionTimeout:l,boundingBoxRef:a,boundingBoxPadding:u,rootMenuRef:_,rootAnchorRef:B,scrollNodesRef:O,reposition:c,viewScroll:v,submenuOpenDelay:d,submenuCloseDelay:p}),[i,o,s,l,B,a,u,c,v,d,p]),ne=L.useMemo(()=>({handleClick(H,se){H.stopPropagation||hr(S,H);let C=H.keepOpen;C===void 0&&(C=se&&H.key===$r.SPACE),C||hr($,{value:H.value,key:H.key,reason:ul.CLICK})},handleClose(H){hr($,{key:H,reason:ul.CLICK})}}),[S,$]);if(!j)return null;const K=I.jsx(jh.Provider,{value:q,children:I.jsx(Y1.Provider,{value:ne,children:I.jsx(g4,{...E,ariaLabel:e||"Menu",externalRef:w,containerRef:_,containerProps:{className:r,containerRef:_,containerProps:n,theming:x,transition:s,onClose:$}})})});return g===!0&&typeof document<"u"?Qs.createPortal(K,document.body):g?g.target?Qs.createPortal(K,g.target):g.stablePosition?null:K:K}),xd=0,Ad=1,au=2,uu=3,cu=4,y4=5,Z1=6,w4=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],ew=t=>({_s:t,status:w4[t],isEnter:tcu}),bd=t=>t?Z1:y4,E4=(t,e)=>{switch(t){case Ad:case xd:return au;case cu:case uu:return bd(e)}},x4=t=>typeof t=="object"?[t.enter,t.exit]:[t,t],A4=(t,e)=>setTimeout(()=>{isNaN(document.body.offsetTop)||t(e+1)},0),Cm=(t,e,r,n,i)=>{clearTimeout(n.current);const o=ew(t);e(o),r.current=o,i&&i({current:o})},b4=({enter:t=!0,exit:e=!0,preEnter:r,preExit:n,timeout:i,initialEntered:o,mountOnEnter:s,unmountOnExit:l,onStateChange:a}={})=>{const[u,c]=L.useState(()=>ew(o?au:bd(s))),d=L.useRef(u),p=L.useRef(),[v,g]=x4(i),x=L.useCallback(()=>{const E=E4(d.current._s,l);E&&Cm(E,c,d,p,a)},[a,l]),S=L.useCallback(E=>{const w=O=>{switch(Cm(O,c,d,p,a),O){case Ad:v>=0&&(p.current=setTimeout(x,v));break;case cu:g>=0&&(p.current=setTimeout(x,g));break;case xd:case uu:p.current=A4(w,O);break}},_=d.current.isEnter;typeof E!="boolean"&&(E=!_),E?!_&&w(t?r?xd:Ad:au):_&&w(e?n?uu:cu:bd(l))},[x,a,t,e,r,n,v,g,l]);return L.useEffect(()=>()=>clearTimeout(p.current),[]),[u,S,x]},_4=({initialOpen:t,initialMounted:e,unmountOnClose:r,transition:n,transitionTimeout:i=500}={})=>{const[{status:o},s,l]=b4({initialEntered:t,mountOnEnter:!e,unmountOnExit:r,timeout:i,enter:ll(n,"open"),exit:ll(n,"close")});return[{state:i4[o],endTransition:l},s]},S4=t=>{const[e,r]=_4(t),[n,i]=L.useState(),o=(s,l)=>{i({position:s,alwaysUpdate:l}),r(!0)};return[{menuItemFocus:n,...e},r,o]},k4=(t,e)=>{const[r]=L.useState({});return{onMouseDown:()=>{r.v=t&&t!=="closed"},onClick:n=>r.v?r.v=!1:e(!0,n)}},N4=(t,e)=>{const r=L.useRef(e);L.useEffect(()=>{r.current!==e&&hr(t,{open:e}),r.current=e},[t,e])},P4=L.forwardRef(function({"aria-label":e,captureFocus:r,initialOpen:n,menuButton:i,instanceRef:o,onMenuChange:s,...l},a){const[u,c,d]=S4(l),{state:p}=u,v=G1(p),g=L.useRef(null),x=k4(p,(B,j)=>d(j.detail?void 0:Ms.FIRST)),S=L.useCallback(B=>{c(!1),B.key&&g.current.focus()},[c]),E=B=>{switch(B.key){case $r.UP:d(Ms.LAST);break;case $r.DOWN:d(Ms.FIRST);break;default:return}B.preventDefault()},w=hr(i,{open:v});if(!w||!w.type)throw new Error("Menu requires a menuButton prop.");const _={ref:Uh(w.ref,g),...Ku({onKeyDown:E,...x},w.props)};Jk(w.type)==="MenuButton"&&(_.isOpen=v);const O=L.cloneElement(w,_);return N4(s,v),L.useImperativeHandle(o,()=>({openMenu:d,closeMenu:()=>c(!1)})),I.jsxs(L.Fragment,{children:[O,I.jsx(v4,{...l,...u,"aria-label":e||(typeof w.props.children=="string"?w.props.children:"Menu"),anchorRef:g,ref:a,onClose:S})]})}),C4=(t,e)=>{const r=L.memo(e),n=L.forwardRef((i,o)=>{const s=L.useRef(null);return I.jsx(r,{...i,itemRef:s,externalRef:o,isHovering:L.useContext(Q1)===s.current})});return n.displayName=`WithHovering(${t})`,n},M4=(t,e,r)=>{ba(()=>{if(t)return;const n=e.current;return r(n,!0),()=>{r(n)}},[t,e,r])},I4=(t,e,r,n)=>{const{submenuCloseDelay:i}=L.useContext(jh),{isParentOpen:o,submenuCtx:s,dispatch:l,updateItems:a}=L.useContext(J1),u=()=>{!r&&!n&&l(xt.SET,t.current)},c=()=>{!n&&l(xt.UNSET,t.current)},d=g=>{r&&!g.currentTarget.contains(g.relatedTarget)&&c()},p=g=>{n||(g.stopPropagation(),s.on(i,u,u))},v=(g,x)=>{s.off(),!x&&c()};return M4(n,t,a),L.useEffect(()=>{r&&o&&e.current&&e.current.focus()},[e,r,o]),{setHover:u,onBlur:d,onPointerMove:p,onPointerLeave:v}},Ki=C4("MenuItem",function({className:e,value:r,href:n,type:i,checked:o,disabled:s,children:l,onClick:a,isHovering:u,itemRef:c,externalRef:d,...p}){const v=!!s,{setHover:g,...x}=I4(c,c,u,v),S=L.useContext(Y1),E=L.useContext(n4),w=i==="radio",_=i==="checkbox",O=!!n&&!v&&!w&&!_,B=w?E.value===r:_?!!o:!1,j=H=>{if(v){H.stopPropagation(),H.preventDefault();return}const se={value:r,syntheticEvent:H};H.key!==void 0&&(se.key=H.key),_&&(se.checked=!B),w&&(se.name=E.name),hr(a,se),w&&hr(E.onRadioChange,se),S.handleClick(se,_||w)},$=H=>{if(u)switch(H.key){case $r.ENTER:H.preventDefault();case $r.SPACE:O?c.current.click():j(H)}},q=L.useMemo(()=>({type:i,disabled:v,hover:u,checked:B,anchor:O}),[i,v,u,B,O]),ne=Ku({...x,onPointerDown:g,onKeyDown:$,onClick:j},p),K={role:w?"menuitemradio":_?"menuitemcheckbox":X1,"aria-checked":w||_?B:void 0,...K1(v,u),...ne,ref:Uh(d,c),className:al({block:Aa,element:r4,modifiers:q,className:e}),children:L.useMemo(()=>hr(l,q),[l,q])};return O?I.jsx("li",{role:o4,children:I.jsx("a",{href:n,...K})}):I.jsx("li",{...K})});function Mm({...t}){return I.jsx(P4,{...t,className:"dropdown "+t.className,menuButton:I.jsx(s4,{className:"unstyled",children:I.jsx(Ok,{style:{marginBottom:"-0.125em"}})}),children:t.children})}function R4({app:t}){var s,l,a,u,c;const{uninstallApp:e,setMirroring:r,setAutoUpdate:n}=Qo(),i=Iu();return!t.state?t.metadata?I.jsxs(Mm,{children:[((s=t.metadata)==null?void 0:s.description)&&I.jsx(Ki,{className:"action-entry",onClick:()=>i(`/app-details/${xe(t)}`),children:"View Details"}),((l=t.metadata)==null?void 0:l.external_url)&&I.jsx(Ki,{children:I.jsx("a",{style:{color:"inherit",whiteSpace:"nowrap",cursor:"pointer",marginTop:"0.25em"},target:"_blank",href:(a=t.metadata)==null?void 0:a.external_url,children:"View Site"})})]}):I.jsx("div",{style:{width:24}}):I.jsxs(Mm,{children:[I.jsx(Ki,{className:"action-entry",onClick:()=>i(`/app-details/${xe(t)}`),children:"View Details"}),t.installed&&I.jsxs(I.Fragment,{children:[I.jsx(Ki,{className:"action-entry",onClick:()=>e(t),children:"Uninstall"}),I.jsxs(Ki,{className:"action-entry",onClick:()=>{var d;return r(t,!((d=t.state)!=null&&d.mirroring))},children:[(u=t.state)!=null&&u.mirroring?"Stop":"Start"," Mirroring"]}),I.jsxs(Ki,{className:"action-entry",onClick:()=>{var d;return n(t,!((d=t.state)!=null&&d.auto_update))},children:[(c=t.state)!=null&&c.auto_update?"Disable":"Enable"," Auto Update"]})]})]})}function ys({app:t,...e}){var r;return L.createElement("div",{...e,key:xe(t),className:"app-entry row between"},I.jsx(q1,{app:t,size:"small"}),I.jsxs("div",{className:"app-actions row",children:[!((r=t.state)!=null&&r.capsApproved)&&I.jsx(W1,{app:t,style:{marginRight:"1em"}}),I.jsx(R4,{app:t})]}))}const _d="/my-apps";function Qu({value:t="",onChange:e=()=>null,hideSearch:r=!1}){const n=Iu(),i=xh(),o=qr.useRef(null),s=i.key!=="default",l=i.pathname===_d;return I.jsxs("div",{className:"search-header row between",children:[i.pathname!=="/"?I.jsx("button",{className:"back-btn col center",onClick:()=>n(s?-1:"/"),children:I.jsx(Mk,{})}):I.jsx("button",{className:"back-btn col center",onClick:()=>n("/publish"),children:I.jsx(z1,{})}),!r&&I.jsxs("div",{className:"searchbar row",children:[I.jsx(Bk,{className:"search-icon",onClick:()=>{var a;return(a=o.current)==null?void 0:a.focus()}}),I.jsx("input",{ref:o,onChange:a=>e(a.target.value),value:t,placeholder:"Search for apps..."}),t.length>0&&I.jsx(Dk,{className:"search-icon",style:{margin:"0 -0.25em 0 0.25em"},onClick:()=>e("")})]}),I.jsx("div",{className:"row",children:I.jsxs("button",{className:`my-pkg-btn row ${l?"selected":""}`,onClick:()=>n(l?-1:_d),children:[I.jsx(Tk,{style:{marginRight:"0.5em"}}),"My Packages"]})})]})}function T4(t){const{listedApps:e,getListedApps:r}=Qo(),[n,i]=L.useState("Recently published"),[o,s]=L.useState(""),[l,a]=L.useState(e),[u,c]=L.useState(1),d=L.useMemo(()=>Array.from({length:Math.ceil(l.length/10)},(g,x)=>x+1),[l]);L.useEffect(()=>{const g=(u-1)*10,x=g+10;a(e.slice(g,x))},[e]),L.useEffect(()=>{r().then(g=>{a(Object.values(g))}).catch(g=>console.error(g))},[]);const p=L.useCallback(async g=>{},[]),v=L.useCallback(g=>{s(g);const x=e.filter(S=>{var E,w,_,O;return S.package.toLowerCase().includes(g.toLowerCase())||((w=(E=S.metadata)==null?void 0:E.description)==null?void 0:w.toLowerCase().includes(g.toLowerCase()))||((O=(_=S.metadata)==null?void 0:_.description)==null?void 0:O.toLowerCase().includes(g.toLowerCase()))},[e]);a(x)},[e]);return I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{value:o,onChange:v}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"New"}),I.jsxs("select",{value:n,onChange:g=>{i(g.target.value),p(g.target.value)},style:{marginBottom:"-1em"},children:[I.jsx("option",{children:"Recently published"}),I.jsx("option",{children:"Most popular"}),I.jsx("option",{children:"Best rating"}),I.jsx("option",{children:"Recently updated"})]})]}),I.jsxs("div",{className:"new card col",style:{flex:1,overflowY:"scroll"},children:[l.map(g=>{var x;return I.jsx(ys,{app:g},xe(g)+(((x=g.state)==null?void 0:x.our_version)||""))}),d.length>1&&I.jsxs("div",{className:"row",style:{alignSelf:"center"},children:[u!==d[0]&&I.jsx(Ik,{onClick:()=>c(u-1)}),d.map(g=>I.jsx("div",{className:`page-selector ${g===u?"selected":""}`,onClick:()=>c(g),children:g},`page-${g}`)),u!==d[d.length-1]&&I.jsx(Rk,{onClick:()=>c(u+1)})]})]})]})}function O4(t){const{myApps:e,getMyApps:r}=Qo(),n=Iu(),[i,o]=L.useState(""),[s,l]=L.useState(e);L.useEffect(()=>{r().then(l).catch(u=>console.error(u))},[]);const a=L.useCallback(u=>{o(u);const c=Object.keys(e).reduce((d,p)=>(d[p]=e[p].filter(v=>{var g,x,S,E;return v.package.toLowerCase().includes(u.toLowerCase())||((x=(g=v.metadata)==null?void 0:g.description)==null?void 0:x.toLowerCase().includes(u.toLowerCase()))||((E=(S=v.metadata)==null?void 0:S.description)==null?void 0:E.toLowerCase().includes(u.toLowerCase()))}),d),{downloaded:[],installed:[],local:[],system:[]});l(c)},[e]);return I.jsxs("div",{style:{width:"100%",height:"100%"},children:[I.jsx(Qu,{value:i,onChange:a}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"My Packages"}),I.jsxs("button",{className:"row",onClick:()=>n("/publish"),children:[I.jsx(z1,{style:{marginRight:"0.5em"}}),"Publish Package"]})]}),I.jsx("div",{className:"my-apps-list",children:I.jsxs("div",{className:"new card col",children:[I.jsx("h3",{children:"Downloaded"}),(s.downloaded||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"Installed"}),(s.installed||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"Local"}),(s.local||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"System"}),(s.system||[]).map(u=>I.jsx(ys,{app:u},xe(u)))]})})]})}function L4(t){var u,c,d,p,v,g,x;const{myApps:e,listedApps:r,getListedApp:n}=Qo(),i=lx(),[o,s]=L.useState(void 0);L.useEffect(()=>{const S=e.local.find(E=>xe(E)===i.id);if(S)return s(S);if(i.id){const E=r.find(w=>xe(w)===i.id);E?s(E):n(i.id).then(w=>s(w)).catch(console.error)}},[i.id]);const l=L.useMemo(()=>{var S;return((S=o==null?void 0:o.metadata)==null?void 0:S.properties.current_version)||"Unknown"},[o]),a=((u=o==null?void 0:o.state)==null?void 0:u.our_version)||((p=(c=o==null?void 0:o.metadata)==null?void 0:c.properties.code_hashes)==null?void 0:p[(d=o==null?void 0:o.metadata)==null?void 0:d.properties.current_version])||"";return I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{value:"",onChange:()=>null,hideSearch:!0}),I.jsx("div",{className:"card",style:{marginTop:"1em"},children:o?I.jsxs(I.Fragment,{children:[I.jsxs("div",{className:"row between",children:[I.jsx(q1,{app:o,size:"large"}),I.jsx(W1,{app:o,style:{marginRight:"0.5em"}})]}),I.jsxs("div",{className:"col",style:{marginTop:"1em"},children:[I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Description"}),I.jsx("div",{className:"value",children:(((v=o.metadata)==null?void 0:v.description)||"No description given").slice(0,2e3)})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Publisher"}),I.jsx("div",{className:"value underline",children:o.publisher})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Version"}),I.jsx("div",{className:"value",children:l})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Mirrors"}),I.jsx("div",{className:"col",children:(((g=o.metadata)==null?void 0:g.properties.mirrors)||[]).map((S,E)=>I.jsx("div",{className:"value underline",children:S},E+S))})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Hash"}),I.jsx("div",{className:"value",style:{wordBreak:"break-all"},children:a})]})]}),I.jsx("div",{className:"app-screenshots row",children:(((x=o.metadata)==null?void 0:x.properties.screenshots)||[]).map((S,E)=>I.jsx("img",{src:S},E+S))})]}):I.jsxs(I.Fragment,{children:[I.jsx("h3",{children:"App details not found for "}),I.jsx("h3",{children:i.id})]})})]})}var _a=(t=>(t[t.SEPOLIA=11155111]="SEPOLIA",t[t.OPTIMISM=10]="OPTIMISM",t[t.OPTIMISM_GOERLI=420]="OPTIMISM_GOERLI",t[t.LOCAL=1337]="LOCAL",t))(_a||{});const fu="0xaa36a7",Im="0xa",Rm={11155111:"0x18c39eB547A0060C6034f8bEaFB947D1C16eADF1"},B4="4902",Tm={[fu]:{chainId:fu,chainName:"Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:["https://rpc.sepolia.org"],blockExplorerUrls:["https://sepolia.etherscan.io"]},[Im]:{chainId:Im,chainName:"Optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:["https://mainnet.optimism.io"],blockExplorerUrls:["https://optimistic.etherscan.io"]}},D4=t=>{switch(t){case"1":case"0x1":return"Ethereum";case"10":case"a":case"0xa":return"Optimism";case"42161":return"Arbitrum";case"11155111":case"aa36a7":case"0xaa36a7":return"Sepolia";default:return"Unknown"}},Om=async t=>{var r,n,i;let e=await((r=window.ethereum)==null?void 0:r.request({method:"net_version"}).catch(()=>"1"));if(e="0x"+(typeof e=="string"?e.replace(/^0x/,""):e.toString(16)),!Tm[t]){console.error(`Invalid chain ID: ${t}`);return}if(t!==e)try{await((n=window.ethereum)==null?void 0:n.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}))}catch(o){if(String(o).includes(B4))await((i=window.ethereum)==null?void 0:i.request({method:"wallet_addEthereumChain",params:[Tm[t]]}));else throw window.alert(`You must enable the ${D4(t)} network in your wallet.`),new Error(`User cancelled connection to ${t}`)}};var cl={},Ju={};Object.defineProperty(Ju,"__esModule",{value:!0});Ju.Connector=void 0;class j4{constructor(e,r){this.actions=e,this.onError=r}resetState(){this.actions.resetState()}}Ju.Connector=j4;var uf,Lm;function U4(){if(Lm)return uf;Lm=1;function t({mustBeMetaMask:e=!1,silent:r=!1,timeout:n=3e3}={}){o();let i=!1;return new Promise(s=>{window.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout(()=>{l()},n));function l(){if(i)return;i=!0,window.removeEventListener("ethereum#initialized",l);const{ethereum:a}=window;a&&(!e||a.isMetaMask)?s(a):(!r&&console.error("@metamask/detect-provider:",e&&a?"Non-MetaMask window.ethereum detected.":"Unable to detect window.ethereum."),s(null))}});function o(){if(typeof e!="boolean")throw new Error("@metamask/detect-provider: Expected option 'mustBeMetaMask' to be a boolean.");if(typeof r!="boolean")throw new Error("@metamask/detect-provider: Expected option 'silent' to be a boolean.");if(typeof n!="number")throw new Error("@metamask/detect-provider: Expected option 'timeout' to be a number.")}}return uf=t,uf}var F4=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z4=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$4=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&F4(e,t,r);return z4(e,t),e},Qi=Fe&&Fe.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(cl,"__esModule",{value:!0});var tw=cl.MetaMask=cl.NoMetaMaskError=void 0;const H4=Ju;class fl extends Error{constructor(){super("MetaMask not installed"),this.name=fl.name,Object.setPrototypeOf(this,fl.prototype)}}cl.NoMetaMaskError=fl;function Zl(t){return Number.parseInt(t,16)}class q4 extends H4.Connector{constructor({actions:e,options:r,onError:n}){super(e,n),this.options=r}isomorphicInitialize(){return Qi(this,void 0,void 0,function*(){if(!this.eagerConnection)return this.eagerConnection=Promise.resolve().then(()=>$4(U4())).then(e=>Qi(this,void 0,void 0,function*(){var r,n;const i=yield e.default(this.options);i&&(this.provider=i,!((r=this.provider.providers)===null||r===void 0)&&r.length&&(this.provider=(n=this.provider.providers.find(o=>o.isMetaMask))!==null&&n!==void 0?n:this.provider.providers[0]),this.provider.on("connect",({chainId:o})=>{this.actions.update({chainId:Zl(o)})}),this.provider.on("disconnect",o=>{var s;if(o.code===1013){console.debug('MetaMask logged connection error 1013: "Try again later"');return}this.actions.resetState(),(s=this.onError)===null||s===void 0||s.call(this,o)}),this.provider.on("chainChanged",o=>{this.actions.update({chainId:Zl(o)})}),this.provider.on("accountsChanged",o=>{o.length===0?this.actions.resetState():this.actions.update({accounts:o})}))}))})}connectEagerly(){return Qi(this,void 0,void 0,function*(){const e=this.actions.startActivation();try{if(yield this.isomorphicInitialize(),!this.provider)return e();const r=yield this.provider.request({method:"eth_accounts"});if(!r.length)throw new Error("No accounts returned");const n=yield this.provider.request({method:"eth_chainId"});this.actions.update({chainId:Zl(n),accounts:r})}catch(r){console.debug("Could not connect eagerly",r),this.actions.resetState()}})}activate(e){var r,n;return Qi(this,void 0,void 0,function*(){let i;return!((n=(r=this.provider)===null||r===void 0?void 0:r.isConnected)===null||n===void 0)&&n.call(r)||(i=this.actions.startActivation()),this.isomorphicInitialize().then(()=>Qi(this,void 0,void 0,function*(){if(!this.provider)throw new fl;const o=yield this.provider.request({method:"eth_requestAccounts"}),s=yield this.provider.request({method:"eth_chainId"}),l=Zl(s),a=typeof e=="number"?e:e==null?void 0:e.chainId;if(!a||l===a)return this.actions.update({chainId:l,accounts:o});const u=`0x${a.toString(16)}`;return this.provider.request({method:"wallet_switchEthereumChain",params:[{chainId:u}]}).catch(c=>{var d,p;if((((p=(d=c.data)===null||d===void 0?void 0:d.originalError)===null||p===void 0?void 0:p.code)||c.code)===4902&&typeof e!="number"){if(!this.provider)throw new Error("No provider");return this.provider.request({method:"wallet_addEthereumChain",params:[Object.assign(Object.assign({},e),{chainId:u})]})}throw c}).then(()=>this.activate(a))})).catch(o=>{throw i==null||i(),o})})}watchAsset({address:e,symbol:r,decimals:n,image:i}){return Qi(this,void 0,void 0,function*(){if(!this.provider)throw new Error("No provider");return this.provider.request({method:"wallet_watchAsset",params:{type:"ERC20",options:{address:e,symbol:r,decimals:n,image:i}}}).then(o=>{if(!o)throw new Error("Rejected");return!0})})}}tw=cl.MetaMask=q4;const[rw,Fh]=qu.initializeConnector(t=>new tw({actions:t}));function W4(t){const e=t.split("."),r=new Uint8Array(t.length+e.length);let n=0;for(const i of e){const o=i.length;r[n]=o,n++;for(let s=0;si.toString(16).padStart(2,"0")).join("")}`}const{useIsActivating:G4}=Fh;function V4({provider:t,packageAbi:e}){const{listedApps:r}=Qo(),{account:n,isActive:i}=qu.useWeb3React(),o=G4(),[s,l]=L.useState(""),[a,u]=L.useState(),[c,d]=L.useState(!1),[p,v]=L.useState(""),[g,x]=L.useState(""),[S,E]=L.useState(""),[w,_]=L.useState(""),[O,B]=L.useState(!1),j=L.useCallback(async()=>{await rw.activate().catch(()=>{});try{Om(fu)}catch(K){console.error(K)}},[]),$=L.useCallback(async()=>{if(!S){_("");return}try{const H=await(await fetch(S)).text();let se=JSON.parse(H);if(!se.properties||!se.properties.package_name||!se.properties.publisher||!se.properties.current_version||!se.properties.mirrors||!se.properties.code_hashes)throw new Error("Invalid metadata");const C=ut(mr(H));_(C),v(se.properties.package_name),x(se.properties.publisher)}catch{window.alert("Error calculating metadata hash. Please ensure the URL is valid, that the metadata is in JSON format, and that it conforms to the Erc721 metadata format for kinode packages. Read more here: TODO")}},[S]),q=L.useCallback(async K=>{K.preventDefault(),K.stopPropagation();let H=w;try{if(!H){const f=await fetch(S);await f.json();const m=await f.text();H=ut(mr(m))}l("Please confirm the transaction in your wallet");const se=W4(g);await Om(fu);const C=await(O?e.updateMetadata(V.from(mS(["string","bytes"],[p,se])),S,H):e.registerApp(p,se,S,H));await new Promise(f=>setTimeout(f,2e3)),l("Publishing package..."),await C.wait(),u({packageName:p,publisherId:g}),v(""),x(g),E(""),_(""),B(!1)}catch(se){console.error(se),window.alert("Error publishing package. Please ensure the package name and publisher ID are valid, and the metadata is in JSON format.")}finally{l("")}},[p,O,g,S,w,e,u,v,x,E,_,B]),ne=L.useCallback(async()=>{O||p&&g&&r.find(K=>K.package===p&&K.publisher===g)&&B(!0)},[r,p,g,O,B]);return I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{hideSearch:!0}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"Publish Package"}),!!n&&I.jsxs("div",{style:{textAlign:"right",lineHeight:1.5},children:[" ","Connected as"," ",(n==null?void 0:n.slice(0,6))+"..."+(n==null?void 0:n.slice(n.length-6))]})]}),s?I.jsx("div",{className:"col center",children:I.jsx(Ed,{msg:s})}):a?I.jsxs("div",{className:"col center",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"Package Published!"}),I.jsxs("div",{style:{marginBottom:"0.5em"},children:[I.jsx("strong",{children:"Package Name:"})," ",a.packageName]}),I.jsxs("div",{style:{marginBottom:"0.5em"},children:[I.jsx("strong",{children:"Publisher ID:"})," ",a.publisherId]}),I.jsx("button",{className:"my-pkg-btn row",style:{marginTop:"1em"},onClick:()=>u(void 0),children:"Publish Another Package"})]}):!n||!i?I.jsxs(I.Fragment,{children:[I.jsx("h4",{style:{},children:"Please connect your wallet to publish a package"}),I.jsx("button",{className:"my-pkg-btn row",onClick:j,children:"Connect Wallet"})]}):o?I.jsx(Ed,{msg:"Approve connection in your wallet"}):I.jsxs("form",{className:"new card col",style:{flex:1,overflowY:"scroll"},onSubmit:q,children:[I.jsxs("div",{className:"row between",style:{cursor:"pointer",padding:"0.5em",margin:"0 0 0.5em -0.5em"},onClick:()=>B(!O),children:[I.jsx("input",{type:"checkbox",checked:O,readOnly:!0}),I.jsx("label",{htmlFor:"update",style:{cursor:"pointer"},children:"Update existing package"})]}),I.jsxs("div",{className:"col f-width",children:[I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsxs("label",{htmlFor:"metadata-url",children:["Metadata URL",I.jsx("span",{style:{marginLeft:"2em",fontSize:"0.9em",textDecoration:"underline",cursor:"pointer"},onClick:()=>d(!c),children:"What is this?"})]}),c&&I.jsxs("div",{style:{textAlign:"left",marginBottom:"0.5em"},children:["Metadata is a JSON file that describes your package.",I.jsx("br",{})," You can"," ",I.jsx("a",{target:"_blank",href:"https://pongo-uploads.s3.us-east-2.amazonaws.com/sample_metadata.json",children:"download a template here"}),"."]}),I.jsx("input",{style:{minWidth:"80%"},id:"metadata-url",type:"text",required:!0,value:S,onChange:K=>E(K.target.value),onBlur:$,placeholder:"https://my-site/metadata.json"})]}),I.jsx("label",{htmlFor:"package-name",children:"Package Name"}),I.jsx("input",{style:{minWidth:"80%"},readOnly:!0,id:"package-name",type:"text",required:!0,placeholder:"Retreived automatically from metadata URL",value:p,onBlur:ne})]}),I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsx("label",{htmlFor:"publisher-id",children:"Publisher ID"}),I.jsx("input",{style:{minWidth:"80%"},readOnly:!0,id:"publisher-id",type:"text",required:!0,placeholder:"Retreived automatically from metadata URL",value:g,onBlur:ne})]}),I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsx("label",{htmlFor:"metadata-hash",children:"Metadata Hash"}),I.jsx("input",{style:{minWidth:"80%"},readOnly:!0,id:"metadata-hash",type:"text",value:w,onChange:K=>_(K.target.value),placeholder:"Calculated automatically from metadata URL"})]}),I.jsx("button",{type:"submit",className:"primary",style:{marginTop:"1em"},children:"Publish"})]})]})}var K4={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Q4=[[rw,Fh]],{useProvider:J4}=Fh,Y4="https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",Is="/main:app_store:sys";window.our&&(window.our.process=Is==null?void 0:Is.replace("/",""));const X4=`${K4.VITE_NODE_URL||"http://localhost:8080"}${Is}`;function Z4(){const t=J4(),[e,r]=L.useState(!0),[n,i]=L.useState(wd.connect(Rm[_a.SEPOLIA],new vi(Y4)));if(L.useEffect(()=>{t==null||t.getNetwork().then(s=>{s.chainId===_a.SEPOLIA&&i(wd.connect(Rm[_a.SEPOLIA],t.getSigner()))})},[t]),L.useEffect(()=>{},[]),!e)return I.jsxs("div",{className:"node-not-connected",children:[I.jsx("h2",{style:{color:"red"},children:"Node not connected"}),I.jsxs("h4",{children:["You need to start a node at ",X4," before you can use this UI in development."]})]});const o={provider:t,packageAbi:n};return I.jsx(qu.Web3ReactProvider,{connectors:Q4,children:I.jsx(_x,{basename:Is,children:I.jsxs(Ax,{children:[I.jsx(ms,{path:"/",element:I.jsx(T4,{...o})}),I.jsx(ms,{path:_d,element:I.jsx(O4,{...o})}),I.jsx(ms,{path:"/app-details/:id",element:I.jsx(L4,{...o})}),I.jsx(ms,{path:"/publish",element:I.jsx(V4,{...o})})]})})})}cf.createRoot(document.getElementById("root")).render(I.jsx(qr.StrictMode,{children:I.jsx(Z4,{})})); diff --git a/kinode/packages/app_store/pkg/ui/assets/index-Wv-dWa0C.js b/kinode/packages/app_store/pkg/ui/assets/index-Wv-dWa0C.js new file mode 100644 index 000000000..ab664f4c8 --- /dev/null +++ b/kinode/packages/app_store/pkg/ui/assets/index-Wv-dWa0C.js @@ -0,0 +1,90 @@ +var nw=Object.defineProperty;var iw=(t,e,r)=>e in t?nw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var zh=(t,e,r)=>(iw(t,typeof e!="symbol"?e+"":e,r),r);function ow(t,e){for(var r=0;rn[i]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))n(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const s of o.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&n(s)}).observe(document,{childList:!0,subtree:!0});function r(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function n(i){if(i.ep)return;i.ep=!0;const o=r(i);fetch(i.href,o)}})();var Fe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Uo(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return t[n]}})}),r}var Bm={exports:{}},du={},Dm={exports:{}},ye={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var dl=Symbol.for("react.element"),sw=Symbol.for("react.portal"),lw=Symbol.for("react.fragment"),aw=Symbol.for("react.strict_mode"),uw=Symbol.for("react.profiler"),cw=Symbol.for("react.provider"),fw=Symbol.for("react.context"),dw=Symbol.for("react.forward_ref"),hw=Symbol.for("react.suspense"),pw=Symbol.for("react.memo"),mw=Symbol.for("react.lazy"),$h=Symbol.iterator;function gw(t){return t===null||typeof t!="object"?null:(t=$h&&t[$h]||t["@@iterator"],typeof t=="function"?t:null)}var jm={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Um=Object.assign,Fm={};function Fo(t,e,r){this.props=t,this.context=e,this.refs=Fm,this.updater=r||jm}Fo.prototype.isReactComponent={};Fo.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Fo.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function zm(){}zm.prototype=Fo.prototype;function Sd(t,e,r){this.props=t,this.context=e,this.refs=Fm,this.updater=r||jm}var kd=Sd.prototype=new zm;kd.constructor=Sd;Um(kd,Fo.prototype);kd.isPureReactComponent=!0;var Hh=Array.isArray,$m=Object.prototype.hasOwnProperty,Nd={current:null},Hm={key:!0,ref:!0,__self:!0,__source:!0};function qm(t,e,r){var n,i={},o=null,s=null;if(e!=null)for(n in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(o=""+e.key),e)$m.call(e,n)&&!Hm.hasOwnProperty(n)&&(i[n]=e[n]);var l=arguments.length-2;if(l===1)i.children=r;else if(1>>1,h=b[k];if(0>>1;ki(y,R))Di(U,y)?(b[k]=U,b[D]=R,k=D):(b[k]=y,b[te]=R,k=te);else if(Di(U,R))b[k]=U,b[D]=R,k=D;else break e}}return M}function i(b,M){var R=b.sortIndex-M.sortIndex;return R!==0?R:b.id-M.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var s=Date,l=s.now();t.unstable_now=function(){return s.now()-l}}var a=[],u=[],c=1,d=null,p=3,v=!1,g=!1,x=!1,S=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function _(b){for(var M=r(u);M!==null;){if(M.callback===null)n(u);else if(M.startTime<=b)n(u),M.sortIndex=M.expirationTime,e(a,M);else break;M=r(u)}}function O(b){if(x=!1,_(b),!g)if(r(a)!==null)g=!0,A(B);else{var M=r(u);M!==null&&N(O,M.startTime-b)}}function B(b,M){g=!1,x&&(x=!1,E(H),H=-1),v=!0;var R=p;try{for(_(M),d=r(a);d!==null&&(!(d.expirationTime>M)||b&&!Y());){var k=d.callback;if(typeof k=="function"){d.callback=null,p=d.priorityLevel;var h=k(d.expirationTime<=M);M=t.unstable_now(),typeof h=="function"?d.callback=h:d===r(a)&&n(a),_(M)}else n(a);d=r(a)}if(d!==null)var P=!0;else{var te=r(u);te!==null&&N(O,te.startTime-M),P=!1}return P}finally{d=null,p=R,v=!1}}var j=!1,$=null,H=-1,ie=5,V=-1;function Y(){return!(t.unstable_now()-Vb||125k?(b.sortIndex=R,e(u,b),r(a)===null&&b===r(u)&&(x?(E(H),H=-1):x=!0,N(O,R-k))):(b.sortIndex=h,e(a,b),g||v||(g=!0,A(B))),b},t.unstable_shouldYield=Y,t.unstable_wrapCallback=function(b){var M=p;return function(){var R=p;p=M;try{return b.apply(this,arguments)}finally{p=R}}}})(Km);Vm.exports=Km;var Pw=Vm.exports;/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Qm=L,pr=Pw;function q(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=1;r"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ff=Object.prototype.hasOwnProperty,Cw=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,Wh={},Gh={};function Mw(t){return ff.call(Gh,t)?!0:ff.call(Wh,t)?!1:Cw.test(t)?Gh[t]=!0:(Wh[t]=!0,!1)}function Iw(t,e,r,n){if(r!==null&&r.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return n?!1:r!==null?!r.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function Rw(t,e,r,n){if(e===null||typeof e>"u"||Iw(t,e,r,n))return!0;if(n)return!1;if(r!==null)switch(r.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Vt(t,e,r,n,i,o,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=n,this.attributeNamespace=i,this.mustUseProperty=r,this.propertyName=t,this.type=e,this.sanitizeURL=o,this.removeEmptyString=s}var Tt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Tt[t]=new Vt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Tt[e]=new Vt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Tt[t]=new Vt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Tt[t]=new Vt(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){Tt[t]=new Vt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Tt[t]=new Vt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Tt[t]=new Vt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Tt[t]=new Vt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Tt[t]=new Vt(t,5,!1,t.toLowerCase(),null,!1,!1)});var Cd=/[\-:]([a-z])/g;function Md(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Cd,Md);Tt[e]=new Vt(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Cd,Md);Tt[e]=new Vt(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Cd,Md);Tt[e]=new Vt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Tt[t]=new Vt(t,1,!1,t.toLowerCase(),null,!1,!1)});Tt.xlinkHref=new Vt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Tt[t]=new Vt(t,1,!1,t.toLowerCase(),null,!0,!0)});function Id(t,e,r,n){var i=Tt.hasOwnProperty(e)?Tt[e]:null;(i!==null?i.type!==0:n||!(2l||i[s]!==o[l]){var a=` +`+i[s].replace(" at new "," at ");return t.displayName&&a.includes("")&&(a=a.replace("",t.displayName)),a}while(1<=s&&0<=l);break}}}finally{hc=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?fs(t):""}function Tw(t){switch(t.tag){case 5:return fs(t.type);case 16:return fs("Lazy");case 13:return fs("Suspense");case 19:return fs("SuspenseList");case 0:case 2:case 15:return t=pc(t.type,!1),t;case 11:return t=pc(t.type.render,!1),t;case 1:return t=pc(t.type,!0),t;default:return""}}function mf(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Zi:return"Fragment";case Xi:return"Portal";case df:return"Profiler";case Rd:return"StrictMode";case hf:return"Suspense";case pf:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Xm:return(t.displayName||"Context")+".Consumer";case Ym:return(t._context.displayName||"Context")+".Provider";case Td:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Od:return e=t.displayName||null,e!==null?e:mf(t.type)||"Memo";case Jn:e=t._payload,t=t._init;try{return mf(t(e))}catch{}}return null}function Ow(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return mf(e);case 8:return e===Rd?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function pi(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function eg(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Lw(t){var e=eg(t)?"checked":"value",r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),n=""+t[e];if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var i=r.get,o=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(s){n=""+s,o.call(this,s)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(s){n=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function kl(t){t._valueTracker||(t._valueTracker=Lw(t))}function tg(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=eg(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function Sa(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function gf(t,e){var r=e.checked;return ft({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:r??t._wrapperState.initialChecked})}function Kh(t,e){var r=e.defaultValue==null?"":e.defaultValue,n=e.checked!=null?e.checked:e.defaultChecked;r=pi(e.value!=null?e.value:r),t._wrapperState={initialChecked:n,initialValue:r,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function rg(t,e){e=e.checked,e!=null&&Id(t,"checked",e,!1)}function vf(t,e){rg(t,e);var r=pi(e.value),n=e.type;if(r!=null)n==="number"?(r===0&&t.value===""||t.value!=r)&&(t.value=""+r):t.value!==""+r&&(t.value=""+r);else if(n==="submit"||n==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?yf(t,e.type,r):e.hasOwnProperty("defaultValue")&&yf(t,e.type,pi(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Qh(t,e,r){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var n=e.type;if(!(n!=="submit"&&n!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,r||e===t.value||(t.value=e),t.defaultValue=e}r=t.name,r!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,r!==""&&(t.name=r)}function yf(t,e,r){(e!=="number"||Sa(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var ds=Array.isArray;function go(t,e,r,n){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Nl.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ts(t,e){if(e){var r=t.firstChild;if(r&&r===t.lastChild&&r.nodeType===3){r.nodeValue=e;return}}t.textContent=e}var ws={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},Bw=["Webkit","ms","Moz","O"];Object.keys(ws).forEach(function(t){Bw.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ws[e]=ws[t]})});function sg(t,e,r){return e==null||typeof e=="boolean"||e===""?"":r||typeof e!="number"||e===0||ws.hasOwnProperty(t)&&ws[t]?(""+e).trim():e+"px"}function lg(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=sg(r,e[r],n);r==="float"&&(r="cssFloat"),n?t.setProperty(r,i):t[r]=i}}var Dw=ft({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function xf(t,e){if(e){if(Dw[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(q(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(q(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(q(61))}if(e.style!=null&&typeof e.style!="object")throw Error(q(62))}}function Af(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var bf=null;function Ld(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var _f=null,vo=null,yo=null;function Xh(t){if(t=ml(t)){if(typeof _f!="function")throw Error(q(280));var e=t.stateNode;e&&(e=vu(e),_f(t.stateNode,t.type,e))}}function ag(t){vo?yo?yo.push(t):yo=[t]:vo=t}function ug(){if(vo){var t=vo,e=yo;if(yo=vo=null,Xh(t),e)for(t=0;t>>=0,t===0?32:31-(Kw(t)/Qw|0)|0}var Pl=64,Cl=4194304;function hs(t){switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Ca(t,e){var r=t.pendingLanes;if(r===0)return 0;var n=0,i=t.suspendedLanes,o=t.pingedLanes,s=r&268435455;if(s!==0){var l=s&~i;l!==0?n=hs(l):(o&=s,o!==0&&(n=hs(o)))}else s=r&~i,s!==0?n=hs(s):o!==0&&(n=hs(o));if(n===0)return 0;if(e!==0&&e!==n&&!(e&i)&&(i=n&-n,o=e&-e,i>=o||i===16&&(o&4194240)!==0))return e;if(n&4&&(n|=r&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=n;0r;r++)e.push(t);return e}function hl(t,e,r){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Wr(e),t[e]=r}function Zw(t,e){var r=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var n=t.eventTimes;for(t=t.expirationTimes;0=xs),l0=" ",a0=!1;function Cg(t,e){switch(t){case"keyup":return N2.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Mg(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var eo=!1;function C2(t,e){switch(t){case"compositionend":return Mg(e);case"keypress":return e.which!==32?null:(a0=!0,l0);case"textInput":return t=e.data,t===l0&&a0?null:t;default:return null}}function M2(t,e){if(eo)return t==="compositionend"||!Hd&&Cg(t,e)?(t=Ng(),na=Fd=ri=null,eo=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:r,offset:e-t};t=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=d0(r)}}function Og(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Og(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Lg(){for(var t=window,e=Sa();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=Sa(t.document)}return e}function qd(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function U2(t){var e=Lg(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&Og(r.ownerDocument.documentElement,r)){if(n!==null&&qd(r)){if(e=n.start,t=n.end,t===void 0&&(t=e),"selectionStart"in r)r.selectionStart=e,r.selectionEnd=Math.min(t,r.value.length);else if(t=(e=r.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var i=r.textContent.length,o=Math.min(n.start,i);n=n.end===void 0?o:Math.min(n.end,i),!t.extend&&o>n&&(i=n,n=o,o=i),i=h0(r,o);var s=h0(r,n);i&&s&&(t.rangeCount!==1||t.anchorNode!==i.node||t.anchorOffset!==i.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(i.node,i.offset),t.removeAllRanges(),o>n?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=r;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof r.focus=="function"&&r.focus(),r=0;r=document.documentMode,to=null,Mf=null,bs=null,If=!1;function p0(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;If||to==null||to!==Sa(n)||(n=to,"selectionStart"in n&&qd(n)?n={start:n.selectionStart,end:n.selectionEnd}:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}),bs&&Us(bs,n)||(bs=n,n=Ra(Mf,"onSelect"),0io||(t.current=Df[io],Df[io]=null,io--)}function Qe(t,e){io++,Df[io]=t.current,t.current=e}var mi={},zt=wi(mi),er=wi(!1),Ri=mi;function ko(t,e){var r=t.type.contextTypes;if(!r)return mi;var n=t.stateNode;if(n&&n.__reactInternalMemoizedUnmaskedChildContext===e)return n.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in r)i[o]=e[o];return n&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=i),i}function tr(t){return t=t.childContextTypes,t!=null}function Oa(){tt(er),tt(zt)}function x0(t,e,r){if(zt.current!==mi)throw Error(q(168));Qe(zt,e),Qe(er,r)}function qg(t,e,r){var n=t.stateNode;if(e=e.childContextTypes,typeof n.getChildContext!="function")return r;n=n.getChildContext();for(var i in n)if(!(i in e))throw Error(q(108,Ow(t)||"Unknown",i));return ft({},r,n)}function La(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||mi,Ri=zt.current,Qe(zt,t),Qe(er,er.current),!0}function A0(t,e,r){var n=t.stateNode;if(!n)throw Error(q(169));r?(t=qg(t,e,Ri),n.__reactInternalMemoizedMergedChildContext=t,tt(er),tt(zt),Qe(zt,t)):tt(er),Qe(er,r)}var An=null,yu=!1,Pc=!1;function Wg(t){An===null?An=[t]:An.push(t)}function Y2(t){yu=!0,Wg(t)}function Ei(){if(!Pc&&An!==null){Pc=!0;var t=0,e=Re;try{var r=An;for(Re=1;t>=s,i-=s,Sn=1<<32-Wr(e)+i|r<H?(ie=$,$=null):ie=$.sibling;var V=p(E,$,_[H],O);if(V===null){$===null&&($=ie);break}t&&$&&V.alternate===null&&e(E,$),w=o(V,w,H),j===null?B=V:j.sibling=V,j=V,$=ie}if(H===_.length)return r(E,$),nt&&bi(E,H),B;if($===null){for(;H<_.length;H++)$=d(E,_[H],O),$!==null&&(w=o($,w,H),j===null?B=$:j.sibling=$,j=$);return nt&&bi(E,H),B}for($=n(E,$);H<_.length;H++)ie=v($,E,H,_[H],O),ie!==null&&(t&&ie.alternate!==null&&$.delete(ie.key===null?H:ie.key),w=o(ie,w,H),j===null?B=ie:j.sibling=ie,j=ie);return t&&$.forEach(function(Y){return e(E,Y)}),nt&&bi(E,H),B}function x(E,w,_,O){var B=Jo(_);if(typeof B!="function")throw Error(q(150));if(_=B.call(_),_==null)throw Error(q(151));for(var j=B=null,$=w,H=w=0,ie=null,V=_.next();$!==null&&!V.done;H++,V=_.next()){$.index>H?(ie=$,$=null):ie=$.sibling;var Y=p(E,$,V.value,O);if(Y===null){$===null&&($=ie);break}t&&$&&Y.alternate===null&&e(E,$),w=o(Y,w,H),j===null?B=Y:j.sibling=Y,j=Y,$=ie}if(V.done)return r(E,$),nt&&bi(E,H),B;if($===null){for(;!V.done;H++,V=_.next())V=d(E,V.value,O),V!==null&&(w=o(V,w,H),j===null?B=V:j.sibling=V,j=V);return nt&&bi(E,H),B}for($=n(E,$);!V.done;H++,V=_.next())V=v($,E,H,V.value,O),V!==null&&(t&&V.alternate!==null&&$.delete(V.key===null?H:V.key),w=o(V,w,H),j===null?B=V:j.sibling=V,j=V);return t&&$.forEach(function(K){return e(E,K)}),nt&&bi(E,H),B}function S(E,w,_,O){if(typeof _=="object"&&_!==null&&_.type===Zi&&_.key===null&&(_=_.props.children),typeof _=="object"&&_!==null){switch(_.$$typeof){case Sl:e:{for(var B=_.key,j=w;j!==null;){if(j.key===B){if(B=_.type,B===Zi){if(j.tag===7){r(E,j.sibling),w=i(j,_.props.children),w.return=E,E=w;break e}}else if(j.elementType===B||typeof B=="object"&&B!==null&&B.$$typeof===Jn&&C0(B)===j.type){r(E,j.sibling),w=i(j,_.props),w.ref=ts(E,j,_),w.return=E,E=w;break e}r(E,j);break}else e(E,j);j=j.sibling}_.type===Zi?(w=Mi(_.props.children,E.mode,O,_.key),w.return=E,E=w):(O=fa(_.type,_.key,_.props,null,E.mode,O),O.ref=ts(E,w,_),O.return=E,E=O)}return s(E);case Xi:e:{for(j=_.key;w!==null;){if(w.key===j)if(w.tag===4&&w.stateNode.containerInfo===_.containerInfo&&w.stateNode.implementation===_.implementation){r(E,w.sibling),w=i(w,_.children||[]),w.return=E,E=w;break e}else{r(E,w);break}else e(E,w);w=w.sibling}w=Bc(_,E.mode,O),w.return=E,E=w}return s(E);case Jn:return j=_._init,S(E,w,j(_._payload),O)}if(ds(_))return g(E,w,_,O);if(Jo(_))return x(E,w,_,O);Bl(E,_)}return typeof _=="string"&&_!==""||typeof _=="number"?(_=""+_,w!==null&&w.tag===6?(r(E,w.sibling),w=i(w,_),w.return=E,E=w):(r(E,w),w=Lc(_,E.mode,O),w.return=E,E=w),s(E)):r(E,w)}return S}var Po=Zg(!0),ev=Zg(!1),gl={},an=wi(gl),Hs=wi(gl),qs=wi(gl);function Pi(t){if(t===gl)throw Error(q(174));return t}function Zd(t,e){switch(Qe(qs,e),Qe(Hs,t),Qe(an,gl),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Ef(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Ef(e,t)}tt(an),Qe(an,e)}function Co(){tt(an),tt(Hs),tt(qs)}function tv(t){Pi(qs.current);var e=Pi(an.current),r=Ef(e,t.type);e!==r&&(Qe(Hs,t),Qe(an,r))}function eh(t){Hs.current===t&&(tt(an),tt(Hs))}var at=wi(0);function za(t){for(var e=t;e!==null;){if(e.tag===13){var r=e.memoizedState;if(r!==null&&(r=r.dehydrated,r===null||r.data==="$?"||r.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Cc=[];function th(){for(var t=0;tr?r:4,t(!0);var n=Mc.transition;Mc.transition={};try{t(!1),e()}finally{Re=r,Mc.transition=n}}function vv(){return Pr().memoizedState}function tE(t,e,r){var n=di(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},yv(t))wv(e,r);else if(r=Qg(t,e,r,n),r!==null){var i=Wt();Gr(r,t,n,i),Ev(r,e,n)}}function rE(t,e,r){var n=di(t),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(yv(t))wv(e,i);else{var o=t.alternate;if(t.lanes===0&&(o===null||o.lanes===0)&&(o=e.lastRenderedReducer,o!==null))try{var s=e.lastRenderedState,l=o(s,r);if(i.hasEagerState=!0,i.eagerState=l,Vr(l,s)){var a=e.interleaved;a===null?(i.next=i,Yd(e)):(i.next=a.next,a.next=i),e.interleaved=i;return}}catch{}finally{}r=Qg(t,e,i,n),r!==null&&(i=Wt(),Gr(r,t,n,i),Ev(r,e,n))}}function yv(t){var e=t.alternate;return t===ct||e!==null&&e===ct}function wv(t,e){_s=$a=!0;var r=t.pending;r===null?e.next=e:(e.next=r.next,r.next=e),t.pending=e}function Ev(t,e,r){if(r&4194240){var n=e.lanes;n&=t.pendingLanes,r|=n,e.lanes=r,Dd(t,r)}}var Ha={readContext:Nr,useCallback:Lt,useContext:Lt,useEffect:Lt,useImperativeHandle:Lt,useInsertionEffect:Lt,useLayoutEffect:Lt,useMemo:Lt,useReducer:Lt,useRef:Lt,useState:Lt,useDebugValue:Lt,useDeferredValue:Lt,useTransition:Lt,useMutableSource:Lt,useSyncExternalStore:Lt,useId:Lt,unstable_isNewReconciler:!1},nE={readContext:Nr,useCallback:function(t,e){return Zr().memoizedState=[t,e===void 0?null:e],t},useContext:Nr,useEffect:I0,useImperativeHandle:function(t,e,r){return r=r!=null?r.concat([t]):null,la(4194308,4,dv.bind(null,e,t),r)},useLayoutEffect:function(t,e){return la(4194308,4,t,e)},useInsertionEffect:function(t,e){return la(4,2,t,e)},useMemo:function(t,e){var r=Zr();return e=e===void 0?null:e,t=t(),r.memoizedState=[t,e],t},useReducer:function(t,e,r){var n=Zr();return e=r!==void 0?r(e):e,n.memoizedState=n.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},n.queue=t,t=t.dispatch=tE.bind(null,ct,t),[n.memoizedState,t]},useRef:function(t){var e=Zr();return t={current:t},e.memoizedState=t},useState:M0,useDebugValue:sh,useDeferredValue:function(t){return Zr().memoizedState=t},useTransition:function(){var t=M0(!1),e=t[0];return t=eE.bind(null,t[1]),Zr().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,r){var n=ct,i=Zr();if(nt){if(r===void 0)throw Error(q(407));r=r()}else{if(r=e(),Nt===null)throw Error(q(349));Oi&30||iv(n,e,r)}i.memoizedState=r;var o={value:r,getSnapshot:e};return i.queue=o,I0(sv.bind(null,n,o,t),[t]),n.flags|=2048,Vs(9,ov.bind(null,n,o,r,e),void 0,null),r},useId:function(){var t=Zr(),e=Nt.identifierPrefix;if(nt){var r=kn,n=Sn;r=(n&~(1<<32-Wr(n)-1)).toString(32)+r,e=":"+e+"R"+r,r=Ws++,0<\/script>",t=t.removeChild(t.firstChild)):typeof n.is=="string"?t=s.createElement(r,{is:n.is}):(t=s.createElement(r),r==="select"&&(s=t,n.multiple?s.multiple=!0:n.size&&(s.size=n.size))):t=s.createElementNS(t,r),t[nn]=e,t[$s]=n,Cv(t,e,!1,!1),e.stateNode=t;e:{switch(s=Af(r,n),r){case"dialog":et("cancel",t),et("close",t),i=n;break;case"iframe":case"object":case"embed":et("load",t),i=n;break;case"video":case"audio":for(i=0;iIo&&(e.flags|=128,n=!0,rs(o,!1),e.lanes=4194304)}else{if(!n)if(t=za(s),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),rs(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!nt)return Bt(e),null}else 2*vt()-o.renderingStartTime>Io&&r!==1073741824&&(e.flags|=128,n=!0,rs(o,!1),e.lanes=4194304);o.isBackwards?(s.sibling=e.child,e.child=s):(r=o.last,r!==null?r.sibling=s:e.child=s,o.last=s)}return o.tail!==null?(e=o.tail,o.rendering=e,o.tail=e.sibling,o.renderingStartTime=vt(),e.sibling=null,r=at.current,Qe(at,n?r&1|2:r&1),e):(Bt(e),null);case 22:case 23:return dh(),n=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==n&&(e.flags|=8192),n&&e.mode&1?lr&1073741824&&(Bt(e),e.subtreeFlags&6&&(e.flags|=8192)):Bt(e),null;case 24:return null;case 25:return null}throw Error(q(156,e.tag))}function fE(t,e){switch(Gd(e),e.tag){case 1:return tr(e.type)&&Oa(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Co(),tt(er),tt(zt),th(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return eh(e),null;case 13:if(tt(at),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(q(340));No()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return tt(at),null;case 4:return Co(),null;case 10:return Jd(e.type._context),null;case 22:case 23:return dh(),null;case 24:return null;default:return null}}var jl=!1,Dt=!1,dE=typeof WeakSet=="function"?WeakSet:Set,Z=null;function ao(t,e){var r=t.ref;if(r!==null)if(typeof r=="function")try{r(null)}catch(n){ht(t,e,n)}else r.current=null}function Qf(t,e,r){try{r()}catch(n){ht(t,e,n)}}var F0=!1;function hE(t,e){if(Rf=Ma,t=Lg(),qd(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var n=r.getSelection&&r.getSelection();if(n&&n.rangeCount!==0){r=n.anchorNode;var i=n.anchorOffset,o=n.focusNode;n=n.focusOffset;try{r.nodeType,o.nodeType}catch{r=null;break e}var s=0,l=-1,a=-1,u=0,c=0,d=t,p=null;t:for(;;){for(var v;d!==r||i!==0&&d.nodeType!==3||(l=s+i),d!==o||n!==0&&d.nodeType!==3||(a=s+n),d.nodeType===3&&(s+=d.nodeValue.length),(v=d.firstChild)!==null;)p=d,d=v;for(;;){if(d===t)break t;if(p===r&&++u===i&&(l=s),p===o&&++c===n&&(a=s),(v=d.nextSibling)!==null)break;d=p,p=d.parentNode}d=v}r=l===-1||a===-1?null:{start:l,end:a}}else r=null}r=r||{start:0,end:0}}else r=null;for(Tf={focusedElem:t,selectionRange:r},Ma=!1,Z=e;Z!==null;)if(e=Z,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Z=t;else for(;Z!==null;){e=Z;try{var g=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(g!==null){var x=g.memoizedProps,S=g.memoizedState,E=e.stateNode,w=E.getSnapshotBeforeUpdate(e.elementType===e.type?x:jr(e.type,x),S);E.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var _=e.stateNode.containerInfo;_.nodeType===1?_.textContent="":_.nodeType===9&&_.documentElement&&_.removeChild(_.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(q(163))}}catch(O){ht(e,e.return,O)}if(t=e.sibling,t!==null){t.return=e.return,Z=t;break}Z=e.return}return g=F0,F0=!1,g}function Ss(t,e,r){var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var i=n=n.next;do{if((i.tag&t)===t){var o=i.destroy;i.destroy=void 0,o!==void 0&&Qf(e,r,o)}i=i.next}while(i!==n)}}function xu(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var r=e=e.next;do{if((r.tag&t)===t){var n=r.create;r.destroy=n()}r=r.next}while(r!==e)}}function Jf(t){var e=t.ref;if(e!==null){var r=t.stateNode;switch(t.tag){case 5:t=r;break;default:t=r}typeof e=="function"?e(t):e.current=t}}function Rv(t){var e=t.alternate;e!==null&&(t.alternate=null,Rv(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[nn],delete e[$s],delete e[Bf],delete e[Q2],delete e[J2])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function Tv(t){return t.tag===5||t.tag===3||t.tag===4}function z0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Tv(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Yf(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.nodeType===8?r.parentNode.insertBefore(t,e):r.insertBefore(t,e):(r.nodeType===8?(e=r.parentNode,e.insertBefore(t,r)):(e=r,e.appendChild(t)),r=r._reactRootContainer,r!=null||e.onclick!==null||(e.onclick=Ta));else if(n!==4&&(t=t.child,t!==null))for(Yf(t,e,r),t=t.sibling;t!==null;)Yf(t,e,r),t=t.sibling}function Xf(t,e,r){var n=t.tag;if(n===5||n===6)t=t.stateNode,e?r.insertBefore(t,e):r.appendChild(t);else if(n!==4&&(t=t.child,t!==null))for(Xf(t,e,r),t=t.sibling;t!==null;)Xf(t,e,r),t=t.sibling}var Mt=null,Fr=!1;function Vn(t,e,r){for(r=r.child;r!==null;)Ov(t,e,r),r=r.sibling}function Ov(t,e,r){if(ln&&typeof ln.onCommitFiberUnmount=="function")try{ln.onCommitFiberUnmount(hu,r)}catch{}switch(r.tag){case 5:Dt||ao(r,e);case 6:var n=Mt,i=Fr;Mt=null,Vn(t,e,r),Mt=n,Fr=i,Mt!==null&&(Fr?(t=Mt,r=r.stateNode,t.nodeType===8?t.parentNode.removeChild(r):t.removeChild(r)):Mt.removeChild(r.stateNode));break;case 18:Mt!==null&&(Fr?(t=Mt,r=r.stateNode,t.nodeType===8?Nc(t.parentNode,r):t.nodeType===1&&Nc(t,r),Ds(t)):Nc(Mt,r.stateNode));break;case 4:n=Mt,i=Fr,Mt=r.stateNode.containerInfo,Fr=!0,Vn(t,e,r),Mt=n,Fr=i;break;case 0:case 11:case 14:case 15:if(!Dt&&(n=r.updateQueue,n!==null&&(n=n.lastEffect,n!==null))){i=n=n.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&Qf(r,e,s),i=i.next}while(i!==n)}Vn(t,e,r);break;case 1:if(!Dt&&(ao(r,e),n=r.stateNode,typeof n.componentWillUnmount=="function"))try{n.props=r.memoizedProps,n.state=r.memoizedState,n.componentWillUnmount()}catch(l){ht(r,e,l)}Vn(t,e,r);break;case 21:Vn(t,e,r);break;case 22:r.mode&1?(Dt=(n=Dt)||r.memoizedState!==null,Vn(t,e,r),Dt=n):Vn(t,e,r);break;default:Vn(t,e,r)}}function $0(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var r=t.stateNode;r===null&&(r=t.stateNode=new dE),e.forEach(function(n){var i=AE.bind(null,t,n);r.has(n)||(r.add(n),n.then(i,i))})}}function Tr(t,e){var r=e.deletions;if(r!==null)for(var n=0;ni&&(i=s),n&=~o}if(n=i,n=vt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*mE(n/1960))-n,10t?16:t,ni===null)var n=!1;else{if(t=ni,ni=null,Ga=0,Ae&6)throw Error(q(331));var i=Ae;for(Ae|=4,Z=t.current;Z!==null;){var o=Z,s=o.child;if(Z.flags&16){var l=o.deletions;if(l!==null){for(var a=0;avt()-ch?Ci(t,0):uh|=r),rr(t,e)}function $v(t,e){e===0&&(t.mode&1?(e=Cl,Cl<<=1,!(Cl&130023424)&&(Cl=4194304)):e=1);var r=Wt();t=Rn(t,e),t!==null&&(hl(t,e,r),rr(t,r))}function xE(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),$v(t,r)}function AE(t,e){var r=0;switch(t.tag){case 13:var n=t.stateNode,i=t.memoizedState;i!==null&&(r=i.retryLane);break;case 19:n=t.stateNode;break;default:throw Error(q(314))}n!==null&&n.delete(e),$v(t,r)}var Hv;Hv=function(t,e,r){if(t!==null)if(t.memoizedProps!==e.pendingProps||er.current)Zt=!0;else{if(!(t.lanes&r)&&!(e.flags&128))return Zt=!1,uE(t,e,r);Zt=!!(t.flags&131072)}else Zt=!1,nt&&e.flags&1048576&&Gg(e,Da,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;aa(t,e),t=e.pendingProps;var i=ko(e,zt.current);Eo(e,r),i=nh(null,e,n,t,i,r);var o=ih();return e.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,tr(n)?(o=!0,La(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Xd(e),i.updater=wu,e.stateNode=i,i._reactInternals=e,$f(e,n,t,r),e=Wf(null,e,n,!0,o,r)):(e.tag=0,nt&&o&&Wd(e),qt(null,e,i,r),e=e.child),e;case 16:n=e.elementType;e:{switch(aa(t,e),t=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=_E(n),t=jr(n,t),i){case 0:e=qf(null,e,n,t,r);break e;case 1:e=D0(null,e,n,t,r);break e;case 11:e=L0(null,e,n,t,r);break e;case 14:e=B0(null,e,n,jr(n.type,t),r);break e}throw Error(q(306,n,""))}return e;case 0:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),qf(t,e,n,i,r);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),D0(t,e,n,i,r);case 3:e:{if(kv(e),t===null)throw Error(q(387));n=e.pendingProps,o=e.memoizedState,i=o.element,Jg(t,e),Fa(e,n,null,r);var s=e.memoizedState;if(n=s.element,o.isDehydrated)if(o={element:n,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=o,e.memoizedState=o,e.flags&256){i=Mo(Error(q(423)),e),e=j0(t,e,n,r,i);break e}else if(n!==i){i=Mo(Error(q(424)),e),e=j0(t,e,n,r,i);break e}else for(cr=ui(e.stateNode.containerInfo.firstChild),dr=e,nt=!0,zr=null,r=ev(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(No(),n===i){e=Tn(t,e,r);break e}qt(t,e,n,r)}e=e.child}return e;case 5:return tv(e),t===null&&Uf(e),n=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,Of(n,i)?s=null:o!==null&&Of(n,o)&&(e.flags|=32),Sv(t,e),qt(t,e,s,r),e.child;case 6:return t===null&&Uf(e),null;case 13:return Nv(t,e,r);case 4:return Zd(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Po(e,null,n,r):qt(t,e,n,r),e.child;case 11:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),L0(t,e,n,i,r);case 7:return qt(t,e,e.pendingProps,r),e.child;case 8:return qt(t,e,e.pendingProps.children,r),e.child;case 12:return qt(t,e,e.pendingProps.children,r),e.child;case 10:e:{if(n=e.type._context,i=e.pendingProps,o=e.memoizedProps,s=i.value,Qe(ja,n._currentValue),n._currentValue=s,o!==null)if(Vr(o.value,s)){if(o.children===i.children&&!er.current){e=Tn(t,e,r);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var l=o.dependencies;if(l!==null){s=o.child;for(var a=l.firstContext;a!==null;){if(a.context===n){if(o.tag===1){a=Pn(-1,r&-r),a.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?a.next=a:(a.next=c.next,c.next=a),u.pending=a}}o.lanes|=r,a=o.alternate,a!==null&&(a.lanes|=r),Ff(o.return,r,e),l.lanes|=r;break}a=a.next}}else if(o.tag===10)s=o.type===e.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(q(341));s.lanes|=r,l=s.alternate,l!==null&&(l.lanes|=r),Ff(s,r,e),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===e){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}qt(t,e,i.children,r),e=e.child}return e;case 9:return i=e.type,n=e.pendingProps.children,Eo(e,r),i=Nr(i),n=n(i),e.flags|=1,qt(t,e,n,r),e.child;case 14:return n=e.type,i=jr(n,e.pendingProps),i=jr(n.type,i),B0(t,e,n,i,r);case 15:return bv(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:jr(n,i),aa(t,e),e.tag=1,tr(n)?(t=!0,La(e)):t=!1,Eo(e,r),Xg(e,n,i),$f(e,n,i,r),Wf(null,e,n,!0,t,r);case 19:return Pv(t,e,r);case 22:return _v(t,e,r)}throw Error(q(156,e.tag))};function qv(t,e){return gg(t,e)}function bE(t,e,r,n){this.tag=t,this.key=r,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=n,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sr(t,e,r,n){return new bE(t,e,r,n)}function ph(t){return t=t.prototype,!(!t||!t.isReactComponent)}function _E(t){if(typeof t=="function")return ph(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Td)return 11;if(t===Od)return 14}return 2}function hi(t,e){var r=t.alternate;return r===null?(r=Sr(t.tag,e,t.key,t.mode),r.elementType=t.elementType,r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.type=t.type,r.flags=0,r.subtreeFlags=0,r.deletions=null),r.flags=t.flags&14680064,r.childLanes=t.childLanes,r.lanes=t.lanes,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,e=t.dependencies,r.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function fa(t,e,r,n,i,o){var s=2;if(n=t,typeof t=="function")ph(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case Zi:return Mi(r.children,i,o,e);case Rd:s=8,i|=8;break;case df:return t=Sr(12,r,e,i|2),t.elementType=df,t.lanes=o,t;case hf:return t=Sr(13,r,e,i),t.elementType=hf,t.lanes=o,t;case pf:return t=Sr(19,r,e,i),t.elementType=pf,t.lanes=o,t;case Zm:return bu(r,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Ym:s=10;break e;case Xm:s=9;break e;case Td:s=11;break e;case Od:s=14;break e;case Jn:s=16,n=null;break e}throw Error(q(130,t==null?t:typeof t,""))}return e=Sr(s,r,e,i),e.elementType=t,e.type=n,e.lanes=o,e}function Mi(t,e,r,n){return t=Sr(7,t,n,e),t.lanes=r,t}function bu(t,e,r,n){return t=Sr(22,t,n,e),t.elementType=Zm,t.lanes=r,t.stateNode={isHidden:!1},t}function Lc(t,e,r){return t=Sr(6,t,null,e),t.lanes=r,t}function Bc(t,e,r){return e=Sr(4,t.children!==null?t.children:[],t.key,e),e.lanes=r,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function SE(t,e,r,n,i){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=gc(0),this.expirationTimes=gc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=gc(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function mh(t,e,r,n,i,o,s,l,a){return t=new SE(t,e,r,l,a),e===1?(e=1,o===!0&&(e|=8)):e=0,o=Sr(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:n,isDehydrated:r,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xd(o),t}function kE(t,e,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Kv)}catch(t){console.error(t)}}Kv(),Gm.exports=gr;var Qs=Gm.exports,J0=Qs;cf.createRoot=J0.createRoot,cf.hydrateRoot=J0.hydrateRoot;/** + * @remix-run/router v1.14.2 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Js(){return Js=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function wh(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function RE(){return Math.random().toString(36).substr(2,8)}function X0(t,e){return{usr:t.state,key:t.key,idx:e}}function nd(t,e,r,n){return r===void 0&&(r=null),Js({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Ho(e):e,{state:r,key:e&&e.key||n||RE()})}function Qv(t){let{pathname:e="/",search:r="",hash:n=""}=t;return r&&r!=="?"&&(e+=r.charAt(0)==="?"?r:"?"+r),n&&n!=="#"&&(e+=n.charAt(0)==="#"?n:"#"+n),e}function Ho(t){let e={};if(t){let r=t.indexOf("#");r>=0&&(e.hash=t.substr(r),t=t.substr(0,r));let n=t.indexOf("?");n>=0&&(e.search=t.substr(n),t=t.substr(0,n)),t&&(e.pathname=t)}return e}function TE(t,e,r,n){n===void 0&&(n={});let{window:i=document.defaultView,v5Compat:o=!1}=n,s=i.history,l=ii.Pop,a=null,u=c();u==null&&(u=0,s.replaceState(Js({},s.state,{idx:u}),""));function c(){return(s.state||{idx:null}).idx}function d(){l=ii.Pop;let S=c(),E=S==null?null:S-u;u=S,a&&a({action:l,location:x.location,delta:E})}function p(S,E){l=ii.Push;let w=nd(x.location,S,E);r&&r(w,S),u=c()+1;let _=X0(w,u),O=x.createHref(w);try{s.pushState(_,"",O)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;i.location.assign(O)}o&&a&&a({action:l,location:x.location,delta:1})}function v(S,E){l=ii.Replace;let w=nd(x.location,S,E);r&&r(w,S),u=c();let _=X0(w,u),O=x.createHref(w);s.replaceState(_,"",O),o&&a&&a({action:l,location:x.location,delta:0})}function g(S){let E=i.location.origin!=="null"?i.location.origin:i.location.href,w=typeof S=="string"?S:Qv(S);return _t(E,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,E)}let x={get action(){return l},get location(){return t(i,s)},listen(S){if(a)throw new Error("A history only accepts one active listener");return i.addEventListener(Y0,d),a=S,()=>{i.removeEventListener(Y0,d),a=null}},createHref(S){return e(i,S)},createURL:g,encodeLocation(S){let E=g(S);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:p,replace:v,go(S){return s.go(S)}};return x}var Z0;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Z0||(Z0={}));function OE(t,e,r){r===void 0&&(r="/");let n=typeof e=="string"?Ho(e):e,i=Xv(n.pathname||"/",r);if(i==null)return null;let o=Jv(t);LE(o);let s=null;for(let l=0;s==null&&l{let a={relativePath:l===void 0?o.path||"":l,caseSensitive:o.caseSensitive===!0,childrenIndex:s,route:o};a.relativePath.startsWith("/")&&(_t(a.relativePath.startsWith(n),'Absolute route path "'+a.relativePath+'" nested under path '+('"'+n+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),a.relativePath=a.relativePath.slice(n.length));let u=Ii([n,a.relativePath]),c=r.concat(a);o.children&&o.children.length>0&&(_t(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),Jv(o.children,e,c,u)),!(o.path==null&&!o.index)&&e.push({path:u,score:$E(u,o.index),routesMeta:c})};return t.forEach((o,s)=>{var l;if(o.path===""||!((l=o.path)!=null&&l.includes("?")))i(o,s);else for(let a of Yv(o.path))i(o,s,a)}),e}function Yv(t){let e=t.split("/");if(e.length===0)return[];let[r,...n]=e,i=r.endsWith("?"),o=r.replace(/\?$/,"");if(n.length===0)return i?[o,""]:[o];let s=Yv(n.join("/")),l=[];return l.push(...s.map(a=>a===""?o:[o,a].join("/"))),i&&l.push(...s),l.map(a=>t.startsWith("/")&&a===""?"/":a)}function LE(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:HE(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const BE=/^:[\w-]+$/,DE=3,jE=2,UE=1,FE=10,zE=-2,ep=t=>t==="*";function $E(t,e){let r=t.split("/"),n=r.length;return r.some(ep)&&(n+=zE),e&&(n+=jE),r.filter(i=>!ep(i)).reduce((i,o)=>i+(BE.test(o)?DE:o===""?UE:FE),n)}function HE(t,e){return t.length===e.length&&t.slice(0,-1).every((n,i)=>n===e[i])?t[t.length-1]-e[e.length-1]:0}function qE(t,e){let{routesMeta:r}=t,n={},i="/",o=[];for(let s=0;s{let{paramName:p,isOptional:v}=c;if(p==="*"){let x=l[d]||"";s=o.slice(0,o.length-x.length).replace(/(.)\/+$/,"$1")}const g=l[d];return v&&!g?u[p]=void 0:u[p]=KE(g||"",p),u},{}),pathname:o,pathnameBase:s,pattern:t}}function GE(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),wh(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let n=[],i="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(s,l,a)=>(n.push({paramName:l,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(n.push({paramName:"*"}),i+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?i+="\\/*$":t!==""&&t!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,e?void 0:"i"),n]}function VE(t){try{return decodeURI(t)}catch(e){return wh(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function KE(t,e){try{return decodeURIComponent(t)}catch(r){return wh(!1,'The value for the URL param "'+e+'" will not be decoded because'+(' the string "'+t+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+r+").")),t}}function Xv(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let r=e.endsWith("/")?e.length-1:e.length,n=t.charAt(r);return n&&n!=="/"?null:t.slice(r)||"/"}function QE(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:i=""}=typeof t=="string"?Ho(t):t;return{pathname:r?r.startsWith("/")?r:JE(r,e):e,search:tx(n),hash:rx(i)}}function JE(t,e){let r=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(i=>{i===".."?r.length>1&&r.pop():i!=="."&&r.push(i)}),r.length>1?r.join("/"):"/"}function Dc(t,e,r,n){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(n)+"]. Please separate it out to the ")+("`to."+r+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function YE(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function XE(t,e){let r=YE(t);return e?r.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function ZE(t,e,r,n){n===void 0&&(n=!1);let i;typeof t=="string"?i=Ho(t):(i=Js({},t),_t(!i.pathname||!i.pathname.includes("?"),Dc("?","pathname","search",i)),_t(!i.pathname||!i.pathname.includes("#"),Dc("#","pathname","hash",i)),_t(!i.search||!i.search.includes("#"),Dc("#","search","hash",i)));let o=t===""||i.pathname==="",s=o?"/":i.pathname,l;if(s==null)l=r;else{let d=e.length-1;if(!n&&s.startsWith("..")){let p=s.split("/");for(;p[0]==="..";)p.shift(),d-=1;i.pathname=p.join("/")}l=d>=0?e[d]:"/"}let a=QE(i,l),u=s&&s!=="/"&&s.endsWith("/"),c=(o||s===".")&&r.endsWith("/");return!a.pathname.endsWith("/")&&(u||c)&&(a.pathname+="/"),a}const Ii=t=>t.join("/").replace(/\/\/+/g,"/"),ex=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),tx=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,rx=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function nx(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const Zv=["post","put","patch","delete"];new Set(Zv);const ix=["get",...Zv];new Set(ix);/** + * React Router v6.21.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function Ys(){return Ys=Object.assign?Object.assign.bind():function(t){for(var e=1;e{l.current=!0}),L.useCallback(function(u,c){if(c===void 0&&(c={}),!l.current)return;if(typeof u=="number"){n.go(u);return}let d=ZE(u,JSON.parse(s),o,c.relative==="path");t==null&&e!=="/"&&(d.pathname=d.pathname==="/"?e:Ii([e,d.pathname])),(c.replace?n.replace:n.push)(d,c.state,c)},[e,n,s,o,t])}function lx(){let{matches:t}=L.useContext($i),e=t[t.length-1];return e?e.params:{}}function ax(t,e){return ux(t,e)}function ux(t,e,r,n){Mu()||_t(!1);let{navigator:i}=L.useContext(Pu),{matches:o}=L.useContext($i),s=o[o.length-1],l=s?s.params:{};s&&s.pathname;let a=s?s.pathnameBase:"/";s&&s.route;let u=xh(),c;if(e){var d;let S=typeof e=="string"?Ho(e):e;a==="/"||(d=S.pathname)!=null&&d.startsWith(a)||_t(!1),c=S}else c=u;let p=c.pathname||"/",v=a==="/"?p:p.slice(a.length)||"/",g=OE(t,{pathname:v}),x=px(g&&g.map(S=>Object.assign({},S,{params:Object.assign({},l,S.params),pathname:Ii([a,i.encodeLocation?i.encodeLocation(S.pathname).pathname:S.pathname]),pathnameBase:S.pathnameBase==="/"?a:Ii([a,i.encodeLocation?i.encodeLocation(S.pathnameBase).pathname:S.pathnameBase])})),o,r,n);return e&&x?L.createElement(Cu.Provider,{value:{location:Ys({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:ii.Pop}},x):x}function cx(){let t=yx(),e=nx(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),r=t instanceof Error?t.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},o=null;return L.createElement(L.Fragment,null,L.createElement("h2",null,"Unexpected Application Error!"),L.createElement("h3",{style:{fontStyle:"italic"}},e),r?L.createElement("pre",{style:i},r):null,o)}const fx=L.createElement(cx,null);class dx extends L.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,r){return r.location!==e.location||r.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:r.error,location:r.location,revalidation:e.revalidation||r.revalidation}}componentDidCatch(e,r){console.error("React Router caught the following error during render",e,r)}render(){return this.state.error!==void 0?L.createElement($i.Provider,{value:this.props.routeContext},L.createElement(ey.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function hx(t){let{routeContext:e,match:r,children:n}=t,i=L.useContext(Eh);return i&&i.static&&i.staticContext&&(r.route.errorElement||r.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=r.route.id),L.createElement($i.Provider,{value:e},n)}function px(t,e,r,n){var i;if(e===void 0&&(e=[]),r===void 0&&(r=null),n===void 0&&(n=null),t==null){var o;if((o=r)!=null&&o.errors)t=r.matches;else return null}let s=t,l=(i=r)==null?void 0:i.errors;if(l!=null){let c=s.findIndex(d=>d.route.id&&(l==null?void 0:l[d.route.id]));c>=0||_t(!1),s=s.slice(0,Math.min(s.length,c+1))}let a=!1,u=-1;if(r&&n&&n.v7_partialHydration)for(let c=0;c=0?s=s.slice(0,u+1):s=[s[0]];break}}}return s.reduceRight((c,d,p)=>{let v,g=!1,x=null,S=null;r&&(v=l&&d.route.id?l[d.route.id]:void 0,x=d.route.errorElement||fx,a&&(u<0&&p===0?(Ex("route-fallback",!1),g=!0,S=null):u===p&&(g=!0,S=d.route.hydrateFallbackElement||null)));let E=e.concat(s.slice(0,p+1)),w=()=>{let _;return v?_=x:g?_=S:d.route.Component?_=L.createElement(d.route.Component,null):d.route.element?_=d.route.element:_=c,L.createElement(hx,{match:d,routeContext:{outlet:c,matches:E,isDataRoute:r!=null},children:_})};return r&&(d.route.ErrorBoundary||d.route.errorElement||p===0)?L.createElement(dx,{location:r.location,revalidation:r.revalidation,component:x,error:v,children:w(),routeContext:{outlet:null,matches:E,isDataRoute:!0}}):w()},null)}var ry=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(ry||{}),Qa=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(Qa||{});function mx(t){let e=L.useContext(Eh);return e||_t(!1),e}function gx(t){let e=L.useContext(ox);return e||_t(!1),e}function vx(t){let e=L.useContext($i);return e||_t(!1),e}function ny(t){let e=vx(),r=e.matches[e.matches.length-1];return r.route.id||_t(!1),r.route.id}function yx(){var t;let e=L.useContext(ey),r=gx(Qa.UseRouteError),n=ny(Qa.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function wx(){let{router:t}=mx(ry.UseNavigateStable),e=ny(Qa.UseNavigateStable),r=L.useRef(!1);return ty(()=>{r.current=!0}),L.useCallback(function(i,o){o===void 0&&(o={}),r.current&&(typeof i=="number"?t.navigate(i):t.navigate(i,Ys({fromRouteId:e},o)))},[t,e])}const tp={};function Ex(t,e,r){!e&&!tp[t]&&(tp[t]=!0)}function ms(t){_t(!1)}function xx(t){let{basename:e="/",children:r=null,location:n,navigationType:i=ii.Pop,navigator:o,static:s=!1,future:l}=t;Mu()&&_t(!1);let a=e.replace(/^\/*/,"/"),u=L.useMemo(()=>({basename:a,navigator:o,static:s,future:Ys({v7_relativeSplatPath:!1},l)}),[a,l,o,s]);typeof n=="string"&&(n=Ho(n));let{pathname:c="/",search:d="",hash:p="",state:v=null,key:g="default"}=n,x=L.useMemo(()=>{let S=Xv(c,a);return S==null?null:{location:{pathname:S,search:d,hash:p,state:v,key:g},navigationType:i}},[a,c,d,p,v,g,i]);return x==null?null:L.createElement(Pu.Provider,{value:u},L.createElement(Cu.Provider,{children:r,value:x}))}function Ax(t){let{children:e,location:r}=t;return ax(id(e),r)}new Promise(()=>{});function id(t,e){e===void 0&&(e=[]);let r=[];return L.Children.forEach(t,(n,i)=>{if(!L.isValidElement(n))return;let o=[...e,i];if(n.type===L.Fragment){r.push.apply(r,id(n.props.children,o));return}n.type!==ms&&_t(!1),!n.props.index||!n.props.children||_t(!1);let s={id:n.props.id||o.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(s.children=id(n.props.children,o)),r.push(s)}),r}/** + * React Router DOM v6.21.3 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */const bx="startTransition",rp=xw[bx];function _x(t){let{basename:e,children:r,future:n,window:i}=t,o=L.useRef();o.current==null&&(o.current=IE({window:i,v5Compat:!0}));let s=o.current,[l,a]=L.useState({action:s.action,location:s.location}),{v7_startTransition:u}=n||{},c=L.useCallback(d=>{u&&rp?rp(()=>a(d)):a(d)},[a,u]);return L.useLayoutEffect(()=>s.listen(c),[s,c]),L.createElement(xx,{basename:e,children:r,location:l.location,navigationType:l.action,navigator:s,future:n})}var np;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(np||(np={}));var ip;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(ip||(ip={}));var Ah={exports:{}};const Sx={},kx=Object.freeze(Object.defineProperty({__proto__:null,default:Sx},Symbol.toStringTag,{value:"Module"})),Nx=Uo(kx);Ah.exports;(function(t){(function(e,r){function n(C,f){if(!C)throw new Error(f||"Assertion failed")}function i(C,f){C.super_=f;var m=function(){};m.prototype=f.prototype,C.prototype=new m,C.prototype.constructor=C}function o(C,f,m){if(o.isBN(C))return C;this.negative=0,this.words=null,this.length=0,this.red=null,C!==null&&((f==="le"||f==="be")&&(m=f,f=10),this._init(C||0,f||10,m||"be"))}typeof e=="object"?e.exports=o:r.BN=o,o.BN=o,o.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=Nx.Buffer}catch{}o.isBN=function(f){return f instanceof o?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===o.wordSize&&Array.isArray(f.words)},o.max=function(f,m){return f.cmp(m)>0?f:m},o.min=function(f,m){return f.cmp(m)<0?f:m},o.prototype._init=function(f,m,A){if(typeof f=="number")return this._initNumber(f,m,A);if(typeof f=="object")return this._initArray(f,m,A);m==="hex"&&(m=16),n(m===(m|0)&&m>=2&&m<=36),f=f.toString().replace(/\s+/g,"");var N=0;f[0]==="-"&&(N++,this.negative=1),N=0;N-=3)M=f[N]|f[N-1]<<8|f[N-2]<<16,this.words[b]|=M<>>26-R&67108863,R+=24,R>=26&&(R-=26,b++);else if(A==="le")for(N=0,b=0;N>>26-R&67108863,R+=24,R>=26&&(R-=26,b++);return this._strip()};function l(C,f){var m=C.charCodeAt(f);if(m>=48&&m<=57)return m-48;if(m>=65&&m<=70)return m-55;if(m>=97&&m<=102)return m-87;n(!1,"Invalid character in "+C)}function a(C,f,m){var A=l(C,m);return m-1>=f&&(A|=l(C,m-1)<<4),A}o.prototype._parseHex=function(f,m,A){this.length=Math.ceil((f.length-m)/6),this.words=new Array(this.length);for(var N=0;N=m;N-=2)R=a(f,m,N)<=18?(b-=18,M+=1,this.words[M]|=R>>>26):b+=8;else{var k=f.length-m;for(N=k%2===0?m+1:m;N=18?(b-=18,M+=1,this.words[M]|=R>>>26):b+=8}this._strip()};function u(C,f,m,A){for(var N=0,b=0,M=Math.min(C.length,m),R=f;R=49?b=k-49+10:k>=17?b=k-17+10:b=k,n(k>=0&&b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=d}catch{o.prototype.inspect=d}else o.prototype.inspect=d;function d(){return(this.red?""}var p=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],v=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],g=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(f,m){f=f||10,m=m|0||1;var A;if(f===16||f==="hex"){A="";for(var N=0,b=0,M=0;M>>24-N&16777215,N+=2,N>=26&&(N-=26,M--),b!==0||M!==this.length-1?A=p[6-k.length]+k+A:A=k+A}for(b!==0&&(A=b.toString(16)+A);A.length%m!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}if(f===(f|0)&&f>=2&&f<=36){var h=v[f],P=g[f];A="";var te=this.clone();for(te.negative=0;!te.isZero();){var y=te.modrn(P).toString(f);te=te.idivn(P),te.isZero()?A=y+A:A=p[h-y.length]+y+A}for(this.isZero()&&(A="0"+A);A.length%m!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(f,m){return this.toArrayLike(s,f,m)}),o.prototype.toArray=function(f,m){return this.toArrayLike(Array,f,m)};var x=function(f,m){return f.allocUnsafe?f.allocUnsafe(m):new f(m)};o.prototype.toArrayLike=function(f,m,A){this._strip();var N=this.byteLength(),b=A||Math.max(1,N);n(N<=b,"byte array longer than desired length"),n(b>0,"Requested array length <= 0");var M=x(f,b),R=m==="le"?"LE":"BE";return this["_toArrayLike"+R](M,N),M},o.prototype._toArrayLikeLE=function(f,m){for(var A=0,N=0,b=0,M=0;b>8&255),A>16&255),M===6?(A>24&255),N=0,M=0):(N=R>>>24,M+=2)}if(A=0&&(f[A--]=R>>8&255),A>=0&&(f[A--]=R>>16&255),M===6?(A>=0&&(f[A--]=R>>24&255),N=0,M=0):(N=R>>>24,M+=2)}if(A>=0)for(f[A--]=N;A>=0;)f[A--]=0},Math.clz32?o.prototype._countBits=function(f){return 32-Math.clz32(f)}:o.prototype._countBits=function(f){var m=f,A=0;return m>=4096&&(A+=13,m>>>=13),m>=64&&(A+=7,m>>>=7),m>=8&&(A+=4,m>>>=4),m>=2&&(A+=2,m>>>=2),A+m},o.prototype._zeroBits=function(f){if(f===0)return 26;var m=f,A=0;return m&8191||(A+=13,m>>>=13),m&127||(A+=7,m>>>=7),m&15||(A+=4,m>>>=4),m&3||(A+=2,m>>>=2),m&1||A++,A},o.prototype.bitLength=function(){var f=this.words[this.length-1],m=this._countBits(f);return(this.length-1)*26+m};function S(C){for(var f=new Array(C.bitLength()),m=0;m>>N&1}return f}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,m=0;mf.length?this.clone().ior(f):f.clone().ior(this)},o.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},o.prototype.iuand=function(f){var m;this.length>f.length?m=f:m=this;for(var A=0;Af.length?this.clone().iand(f):f.clone().iand(this)},o.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},o.prototype.iuxor=function(f){var m,A;this.length>f.length?(m=this,A=f):(m=f,A=this);for(var N=0;Nf.length?this.clone().ixor(f):f.clone().ixor(this)},o.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},o.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var m=Math.ceil(f/26)|0,A=f%26;this._expand(m),A>0&&m--;for(var N=0;N0&&(this.words[N]=~this.words[N]&67108863>>26-A),this._strip()},o.prototype.notn=function(f){return this.clone().inotn(f)},o.prototype.setn=function(f,m){n(typeof f=="number"&&f>=0);var A=f/26|0,N=f%26;return this._expand(A+1),m?this.words[A]=this.words[A]|1<f.length?(A=this,N=f):(A=f,N=this);for(var b=0,M=0;M>>26;for(;b!==0&&M>>26;if(this.length=A.length,b!==0)this.words[this.length]=b,this.length++;else if(A!==this)for(;Mf.length?this.clone().iadd(f):f.clone().iadd(this)},o.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var m=this.iadd(f);return f.negative=1,m._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var A=this.cmp(f);if(A===0)return this.negative=0,this.length=1,this.words[0]=0,this;var N,b;A>0?(N=this,b=f):(N=f,b=this);for(var M=0,R=0;R>26,this.words[R]=m&67108863;for(;M!==0&&R>26,this.words[R]=m&67108863;if(M===0&&R>>26,te=k&67108863,y=Math.min(h,f.length-1),D=Math.max(0,h-C.length+1);D<=y;D++){var U=h-D|0;N=C.words[U]|0,b=f.words[D]|0,M=N*b+te,P+=M/67108864|0,te=M&67108863}m.words[h]=te|0,k=P|0}return k!==0?m.words[h]=k|0:m.length--,m._strip()}var w=function(f,m,A){var N=f.words,b=m.words,M=A.words,R=0,k,h,P,te=N[0]|0,y=te&8191,D=te>>>13,U=N[1]|0,F=U&8191,W=U>>>13,oe=N[2]|0,X=oe&8191,Q=oe>>>13,Je=N[3]|0,J=Je&8191,le=Je>>>13,Qr=N[4]|0,Te=Qr&8191,Ne=Qr>>>13,Jr=N[5]|0,Pe=Jr&8191,ce=Jr>>>13,wr=N[6]|0,fe=wr&8191,Oe=wr>>>13,Yr=N[7]|0,me=Yr&8191,ze=Yr>>>13,gn=N[8]|0,$e=gn&8191,He=gn>>>13,Ht=N[9]|0,Le=Ht&8191,qe=Ht>>>13,Rr=b[0]|0,Ce=Rr&8191,We=Rr>>>13,vn=b[1]|0,Be=vn&8191,Ge=vn>>>13,yn=b[2]|0,De=yn&8191,ne=yn>>>13,ot=b[3]|0,ge=ot&8191,de=ot>>>13,rt=b[4]|0,be=rt&8191,_e=rt>>>13,Ct=b[5]|0,Me=Ct&8191,je=Ct>>>13,Kt=b[6]|0,Ve=Kt&8191,Ke=Kt>>>13,Qt=b[7]|0,Ie=Qt&8191,Ue=Qt>>>13,Er=b[8]|0,ke=Er&8191,Ye=Er>>>13,Ai=b[9]|0,Xe=Ai&8191,Ze=Ai>>>13;A.negative=f.negative^m.negative,A.length=19,k=Math.imul(y,Ce),h=Math.imul(y,We),h=h+Math.imul(D,Ce)|0,P=Math.imul(D,We);var $n=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+($n>>>26)|0,$n&=67108863,k=Math.imul(F,Ce),h=Math.imul(F,We),h=h+Math.imul(W,Ce)|0,P=Math.imul(W,We),k=k+Math.imul(y,Be)|0,h=h+Math.imul(y,Ge)|0,h=h+Math.imul(D,Be)|0,P=P+Math.imul(D,Ge)|0;var Hn=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Hn>>>26)|0,Hn&=67108863,k=Math.imul(X,Ce),h=Math.imul(X,We),h=h+Math.imul(Q,Ce)|0,P=Math.imul(Q,We),k=k+Math.imul(F,Be)|0,h=h+Math.imul(F,Ge)|0,h=h+Math.imul(W,Be)|0,P=P+Math.imul(W,Ge)|0,k=k+Math.imul(y,De)|0,h=h+Math.imul(y,ne)|0,h=h+Math.imul(D,De)|0,P=P+Math.imul(D,ne)|0;var qn=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(qn>>>26)|0,qn&=67108863,k=Math.imul(J,Ce),h=Math.imul(J,We),h=h+Math.imul(le,Ce)|0,P=Math.imul(le,We),k=k+Math.imul(X,Be)|0,h=h+Math.imul(X,Ge)|0,h=h+Math.imul(Q,Be)|0,P=P+Math.imul(Q,Ge)|0,k=k+Math.imul(F,De)|0,h=h+Math.imul(F,ne)|0,h=h+Math.imul(W,De)|0,P=P+Math.imul(W,ne)|0,k=k+Math.imul(y,ge)|0,h=h+Math.imul(y,de)|0,h=h+Math.imul(D,ge)|0,P=P+Math.imul(D,de)|0;var Wn=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,k=Math.imul(Te,Ce),h=Math.imul(Te,We),h=h+Math.imul(Ne,Ce)|0,P=Math.imul(Ne,We),k=k+Math.imul(J,Be)|0,h=h+Math.imul(J,Ge)|0,h=h+Math.imul(le,Be)|0,P=P+Math.imul(le,Ge)|0,k=k+Math.imul(X,De)|0,h=h+Math.imul(X,ne)|0,h=h+Math.imul(Q,De)|0,P=P+Math.imul(Q,ne)|0,k=k+Math.imul(F,ge)|0,h=h+Math.imul(F,de)|0,h=h+Math.imul(W,ge)|0,P=P+Math.imul(W,de)|0,k=k+Math.imul(y,be)|0,h=h+Math.imul(y,_e)|0,h=h+Math.imul(D,be)|0,P=P+Math.imul(D,_e)|0;var Gn=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Gn>>>26)|0,Gn&=67108863,k=Math.imul(Pe,Ce),h=Math.imul(Pe,We),h=h+Math.imul(ce,Ce)|0,P=Math.imul(ce,We),k=k+Math.imul(Te,Be)|0,h=h+Math.imul(Te,Ge)|0,h=h+Math.imul(Ne,Be)|0,P=P+Math.imul(Ne,Ge)|0,k=k+Math.imul(J,De)|0,h=h+Math.imul(J,ne)|0,h=h+Math.imul(le,De)|0,P=P+Math.imul(le,ne)|0,k=k+Math.imul(X,ge)|0,h=h+Math.imul(X,de)|0,h=h+Math.imul(Q,ge)|0,P=P+Math.imul(Q,de)|0,k=k+Math.imul(F,be)|0,h=h+Math.imul(F,_e)|0,h=h+Math.imul(W,be)|0,P=P+Math.imul(W,_e)|0,k=k+Math.imul(y,Me)|0,h=h+Math.imul(y,je)|0,h=h+Math.imul(D,Me)|0,P=P+Math.imul(D,je)|0;var Yu=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Yu>>>26)|0,Yu&=67108863,k=Math.imul(fe,Ce),h=Math.imul(fe,We),h=h+Math.imul(Oe,Ce)|0,P=Math.imul(Oe,We),k=k+Math.imul(Pe,Be)|0,h=h+Math.imul(Pe,Ge)|0,h=h+Math.imul(ce,Be)|0,P=P+Math.imul(ce,Ge)|0,k=k+Math.imul(Te,De)|0,h=h+Math.imul(Te,ne)|0,h=h+Math.imul(Ne,De)|0,P=P+Math.imul(Ne,ne)|0,k=k+Math.imul(J,ge)|0,h=h+Math.imul(J,de)|0,h=h+Math.imul(le,ge)|0,P=P+Math.imul(le,de)|0,k=k+Math.imul(X,be)|0,h=h+Math.imul(X,_e)|0,h=h+Math.imul(Q,be)|0,P=P+Math.imul(Q,_e)|0,k=k+Math.imul(F,Me)|0,h=h+Math.imul(F,je)|0,h=h+Math.imul(W,Me)|0,P=P+Math.imul(W,je)|0,k=k+Math.imul(y,Ve)|0,h=h+Math.imul(y,Ke)|0,h=h+Math.imul(D,Ve)|0,P=P+Math.imul(D,Ke)|0;var Xu=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,k=Math.imul(me,Ce),h=Math.imul(me,We),h=h+Math.imul(ze,Ce)|0,P=Math.imul(ze,We),k=k+Math.imul(fe,Be)|0,h=h+Math.imul(fe,Ge)|0,h=h+Math.imul(Oe,Be)|0,P=P+Math.imul(Oe,Ge)|0,k=k+Math.imul(Pe,De)|0,h=h+Math.imul(Pe,ne)|0,h=h+Math.imul(ce,De)|0,P=P+Math.imul(ce,ne)|0,k=k+Math.imul(Te,ge)|0,h=h+Math.imul(Te,de)|0,h=h+Math.imul(Ne,ge)|0,P=P+Math.imul(Ne,de)|0,k=k+Math.imul(J,be)|0,h=h+Math.imul(J,_e)|0,h=h+Math.imul(le,be)|0,P=P+Math.imul(le,_e)|0,k=k+Math.imul(X,Me)|0,h=h+Math.imul(X,je)|0,h=h+Math.imul(Q,Me)|0,P=P+Math.imul(Q,je)|0,k=k+Math.imul(F,Ve)|0,h=h+Math.imul(F,Ke)|0,h=h+Math.imul(W,Ve)|0,P=P+Math.imul(W,Ke)|0,k=k+Math.imul(y,Ie)|0,h=h+Math.imul(y,Ue)|0,h=h+Math.imul(D,Ie)|0,P=P+Math.imul(D,Ue)|0;var Zu=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(Zu>>>26)|0,Zu&=67108863,k=Math.imul($e,Ce),h=Math.imul($e,We),h=h+Math.imul(He,Ce)|0,P=Math.imul(He,We),k=k+Math.imul(me,Be)|0,h=h+Math.imul(me,Ge)|0,h=h+Math.imul(ze,Be)|0,P=P+Math.imul(ze,Ge)|0,k=k+Math.imul(fe,De)|0,h=h+Math.imul(fe,ne)|0,h=h+Math.imul(Oe,De)|0,P=P+Math.imul(Oe,ne)|0,k=k+Math.imul(Pe,ge)|0,h=h+Math.imul(Pe,de)|0,h=h+Math.imul(ce,ge)|0,P=P+Math.imul(ce,de)|0,k=k+Math.imul(Te,be)|0,h=h+Math.imul(Te,_e)|0,h=h+Math.imul(Ne,be)|0,P=P+Math.imul(Ne,_e)|0,k=k+Math.imul(J,Me)|0,h=h+Math.imul(J,je)|0,h=h+Math.imul(le,Me)|0,P=P+Math.imul(le,je)|0,k=k+Math.imul(X,Ve)|0,h=h+Math.imul(X,Ke)|0,h=h+Math.imul(Q,Ve)|0,P=P+Math.imul(Q,Ke)|0,k=k+Math.imul(F,Ie)|0,h=h+Math.imul(F,Ue)|0,h=h+Math.imul(W,Ie)|0,P=P+Math.imul(W,Ue)|0,k=k+Math.imul(y,ke)|0,h=h+Math.imul(y,Ye)|0,h=h+Math.imul(D,ke)|0,P=P+Math.imul(D,Ye)|0;var ec=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ec>>>26)|0,ec&=67108863,k=Math.imul(Le,Ce),h=Math.imul(Le,We),h=h+Math.imul(qe,Ce)|0,P=Math.imul(qe,We),k=k+Math.imul($e,Be)|0,h=h+Math.imul($e,Ge)|0,h=h+Math.imul(He,Be)|0,P=P+Math.imul(He,Ge)|0,k=k+Math.imul(me,De)|0,h=h+Math.imul(me,ne)|0,h=h+Math.imul(ze,De)|0,P=P+Math.imul(ze,ne)|0,k=k+Math.imul(fe,ge)|0,h=h+Math.imul(fe,de)|0,h=h+Math.imul(Oe,ge)|0,P=P+Math.imul(Oe,de)|0,k=k+Math.imul(Pe,be)|0,h=h+Math.imul(Pe,_e)|0,h=h+Math.imul(ce,be)|0,P=P+Math.imul(ce,_e)|0,k=k+Math.imul(Te,Me)|0,h=h+Math.imul(Te,je)|0,h=h+Math.imul(Ne,Me)|0,P=P+Math.imul(Ne,je)|0,k=k+Math.imul(J,Ve)|0,h=h+Math.imul(J,Ke)|0,h=h+Math.imul(le,Ve)|0,P=P+Math.imul(le,Ke)|0,k=k+Math.imul(X,Ie)|0,h=h+Math.imul(X,Ue)|0,h=h+Math.imul(Q,Ie)|0,P=P+Math.imul(Q,Ue)|0,k=k+Math.imul(F,ke)|0,h=h+Math.imul(F,Ye)|0,h=h+Math.imul(W,ke)|0,P=P+Math.imul(W,Ye)|0,k=k+Math.imul(y,Xe)|0,h=h+Math.imul(y,Ze)|0,h=h+Math.imul(D,Xe)|0,P=P+Math.imul(D,Ze)|0;var tc=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(tc>>>26)|0,tc&=67108863,k=Math.imul(Le,Be),h=Math.imul(Le,Ge),h=h+Math.imul(qe,Be)|0,P=Math.imul(qe,Ge),k=k+Math.imul($e,De)|0,h=h+Math.imul($e,ne)|0,h=h+Math.imul(He,De)|0,P=P+Math.imul(He,ne)|0,k=k+Math.imul(me,ge)|0,h=h+Math.imul(me,de)|0,h=h+Math.imul(ze,ge)|0,P=P+Math.imul(ze,de)|0,k=k+Math.imul(fe,be)|0,h=h+Math.imul(fe,_e)|0,h=h+Math.imul(Oe,be)|0,P=P+Math.imul(Oe,_e)|0,k=k+Math.imul(Pe,Me)|0,h=h+Math.imul(Pe,je)|0,h=h+Math.imul(ce,Me)|0,P=P+Math.imul(ce,je)|0,k=k+Math.imul(Te,Ve)|0,h=h+Math.imul(Te,Ke)|0,h=h+Math.imul(Ne,Ve)|0,P=P+Math.imul(Ne,Ke)|0,k=k+Math.imul(J,Ie)|0,h=h+Math.imul(J,Ue)|0,h=h+Math.imul(le,Ie)|0,P=P+Math.imul(le,Ue)|0,k=k+Math.imul(X,ke)|0,h=h+Math.imul(X,Ye)|0,h=h+Math.imul(Q,ke)|0,P=P+Math.imul(Q,Ye)|0,k=k+Math.imul(F,Xe)|0,h=h+Math.imul(F,Ze)|0,h=h+Math.imul(W,Xe)|0,P=P+Math.imul(W,Ze)|0;var rc=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(rc>>>26)|0,rc&=67108863,k=Math.imul(Le,De),h=Math.imul(Le,ne),h=h+Math.imul(qe,De)|0,P=Math.imul(qe,ne),k=k+Math.imul($e,ge)|0,h=h+Math.imul($e,de)|0,h=h+Math.imul(He,ge)|0,P=P+Math.imul(He,de)|0,k=k+Math.imul(me,be)|0,h=h+Math.imul(me,_e)|0,h=h+Math.imul(ze,be)|0,P=P+Math.imul(ze,_e)|0,k=k+Math.imul(fe,Me)|0,h=h+Math.imul(fe,je)|0,h=h+Math.imul(Oe,Me)|0,P=P+Math.imul(Oe,je)|0,k=k+Math.imul(Pe,Ve)|0,h=h+Math.imul(Pe,Ke)|0,h=h+Math.imul(ce,Ve)|0,P=P+Math.imul(ce,Ke)|0,k=k+Math.imul(Te,Ie)|0,h=h+Math.imul(Te,Ue)|0,h=h+Math.imul(Ne,Ie)|0,P=P+Math.imul(Ne,Ue)|0,k=k+Math.imul(J,ke)|0,h=h+Math.imul(J,Ye)|0,h=h+Math.imul(le,ke)|0,P=P+Math.imul(le,Ye)|0,k=k+Math.imul(X,Xe)|0,h=h+Math.imul(X,Ze)|0,h=h+Math.imul(Q,Xe)|0,P=P+Math.imul(Q,Ze)|0;var nc=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(nc>>>26)|0,nc&=67108863,k=Math.imul(Le,ge),h=Math.imul(Le,de),h=h+Math.imul(qe,ge)|0,P=Math.imul(qe,de),k=k+Math.imul($e,be)|0,h=h+Math.imul($e,_e)|0,h=h+Math.imul(He,be)|0,P=P+Math.imul(He,_e)|0,k=k+Math.imul(me,Me)|0,h=h+Math.imul(me,je)|0,h=h+Math.imul(ze,Me)|0,P=P+Math.imul(ze,je)|0,k=k+Math.imul(fe,Ve)|0,h=h+Math.imul(fe,Ke)|0,h=h+Math.imul(Oe,Ve)|0,P=P+Math.imul(Oe,Ke)|0,k=k+Math.imul(Pe,Ie)|0,h=h+Math.imul(Pe,Ue)|0,h=h+Math.imul(ce,Ie)|0,P=P+Math.imul(ce,Ue)|0,k=k+Math.imul(Te,ke)|0,h=h+Math.imul(Te,Ye)|0,h=h+Math.imul(Ne,ke)|0,P=P+Math.imul(Ne,Ye)|0,k=k+Math.imul(J,Xe)|0,h=h+Math.imul(J,Ze)|0,h=h+Math.imul(le,Xe)|0,P=P+Math.imul(le,Ze)|0;var ic=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ic>>>26)|0,ic&=67108863,k=Math.imul(Le,be),h=Math.imul(Le,_e),h=h+Math.imul(qe,be)|0,P=Math.imul(qe,_e),k=k+Math.imul($e,Me)|0,h=h+Math.imul($e,je)|0,h=h+Math.imul(He,Me)|0,P=P+Math.imul(He,je)|0,k=k+Math.imul(me,Ve)|0,h=h+Math.imul(me,Ke)|0,h=h+Math.imul(ze,Ve)|0,P=P+Math.imul(ze,Ke)|0,k=k+Math.imul(fe,Ie)|0,h=h+Math.imul(fe,Ue)|0,h=h+Math.imul(Oe,Ie)|0,P=P+Math.imul(Oe,Ue)|0,k=k+Math.imul(Pe,ke)|0,h=h+Math.imul(Pe,Ye)|0,h=h+Math.imul(ce,ke)|0,P=P+Math.imul(ce,Ye)|0,k=k+Math.imul(Te,Xe)|0,h=h+Math.imul(Te,Ze)|0,h=h+Math.imul(Ne,Xe)|0,P=P+Math.imul(Ne,Ze)|0;var oc=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(oc>>>26)|0,oc&=67108863,k=Math.imul(Le,Me),h=Math.imul(Le,je),h=h+Math.imul(qe,Me)|0,P=Math.imul(qe,je),k=k+Math.imul($e,Ve)|0,h=h+Math.imul($e,Ke)|0,h=h+Math.imul(He,Ve)|0,P=P+Math.imul(He,Ke)|0,k=k+Math.imul(me,Ie)|0,h=h+Math.imul(me,Ue)|0,h=h+Math.imul(ze,Ie)|0,P=P+Math.imul(ze,Ue)|0,k=k+Math.imul(fe,ke)|0,h=h+Math.imul(fe,Ye)|0,h=h+Math.imul(Oe,ke)|0,P=P+Math.imul(Oe,Ye)|0,k=k+Math.imul(Pe,Xe)|0,h=h+Math.imul(Pe,Ze)|0,h=h+Math.imul(ce,Xe)|0,P=P+Math.imul(ce,Ze)|0;var sc=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(sc>>>26)|0,sc&=67108863,k=Math.imul(Le,Ve),h=Math.imul(Le,Ke),h=h+Math.imul(qe,Ve)|0,P=Math.imul(qe,Ke),k=k+Math.imul($e,Ie)|0,h=h+Math.imul($e,Ue)|0,h=h+Math.imul(He,Ie)|0,P=P+Math.imul(He,Ue)|0,k=k+Math.imul(me,ke)|0,h=h+Math.imul(me,Ye)|0,h=h+Math.imul(ze,ke)|0,P=P+Math.imul(ze,Ye)|0,k=k+Math.imul(fe,Xe)|0,h=h+Math.imul(fe,Ze)|0,h=h+Math.imul(Oe,Xe)|0,P=P+Math.imul(Oe,Ze)|0;var lc=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(lc>>>26)|0,lc&=67108863,k=Math.imul(Le,Ie),h=Math.imul(Le,Ue),h=h+Math.imul(qe,Ie)|0,P=Math.imul(qe,Ue),k=k+Math.imul($e,ke)|0,h=h+Math.imul($e,Ye)|0,h=h+Math.imul(He,ke)|0,P=P+Math.imul(He,Ye)|0,k=k+Math.imul(me,Xe)|0,h=h+Math.imul(me,Ze)|0,h=h+Math.imul(ze,Xe)|0,P=P+Math.imul(ze,Ze)|0;var ac=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(ac>>>26)|0,ac&=67108863,k=Math.imul(Le,ke),h=Math.imul(Le,Ye),h=h+Math.imul(qe,ke)|0,P=Math.imul(qe,Ye),k=k+Math.imul($e,Xe)|0,h=h+Math.imul($e,Ze)|0,h=h+Math.imul(He,Xe)|0,P=P+Math.imul(He,Ze)|0;var uc=(R+k|0)+((h&8191)<<13)|0;R=(P+(h>>>13)|0)+(uc>>>26)|0,uc&=67108863,k=Math.imul(Le,Xe),h=Math.imul(Le,Ze),h=h+Math.imul(qe,Xe)|0,P=Math.imul(qe,Ze);var cc=(R+k|0)+((h&8191)<<13)|0;return R=(P+(h>>>13)|0)+(cc>>>26)|0,cc&=67108863,M[0]=$n,M[1]=Hn,M[2]=qn,M[3]=Wn,M[4]=Gn,M[5]=Yu,M[6]=Xu,M[7]=Zu,M[8]=ec,M[9]=tc,M[10]=rc,M[11]=nc,M[12]=ic,M[13]=oc,M[14]=sc,M[15]=lc,M[16]=ac,M[17]=uc,M[18]=cc,R!==0&&(M[19]=R,A.length++),A};Math.imul||(w=E);function _(C,f,m){m.negative=f.negative^C.negative,m.length=C.length+f.length;for(var A=0,N=0,b=0;b>>26)|0,N+=M>>>26,M&=67108863}m.words[b]=R,A=M,M=N}return A!==0?m.words[b]=A:m.length--,m._strip()}function O(C,f,m){return _(C,f,m)}o.prototype.mulTo=function(f,m){var A,N=this.length+f.length;return this.length===10&&f.length===10?A=w(this,f,m):N<63?A=E(this,f,m):N<1024?A=_(this,f,m):A=O(this,f,m),A},o.prototype.mul=function(f){var m=new o(null);return m.words=new Array(this.length+f.length),this.mulTo(f,m)},o.prototype.mulf=function(f){var m=new o(null);return m.words=new Array(this.length+f.length),O(this,f,m)},o.prototype.imul=function(f){return this.clone().mulTo(f,this)},o.prototype.imuln=function(f){var m=f<0;m&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var A=0,N=0;N>=26,A+=b/67108864|0,A+=M>>>26,this.words[N]=M&67108863}return A!==0&&(this.words[N]=A,this.length++),m?this.ineg():this},o.prototype.muln=function(f){return this.clone().imuln(f)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(f){var m=S(f);if(m.length===0)return new o(1);for(var A=this,N=0;N=0);var m=f%26,A=(f-m)/26,N=67108863>>>26-m<<26-m,b;if(m!==0){var M=0;for(b=0;b>>26-m}M&&(this.words[b]=M,this.length++)}if(A!==0){for(b=this.length-1;b>=0;b--)this.words[b+A]=this.words[b];for(b=0;b=0);var N;m?N=(m-m%26)/26:N=0;var b=f%26,M=Math.min((f-b)/26,this.length),R=67108863^67108863>>>b<M)for(this.length-=M,h=0;h=0&&(P!==0||h>=N);h--){var te=this.words[h]|0;this.words[h]=P<<26-b|te>>>b,P=te&R}return k&&P!==0&&(k.words[k.length++]=P),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(f,m,A){return n(this.negative===0),this.iushrn(f,m,A)},o.prototype.shln=function(f){return this.clone().ishln(f)},o.prototype.ushln=function(f){return this.clone().iushln(f)},o.prototype.shrn=function(f){return this.clone().ishrn(f)},o.prototype.ushrn=function(f){return this.clone().iushrn(f)},o.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var m=f%26,A=(f-m)/26,N=1<=0);var m=f%26,A=(f-m)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=A)return this;if(m!==0&&A++,this.length=Math.min(A,this.length),m!==0){var N=67108863^67108863>>>m<=67108864;m++)this.words[m]-=67108864,m===this.length-1?this.words[m+1]=1:this.words[m+1]++;return this.length=Math.max(this.length,m+1),this},o.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var m=0;m>26)-(k/67108864|0),this.words[b+A]=M&67108863}for(;b>26,this.words[b+A]=M&67108863;if(R===0)return this._strip();for(n(R===-1),R=0,b=0;b>26,this.words[b]=M&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(f,m){var A=this.length-f.length,N=this.clone(),b=f,M=b.words[b.length-1]|0,R=this._countBits(M);A=26-R,A!==0&&(b=b.ushln(A),N.iushln(A),M=b.words[b.length-1]|0);var k=N.length-b.length,h;if(m!=="mod"){h=new o(null),h.length=k+1,h.words=new Array(h.length);for(var P=0;P=0;y--){var D=(N.words[b.length+y]|0)*67108864+(N.words[b.length+y-1]|0);for(D=Math.min(D/M|0,67108863),N._ishlnsubmul(b,D,y);N.negative!==0;)D--,N.negative=0,N._ishlnsubmul(b,1,y),N.isZero()||(N.negative^=1);h&&(h.words[y]=D)}return h&&h._strip(),N._strip(),m!=="div"&&A!==0&&N.iushrn(A),{div:h||null,mod:N}},o.prototype.divmod=function(f,m,A){if(n(!f.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var N,b,M;return this.negative!==0&&f.negative===0?(M=this.neg().divmod(f,m),m!=="mod"&&(N=M.div.neg()),m!=="div"&&(b=M.mod.neg(),A&&b.negative!==0&&b.iadd(f)),{div:N,mod:b}):this.negative===0&&f.negative!==0?(M=this.divmod(f.neg(),m),m!=="mod"&&(N=M.div.neg()),{div:N,mod:M.mod}):this.negative&f.negative?(M=this.neg().divmod(f.neg(),m),m!=="div"&&(b=M.mod.neg(),A&&b.negative!==0&&b.isub(f)),{div:M.div,mod:b}):f.length>this.length||this.cmp(f)<0?{div:new o(0),mod:this}:f.length===1?m==="div"?{div:this.divn(f.words[0]),mod:null}:m==="mod"?{div:null,mod:new o(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new o(this.modrn(f.words[0]))}:this._wordDiv(f,m)},o.prototype.div=function(f){return this.divmod(f,"div",!1).div},o.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},o.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},o.prototype.divRound=function(f){var m=this.divmod(f);if(m.mod.isZero())return m.div;var A=m.div.negative!==0?m.mod.isub(f):m.mod,N=f.ushrn(1),b=f.andln(1),M=A.cmp(N);return M<0||b===1&&M===0?m.div:m.div.negative!==0?m.div.isubn(1):m.div.iaddn(1)},o.prototype.modrn=function(f){var m=f<0;m&&(f=-f),n(f<=67108863);for(var A=(1<<26)%f,N=0,b=this.length-1;b>=0;b--)N=(A*N+(this.words[b]|0))%f;return m?-N:N},o.prototype.modn=function(f){return this.modrn(f)},o.prototype.idivn=function(f){var m=f<0;m&&(f=-f),n(f<=67108863);for(var A=0,N=this.length-1;N>=0;N--){var b=(this.words[N]|0)+A*67108864;this.words[N]=b/f|0,A=b%f}return this._strip(),m?this.ineg():this},o.prototype.divn=function(f){return this.clone().idivn(f)},o.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var m=this,A=f.clone();m.negative!==0?m=m.umod(f):m=m.clone();for(var N=new o(1),b=new o(0),M=new o(0),R=new o(1),k=0;m.isEven()&&A.isEven();)m.iushrn(1),A.iushrn(1),++k;for(var h=A.clone(),P=m.clone();!m.isZero();){for(var te=0,y=1;!(m.words[0]&y)&&te<26;++te,y<<=1);if(te>0)for(m.iushrn(te);te-- >0;)(N.isOdd()||b.isOdd())&&(N.iadd(h),b.isub(P)),N.iushrn(1),b.iushrn(1);for(var D=0,U=1;!(A.words[0]&U)&&D<26;++D,U<<=1);if(D>0)for(A.iushrn(D);D-- >0;)(M.isOdd()||R.isOdd())&&(M.iadd(h),R.isub(P)),M.iushrn(1),R.iushrn(1);m.cmp(A)>=0?(m.isub(A),N.isub(M),b.isub(R)):(A.isub(m),M.isub(N),R.isub(b))}return{a:M,b:R,gcd:A.iushln(k)}},o.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var m=this,A=f.clone();m.negative!==0?m=m.umod(f):m=m.clone();for(var N=new o(1),b=new o(0),M=A.clone();m.cmpn(1)>0&&A.cmpn(1)>0;){for(var R=0,k=1;!(m.words[0]&k)&&R<26;++R,k<<=1);if(R>0)for(m.iushrn(R);R-- >0;)N.isOdd()&&N.iadd(M),N.iushrn(1);for(var h=0,P=1;!(A.words[0]&P)&&h<26;++h,P<<=1);if(h>0)for(A.iushrn(h);h-- >0;)b.isOdd()&&b.iadd(M),b.iushrn(1);m.cmp(A)>=0?(m.isub(A),N.isub(b)):(A.isub(m),b.isub(N))}var te;return m.cmpn(1)===0?te=N:te=b,te.cmpn(0)<0&&te.iadd(f),te},o.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var m=this.clone(),A=f.clone();m.negative=0,A.negative=0;for(var N=0;m.isEven()&&A.isEven();N++)m.iushrn(1),A.iushrn(1);do{for(;m.isEven();)m.iushrn(1);for(;A.isEven();)A.iushrn(1);var b=m.cmp(A);if(b<0){var M=m;m=A,A=M}else if(b===0||A.cmpn(1)===0)break;m.isub(A)}while(!0);return A.iushln(N)},o.prototype.invm=function(f){return this.egcd(f).a.umod(f)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(f){return this.words[0]&f},o.prototype.bincn=function(f){n(typeof f=="number");var m=f%26,A=(f-m)/26,N=1<>>26,R&=67108863,this.words[M]=R}return b!==0&&(this.words[M]=b,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(f){var m=f<0;if(this.negative!==0&&!m)return-1;if(this.negative===0&&m)return 1;this._strip();var A;if(this.length>1)A=1;else{m&&(f=-f),n(f<=67108863,"Number is too big");var N=this.words[0]|0;A=N===f?0:Nf.length)return 1;if(this.length=0;A--){var N=this.words[A]|0,b=f.words[A]|0;if(N!==b){Nb&&(m=1);break}}return m},o.prototype.gtn=function(f){return this.cmpn(f)===1},o.prototype.gt=function(f){return this.cmp(f)===1},o.prototype.gten=function(f){return this.cmpn(f)>=0},o.prototype.gte=function(f){return this.cmp(f)>=0},o.prototype.ltn=function(f){return this.cmpn(f)===-1},o.prototype.lt=function(f){return this.cmp(f)===-1},o.prototype.lten=function(f){return this.cmpn(f)<=0},o.prototype.lte=function(f){return this.cmp(f)<=0},o.prototype.eqn=function(f){return this.cmpn(f)===0},o.prototype.eq=function(f){return this.cmp(f)===0},o.red=function(f){return new Y(f)},o.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(f){return this.red=f,this},o.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},o.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},o.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},o.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},o.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},o.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},o.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},o.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var B={k256:null,p224:null,p192:null,p25519:null};function j(C,f){this.name=C,this.p=new o(f,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}j.prototype._tmp=function(){var f=new o(null);return f.words=new Array(Math.ceil(this.n/13)),f},j.prototype.ireduce=function(f){var m=f,A;do this.split(m,this.tmp),m=this.imulK(m),m=m.iadd(this.tmp),A=m.bitLength();while(A>this.n);var N=A0?m.isub(this.p):m.strip!==void 0?m.strip():m._strip(),m},j.prototype.split=function(f,m){f.iushrn(this.n,0,m)},j.prototype.imulK=function(f){return f.imul(this.k)};function $(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i($,j),$.prototype.split=function(f,m){for(var A=4194303,N=Math.min(f.length,9),b=0;b>>22,M=R}M>>>=22,f.words[b-10]=M,M===0&&f.length>10?f.length-=10:f.length-=9},$.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var m=0,A=0;A>>=26,f.words[A]=b,m=N}return m!==0&&(f.words[f.length++]=m),f},o._prime=function(f){if(B[f])return B[f];var m;if(f==="k256")m=new $;else if(f==="p224")m=new H;else if(f==="p192")m=new ie;else if(f==="p25519")m=new V;else throw new Error("Unknown prime "+f);return B[f]=m,m};function Y(C){if(typeof C=="string"){var f=o._prime(C);this.m=f.p,this.prime=f}else n(C.gtn(1),"modulus must be greater than 1"),this.m=C,this.prime=null}Y.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},Y.prototype._verify2=function(f,m){n((f.negative|m.negative)===0,"red works only with positives"),n(f.red&&f.red===m.red,"red works only with red numbers")},Y.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(c(f,f.umod(this.m)._forceRed(this)),f)},Y.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},Y.prototype.add=function(f,m){this._verify2(f,m);var A=f.add(m);return A.cmp(this.m)>=0&&A.isub(this.m),A._forceRed(this)},Y.prototype.iadd=function(f,m){this._verify2(f,m);var A=f.iadd(m);return A.cmp(this.m)>=0&&A.isub(this.m),A},Y.prototype.sub=function(f,m){this._verify2(f,m);var A=f.sub(m);return A.cmpn(0)<0&&A.iadd(this.m),A._forceRed(this)},Y.prototype.isub=function(f,m){this._verify2(f,m);var A=f.isub(m);return A.cmpn(0)<0&&A.iadd(this.m),A},Y.prototype.shl=function(f,m){return this._verify1(f),this.imod(f.ushln(m))},Y.prototype.imul=function(f,m){return this._verify2(f,m),this.imod(f.imul(m))},Y.prototype.mul=function(f,m){return this._verify2(f,m),this.imod(f.mul(m))},Y.prototype.isqr=function(f){return this.imul(f,f.clone())},Y.prototype.sqr=function(f){return this.mul(f,f)},Y.prototype.sqrt=function(f){if(f.isZero())return f.clone();var m=this.m.andln(3);if(n(m%2===1),m===3){var A=this.m.add(new o(1)).iushrn(2);return this.pow(f,A)}for(var N=this.m.subn(1),b=0;!N.isZero()&&N.andln(1)===0;)b++,N.iushrn(1);n(!N.isZero());var M=new o(1).toRed(this),R=M.redNeg(),k=this.m.subn(1).iushrn(1),h=this.m.bitLength();for(h=new o(2*h*h).toRed(this);this.pow(h,k).cmp(R)!==0;)h.redIAdd(R);for(var P=this.pow(h,N),te=this.pow(f,N.addn(1).iushrn(1)),y=this.pow(f,N),D=b;y.cmp(M)!==0;){for(var U=y,F=0;U.cmp(M)!==0;F++)U=U.redSqr();n(F=0;b--){for(var P=m.words[b],te=h-1;te>=0;te--){var y=P>>te&1;if(M!==N[0]&&(M=this.sqr(M)),y===0&&R===0){k=0;continue}R<<=1,R|=y,k++,!(k!==A&&(b!==0||te!==0))&&(M=this.mul(M,N[R]),k=0,R=0)}h=26}return M},Y.prototype.convertTo=function(f){var m=f.umod(this.m);return m===f?m.clone():m},Y.prototype.convertFrom=function(f){var m=f.clone();return m.red=null,m},o.mont=function(f){return new K(f)};function K(C){Y.call(this,C),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(K,Y),K.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},K.prototype.convertFrom=function(f){var m=this.imod(f.mul(this.rinv));return m.red=null,m},K.prototype.imul=function(f,m){if(f.isZero()||m.isZero())return f.words[0]=0,f.length=1,f;var A=f.imul(m),N=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=A.isub(N).iushrn(this.shift),M=b;return b.cmp(this.m)>=0?M=b.isub(this.m):b.cmpn(0)<0&&(M=b.iadd(this.m)),M._forceRed(this)},K.prototype.mul=function(f,m){if(f.isZero()||m.isZero())return new o(0)._forceRed(this);var A=f.mul(m),N=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),b=A.isub(N).iushrn(this.shift),M=b;return b.cmp(this.m)>=0?M=b.isub(this.m):b.cmpn(0)<0&&(M=b.iadd(this.m)),M._forceRed(this)},K.prototype.invm=function(f){var m=this.imod(f._invmp(this.m).mul(this.r2));return m._forceRed(this)}})(t,Fe)})(Ah);var Px=Ah.exports;const ue=jo(Px),Cx="logger/5.7.0";let op=!1,sp=!1;const da={debug:1,default:2,info:2,warning:3,error:4,off:5};let lp=da.default,jc=null;function Mx(){try{const t=[];if(["NFD","NFC","NFKD","NFKC"].forEach(e=>{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{t.push(e)}}),t.length)throw new Error("missing "+t.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(t){return t.message}return null}const ap=Mx();var od;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(od||(od={}));var Ur;(function(t){t.UNKNOWN_ERROR="UNKNOWN_ERROR",t.NOT_IMPLEMENTED="NOT_IMPLEMENTED",t.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",t.NETWORK_ERROR="NETWORK_ERROR",t.SERVER_ERROR="SERVER_ERROR",t.TIMEOUT="TIMEOUT",t.BUFFER_OVERRUN="BUFFER_OVERRUN",t.NUMERIC_FAULT="NUMERIC_FAULT",t.MISSING_NEW="MISSING_NEW",t.INVALID_ARGUMENT="INVALID_ARGUMENT",t.MISSING_ARGUMENT="MISSING_ARGUMENT",t.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",t.CALL_EXCEPTION="CALL_EXCEPTION",t.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",t.NONCE_EXPIRED="NONCE_EXPIRED",t.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",t.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",t.TRANSACTION_REPLACED="TRANSACTION_REPLACED",t.ACTION_REJECTED="ACTION_REJECTED"})(Ur||(Ur={}));const up="0123456789abcdef";class T{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();da[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(lp>da[n])&&console.log.apply(console,r)}debug(...e){this._log(T.levels.DEBUG,e)}info(...e){this._log(T.levels.INFO,e)}warn(...e){this._log(T.levels.WARNING,e)}makeError(e,r,n){if(sp)return this.makeError("censored error",r,{});r||(r=T.errors.UNKNOWN_ERROR),n||(n={});const i=[];Object.keys(n).forEach(a=>{const u=n[a];try{if(u instanceof Uint8Array){let c="";for(let d=0;d>4],c+=up[u[d]&15];i.push(a+"=Uint8Array(0x"+c+")")}else i.push(a+"="+JSON.stringify(u))}catch{i.push(a+"="+JSON.stringify(n[a].toString()))}}),i.push(`code=${r}`),i.push(`version=${this.version}`);const o=e;let s="";switch(r){case Ur.NUMERIC_FAULT:{s="NUMERIC_FAULT";const a=e;switch(a){case"overflow":case"underflow":case"division-by-zero":s+="-"+a;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-unbound-result";break}break}case Ur.CALL_EXCEPTION:case Ur.INSUFFICIENT_FUNDS:case Ur.MISSING_NEW:case Ur.NONCE_EXPIRED:case Ur.REPLACEMENT_UNDERPRICED:case Ur.TRANSACTION_REPLACED:case Ur.UNPREDICTABLE_GAS_LIMIT:s=r;break}s&&(e+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),i.length&&(e+=" ("+i.join(", ")+")");const l=new Error(e);return l.reason=o,l.code=r,Object.keys(n).forEach(function(a){l[a]=n[a]}),l}throwError(e,r,n){throw this.makeError(e,r,n)}throwArgumentError(e,r,n){return this.throwError(e,T.errors.INVALID_ARGUMENT,{argument:r,value:n})}assert(e,r,n,i){e||this.throwError(r,n,i)}assertArgument(e,r,n,i){e||this.throwArgumentError(r,n,i)}checkNormalize(e){ap&&this.throwError("platform missing String.prototype.normalize",T.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:ap})}checkSafeUint53(e,r){typeof e=="number"&&(r==null&&(r="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(r,T.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,T.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,r,n){n?n=": "+n:n="",er&&this.throwError("too many arguments"+n,T.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",T.errors.MISSING_NEW,{name:r.name})}checkAbstract(e,r){e===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",T.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",T.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return jc||(jc=new T(Cx)),jc}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",T.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),op){if(!e)return;this.globalLogger().throwError("error censorship permanent",T.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}sp=!!e,op=!!r}static setLogLevel(e){const r=da[e.toLowerCase()];if(r==null){T.globalLogger().warn("invalid log level - "+e);return}lp=r}static from(e){return new T(e)}}T.errors=Ur;T.levels=od;const Ix="bytes/5.7.0",dt=new T(Ix);function iy(t){return!!t.toHexString}function Ao(t){return t.slice||(t.slice=function(){const e=Array.prototype.slice.call(arguments);return Ao(new Uint8Array(Array.prototype.slice.apply(t,e)))}),t}function bh(t){return pe(t)&&!(t.length%2)||Ru(t)}function cp(t){return typeof t=="number"&&t==t&&t%1===0}function Ru(t){if(t==null)return!1;if(t.constructor===Uint8Array)return!0;if(typeof t=="string"||!cp(t.length)||t.length<0)return!1;for(let e=0;e=256)return!1}return!0}function se(t,e){if(e||(e={}),typeof t=="number"){dt.checkSafeUint53(t,"invalid arrayify value");const r=[];for(;t;)r.unshift(t&255),t=parseInt(String(t/256));return r.length===0&&r.push(0),Ao(new Uint8Array(r))}if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),iy(t)&&(t=t.toHexString()),pe(t)){let r=t.substring(2);r.length%2&&(e.hexPad==="left"?r="0"+r:e.hexPad==="right"?r+="0":dt.throwArgumentError("hex data is odd-length","value",t));const n=[];for(let i=0;ise(i)),r=e.reduce((i,o)=>i+o.length,0),n=new Uint8Array(r);return e.reduce((i,o)=>(n.set(o,i),i+o.length),0),Ao(n)}function Ro(t){let e=se(t);if(e.length===0)return e;let r=0;for(;re&&dt.throwArgumentError("value out of range","value",arguments[0]);const r=new Uint8Array(e);return r.set(t,e-t.length),Ao(r)}function pe(t,e){return!(typeof t!="string"||!t.match(/^0x[0-9A-Fa-f]*$/)||e&&t.length!==2+2*e)}const Uc="0123456789abcdef";function re(t,e){if(e||(e={}),typeof t=="number"){dt.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=Uc[t&15]+r,t=Math.floor(t/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if(typeof t=="bigint")return t=t.toString(16),t.length%2?"0x0"+t:"0x"+t;if(e.allowMissingPrefix&&typeof t=="string"&&t.substring(0,2)!=="0x"&&(t="0x"+t),iy(t))return t.toHexString();if(pe(t))return t.length%2&&(e.hexPad==="left"?t="0x0"+t.substring(2):e.hexPad==="right"?t+="0":dt.throwArgumentError("hex data is odd-length","value",t)),t.toLowerCase();if(Ru(t)){let r="0x";for(let n=0;n>4]+Uc[i&15]}return r}return dt.throwArgumentError("invalid hexlify value","value",t)}function On(t){if(typeof t!="string")t=re(t);else if(!pe(t)||t.length%2)return null;return(t.length-2)/2}function It(t,e,r){return typeof t!="string"?t=re(t):(!pe(t)||t.length%2)&&dt.throwArgumentError("invalid hexData","value",t),e=2+2*e,r!=null?"0x"+t.substring(e,2+2*r):"0x"+t.substring(e)}function Xt(t){let e="0x";return t.forEach(r=>{e+=re(r).substring(2)}),e}function Tu(t){const e=Rx(re(t,{hexPad:"left"}));return e==="0x"?"0x0":e}function Rx(t){typeof t!="string"&&(t=re(t)),pe(t)||dt.throwArgumentError("invalid hex string","value",t),t=t.substring(2);let e=0;for(;e2*e+2&&dt.throwArgumentError("value out of range","value",arguments[1]);t.length<2*e+2;)t="0x0"+t.substring(2);return t}function Ou(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(bh(t)){let r=se(t);r.length===64?(e.v=27+(r[32]>>7),r[32]&=127,e.r=re(r.slice(0,32)),e.s=re(r.slice(32,64))):r.length===65?(e.r=re(r.slice(0,32)),e.s=re(r.slice(32,64)),e.v=r[64]):dt.throwArgumentError("invalid signature string","signature",t),e.v<27&&(e.v===0||e.v===1?e.v+=27:dt.throwArgumentError("signature invalid v byte","signature",t)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(r[32]|=128),e._vs=re(r.slice(32,64))}else{if(e.r=t.r,e.s=t.s,e.v=t.v,e.recoveryParam=t.recoveryParam,e._vs=t._vs,e._vs!=null){const i=ha(se(e._vs),32);e._vs=re(i);const o=i[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=o:e.recoveryParam!==o&&dt.throwArgumentError("signature recoveryParam mismatch _vs","signature",t),i[0]&=127;const s=re(i);e.s==null?e.s=s:e.s!==s&&dt.throwArgumentError("signature v mismatch _vs","signature",t)}if(e.recoveryParam==null)e.v==null?dt.throwArgumentError("signature missing v and recoveryParam","signature",t):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const i=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==i&&dt.throwArgumentError("signature recoveryParam mismatch v","signature",t)}e.r==null||!pe(e.r)?dt.throwArgumentError("signature missing or invalid r","signature",t):e.r=pt(e.r,32),e.s==null||!pe(e.s)?dt.throwArgumentError("signature missing or invalid s","signature",t):e.s=pt(e.s,32);const r=se(e.s);r[0]>=128&&dt.throwArgumentError("signature s out of range","signature",t),e.recoveryParam&&(r[0]|=128);const n=re(r);e._vs&&(pe(e._vs)||dt.throwArgumentError("signature invalid _vs","signature",t),e._vs=pt(e._vs,32)),e._vs==null?e._vs=n:e._vs!==n&&dt.throwArgumentError("signature _vs mismatch v and s","signature",t)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}const Tx="bignumber/5.7.0";var Xs=ue.BN;const En=new T(Tx),Fc={},fp=9007199254740991;let dp=!1;class G{constructor(e,r){e!==Fc&&En.throwError("cannot call constructor directly; use BigNumber.from",T.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=r,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Jt(ve(this).fromTwos(e))}toTwos(e){return Jt(ve(this).toTwos(e))}abs(){return this._hex[0]==="-"?G.from(this._hex.substring(1)):this}add(e){return Jt(ve(this).add(ve(e)))}sub(e){return Jt(ve(this).sub(ve(e)))}div(e){return G.from(e).isZero()&&xr("division-by-zero","div"),Jt(ve(this).div(ve(e)))}mul(e){return Jt(ve(this).mul(ve(e)))}mod(e){const r=ve(e);return r.isNeg()&&xr("division-by-zero","mod"),Jt(ve(this).umod(r))}pow(e){const r=ve(e);return r.isNeg()&&xr("negative-power","pow"),Jt(ve(this).pow(r))}and(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","and"),Jt(ve(this).and(r))}or(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","or"),Jt(ve(this).or(r))}xor(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&xr("unbound-bitwise-result","xor"),Jt(ve(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&xr("negative-width","mask"),Jt(ve(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&xr("negative-width","shl"),Jt(ve(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&xr("negative-width","shr"),Jt(ve(this).shrn(e))}eq(e){return ve(this).eq(ve(e))}lt(e){return ve(this).lt(ve(e))}lte(e){return ve(this).lte(ve(e))}gt(e){return ve(this).gt(ve(e))}gte(e){return ve(this).gte(ve(e))}isNegative(){return this._hex[0]==="-"}isZero(){return ve(this).isZero()}toNumber(){try{return ve(this).toNumber()}catch{xr("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return En.throwError("this platform does not support BigInt",T.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?dp||(dp=!0,En.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?En.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",T.errors.UNEXPECTED_ARGUMENT,{}):En.throwError("BigNumber.toString does not accept parameters",T.errors.UNEXPECTED_ARGUMENT,{})),ve(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof G)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new G(Fc,Zs(e)):e.match(/^-?[0-9]+$/)?new G(Fc,Zs(new Xs(e))):En.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&xr("underflow","BigNumber.from",e),(e>=fp||e<=-fp)&&xr("overflow","BigNumber.from",e),G.from(String(e));const r=e;if(typeof r=="bigint")return G.from(r.toString());if(Ru(r))return G.from(re(r));if(r)if(r.toHexString){const n=r.toHexString();if(typeof n=="string")return G.from(n)}else{let n=r._hex;if(n==null&&r.type==="BigNumber"&&(n=r.hex),typeof n=="string"&&(pe(n)||n[0]==="-"&&pe(n.substring(1))))return G.from(n)}return En.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}}function Zs(t){if(typeof t!="string")return Zs(t.toString(16));if(t[0]==="-")return t=t.substring(1),t[0]==="-"&&En.throwArgumentError("invalid hex","value",t),t=Zs(t),t==="0x00"?t:"-"+t;if(t.substring(0,2)!=="0x"&&(t="0x"+t),t==="0x")return"0x00";for(t.length%2&&(t="0x0"+t.substring(2));t.length>4&&t.substring(0,4)==="0x00";)t="0x"+t.substring(4);return t}function Jt(t){return G.from(Zs(t))}function ve(t){const e=G.from(t).toHexString();return e[0]==="-"?new Xs("-"+e.substring(3),16):new Xs(e.substring(2),16)}function xr(t,e,r){const n={fault:t,operation:e};return r!=null&&(n.value=r),En.throwError(t,T.errors.NUMERIC_FAULT,n)}function Ox(t){return new Xs(t,36).toString(16)}function Lx(t){return new Xs(t,16).toString(36)}const Bx="properties/5.7.0";var Dx=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Ja=new T(Bx);function z(t,e,r){Object.defineProperty(t,e,{enumerable:!0,value:r,writable:!1})}function fr(t,e){for(let r=0;r<32;r++){if(t[e])return t[e];if(!t.prototype||typeof t.prototype!="object")break;t=Object.getPrototypeOf(t.prototype).constructor}return null}function yt(t){return Dx(this,void 0,void 0,function*(){const e=Object.keys(t).map(n=>{const i=t[n];return Promise.resolve(i).then(o=>({key:n,value:o}))});return(yield Promise.all(e)).reduce((n,i)=>(n[i.key]=i.value,n),{})})}function jx(t,e){(!t||typeof t!="object")&&Ja.throwArgumentError("invalid object","object",t),Object.keys(t).forEach(r=>{e[r]||Ja.throwArgumentError("invalid object key - "+r,"transaction:"+r,t)})}function it(t){const e={};for(const r in t)e[r]=t[r];return e}const Ux={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function oy(t){if(t==null||Ux[typeof t])return!0;if(Array.isArray(t)||typeof t=="object"){if(!Object.isFrozen(t))return!1;const e=Object.keys(t);for(let r=0;rnr(e)));if(typeof t=="object"){const e={};for(const r in t){const n=t[r];n!==void 0&&z(e,r,nr(n))}return e}return Ja.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function nr(t){return Fx(t)}class vl{constructor(e){for(const r in e)this[r]=nr(e[r])}}const yl="abi/5.7.0",Ee=new T(yl),Di={};let hp={calldata:!0,memory:!0,storage:!0},zx={calldata:!0,memory:!0};function zl(t,e){if(t==="bytes"||t==="string"){if(hp[e])return!0}else if(t==="address"){if(e==="payable")return!0}else if((t.indexOf("[")>=0||t==="tuple")&&zx[e])return!0;return(hp[e]||e==="payable")&&Ee.throwArgumentError("invalid modifier","name",e),!1}function $x(t,e){let r=t;function n(l){Ee.throwArgumentError(`unexpected character at position ${l}`,"param",t)}t=t.replace(/\s/g," ");function i(l){let a={type:"",name:"",parent:l,state:{allowType:!0}};return e&&(a.indexed=!1),a}let o={type:"",name:"",state:{allowType:!0}},s=o;for(let l=0;lJSON.parse(i.format(e)))),JSON.stringify(n)}let r="";return this.baseType==="array"?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):this.baseType==="tuple"?(e!==Se.sighash&&(r+=this.type),r+="("+this.components.map(n=>n.format(e)).join(e===Se.full?", ":",")+")"):r+=this.type,e!==Se.sighash&&(this.indexed===!0&&(r+=" indexed"),e===Se.full&&this.name&&(r+=" "+this.name)),r}static from(e,r){return typeof e=="string"?kt.fromString(e,r):kt.fromObject(e)}static fromObject(e){return kt.isParamType(e)?e:new kt(Di,{name:e.name||null,type:Ji(e.type),indexed:e.indexed==null?null:!!e.indexed,components:e.components?e.components.map(kt.fromObject):null})}static fromString(e,r){function n(i){return kt.fromObject({name:i.name,type:i.type,indexed:i.indexed,components:i.components})}return n($x(e,!!r))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function el(t,e){return Wx(t).map(r=>kt.fromString(r,e))}class Nn{constructor(e,r){e!==Di&&Ee.throwError("use a static from method",T.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),pa(this,r),this._isFragment=!0,Object.freeze(this)}static from(e){return Nn.isFragment(e)?e:typeof e=="string"?Nn.fromString(e):Nn.fromObject(e)}static fromObject(e){if(Nn.isFragment(e))return e;switch(e.type){case"function":return sn.fromObject(e);case"event":return _n.fromObject(e);case"constructor":return on.fromObject(e);case"error":return ei.fromObject(e);case"fallback":case"receive":return null}return Ee.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return e=e.replace(/\s/g," "),e=e.replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," "),e=e.trim(),e.split(" ")[0]==="event"?_n.fromString(e.substring(5).trim()):e.split(" ")[0]==="function"?sn.fromString(e.substring(8).trim()):e.split("(")[0].trim()==="constructor"?on.fromString(e.trim()):e.split(" ")[0]==="error"?ei.fromString(e.substring(5).trim()):Ee.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!!(e&&e._isFragment)}}class _n extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="event "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",e!==Se.sighash&&this.anonymous&&(r+="anonymous "),r.trim()}static from(e){return typeof e=="string"?_n.fromString(e):_n.fromObject(e)}static fromObject(e){if(_n.isEventFragment(e))return e;e.type!=="event"&&Ee.throwArgumentError("invalid event object","value",e);const r={name:tl(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(kt.fromObject):[],type:"event"};return new _n(Di,r)}static fromString(e){let r=e.match(rl);r||Ee.throwArgumentError("invalid event string","value",e);let n=!1;return r[3].split(" ").forEach(i=>{switch(i.trim()){case"anonymous":n=!0;break;case"":break;default:Ee.warn("unknown modifier: "+i)}}),_n.fromObject({name:r[1].trim(),anonymous:n,inputs:el(r[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&e.type==="event"}}function sy(t,e){e.gas=null;let r=t.split("@");return r.length!==1?(r.length>2&&Ee.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||Ee.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=G.from(r[1]),r[0]):t}function ly(t,e){e.constant=!1,e.payable=!1,e.stateMutability="nonpayable",t.split(" ").forEach(r=>{switch(r.trim()){case"constant":e.constant=!0;break;case"payable":e.payable=!0,e.stateMutability="payable";break;case"nonpayable":e.payable=!1,e.stateMutability="nonpayable";break;case"pure":e.constant=!0,e.stateMutability="pure";break;case"view":e.constant=!0,e.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+r)}})}function ay(t){let e={constant:!1,payable:!0,stateMutability:"payable"};return t.stateMutability!=null?(e.stateMutability=t.stateMutability,e.constant=e.stateMutability==="view"||e.stateMutability==="pure",t.constant!=null&&!!t.constant!==e.constant&&Ee.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable=e.stateMutability==="payable",t.payable!=null&&!!t.payable!==e.payable&&Ee.throwArgumentError("cannot have payable function with mutability "+e.stateMutability,"value",t)):t.payable!=null?(e.payable=!!t.payable,t.constant==null&&!e.payable&&t.type!=="constructor"&&Ee.throwArgumentError("unable to determine stateMutability","value",t),e.constant=!!t.constant,e.constant?e.stateMutability="view":e.stateMutability=e.payable?"payable":"nonpayable",e.payable&&e.constant&&Ee.throwArgumentError("cannot have constant payable function","value",t)):t.constant!=null?(e.constant=!!t.constant,e.payable=!e.constant,e.stateMutability=e.constant?"view":"payable"):t.type!=="constructor"&&Ee.throwArgumentError("unable to determine stateMutability","value",t),e}class on extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"constructor",stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});e===Se.sighash&&Ee.throwError("cannot format a constructor for sighash",T.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let r="constructor("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ";return this.stateMutability&&this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "),r.trim()}static from(e){return typeof e=="string"?on.fromString(e):on.fromObject(e)}static fromObject(e){if(on.isConstructorFragment(e))return e;e.type!=="constructor"&&Ee.throwArgumentError("invalid constructor object","value",e);let r=ay(e);r.constant&&Ee.throwArgumentError("constructor cannot be constant","value",e);const n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(kt.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?G.from(e.gas):null};return new on(Di,n)}static fromString(e){let r={type:"constructor"};e=sy(e,r);let n=e.match(rl);return(!n||n[1].trim()!=="constructor")&&Ee.throwArgumentError("invalid constructor string","value",e),r.inputs=el(n[2].trim(),!1),ly(n[3].trim(),r),on.fromObject(r)}static isConstructorFragment(e){return e&&e._isFragment&&e.type==="constructor"}}class sn extends on{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map(n=>JSON.parse(n.format(e))),outputs:this.outputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="function "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",e!==Se.sighash&&(this.stateMutability?this.stateMutability!=="nonpayable"&&(r+=this.stateMutability+" "):this.constant&&(r+="view "),this.outputs&&this.outputs.length&&(r+="returns ("+this.outputs.map(n=>n.format(e)).join(", ")+") "),this.gas!=null&&(r+="@"+this.gas.toString()+" ")),r.trim()}static from(e){return typeof e=="string"?sn.fromString(e):sn.fromObject(e)}static fromObject(e){if(sn.isFunctionFragment(e))return e;e.type!=="function"&&Ee.throwArgumentError("invalid function object","value",e);let r=ay(e);const n={type:e.type,name:tl(e.name),constant:r.constant,inputs:e.inputs?e.inputs.map(kt.fromObject):[],outputs:e.outputs?e.outputs.map(kt.fromObject):[],payable:r.payable,stateMutability:r.stateMutability,gas:e.gas?G.from(e.gas):null};return new sn(Di,n)}static fromString(e){let r={type:"function"};e=sy(e,r);let n=e.split(" returns ");n.length>2&&Ee.throwArgumentError("invalid function string","value",e);let i=n[0].match(rl);if(i||Ee.throwArgumentError("invalid function signature","value",e),r.name=i[1].trim(),r.name&&tl(r.name),r.inputs=el(i[2],!1),ly(i[3].trim(),r),n.length>1){let o=n[1].match(rl);(o[1].trim()!=""||o[3].trim()!="")&&Ee.throwArgumentError("unexpected tokens","value",e),r.outputs=el(o[2],!1)}else r.outputs=[];return sn.fromObject(r)}static isFunctionFragment(e){return e&&e._isFragment&&e.type==="function"}}function pp(t){const e=t.format();return(e==="Error(string)"||e==="Panic(uint256)")&&Ee.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class ei extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||Ee.throwArgumentError("invalid format type","format",e),e===Se.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(n=>JSON.parse(n.format(e)))});let r="";return e!==Se.sighash&&(r+="error "),r+=this.name+"("+this.inputs.map(n=>n.format(e)).join(e===Se.full?", ":",")+") ",r.trim()}static from(e){return typeof e=="string"?ei.fromString(e):ei.fromObject(e)}static fromObject(e){if(ei.isErrorFragment(e))return e;e.type!=="error"&&Ee.throwArgumentError("invalid error object","value",e);const r={type:e.type,name:tl(e.name),inputs:e.inputs?e.inputs.map(kt.fromObject):[]};return pp(new ei(Di,r))}static fromString(e){let r={type:"error"},n=e.match(rl);return n||Ee.throwArgumentError("invalid error signature","value",e),r.name=n[1].trim(),r.name&&tl(r.name),r.inputs=el(n[2],!1),pp(ei.fromObject(r))}static isErrorFragment(e){return e&&e._isFragment&&e.type==="error"}}function Ji(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const qx=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function tl(t){return(!t||!t.match(qx))&&Ee.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const rl=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function Wx(t){t=t.trim();let e=[],r="",n=0;for(let i=0;ithis.wordSize&&_h.throwError("value out-of-bounds",T.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:r.length}),r.length%this.wordSize&&(r=Ut([this._padding.slice(r.length%this.wordSize),r])),r}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,r=>{this._data[e]=this._getValue(r)}}}class Ya{constructor(e,r,n,i){z(this,"_data",se(e)),z(this,"wordSize",r||32),z(this,"_coerceFunc",n),z(this,"allowLoose",i),this._offset=0}get data(){return re(this._data)}get consumed(){return this._offset}static coerce(e,r){let n=e.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(r=r.toNumber()),r}coerce(e,r){return this._coerceFunc?this._coerceFunc(e,r):Ya.coerce(e,r)}_peekBytes(e,r,n){let i=Math.ceil(r/this.wordSize)*this.wordSize;return this._offset+i>this._data.length&&(this.allowLoose&&n&&this._offset+r<=this._data.length?i=r:_h.throwError("data out-of-bounds",T.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new Ya(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,r){let n=this._peekBytes(0,e,!!r);return this._offset+=n.length,n.slice(0,e)}readValue(){return G.from(this.readBytes(this.wordSize))}}var uy={exports:{}};/** + * [js-sha3]{@link https://github.com/emn178/js-sha3} + * + * @version 0.8.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2015-2018 + * @license MIT + */(function(t){(function(){var e="input is invalid type",r="finalize already called",n=typeof window=="object",i=n?window:{};i.JS_SHA3_NO_WINDOW&&(n=!1);var o=!n&&typeof self=="object",s=!i.JS_SHA3_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;s?i=Fe:o&&(i=self);var l=!i.JS_SHA3_NO_COMMON_JS&&!0&&t.exports,a=!i.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),c=[31,7936,2031616,520093696],d=[4,1024,262144,67108864],p=[1,256,65536,16777216],v=[6,1536,393216,100663296],g=[0,8,16,24],x=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],S=[224,256,384,512],E=[128,256],w=["hex","buffer","arrayBuffer","array","digest"],_={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(y){return Object.prototype.toString.call(y)==="[object Array]"}),a&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(y){return typeof y=="object"&&y.buffer&&y.buffer.constructor===ArrayBuffer});for(var O=function(y,D,U){return function(F){return new h(y,D,y).update(F)[U]()}},B=function(y,D,U){return function(F,W){return new h(y,D,W).update(F)[U]()}},j=function(y,D,U){return function(F,W,oe,X){return f["cshake"+y].update(F,W,oe,X)[U]()}},$=function(y,D,U){return function(F,W,oe,X){return f["kmac"+y].update(F,W,oe,X)[U]()}},H=function(y,D,U,F){for(var W=0;W>5,this.byteCount=this.blockCount<<2,this.outputBlocks=U>>5,this.extraBytes=(U&31)>>3;for(var F=0;F<50;++F)this.s[F]=0}h.prototype.update=function(y){if(this.finalized)throw new Error(r);var D,U=typeof y;if(U!=="string"){if(U==="object"){if(y===null)throw new Error(e);if(a&&y.constructor===ArrayBuffer)y=new Uint8Array(y);else if(!Array.isArray(y)&&(!a||!ArrayBuffer.isView(y)))throw new Error(e)}else throw new Error(e);D=!0}for(var F=this.blocks,W=this.byteCount,oe=y.length,X=this.blockCount,Q=0,Je=this.s,J,le;Q>2]|=y[Q]<>2]|=le<>2]|=(192|le>>6)<>2]|=(128|le&63)<=57344?(F[J>>2]|=(224|le>>12)<>2]|=(128|le>>6&63)<>2]|=(128|le&63)<>2]|=(240|le>>18)<>2]|=(128|le>>12&63)<>2]|=(128|le>>6&63)<>2]|=(128|le&63)<=W){for(this.start=J-W,this.block=F[X],J=0;J>8,U=y&255;U>0;)W.unshift(U),y=y>>8,U=y&255,++F;return D?W.push(F):W.unshift(F),this.update(W),W.length},h.prototype.encodeString=function(y){var D,U=typeof y;if(U!=="string"){if(U==="object"){if(y===null)throw new Error(e);if(a&&y.constructor===ArrayBuffer)y=new Uint8Array(y);else if(!Array.isArray(y)&&(!a||!ArrayBuffer.isView(y)))throw new Error(e)}else throw new Error(e);D=!0}var F=0,W=y.length;if(D)F=W;else for(var oe=0;oe=57344?F+=3:(X=65536+((X&1023)<<10|y.charCodeAt(++oe)&1023),F+=4)}return F+=this.encode(F*8),this.update(y),F},h.prototype.bytepad=function(y,D){for(var U=this.encode(D),F=0;F>2]|=this.padding[D&3],this.lastByteIndex===this.byteCount)for(y[0]=y[U],D=1;D>4&15]+u[Q&15]+u[Q>>12&15]+u[Q>>8&15]+u[Q>>20&15]+u[Q>>16&15]+u[Q>>28&15]+u[Q>>24&15];oe%y===0&&(te(D),W=0)}return F&&(Q=D[W],X+=u[Q>>4&15]+u[Q&15],F>1&&(X+=u[Q>>12&15]+u[Q>>8&15]),F>2&&(X+=u[Q>>20&15]+u[Q>>16&15])),X},h.prototype.arrayBuffer=function(){this.finalize();var y=this.blockCount,D=this.s,U=this.outputBlocks,F=this.extraBytes,W=0,oe=0,X=this.outputBits>>3,Q;F?Q=new ArrayBuffer(U+1<<2):Q=new ArrayBuffer(X);for(var Je=new Uint32Array(Q);oe>8&255,X[Q+2]=Je>>16&255,X[Q+3]=Je>>24&255;oe%y===0&&te(D)}return F&&(Q=oe<<2,Je=D[W],X[Q]=Je&255,F>1&&(X[Q+1]=Je>>8&255),F>2&&(X[Q+2]=Je>>16&255)),X};function P(y,D,U){h.call(this,y,D,U)}P.prototype=new h,P.prototype.finalize=function(){return this.encode(this.outputBits,!0),h.prototype.finalize.call(this)};var te=function(y){var D,U,F,W,oe,X,Q,Je,J,le,Qr,Te,Ne,Jr,Pe,ce,wr,fe,Oe,Yr,me,ze,gn,$e,He,Ht,Le,qe,Rr,Ce,We,vn,Be,Ge,yn,De,ne,ot,ge,de,rt,be,_e,Ct,Me,je,Kt,Ve,Ke,Qt,Ie,Ue,Er,ke,Ye,Ai,Xe,Ze,$n,Hn,qn,Wn,Gn;for(F=0;F<48;F+=2)W=y[0]^y[10]^y[20]^y[30]^y[40],oe=y[1]^y[11]^y[21]^y[31]^y[41],X=y[2]^y[12]^y[22]^y[32]^y[42],Q=y[3]^y[13]^y[23]^y[33]^y[43],Je=y[4]^y[14]^y[24]^y[34]^y[44],J=y[5]^y[15]^y[25]^y[35]^y[45],le=y[6]^y[16]^y[26]^y[36]^y[46],Qr=y[7]^y[17]^y[27]^y[37]^y[47],Te=y[8]^y[18]^y[28]^y[38]^y[48],Ne=y[9]^y[19]^y[29]^y[39]^y[49],D=Te^(X<<1|Q>>>31),U=Ne^(Q<<1|X>>>31),y[0]^=D,y[1]^=U,y[10]^=D,y[11]^=U,y[20]^=D,y[21]^=U,y[30]^=D,y[31]^=U,y[40]^=D,y[41]^=U,D=W^(Je<<1|J>>>31),U=oe^(J<<1|Je>>>31),y[2]^=D,y[3]^=U,y[12]^=D,y[13]^=U,y[22]^=D,y[23]^=U,y[32]^=D,y[33]^=U,y[42]^=D,y[43]^=U,D=X^(le<<1|Qr>>>31),U=Q^(Qr<<1|le>>>31),y[4]^=D,y[5]^=U,y[14]^=D,y[15]^=U,y[24]^=D,y[25]^=U,y[34]^=D,y[35]^=U,y[44]^=D,y[45]^=U,D=Je^(Te<<1|Ne>>>31),U=J^(Ne<<1|Te>>>31),y[6]^=D,y[7]^=U,y[16]^=D,y[17]^=U,y[26]^=D,y[27]^=U,y[36]^=D,y[37]^=U,y[46]^=D,y[47]^=U,D=le^(W<<1|oe>>>31),U=Qr^(oe<<1|W>>>31),y[8]^=D,y[9]^=U,y[18]^=D,y[19]^=U,y[28]^=D,y[29]^=U,y[38]^=D,y[39]^=U,y[48]^=D,y[49]^=U,Jr=y[0],Pe=y[1],je=y[11]<<4|y[10]>>>28,Kt=y[10]<<4|y[11]>>>28,qe=y[20]<<3|y[21]>>>29,Rr=y[21]<<3|y[20]>>>29,Hn=y[31]<<9|y[30]>>>23,qn=y[30]<<9|y[31]>>>23,be=y[40]<<18|y[41]>>>14,_e=y[41]<<18|y[40]>>>14,Ge=y[2]<<1|y[3]>>>31,yn=y[3]<<1|y[2]>>>31,ce=y[13]<<12|y[12]>>>20,wr=y[12]<<12|y[13]>>>20,Ve=y[22]<<10|y[23]>>>22,Ke=y[23]<<10|y[22]>>>22,Ce=y[33]<<13|y[32]>>>19,We=y[32]<<13|y[33]>>>19,Wn=y[42]<<2|y[43]>>>30,Gn=y[43]<<2|y[42]>>>30,ke=y[5]<<30|y[4]>>>2,Ye=y[4]<<30|y[5]>>>2,De=y[14]<<6|y[15]>>>26,ne=y[15]<<6|y[14]>>>26,fe=y[25]<<11|y[24]>>>21,Oe=y[24]<<11|y[25]>>>21,Qt=y[34]<<15|y[35]>>>17,Ie=y[35]<<15|y[34]>>>17,vn=y[45]<<29|y[44]>>>3,Be=y[44]<<29|y[45]>>>3,$e=y[6]<<28|y[7]>>>4,He=y[7]<<28|y[6]>>>4,Ai=y[17]<<23|y[16]>>>9,Xe=y[16]<<23|y[17]>>>9,ot=y[26]<<25|y[27]>>>7,ge=y[27]<<25|y[26]>>>7,Yr=y[36]<<21|y[37]>>>11,me=y[37]<<21|y[36]>>>11,Ue=y[47]<<24|y[46]>>>8,Er=y[46]<<24|y[47]>>>8,Ct=y[8]<<27|y[9]>>>5,Me=y[9]<<27|y[8]>>>5,Ht=y[18]<<20|y[19]>>>12,Le=y[19]<<20|y[18]>>>12,Ze=y[29]<<7|y[28]>>>25,$n=y[28]<<7|y[29]>>>25,de=y[38]<<8|y[39]>>>24,rt=y[39]<<8|y[38]>>>24,ze=y[48]<<14|y[49]>>>18,gn=y[49]<<14|y[48]>>>18,y[0]=Jr^~ce&fe,y[1]=Pe^~wr&Oe,y[10]=$e^~Ht&qe,y[11]=He^~Le&Rr,y[20]=Ge^~De&ot,y[21]=yn^~ne&ge,y[30]=Ct^~je&Ve,y[31]=Me^~Kt&Ke,y[40]=ke^~Ai&Ze,y[41]=Ye^~Xe&$n,y[2]=ce^~fe&Yr,y[3]=wr^~Oe&me,y[12]=Ht^~qe&Ce,y[13]=Le^~Rr&We,y[22]=De^~ot&de,y[23]=ne^~ge&rt,y[32]=je^~Ve&Qt,y[33]=Kt^~Ke&Ie,y[42]=Ai^~Ze&Hn,y[43]=Xe^~$n&qn,y[4]=fe^~Yr&ze,y[5]=Oe^~me&gn,y[14]=qe^~Ce&vn,y[15]=Rr^~We&Be,y[24]=ot^~de&be,y[25]=ge^~rt&_e,y[34]=Ve^~Qt&Ue,y[35]=Ke^~Ie&Er,y[44]=Ze^~Hn&Wn,y[45]=$n^~qn&Gn,y[6]=Yr^~ze&Jr,y[7]=me^~gn&Pe,y[16]=Ce^~vn&$e,y[17]=We^~Be&He,y[26]=de^~be&Ge,y[27]=rt^~_e&yn,y[36]=Qt^~Ue&Ct,y[37]=Ie^~Er&Me,y[46]=Hn^~Wn&ke,y[47]=qn^~Gn&Ye,y[8]=ze^~Jr&ce,y[9]=gn^~Pe&wr,y[18]=vn^~$e&Ht,y[19]=Be^~He&Le,y[28]=be^~Ge&De,y[29]=_e^~yn&ne,y[38]=Ue^~Ct&je,y[39]=Er^~Me&Kt,y[48]=Wn^~ke&Ai,y[49]=Gn^~Ye&Xe,y[0]^=x[F],y[1]^=x[F+1]};if(l)t.exports=f;else for(A=0;A>=8;return e}function gp(t,e,r){let n=0;for(let i=0;ie+1+n&&tn.throwError("child data too short",T.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function fy(t,e){if(t.length===0&&tn.throwError("data too short",T.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&tn.throwError("data short segment too short",T.errors.BUFFER_OVERRUN,{});const n=gp(t,e+1,r);return e+1+r+n>t.length&&tn.throwError("data long segment too short",T.errors.BUFFER_OVERRUN,{}),vp(t,e,e+1+r,r+n)}else if(t[e]>=192){const r=t[e]-192;return e+1+r>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{}),vp(t,e,e+1,r)}else if(t[e]>=184){const r=t[e]-183;e+1+r>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{});const n=gp(t,e+1,r);e+1+r+n>t.length&&tn.throwError("data array too short",T.errors.BUFFER_OVERRUN,{});const i=re(t.slice(e+1+r,e+1+r+n));return{consumed:1+r+n,result:i}}else if(t[e]>=128){const r=t[e]-128;e+1+r>t.length&&tn.throwError("data too short",T.errors.BUFFER_OVERRUN,{});const n=re(t.slice(e+1,e+1+r));return{consumed:1+r,result:n}}return{consumed:1,result:re(t[e])}}function Sh(t){const e=se(t),r=fy(e,0);return r.consumed!==e.length&&tn.throwArgumentError("invalid rlp data","data",t),r.result}const Jx="address/5.7.0",oi=new T(Jx);function yp(t){pe(t,20)||oi.throwArgumentError("invalid address","address",t),t=t.toLowerCase();const e=t.substring(2).split(""),r=new Uint8Array(40);for(let i=0;i<40;i++)r[i]=e[i].charCodeAt(0);const n=se(ut(r));for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&(e[i]=e[i].toUpperCase()),(n[i>>1]&15)>=8&&(e[i+1]=e[i+1].toUpperCase());return"0x"+e.join("")}const Yx=9007199254740991;function Xx(t){return Math.log10?Math.log10(t):Math.log(t)/Math.LN10}const kh={};for(let t=0;t<10;t++)kh[String(t)]=String(t);for(let t=0;t<26;t++)kh[String.fromCharCode(65+t)]=String(10+t);const wp=Math.floor(Xx(Yx));function dy(t){t=t.toUpperCase(),t=t.substring(4)+t.substring(0,2)+"00";let e=t.split("").map(n=>kh[n]).join("");for(;e.length>=wp;){let n=e.substring(0,wp);e=parseInt(n,10)%97+e.substring(n.length)}let r=String(98-parseInt(e,10)%97);for(;r.length<2;)r="0"+r;return r}function mt(t){let e=null;if(typeof t!="string"&&oi.throwArgumentError("invalid address","address",t),t.match(/^(0x)?[0-9a-fA-F]{40}$/))t.substring(0,2)!=="0x"&&(t="0x"+t),e=yp(t),t.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==t&&oi.throwArgumentError("bad address checksum","address",t);else if(t.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(t.substring(2,4)!==dy(t)&&oi.throwArgumentError("bad icap checksum","address",t),e=Ox(t.substring(4));e.length<40;)e="0"+e;e=yp("0x"+e)}else oi.throwArgumentError("invalid address","address",t);return e}function Zx(t){try{return mt(t),!0}catch{}return!1}function eA(t){let e=Lx(mt(t).substring(2)).toUpperCase();for(;e.length<30;)e="0"+e;return"XE"+dy("XE00"+e)+e}function Nh(t){let e=null;try{e=mt(t.from)}catch{oi.throwArgumentError("missing from address","transaction",t)}const r=Ro(se(G.from(t.nonce).toHexString()));return mt(It(ut(Lu([e,r])),12))}function tA(t,e,r){return On(e)!==32&&oi.throwArgumentError("salt must be 32 bytes","salt",e),On(r)!==32&&oi.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),mt(It(ut(Ut(["0xff",mt(t),e,r])),12))}const rA=Object.freeze(Object.defineProperty({__proto__:null,getAddress:mt,getContractAddress:Nh,getCreate2Address:tA,getIcapAddress:eA,isAddress:Zx},Symbol.toStringTag,{value:"Module"}));class nA extends jn{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,r){try{r=mt(r)}catch(n){this._throwError(n.message,r)}return e.writeValue(r)}decode(e){return mt(pt(e.readValue().toHexString(),20))}}class iA extends jn{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,r){return this.coder.encode(e,r)}decode(e){return this.coder.decode(e)}}const co=new T(yl);function hy(t,e,r){let n=null;if(Array.isArray(r))n=r;else if(r&&typeof r=="object"){let a={};n=e.map(u=>{const c=u.localName;return c||co.throwError("cannot encode object for signature with missing names",T.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),a[c]&&co.throwError("cannot encode object for signature with duplicate names",T.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),a[c]=!0,r[c]})}else co.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&co.throwArgumentError("types/value length mismatch","tuple",r);let i=new sd(t.wordSize),o=new sd(t.wordSize),s=[];e.forEach((a,u)=>{let c=n[u];if(a.dynamic){let d=o.length;a.encode(o,c);let p=i.writeUpdatableValue();s.push(v=>{p(v+d)})}else a.encode(i,c)}),s.forEach(a=>{a(i.length)});let l=t.appendWriter(i);return l+=t.appendWriter(o),l}function py(t,e){let r=[],n=t.subReader(0);e.forEach(o=>{let s=null;if(o.dynamic){let l=t.readValue(),a=n.subReader(l.toNumber());try{s=o.decode(a)}catch(u){if(u.code===T.errors.BUFFER_OVERRUN)throw u;s=u,s.baseType=o.name,s.name=o.localName,s.type=o.type}}else try{s=o.decode(t)}catch(l){if(l.code===T.errors.BUFFER_OVERRUN)throw l;s=l,s.baseType=o.name,s.name=o.localName,s.type=o.type}s!=null&&r.push(s)});const i=e.reduce((o,s)=>{const l=s.localName;return l&&(o[l]||(o[l]=0),o[l]++),o},{});e.forEach((o,s)=>{let l=o.localName;if(!l||i[l]!==1||(l==="length"&&(l="_length"),r[l]!=null))return;const a=r[s];a instanceof Error?Object.defineProperty(r,l,{enumerable:!0,get:()=>{throw a}}):r[l]=a});for(let o=0;o{throw s}})}return Object.freeze(r)}class oA extends jn{constructor(e,r,n){const i=e.type+"["+(r>=0?r:"")+"]",o=r===-1||e.dynamic;super("array",i,n,o),this.coder=e,this.length=r}defaultValue(){const e=this.coder.defaultValue(),r=[];for(let n=0;ne._data.length&&co.throwError("insufficient data length",T.errors.BUFFER_OVERRUN,{length:e._data.length,count:r}));let n=[];for(let i=0;i>6===2;s++)o++;return o}return t===ar.OVERRUN?r.length-e-1:0}function yA(t,e,r,n,i){return t===ar.OVERLONG?(n.push(i),0):(n.push(65533),yy(t,e,r))}const wA=Object.freeze({error:vA,ignore:yy,replace:yA});function wy(t,e){e==null&&(e=wA.error),t=se(t);const r=[];let n=0;for(;n>7)){r.push(i);continue}let o=null,s=null;if((i&224)===192)o=1,s=127;else if((i&240)===224)o=2,s=2047;else if((i&248)===240)o=3,s=65535;else{(i&192)===128?n+=e(ar.UNEXPECTED_CONTINUE,n-1,t,r):n+=e(ar.BAD_PREFIX,n-1,t,r);continue}if(n-1+o>=t.length){n+=e(ar.OVERRUN,n-1,t,r);continue}let l=i&(1<<8-o-1)-1;for(let a=0;a1114111){n+=e(ar.OUT_OF_RANGE,n-1-o,t,r,l);continue}if(l>=55296&&l<=57343){n+=e(ar.UTF16_SURROGATE,n-1-o,t,r,l);continue}if(l<=s){n+=e(ar.OVERLONG,n-1-o,t,r,l);continue}r.push(l)}}return r}function mr(t,e=nl.current){e!=nl.current&&(vy.checkNormalize(),t=t.normalize(e));let r=[];for(let n=0;n>6|192),r.push(i&63|128);else if((i&64512)==55296){n++;const o=t.charCodeAt(n);if(n>=t.length||(o&64512)!==56320)throw new Error("invalid utf-8 string");const s=65536+((i&1023)<<10)+(o&1023);r.push(s>>18|240),r.push(s>>12&63|128),r.push(s>>6&63|128),r.push(s&63|128)}else r.push(i>>12|224),r.push(i>>6&63|128),r.push(i&63|128)}return se(r)}function EA(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function wl(t,e){return EA(wy(t,e))}function xA(t,e=nl.current){return wy(mr(t,e))}class AA extends my{constructor(e){super("string",e)}defaultValue(){return""}encode(e,r){return super.encode(e,mr(r))}decode(e){return wl(super.decode(e))}}class $l extends jn{constructor(e,r){let n=!1;const i=[];e.forEach(s=>{s.dynamic&&(n=!0),i.push(s.type)});const o="tuple("+i.join(",")+")";super("tuple",o,r,n),this.coders=e}defaultValue(){const e=[];this.coders.forEach(n=>{e.push(n.defaultValue())});const r=this.coders.reduce((n,i)=>{const o=i.localName;return o&&(n[o]||(n[o]=0),n[o]++),n},{});return this.coders.forEach((n,i)=>{let o=n.localName;!o||r[o]!==1||(o==="length"&&(o="_length"),e[o]==null&&(e[o]=e[i]))}),Object.freeze(e)}encode(e,r){return hy(e,this.coders,r)}decode(e){return e.coerce(this.name,py(e,this.coders))}}const Hl=new T(yl),bA=new RegExp(/^bytes([0-9]*)$/),_A=new RegExp(/^(u?int)([0-9]*)$/);class SA{constructor(e){z(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new nA(e.name);case"bool":return new sA(e.name);case"string":return new AA(e.name);case"bytes":return new lA(e.name);case"array":return new oA(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new $l((e.components||[]).map(n=>this._getCoder(n)),e.name);case"":return new uA(e.name)}let r=e.type.match(_A);if(r){let n=parseInt(r[2]||"256");return(n===0||n>256||n%8!==0)&&Hl.throwArgumentError("invalid "+r[1]+" bit length","param",e),new mA(n/8,r[1]==="int",e.name)}if(r=e.type.match(bA),r){let n=parseInt(r[1]);return(n===0||n>32)&&Hl.throwArgumentError("invalid bytes length","param",e),new aA(n,e.name)}return Hl.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,r){return new Ya(e,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new sd(this._getWordSize())}getDefaultValue(e){const r=e.map(i=>this._getCoder(kt.from(i)));return new $l(r,"_").defaultValue()}encode(e,r){e.length!==r.length&&Hl.throwError("types/values length mismatch",T.errors.INVALID_ARGUMENT,{count:{types:e.length,values:r.length},value:{types:e,values:r}});const n=e.map(s=>this._getCoder(kt.from(s))),i=new $l(n,"_"),o=this._getWriter();return i.encode(o,r),o.data}decode(e,r,n){const i=e.map(s=>this._getCoder(kt.from(s)));return new $l(i,"_").decode(this._getReader(se(r),n))}}const kA=new SA;function fo(t){return ut(mr(t))}const Ey="hash/5.7.0";function xy(t){t=atob(t);const e=[];for(let r=0;r0&&Array.isArray(l)?i(l,s-1):r.push(l)})};return i(t,e),r}function NA(t){const e={};for(let r=0;r>--a&1}const d=31,p=Math.pow(2,d),v=p>>>1,g=v>>1,x=p-1;let S=0;for(let B=0;B1;){let V=j+$>>>1;B>>1|c(),H=H<<1^v,ie=(ie^v)<<1|v|1;w=H,_=1+ie-H}let O=n-4;return E.map(B=>{switch(B-O){case 3:return O+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return O+256+(t[l++]<<8|t[l++]);case 1:return O+t[l++];default:return B-1}})}function CA(t){let e=0;return()=>t[e++]}function MA(t){return CA(PA(t))}function IA(t){return t&1?~t>>1:t>>1}function RA(t,e){let r=Array(t);for(let n=0;ne[s]):r}function OA(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(BA(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(DA(r,t))}return NA(by(e))}function LA(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function _y(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;in[s].push(o));return n}function BA(t,e){let r=1+e(),n=e(),i=LA(e),o=_y(i.length,1+t,e);return by(o.map((s,l)=>{const a=s[0],u=s.slice(1);return Array(i[l]).fill(void 0).map((c,d)=>{let p=d*n;return[a+d*r,u.map(v=>v+p)]})}))}function DA(t,e){let r=1+e();return _y(r,1+t,e).map(i=>[i[0],i.slice(1)])}function jA(t){let e=Xa(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let u=Xa(t,e);if(u.length==0)break;n.push({set:new Set(u),node:r()})}n.sort((u,c)=>c.set.size-u.set.size);let i=t(),o=i%3;i=i/3|0;let s=!!(i&1);i>>=1;let l=i==1,a=i==2;return{branches:n,valid:o,fe0f:s,save:l,check:a}}}function UA(){return MA(xy("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const Bu=UA(),FA=new Set(Xa(Bu)),zA=new Set(Xa(Bu)),$A=OA(Bu),HA=jA(Bu),xp=45,Ap=95;function Sy(t){return xA(t)}function qA(t){return t.filter(e=>e!=65039)}function ky(t){for(let e of t.split(".")){let r=Sy(e);try{for(let n=r.lastIndexOf(Ap)-1;n>=0;n--)if(r[n]!==Ap)throw new Error("underscore only allowed at start");if(r.length>=4&&r.every(n=>n<128)&&r[2]===xp&&r[3]===xp)throw new Error("invalid label extension")}catch(n){throw new Error(`Invalid label "${e}": ${n.message}`)}}return t}function WA(t){return ky(GA(t,qA))}function GA(t,e){let r=Sy(t).reverse(),n=[];for(;r.length;){let i=KA(r);if(i){n.push(...e(i));continue}let o=r.pop();if(FA.has(o)){n.push(o);continue}if(zA.has(o))continue;let s=$A[o];if(s){n.push(...s);continue}throw new Error(`Disallowed codepoint: 0x${o.toString(16).toUpperCase()}`)}return ky(VA(String.fromCodePoint(...n)))}function VA(t){return t.normalize("NFC")}function KA(t,e){var r;let n=HA,i,o,s=[],l=t.length;for(e&&(e.length=0);l;){let a=t[--l];if(n=(r=n.branches.find(u=>u.set.has(a)))===null||r===void 0?void 0:r.node,!n)break;if(n.save)o=a;else if(n.check&&a===o)break;s.push(a),n.fe0f&&(s.push(65039),l>0&&t[l-1]==65039&&l--),n.valid&&(i=s.slice(),n.valid==2&&i.splice(1,1),e&&e.push(...t.slice(l).reverse()),t.length=l)}return i}const QA=new T(Ey),Ny=new Uint8Array(32);Ny.fill(0);function bp(t){if(t.length===0)throw new Error("invalid ENS name; empty component");return t}function Py(t){const e=mr(WA(t)),r=[];if(t.length===0)return r;let n=0;for(let i=0;i=e.length)throw new Error("invalid ENS name; empty component");return r.push(bp(e.slice(n))),r}function ma(t){typeof t!="string"&&QA.throwArgumentError("invalid ENS name; not a string","name",t);let e=Ny;const r=Py(t);for(;r.length;)e=ut(Ut([e,ut(r.pop())]));return re(e)}function JA(t){return re(Ut(Py(t).map(e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const r=new Uint8Array(e.length+1);return r.set(e,1),r[0]=r.length-1,r})))+"00"}var YA=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const lt=new T(Ey),Cy=new Uint8Array(32);Cy.fill(0);const XA=G.from(-1),My=G.from(0),Iy=G.from(1),ZA=G.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function eb(t){const e=se(t),r=e.length%32;return r?Xt([e,Cy.slice(r)]):re(e)}const tb=pt(Iy.toHexString(),32),rb=pt(My.toHexString(),32),_p={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},zc=["name","version","chainId","verifyingContract","salt"];function Sp(t){return function(e){return typeof e!="string"&<.throwArgumentError(`invalid domain value for ${JSON.stringify(t)}`,`domain.${t}`,e),e}}const nb={name:Sp("name"),version:Sp("version"),chainId:function(t){try{return G.from(t).toString()}catch{}return lt.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",t)},verifyingContract:function(t){try{return mt(t).toLowerCase()}catch{}return lt.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",t)},salt:function(t){try{const e=se(t);if(e.length!==32)throw new Error("bad length");return re(e)}catch{}return lt.throwArgumentError('invalid domain value "salt"',"domain.salt",t)}};function $c(t){{const e=t.match(/^(u?)int(\d*)$/);if(e){const r=e[1]==="",n=parseInt(e[2]||"256");(n%8!==0||n>256||e[2]&&e[2]!==String(n))&<.throwArgumentError("invalid numeric width","type",t);const i=ZA.mask(r?n-1:n),o=r?i.add(Iy).mul(XA):My;return function(s){const l=G.from(s);return(l.lt(o)||l.gt(i))&<.throwArgumentError(`value out-of-bounds for ${t}`,"value",s),pt(l.toTwos(256).toHexString(),32)}}}{const e=t.match(/^bytes(\d+)$/);if(e){const r=parseInt(e[1]);return(r===0||r>32||e[1]!==String(r))&<.throwArgumentError("invalid bytes width","type",t),function(n){return se(n).length!==r&<.throwArgumentError(`invalid length for ${t}`,"value",n),eb(n)}}}switch(t){case"address":return function(e){return pt(mt(e),32)};case"bool":return function(e){return e?tb:rb};case"bytes":return function(e){return ut(e)};case"string":return function(e){return fo(e)}}return null}function kp(t,e){return`${t}(${e.map(({name:r,type:n})=>n+" "+r).join(",")})`}class sr{constructor(e){z(this,"types",Object.freeze(nr(e))),z(this,"_encoderCache",{}),z(this,"_types",{});const r={},n={},i={};Object.keys(e).forEach(l=>{r[l]={},n[l]=[],i[l]={}});for(const l in e){const a={};e[l].forEach(u=>{a[u.name]&<.throwArgumentError(`duplicate variable name ${JSON.stringify(u.name)} in ${JSON.stringify(l)}`,"types",e),a[u.name]=!0;const c=u.type.match(/^([^\x5b]*)(\x5b|$)/)[1];c===l&<.throwArgumentError(`circular type reference to ${JSON.stringify(c)}`,"types",e),!$c(c)&&(n[c]||lt.throwArgumentError(`unknown type ${JSON.stringify(c)}`,"types",e),n[c].push(l),r[l][c]=!0)})}const o=Object.keys(n).filter(l=>n[l].length===0);o.length===0?lt.throwArgumentError("missing primary type","types",e):o.length>1&<.throwArgumentError(`ambiguous primary types or unused types: ${o.map(l=>JSON.stringify(l)).join(", ")}`,"types",e),z(this,"primaryType",o[0]);function s(l,a){a[l]&<.throwArgumentError(`circular type reference to ${JSON.stringify(l)}`,"types",e),a[l]=!0,Object.keys(r[l]).forEach(u=>{n[u]&&(s(u,a),Object.keys(a).forEach(c=>{i[c][u]=!0}))}),delete a[l]}s(this.primaryType,{});for(const l in i){const a=Object.keys(i[l]);a.sort(),this._types[l]=kp(l,e[l])+a.map(u=>kp(u,e[u])).join("")}}getEncoder(e){let r=this._encoderCache[e];return r||(r=this._encoderCache[e]=this._getEncoder(e)),r}_getEncoder(e){{const i=$c(e);if(i)return i}const r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const i=r[1],o=this.getEncoder(i),s=parseInt(r[3]);return l=>{s>=0&&l.length!==s&<.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",l);let a=l.map(o);return this._types[i]&&(a=a.map(ut)),ut(Xt(a))}}const n=this.types[e];if(n){const i=fo(this._types[e]);return o=>{const s=n.map(({name:l,type:a})=>{const u=this.getEncoder(a)(o[l]);return this._types[a]?ut(u):u});return s.unshift(i),Xt(s)}}return lt.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const r=this._types[e];return r||lt.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),r}encodeData(e,r){return this.getEncoder(e)(r)}hashStruct(e,r){return ut(this.encodeData(e,r))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,r,n){if($c(e))return n(e,r);const i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){const s=i[1],l=parseInt(i[3]);return l>=0&&r.length!==l&<.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",r),r.map(a=>this._visit(s,a,n))}const o=this.types[e];return o?o.reduce((s,{name:l,type:a})=>(s[l]=this._visit(a,r[l],n),s),{}):lt.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,r){return this._visit(this.primaryType,e,r)}static from(e){return new sr(e)}static getPrimaryType(e){return sr.from(e).primaryType}static hashStruct(e,r,n){return sr.from(r).hashStruct(e,n)}static hashDomain(e){const r=[];for(const n in e){const i=_p[n];i||lt.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),r.push({name:n,type:i})}return r.sort((n,i)=>zc.indexOf(n.name)-zc.indexOf(i.name)),sr.hashStruct("EIP712Domain",{EIP712Domain:r},e)}static encode(e,r,n){return Xt(["0x1901",sr.hashDomain(e),sr.from(r).hash(n)])}static hash(e,r,n){return ut(sr.encode(e,r,n))}static resolveNames(e,r,n,i){return YA(this,void 0,void 0,function*(){e=it(e);const o={};e.verifyingContract&&!pe(e.verifyingContract,20)&&(o[e.verifyingContract]="0x");const s=sr.from(r);s.visit(n,(l,a)=>(l==="address"&&!pe(a,20)&&(o[a]="0x"),a));for(const l in o)o[l]=yield i(l);return e.verifyingContract&&o[e.verifyingContract]&&(e.verifyingContract=o[e.verifyingContract]),n=s.visit(n,(l,a)=>l==="address"&&o[a]?o[a]:a),{domain:e,value:n}})}static getPayload(e,r,n){sr.hashDomain(e);const i={},o=[];zc.forEach(a=>{const u=e[a];u!=null&&(i[a]=nb[a](u),o.push({name:a,type:_p[a]}))});const s=sr.from(r),l=it(r);return l.EIP712Domain?lt.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):l.EIP712Domain=o,s.encode(n),{types:l,domain:i,primaryType:s.primaryType,message:s.visit(n,(a,u)=>{if(a.match(/^bytes(\d*)/))return re(se(u));if(a.match(/^u?int/))return G.from(u).toString();switch(a){case"address":return u.toLowerCase();case"bool":return!!u;case"string":return typeof u!="string"&<.throwArgumentError("invalid string","value",u),u}return lt.throwArgumentError("unsupported type","type",a)})}}}const st=new T(yl);class ib extends vl{}class ob extends vl{}class sb extends vl{}class ld extends vl{static isIndexed(e){return!!(e&&e._isIndexed)}}const lb={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Np(t,e){const r=new Error(`deferred error during ABI decoding triggered accessing ${t}`);return r.error=e,r}class ad{constructor(e){let r=[];typeof e=="string"?r=JSON.parse(e):r=e,z(this,"fragments",r.map(n=>Nn.from(n)).filter(n=>n!=null)),z(this,"_abiCoder",fr(new.target,"getAbiCoder")()),z(this,"functions",{}),z(this,"errors",{}),z(this,"events",{}),z(this,"structs",{}),this.fragments.forEach(n=>{let i=null;switch(n.type){case"constructor":if(this.deploy){st.warn("duplicate definition - constructor");return}z(this,"deploy",n);return;case"function":i=this.functions;break;case"event":i=this.events;break;case"error":i=this.errors;break;default:return}let o=n.format();if(i[o]){st.warn("duplicate definition - "+o);return}i[o]=n}),this.deploy||z(this,"deploy",on.from({payable:!1,type:"constructor"})),z(this,"_isInterface",!0)}format(e){e||(e=Se.full),e===Se.sighash&&st.throwArgumentError("interface does not support formatting sighash","format",e);const r=this.fragments.map(n=>n.format(e));return e===Se.json?JSON.stringify(r.map(n=>JSON.parse(n))):r}static getAbiCoder(){return kA}static getAddress(e){return mt(e)}static getSighash(e){return It(fo(e.format()),0,4)}static getEventTopic(e){return fo(e.format())}getFunction(e){if(pe(e)){for(const n in this.functions)if(e===this.getSighash(n))return this.functions[n];st.throwArgumentError("no matching function","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.functions).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching function","name",n):i.length>1&&st.throwArgumentError("multiple matching functions","name",n),this.functions[i[0]]}const r=this.functions[sn.fromString(e).format()];return r||st.throwArgumentError("no matching function","signature",e),r}getEvent(e){if(pe(e)){const n=e.toLowerCase();for(const i in this.events)if(n===this.getEventTopic(i))return this.events[i];st.throwArgumentError("no matching event","topichash",n)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.events).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching event","name",n):i.length>1&&st.throwArgumentError("multiple matching events","name",n),this.events[i[0]]}const r=this.events[_n.fromString(e).format()];return r||st.throwArgumentError("no matching event","signature",e),r}getError(e){if(pe(e)){const n=fr(this.constructor,"getSighash");for(const i in this.errors){const o=this.errors[i];if(e===n(o))return this.errors[i]}st.throwArgumentError("no matching error","sighash",e)}if(e.indexOf("(")===-1){const n=e.trim(),i=Object.keys(this.errors).filter(o=>o.split("(")[0]===n);return i.length===0?st.throwArgumentError("no matching error","name",n):i.length>1&&st.throwArgumentError("multiple matching errors","name",n),this.errors[i[0]]}const r=this.errors[sn.fromString(e).format()];return r||st.throwArgumentError("no matching error","signature",e),r}getSighash(e){if(typeof e=="string")try{e=this.getFunction(e)}catch(r){try{e=this.getError(e)}catch{throw r}}return fr(this.constructor,"getSighash")(e)}getEventTopic(e){return typeof e=="string"&&(e=this.getEvent(e)),fr(this.constructor,"getEventTopic")(e)}_decodeParams(e,r){return this._abiCoder.decode(e,r)}_encodeParams(e,r){return this._abiCoder.encode(e,r)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,r){typeof e=="string"&&(e=this.getError(e));const n=se(r);return re(n.slice(0,4))!==this.getSighash(e)&&st.throwArgumentError(`data signature does not match error ${e.name}.`,"data",re(n)),this._decodeParams(e.inputs,n.slice(4))}encodeErrorResult(e,r){return typeof e=="string"&&(e=this.getError(e)),re(Ut([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionData(e,r){typeof e=="string"&&(e=this.getFunction(e));const n=se(r);return re(n.slice(0,4))!==this.getSighash(e)&&st.throwArgumentError(`data signature does not match function ${e.name}.`,"data",re(n)),this._decodeParams(e.inputs,n.slice(4))}encodeFunctionData(e,r){return typeof e=="string"&&(e=this.getFunction(e)),re(Ut([this.getSighash(e),this._encodeParams(e.inputs,r||[])]))}decodeFunctionResult(e,r){typeof e=="string"&&(e=this.getFunction(e));let n=se(r),i=null,o="",s=null,l=null,a=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,n)}catch{}break;case 4:{const u=re(n.slice(0,4)),c=lb[u];if(c)s=this._abiCoder.decode(c.inputs,n.slice(4)),l=c.name,a=c.signature,c.reason&&(i=s[0]),l==="Error"?o=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(s[0])}`:l==="Panic"&&(o=`; VM Exception while processing transaction: reverted with panic code ${s[0]}`);else try{const d=this.getError(u);s=this._abiCoder.decode(d.inputs,n.slice(4)),l=d.name,a=d.format()}catch{}break}}return st.throwError("call revert exception"+o,T.errors.CALL_EXCEPTION,{method:e.format(),data:re(r),errorArgs:s,errorName:l,errorSignature:a,reason:i})}encodeFunctionResult(e,r){return typeof e=="string"&&(e=this.getFunction(e)),re(this._abiCoder.encode(e.outputs,r||[]))}encodeFilterTopics(e,r){typeof e=="string"&&(e=this.getEvent(e)),r.length>e.inputs.length&&st.throwError("too many arguments for "+e.format(),T.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:r});let n=[];e.anonymous||n.push(this.getEventTopic(e));const i=(o,s)=>o.type==="string"?fo(s):o.type==="bytes"?ut(re(s)):(o.type==="bool"&&typeof s=="boolean"&&(s=s?"0x01":"0x00"),o.type.match(/^u?int/)&&(s=G.from(s).toHexString()),o.type==="address"&&this._abiCoder.encode(["address"],[s]),pt(re(s),32));for(r.forEach((o,s)=>{let l=e.inputs[s];if(!l.indexed){o!=null&&st.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+l.name,o);return}o==null?n.push(null):l.baseType==="array"||l.baseType==="tuple"?st.throwArgumentError("filtering with tuples or arrays not supported","contract."+l.name,o):Array.isArray(o)?n.push(o.map(a=>i(l,a))):n.push(i(l,o))});n.length&&n[n.length-1]===null;)n.pop();return n}encodeEventLog(e,r){typeof e=="string"&&(e=this.getEvent(e));const n=[],i=[],o=[];return e.anonymous||n.push(this.getEventTopic(e)),r.length!==e.inputs.length&&st.throwArgumentError("event arguments/values mismatch","values",r),e.inputs.forEach((s,l)=>{const a=r[l];if(s.indexed)if(s.type==="string")n.push(fo(a));else if(s.type==="bytes")n.push(ut(a));else{if(s.baseType==="tuple"||s.baseType==="array")throw new Error("not implemented");n.push(this._abiCoder.encode([s.type],[a]))}else i.push(s),o.push(a)}),{data:this._abiCoder.encode(i,o),topics:n}}decodeEventLog(e,r,n){if(typeof e=="string"&&(e=this.getEvent(e)),n!=null&&!e.anonymous){let p=this.getEventTopic(e);(!pe(n[0],32)||n[0].toLowerCase()!==p)&&st.throwError("fragment/topic mismatch",T.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:p,value:n[0]}),n=n.slice(1)}let i=[],o=[],s=[];e.inputs.forEach((p,v)=>{p.indexed?p.type==="string"||p.type==="bytes"||p.baseType==="tuple"||p.baseType==="array"?(i.push(kt.fromObject({type:"bytes32",name:p.name})),s.push(!0)):(i.push(p),s.push(!1)):(o.push(p),s.push(!1))});let l=n!=null?this._abiCoder.decode(i,Ut(n)):null,a=this._abiCoder.decode(o,r,!0),u=[],c=0,d=0;e.inputs.forEach((p,v)=>{if(p.indexed)if(l==null)u[v]=new ld({_isIndexed:!0,hash:null});else if(s[v])u[v]=new ld({_isIndexed:!0,hash:l[d++]});else try{u[v]=l[d++]}catch(g){u[v]=g}else try{u[v]=a[c++]}catch(g){u[v]=g}if(p.name&&u[p.name]==null){const g=u[v];g instanceof Error?Object.defineProperty(u,p.name,{enumerable:!0,get:()=>{throw Np(`property ${JSON.stringify(p.name)}`,g)}}):u[p.name]=g}});for(let p=0;p{throw Np(`index ${p}`,v)}})}return Object.freeze(u)}parseTransaction(e){let r=this.getFunction(e.data.substring(0,10).toLowerCase());return r?new ob({args:this._abiCoder.decode(r.inputs,"0x"+e.data.substring(10)),functionFragment:r,name:r.name,signature:r.format(),sighash:this.getSighash(r),value:G.from(e.value||"0")}):null}parseLog(e){let r=this.getEvent(e.topics[0]);return!r||r.anonymous?null:new ib({eventFragment:r,name:r.name,signature:r.format(),topic:this.getEventTopic(r),args:this.decodeEventLog(r,e.data,e.topics)})}parseError(e){const r=re(e);let n=this.getError(r.substring(0,10).toLowerCase());return n?new sb({args:this._abiCoder.decode(n.inputs,"0x"+r.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(e){return!!(e&&e._isInterface)}}const ab="abstract-provider/5.7.0";var ub=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const cb=new T(ab);class fb extends vl{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class qo{constructor(){cb.checkAbstract(new.target,qo),z(this,"_isProvider",!0)}getFeeData(){return ub(this,void 0,void 0,function*(){const{block:e,gasPrice:r}=yield yt({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch(s=>null)});let n=null,i=null,o=null;return e&&e.baseFeePerGas&&(n=e.baseFeePerGas,o=G.from("1500000000"),i=e.baseFeePerGas.mul(2).add(o)),{lastBaseFeePerGas:n,maxFeePerGas:i,maxPriorityFeePerGas:o,gasPrice:r}})}addListener(e,r){return this.on(e,r)}removeListener(e,r){return this.off(e,r)}static isProvider(e){return!!(e&&e._isProvider)}}const db="abstract-signer/5.7.0";var Or=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Ar=new T(db),hb=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],pb=[T.errors.INSUFFICIENT_FUNDS,T.errors.NONCE_EXPIRED,T.errors.REPLACEMENT_UNDERPRICED];class El{constructor(){Ar.checkAbstract(new.target,El),z(this,"_isSigner",!0)}getBalance(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)})}getTransactionCount(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)})}estimateGas(e){return Or(this,void 0,void 0,function*(){this._checkProvider("estimateGas");const r=yield yt(this.checkTransaction(e));return yield this.provider.estimateGas(r)})}call(e,r){return Or(this,void 0,void 0,function*(){this._checkProvider("call");const n=yield yt(this.checkTransaction(e));return yield this.provider.call(n,r)})}sendTransaction(e){return Or(this,void 0,void 0,function*(){this._checkProvider("sendTransaction");const r=yield this.populateTransaction(e),n=yield this.signTransaction(r);return yield this.provider.sendTransaction(n)})}getChainId(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getChainId"),(yield this.provider.getNetwork()).chainId})}getGasPrice(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()})}getFeeData(){return Or(this,void 0,void 0,function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()})}resolveName(e){return Or(this,void 0,void 0,function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)})}checkTransaction(e){for(const n in e)hb.indexOf(n)===-1&&Ar.throwArgumentError("invalid transaction key: "+n,"transaction",e);const r=it(e);return r.from==null?r.from=this.getAddress():r.from=Promise.all([Promise.resolve(r.from),this.getAddress()]).then(n=>(n[0].toLowerCase()!==n[1].toLowerCase()&&Ar.throwArgumentError("from address mismatch","transaction",e),n[0])),r}populateTransaction(e){return Or(this,void 0,void 0,function*(){const r=yield yt(this.checkTransaction(e));r.to!=null&&(r.to=Promise.resolve(r.to).then(i=>Or(this,void 0,void 0,function*(){if(i==null)return null;const o=yield this.resolveName(i);return o==null&&Ar.throwArgumentError("provided ENS name resolves to null","tx.to",i),o})),r.to.catch(i=>{}));const n=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||n)?Ar.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(r.type===0||r.type===1)&&n&&Ar.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1)r.gasPrice==null&&(r.gasPrice=this.getGasPrice());else{const i=yield this.getFeeData();if(r.type==null)if(i.maxFeePerGas!=null&&i.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){const o=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=o,r.maxPriorityFeePerGas=o}else r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas);else i.gasPrice!=null?(n&&Ar.throwError("network does not support EIP-1559",T.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=i.gasPrice),r.type=0):Ar.throwError("failed to get consistent fee data",T.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else r.type===2&&(r.maxFeePerGas==null&&(r.maxFeePerGas=i.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=i.maxPriorityFeePerGas))}return r.nonce==null&&(r.nonce=this.getTransactionCount("pending")),r.gasLimit==null&&(r.gasLimit=this.estimateGas(r).catch(i=>{if(pb.indexOf(i.code)>=0)throw i;return Ar.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:i,tx:r})})),r.chainId==null?r.chainId=this.getChainId():r.chainId=Promise.all([Promise.resolve(r.chainId),this.getChainId()]).then(i=>(i[1]!==0&&i[0]!==i[1]&&Ar.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield yt(r)})}_checkProvider(e){this.provider||Ar.throwError("missing provider",T.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!!(e&&e._isSigner)}}class Ph extends El{constructor(e,r){super(),z(this,"address",e),z(this,"provider",r||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,r){return Promise.resolve().then(()=>{Ar.throwError(e,T.errors.UNSUPPORTED_OPERATION,{operation:r})})}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,r,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new Ph(this.address,e)}}var Ry={},we={},xl=Ty;function Ty(t,e){if(!t)throw new Error(e||"Assertion failed")}Ty.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var ud={exports:{}};typeof Object.create=="function"?ud.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:ud.exports=function(e,r){if(r){e.super_=r;var n=function(){};n.prototype=r.prototype,e.prototype=new n,e.prototype.constructor=e}};var mb=ud.exports,gb=xl,vb=mb;we.inherits=vb;function yb(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function wb(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var r=[];if(typeof t=="string")if(e){if(e==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),i=0;i>6|192,r[n++]=o&63|128):yb(t,i)?(o=65536+((o&1023)<<10)+(t.charCodeAt(++i)&1023),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=o&63|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=o&63|128)}else for(i=0;i>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return e>>>0}we.htonl=Oy;function xb(t,e){for(var r="",n=0;n>>0}return o}we.join32=Ab;function bb(t,e){for(var r=new Array(t.length*4),n=0,i=0;n>>24,r[i+1]=o>>>16&255,r[i+2]=o>>>8&255,r[i+3]=o&255):(r[i+3]=o>>>24,r[i+2]=o>>>16&255,r[i+1]=o>>>8&255,r[i]=o&255)}return r}we.split32=bb;function _b(t,e){return t>>>e|t<<32-e}we.rotr32=_b;function Sb(t,e){return t<>>32-e}we.rotl32=Sb;function kb(t,e){return t+e>>>0}we.sum32=kb;function Nb(t,e,r){return t+e+r>>>0}we.sum32_3=Nb;function Pb(t,e,r,n){return t+e+r+n>>>0}we.sum32_4=Pb;function Cb(t,e,r,n,i){return t+e+r+n+i>>>0}we.sum32_5=Cb;function Mb(t,e,r,n){var i=t[e],o=t[e+1],s=n+o>>>0,l=(s>>0,t[e+1]=s}we.sum64=Mb;function Ib(t,e,r,n){var i=e+n>>>0,o=(i>>0}we.sum64_hi=Ib;function Rb(t,e,r,n){var i=e+n;return i>>>0}we.sum64_lo=Rb;function Tb(t,e,r,n,i,o,s,l){var a=0,u=e;u=u+n>>>0,a+=u>>0,a+=u>>0,a+=u>>0}we.sum64_4_hi=Tb;function Ob(t,e,r,n,i,o,s,l){var a=e+n+o+l;return a>>>0}we.sum64_4_lo=Ob;function Lb(t,e,r,n,i,o,s,l,a,u){var c=0,d=e;d=d+n>>>0,c+=d>>0,c+=d>>0,c+=d>>0,c+=d>>0}we.sum64_5_hi=Lb;function Bb(t,e,r,n,i,o,s,l,a,u){var c=e+n+o+l+u;return c>>>0}we.sum64_5_lo=Bb;function Db(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}we.rotr64_hi=Db;function jb(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}we.rotr64_lo=jb;function Ub(t,e,r){return t>>>r}we.shr64_hi=Ub;function Fb(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}we.shr64_lo=Fb;var Wo={},Pp=we,zb=xl;function Du(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}Wo.BlockHash=Du;Du.prototype.update=function(e,r){if(e=Pp.toArray(e,r),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var n=e.length%this._delta8;this.pending=e.slice(e.length-n,e.length),this.pending.length===0&&(this.pending=null),e=Pp.join32(e,0,e.length-n,this.endian);for(var i=0;i>>24&255,i[o++]=e>>>16&255,i[o++]=e>>>8&255,i[o++]=e&255}else for(i[o++]=e&255,i[o++]=e>>>8&255,i[o++]=e>>>16&255,i[o++]=e>>>24&255,i[o++]=0,i[o++]=0,i[o++]=0,i[o++]=0,s=8;s>>3}mn.g0_256=Gb;function Vb(t){return un(t,17)^un(t,19)^t>>>10}mn.g1_256=Vb;var To=we,Kb=Wo,Qb=mn,Hc=To.rotl32,is=To.sum32,Jb=To.sum32_5,Yb=Qb.ft_1,Fy=Kb.BlockHash,Xb=[1518500249,1859775393,2400959708,3395469782];function dn(){if(!(this instanceof dn))return new dn;Fy.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}To.inherits(dn,Fy);var Zb=dn;dn.blockSize=512;dn.outSize=160;dn.hmacStrength=80;dn.padLength=64;dn.prototype._update=function(e,r){for(var n=this.W,i=0;i<16;i++)n[i]=e[r+i];for(;ithis.blockSize&&(e=new this.Hash().update(e).digest()),F_(e.length<=this.blockSize);for(var r=e.length;r>8,p=c&255;d?a.push(d,p):a.push(p)}return a}r.toArray=n;function i(s){return s.length===1?"0"+s:s}r.zero2=i;function o(s){for(var l="",a=0;a(p>>1)-1?x=(p>>1)-S:x=S,v.isubn(x)):x=0,d[g]=x,v.iushrn(1)}return d}r.getNAF=n;function i(a,u){var c=[[],[]];a=a.clone(),u=u.clone();for(var d=0,p=0,v;a.cmpn(-d)>0||u.cmpn(-p)>0;){var g=a.andln(3)+d&3,x=u.andln(3)+p&3;g===3&&(g=-1),x===3&&(x=-1);var S;g&1?(v=a.andln(7)+d&7,(v===3||v===5)&&x===2?S=-g:S=g):S=0,c[0].push(S);var E;x&1?(v=u.andln(7)+p&7,(v===3||v===5)&&g===2?E=-x:E=x):E=0,c[1].push(E),2*d===S+1&&(d=1-d),2*p===E+1&&(p=1-p),a.iushrn(1),u.iushrn(1)}return c}r.getJSF=i;function o(a,u,c){var d="_"+u;a.prototype[u]=function(){return this[d]!==void 0?this[d]:this[d]=c.call(this)}}r.cachedProperty=o;function s(a){return typeof a=="string"?r.toArray(a,"hex"):a}r.parseBytes=s;function l(a){return new ue(a,"hex","le")}r.intFromLE=l}),Za=yr.getNAF,H_=yr.getJSF,eu=yr.assert;function xi(t,e){this.type=t,this.p=new ue(e.p,16),this.red=e.prime?ue.red(e.prime):ue.mont(this.p),this.zero=new ue(0).toRed(this.red),this.one=new ue(1).toRed(this.red),this.two=new ue(2).toRed(this.red),this.n=e.n&&new ue(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Hi=xi;xi.prototype.point=function(){throw new Error("Not implemented")};xi.prototype.validate=function(){throw new Error("Not implemented")};xi.prototype._fixedNafMul=function(e,r){eu(e.precomputed);var n=e._getDoubles(),i=Za(r,1,this._bitLength),o=(1<=l;u--)a=(a<<1)+i[u];s.push(a)}for(var c=this.jpoint(null,null,null),d=this.jpoint(null,null,null),p=o;p>0;p--){for(l=0;l=0;a--){for(var u=0;a>=0&&s[a]===0;a--)u++;if(a>=0&&u++,l=l.dblp(u),a<0)break;var c=s[a];eu(c!==0),e.type==="affine"?c>0?l=l.mixedAdd(o[c-1>>1]):l=l.mixedAdd(o[-c-1>>1].neg()):c>0?l=l.add(o[c-1>>1]):l=l.add(o[-c-1>>1].neg())}return e.type==="affine"?l.toP():l};xi.prototype._wnafMulAdd=function(e,r,n,i,o){var s=this._wnafT1,l=this._wnafT2,a=this._wnafT3,u=0,c,d,p;for(c=0;c=1;c-=2){var g=c-1,x=c;if(s[g]!==1||s[x]!==1){a[g]=Za(n[g],s[g],this._bitLength),a[x]=Za(n[x],s[x],this._bitLength),u=Math.max(a[g].length,u),u=Math.max(a[x].length,u);continue}var S=[r[g],null,null,r[x]];r[g].y.cmp(r[x].y)===0?(S[1]=r[g].add(r[x]),S[2]=r[g].toJ().mixedAdd(r[x].neg())):r[g].y.cmp(r[x].y.redNeg())===0?(S[1]=r[g].toJ().mixedAdd(r[x]),S[2]=r[g].add(r[x].neg())):(S[1]=r[g].toJ().mixedAdd(r[x]),S[2]=r[g].toJ().mixedAdd(r[x].neg()));var E=[-3,-1,-5,-7,0,7,5,1,3],w=H_(n[g],n[x]);for(u=Math.max(w[0].length,u),a[g]=new Array(u),a[x]=new Array(u),d=0;d=0;c--){for(var $=0;c>=0;){var H=!0;for(d=0;d=0&&$++,B=B.dblp($),c<0)break;for(d=0;d0?p=l[d][ie-1>>1]:ie<0&&(p=l[d][-ie-1>>1].neg()),p.type==="affine"?B=B.mixedAdd(p):B=B.add(p))}}for(c=0;c=Math.ceil((e.bitLength()+1)/r.step):!1};Mr.prototype._getDoubles=function(e,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,o=0;o=0&&(v=u,g=c),d.negative&&(d=d.neg(),p=p.neg()),v.negative&&(v=v.neg(),g=g.neg()),[{a:d,b:p},{a:v,b:g}]};Ir.prototype._endoSplit=function(e){var r=this.endo.basis,n=r[0],i=r[1],o=i.b.mul(e).divRound(this.n),s=n.b.neg().mul(e).divRound(this.n),l=o.mul(n.a),a=s.mul(i.a),u=o.mul(n.b),c=s.mul(i.b),d=e.sub(l).sub(a),p=u.add(c).neg();return{k1:d,k2:p}};Ir.prototype.pointFromX=function(e,r){e=new ue(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var o=i.fromRed().isOdd();return(r&&!o||!r&&o)&&(i=i.redNeg()),this.point(e,i)};Ir.prototype.validate=function(e){if(e.inf)return!0;var r=e.x,n=e.y,i=this.a.redMul(r),o=r.redSqr().redMul(r).redIAdd(i).redIAdd(this.b);return n.redSqr().redISub(o).cmpn(0)===0};Ir.prototype._endoWnafMulAdd=function(e,r,n){for(var i=this._endoWnafT1,o=this._endoWnafT2,s=0;s":""};Pt.prototype.isInfinity=function(){return this.inf};Pt.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(this.x.cmp(e.x)===0)return this.curve.point(null,null);var r=this.y.redSub(e.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(e.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(e.x),i=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,i)};Pt.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),i=e.redInvm(),o=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(i),s=o.redSqr().redISub(this.x.redAdd(this.x)),l=o.redMul(this.x.redSub(s)).redISub(this.y);return this.curve.point(s,l)};Pt.prototype.getX=function(){return this.x.fromRed()};Pt.prototype.getY=function(){return this.y.fromRed()};Pt.prototype.mul=function(e){return e=new ue(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)};Pt.prototype.mulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o):this.curve._wnafMulAdd(1,i,o,2)};Pt.prototype.jmulAdd=function(e,r,n){var i=[this,r],o=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(i,o,!0):this.curve._wnafMulAdd(1,i,o,2,!0)};Pt.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)};Pt.prototype.neg=function(e){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,i=function(o){return o.neg()};r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(i)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(i)}}}return r};Pt.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var e=this.curve.jpoint(this.x,this.y,this.curve.one);return e};function Ot(t,e,r,n){Hi.BasePoint.call(this,t,"jacobian"),e===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new ue(0)):(this.x=new ue(e,16),this.y=new ue(r,16),this.z=new ue(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Mh(Ot,Hi.BasePoint);Ir.prototype.jpoint=function(e,r,n){return new Ot(this,e,r,n)};Ot.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),r=e.redSqr(),n=this.x.redMul(r),i=this.y.redMul(r).redMul(e);return this.curve.point(n,i)};Ot.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Ot.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var r=e.z.redSqr(),n=this.z.redSqr(),i=this.x.redMul(r),o=e.x.redMul(n),s=this.y.redMul(r.redMul(e.z)),l=e.y.redMul(n.redMul(this.z)),a=i.redSub(o),u=s.redSub(l);if(a.cmpn(0)===0)return u.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var c=a.redSqr(),d=c.redMul(a),p=i.redMul(c),v=u.redSqr().redIAdd(d).redISub(p).redISub(p),g=u.redMul(p.redISub(v)).redISub(s.redMul(d)),x=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(v,g,x)};Ot.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var r=this.z.redSqr(),n=this.x,i=e.x.redMul(r),o=this.y,s=e.y.redMul(r).redMul(this.z),l=n.redSub(i),a=o.redSub(s);if(l.cmpn(0)===0)return a.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var u=l.redSqr(),c=u.redMul(l),d=n.redMul(u),p=a.redSqr().redIAdd(c).redISub(d).redISub(d),v=a.redMul(d.redISub(p)).redISub(o.redMul(c)),g=this.z.redMul(l);return this.curve.jpoint(p,v,g)};Ot.prototype.dblp=function(e){if(e===0)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r=0)return!1;if(n.redIAdd(o),this.x.cmp(n)===0)return!0}};Ot.prototype.inspect=function(){return this.isInfinity()?"":""};Ot.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var ga=Ko(function(t,e){var r=e;r.base=Hi,r.short=W_,r.mont=null,r.edwards=null}),va=Ko(function(t,e){var r=e,n=yr.assert;function i(l){l.type==="short"?this.curve=new ga.short(l):l.type==="edwards"?this.curve=new ga.edwards(l):this.curve=new ga.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}r.PresetCurve=i;function o(l,a){Object.defineProperty(r,l,{configurable:!0,enumerable:!0,get:function(){var u=new i(a);return Object.defineProperty(r,l,{configurable:!0,enumerable:!0,value:u}),u}})}o("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:en.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:en.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:en.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:en.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),o("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:en.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:en.sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:en.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var s;try{s=null.crash()}catch{s=void 0}o("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:en.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",s]})});function gi(t){if(!(this instanceof gi))return new gi(t);this.hash=t.hash,this.predResist=!!t.predResist,this.outLen=this.hash.outSize,this.minEntropy=t.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=Hr.toArray(t.entropy,t.entropyEnc||"hex"),r=Hr.toArray(t.nonce,t.nonceEnc||"hex"),n=Hr.toArray(t.pers,t.persEnc||"hex");Ch(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,r,n)}var Xy=gi;gi.prototype._init=function(e,r,n){var i=e.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1};gi.prototype.generate=function(e,r,n,i){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(i=n,n=r,r=null),n&&(n=Hr.toArray(n,i||"hex"),this._update(n));for(var o=[];o.length"};var G_=yr.assert;function ju(t,e){if(t instanceof ju)return t;this._importDER(t,e)||(G_(t.r&&t.s,"Signature without r or s"),this.r=new ue(t.r,16),this.s=new ue(t.s,16),t.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=t.recoveryParam)}var Uu=ju;function V_(){this.place=0}function Gc(t,e){var r=t[e.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4)return!1;for(var i=0,o=0,s=e.place;o>>=0;return i<=127?!1:(e.place=s,i)}function Rp(t){for(var e=0,r=t.length-1;!t[e]&&!(t[e+1]&128)&&e>>3);for(t.push(r|128);--r;)t.push(e>>>(r<<3)&255);t.push(e)}ju.prototype.toDER=function(e){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=Rp(r),n=Rp(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];Vc(i,r.length),i=i.concat(r),i.push(2),Vc(i,n.length);var o=i.concat(n),s=[48];return Vc(s,o.length),s=s.concat(o),yr.encode(s,e)};var K_=function(){throw new Error("unsupported")},Zy=yr.assert;function Cr(t){if(!(this instanceof Cr))return new Cr(t);typeof t=="string"&&(Zy(Object.prototype.hasOwnProperty.call(va,t),"Unknown curve "+t),t=va[t]),t instanceof va.PresetCurve&&(t={curve:t}),this.curve=t.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=t.curve.g,this.g.precompute(t.curve.n.bitLength()+1),this.hash=t.hash||t.curve.hash}var Q_=Cr;Cr.prototype.keyPair=function(e){return new Ih(this,e)};Cr.prototype.keyFromPrivate=function(e,r){return Ih.fromPrivate(this,e,r)};Cr.prototype.keyFromPublic=function(e,r){return Ih.fromPublic(this,e,r)};Cr.prototype.genKeyPair=function(e){e||(e={});for(var r=new Xy({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||K_(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),i=this.n.sub(new ue(2));;){var o=new ue(r.generate(n));if(!(o.cmp(i)>0))return o.iaddn(1),this.keyFromPrivate(o)}};Cr.prototype._truncateToN=function(e,r){var n=e.byteLength()*8-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!r&&e.cmp(this.n)>=0?e.sub(this.n):e};Cr.prototype.sign=function(e,r,n,i){typeof n=="object"&&(i=n,n=null),i||(i={}),r=this.keyFromPrivate(r,n),e=this._truncateToN(new ue(e,16));for(var o=this.n.byteLength(),s=r.getPrivate().toArray("be",o),l=e.toArray("be",o),a=new Xy({hash:this.hash,entropy:s,nonce:l,pers:i.pers,persEnc:i.persEnc||"utf8"}),u=this.n.sub(new ue(1)),c=0;;c++){var d=i.k?i.k(c):new ue(a.generate(this.n.byteLength()));if(d=this._truncateToN(d,!0),!(d.cmpn(1)<=0||d.cmp(u)>=0)){var p=this.g.mul(d);if(!p.isInfinity()){var v=p.getX(),g=v.umod(this.n);if(g.cmpn(0)!==0){var x=d.invm(this.n).mul(g.mul(r.getPrivate()).iadd(e));if(x=x.umod(this.n),x.cmpn(0)!==0){var S=(p.getY().isOdd()?1:0)|(v.cmp(g)!==0?2:0);return i.canonical&&x.cmp(this.nh)>0&&(x=this.n.sub(x),S^=1),new Uu({r:g,s:x,recoveryParam:S})}}}}}};Cr.prototype.verify=function(e,r,n,i){e=this._truncateToN(new ue(e,16)),n=this.keyFromPublic(n,i),r=new Uu(r,"hex");var o=r.r,s=r.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||s.cmpn(1)<0||s.cmp(this.n)>=0)return!1;var l=s.invm(this.n),a=l.mul(e).umod(this.n),u=l.mul(o).umod(this.n),c;return this.curve._maxwellTrick?(c=this.g.jmulAdd(a,n.getPublic(),u),c.isInfinity()?!1:c.eqXToP(o)):(c=this.g.mulAdd(a,n.getPublic(),u),c.isInfinity()?!1:c.getX().umod(this.n).cmp(o)===0)};Cr.prototype.recoverPubKey=function(t,e,r,n){Zy((3&r)===r,"The recovery param is more than two bits"),e=new Uu(e,n);var i=this.n,o=new ue(t),s=e.r,l=e.s,a=r&1,u=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&u)throw new Error("Unable to find sencond key candinate");u?s=this.curve.pointFromX(s.add(this.curve.n),a):s=this.curve.pointFromX(s,a);var c=e.r.invm(i),d=i.sub(o).mul(c).umod(i),p=l.mul(c).umod(i);return this.g.mulAdd(d,s,p)};Cr.prototype.getKeyRecoveryParam=function(t,e,r,n){if(e=new Uu(e,n),e.recoveryParam!==null)return e.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(t,e,i)}catch{continue}if(o.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var J_=Ko(function(t,e){var r=e;r.version="6.5.4",r.utils=yr,r.rand=function(){throw new Error("unsupported")},r.curve=ga,r.curves=va,r.ec=Q_,r.eddsa=null}),Y_=J_.ec;const X_="signing-key/5.7.0",hd=new T(X_);let Kc=null;function rn(){return Kc||(Kc=new Y_("secp256k1")),Kc}class Z_{constructor(e){z(this,"curve","secp256k1"),z(this,"privateKey",re(e)),On(this.privateKey)!==32&&hd.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const r=rn().keyFromPrivate(se(this.privateKey));z(this,"publicKey","0x"+r.getPublic(!1,"hex")),z(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),z(this,"_isSigningKey",!0)}_addPoint(e){const r=rn().keyFromPublic(se(this.publicKey)),n=rn().keyFromPublic(se(e));return"0x"+r.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const r=rn().keyFromPrivate(se(this.privateKey)),n=se(e);n.length!==32&&hd.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Ou({recoveryParam:i.recoveryParam,r:pt("0x"+i.r.toString(16),32),s:pt("0x"+i.s.toString(16),32)})}computeSharedSecret(e){const r=rn().keyFromPrivate(se(this.privateKey)),n=rn().keyFromPublic(se(e1(e)));return pt("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function e3(t,e){const r=Ou(e),n={r:se(r.r),s:se(r.s)};return"0x"+rn().recoverPubKey(se(t),n,r.recoveryParam).encode("hex",!1)}function e1(t,e){const r=se(t);if(r.length===32){const n=new Z_(r);return e?"0x"+rn().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return e?re(r):"0x"+rn().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return e?"0x"+rn().keyFromPublic(r).getPublic(!0,"hex"):re(r)}return hd.throwArgumentError("invalid public or private key","key","[REDACTED]")}const t3="transactions/5.7.0",Un=new T(t3);var Tp;(function(t){t[t.legacy=0]="legacy",t[t.eip2930=1]="eip2930",t[t.eip1559=2]="eip1559"})(Tp||(Tp={}));function Rh(t){return t==="0x"?null:mt(t)}function jt(t){return t==="0x"?gy:G.from(t)}function r3(t){const e=e1(t);return mt(It(ut(It(e,1)),12))}function t1(t,e){return r3(e3(se(t),e))}function ur(t,e){const r=Ro(G.from(t).toHexString());return r.length>32&&Un.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function Qc(t,e){return{address:mt(t),storageKeys:(e||[]).map((r,n)=>(On(r)!==32&&Un.throwArgumentError("invalid access list storageKey",`accessList[${t}:${n}]`,r),r.toLowerCase()))}}function qi(t){if(Array.isArray(t))return t.map((r,n)=>Array.isArray(r)?(r.length>2&&Un.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${n}]`,r),Qc(r[0],r[1])):Qc(r.address,r.storageKeys));const e=Object.keys(t).map(r=>{const n=t[r].reduce((i,o)=>(i[o]=!0,i),{});return Qc(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function r1(t){return qi(t).map(e=>[e.address,e.storageKeys])}function n3(t,e){if(t.gasPrice!=null){const n=G.from(t.gasPrice),i=G.from(t.maxFeePerGas||0);n.eq(i)||Un.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:n,maxFeePerGas:i})}const r=[ur(t.chainId||0,"chainId"),ur(t.nonce||0,"nonce"),ur(t.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),ur(t.maxFeePerGas||0,"maxFeePerGas"),ur(t.gasLimit||0,"gasLimit"),t.to!=null?mt(t.to):"0x",ur(t.value||0,"value"),t.data||"0x",r1(t.accessList||[])];if(e){const n=Ou(e);r.push(ur(n.recoveryParam,"recoveryParam")),r.push(Ro(n.r)),r.push(Ro(n.s))}return Xt(["0x02",Lu(r)])}function i3(t,e){const r=[ur(t.chainId||0,"chainId"),ur(t.nonce||0,"nonce"),ur(t.gasPrice||0,"gasPrice"),ur(t.gasLimit||0,"gasLimit"),t.to!=null?mt(t.to):"0x",ur(t.value||0,"value"),t.data||"0x",r1(t.accessList||[])];if(e){const n=Ou(e);r.push(ur(n.recoveryParam,"recoveryParam")),r.push(Ro(n.r)),r.push(Ro(n.s))}return Xt(["0x01",Lu(r)])}function n1(t,e,r){try{const n=jt(e[0]).toNumber();if(n!==0&&n!==1)throw new Error("bad recid");t.v=n}catch{Un.throwArgumentError("invalid v for transaction type: 1","v",e[0])}t.r=pt(e[1],32),t.s=pt(e[2],32);try{const n=ut(r(t));t.from=t1(n,{r:t.r,s:t.s,recoveryParam:t.v})}catch{}}function o3(t){const e=Sh(t.slice(1));e.length!==9&&e.length!==12&&Un.throwArgumentError("invalid component count for transaction type: 2","payload",re(t));const r=jt(e[2]),n=jt(e[3]),i={type:2,chainId:jt(e[0]).toNumber(),nonce:jt(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:jt(e[4]),to:Rh(e[5]),value:jt(e[6]),data:e[7],accessList:qi(e[8])};return e.length===9||(i.hash=ut(t),n1(i,e.slice(9),n3)),i}function s3(t){const e=Sh(t.slice(1));e.length!==8&&e.length!==11&&Un.throwArgumentError("invalid component count for transaction type: 1","payload",re(t));const r={type:1,chainId:jt(e[0]).toNumber(),nonce:jt(e[1]).toNumber(),gasPrice:jt(e[2]),gasLimit:jt(e[3]),to:Rh(e[4]),value:jt(e[5]),data:e[6],accessList:qi(e[7])};return e.length===8||(r.hash=ut(t),n1(r,e.slice(8),i3)),r}function l3(t){const e=Sh(t);e.length!==9&&e.length!==6&&Un.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:jt(e[0]).toNumber(),gasPrice:jt(e[1]),gasLimit:jt(e[2]),to:Rh(e[3]),value:jt(e[4]),data:e[5],chainId:0};if(e.length===6)return r;try{r.v=G.from(e[6]).toNumber()}catch{return r}if(r.r=pt(e[7],32),r.s=pt(e[8],32),G.from(r.r).isZero()&&G.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);let n=r.v-27;const i=e.slice(0,6);r.chainId!==0&&(i.push(re(r.chainId)),i.push("0x"),i.push("0x"),n-=r.chainId*2+8);const o=ut(Lu(i));try{r.from=t1(o,{r:re(r.r),s:re(r.s),recoveryParam:n})}catch{}r.hash=ut(t)}return r.type=null,r}function a3(t){const e=se(t);if(e[0]>127)return l3(e);switch(e[0]){case 1:return s3(e);case 2:return o3(e)}return Un.throwError(`unsupported transaction type: ${e[0]}`,T.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const u3="contracts/5.7.0";var Ui=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const gt=new T(u3);function tu(t,e){return Ui(this,void 0,void 0,function*(){const r=yield e;typeof r!="string"&>.throwArgumentError("invalid address or ENS name","name",r);try{return mt(r)}catch{}t||gt.throwError("a provider or signer is needed to resolve ENS names",T.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const n=yield t.resolveName(r);return n==null&>.throwArgumentError("resolver or addr is not configured for ENS name","name",r),n})}function ya(t,e,r){return Ui(this,void 0,void 0,function*(){return Array.isArray(r)?yield Promise.all(r.map((n,i)=>ya(t,Array.isArray(e)?e[i]:e[n.name],n))):r.type==="address"?yield tu(t,e):r.type==="tuple"?yield ya(t,e,r.components):r.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(n=>ya(t,n,r.arrayChildren))):Promise.reject(gt.makeError("invalid value for array",T.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function Fu(t,e,r){return Ui(this,void 0,void 0,function*(){let n={};r.length===e.inputs.length+1&&typeof r[r.length-1]=="object"&&(n=it(r.pop())),gt.checkArgumentCount(r.length,e.inputs.length,"passed to contract"),t.signer?n.from?n.from=yt({override:tu(t.signer,n.from),signer:t.signer.getAddress()}).then(u=>Ui(this,void 0,void 0,function*(){return mt(u.signer)!==u.override&>.throwError("Contract with a Signer cannot override from",T.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),u.override})):n.from=t.signer.getAddress():n.from&&(n.from=tu(t.provider,n.from));const i=yield yt({args:ya(t.signer||t.provider,r,e.inputs),address:t.resolvedAddress,overrides:yt(n)||{}}),o=t.interface.encodeFunctionData(e,i.args),s={data:o,to:i.address},l=i.overrides;if(l.nonce!=null&&(s.nonce=G.from(l.nonce).toNumber()),l.gasLimit!=null&&(s.gasLimit=G.from(l.gasLimit)),l.gasPrice!=null&&(s.gasPrice=G.from(l.gasPrice)),l.maxFeePerGas!=null&&(s.maxFeePerGas=G.from(l.maxFeePerGas)),l.maxPriorityFeePerGas!=null&&(s.maxPriorityFeePerGas=G.from(l.maxPriorityFeePerGas)),l.from!=null&&(s.from=l.from),l.type!=null&&(s.type=l.type),l.accessList!=null&&(s.accessList=qi(l.accessList)),s.gasLimit==null&&e.gas!=null){let u=21e3;const c=se(o);for(let d=0;dn[u]!=null);return a.length&>.throwError(`cannot override ${a.map(u=>JSON.stringify(u)).join(",")}`,T.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:a}),s})}function c3(t,e){return function(...r){return Fu(t,e,r)}}function f3(t,e){const r=t.signer||t.provider;return function(...n){return Ui(this,void 0,void 0,function*(){r||gt.throwError("estimate require a provider or signer",T.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield Fu(t,e,n);return yield r.estimateGas(i)})}}function d3(t,e){const r=e.wait.bind(e);e.wait=n=>r(n).then(i=>(i.events=i.logs.map(o=>{let s=nr(o),l=null;try{l=t.interface.parseLog(o)}catch{}return l&&(s.args=l.args,s.decode=(a,u)=>t.interface.decodeEventLog(l.eventFragment,a,u),s.event=l.name,s.eventSignature=l.signature),s.removeListener=()=>t.provider,s.getBlock=()=>t.provider.getBlock(i.blockHash),s.getTransaction=()=>t.provider.getTransaction(i.transactionHash),s.getTransactionReceipt=()=>Promise.resolve(i),s}),i))}function i1(t,e,r){const n=t.signer||t.provider;return function(...i){return Ui(this,void 0,void 0,function*(){let o;if(i.length===e.inputs.length+1&&typeof i[i.length-1]=="object"){const a=it(i.pop());a.blockTag!=null&&(o=yield a.blockTag),delete a.blockTag,i.push(a)}t.deployTransaction!=null&&(yield t._deployed(o));const s=yield Fu(t,e,i),l=yield n.call(s,o);try{let a=t.interface.decodeFunctionResult(e,l);return r&&e.outputs.length===1&&(a=a[0]),a}catch(a){throw a.code===T.errors.CALL_EXCEPTION&&(a.address=t.address,a.args=i,a.transaction=s),a}})}}function h3(t,e){return function(...r){return Ui(this,void 0,void 0,function*(){t.signer||gt.throwError("sending a transaction requires a signer",T.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),t.deployTransaction!=null&&(yield t._deployed());const n=yield Fu(t,e,r),i=yield t.signer.sendTransaction(n);return d3(t,i),i})}}function Op(t,e,r){return e.constant?i1(t,e,r):h3(t,e)}function o1(t){return t.address&&(t.topics==null||t.topics.length===0)?"*":(t.address||"*")+"@"+(t.topics?t.topics.map(e=>Array.isArray(e)?e.join("|"):e).join(":"):"")}class il{constructor(e,r){z(this,"tag",e),z(this,"filter",r),this._listeners=[]}addListener(e,r){this._listeners.push({listener:e,once:r})}removeListener(e){let r=!1;this._listeners=this._listeners.filter(n=>r||n.listener!==e?!0:(r=!0,!1))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map(e=>e.listener)}listenerCount(){return this._listeners.length}run(e){const r=this.listenerCount();return this._listeners=this._listeners.filter(n=>{const i=e.slice();return setTimeout(()=>{n.listener.apply(this,i)},0),!n.once}),r}prepareEvent(e){}getEmit(e){return[e]}}class p3 extends il{constructor(){super("error",null)}}class Lp extends il{constructor(e,r,n,i){const o={address:e};let s=r.getEventTopic(n);i?(s!==i[0]&>.throwArgumentError("topic mismatch","topics",i),o.topics=i.slice()):o.topics=[s],super(o1(o),o),z(this,"address",e),z(this,"interface",r),z(this,"fragment",n)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(r,n)=>this.interface.decodeEventLog(this.fragment,r,n);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(r){e.args=null,e.decodeError=r}}getEmit(e){const r=Gx(e.args);if(r.length)throw r[0].error;const n=(e.args||[]).slice();return n.push(e),n}}class Bp extends il{constructor(e,r){super("*",{address:e}),z(this,"address",e),z(this,"interface",r)}prepareEvent(e){super.prepareEvent(e);try{const r=this.interface.parseLog(e);e.event=r.name,e.eventSignature=r.signature,e.decode=(n,i)=>this.interface.decodeEventLog(r.eventFragment,n,i),e.args=r.args}catch{}}}class m3{constructor(e,r,n){z(this,"interface",fr(new.target,"getInterface")(r)),n==null?(z(this,"provider",null),z(this,"signer",null)):El.isSigner(n)?(z(this,"provider",n.provider||null),z(this,"signer",n)):qo.isProvider(n)?(z(this,"provider",n),z(this,"signer",null)):gt.throwArgumentError("invalid signer or provider","signerOrProvider",n),z(this,"callStatic",{}),z(this,"estimateGas",{}),z(this,"functions",{}),z(this,"populateTransaction",{}),z(this,"filters",{});{const s={};Object.keys(this.interface.events).forEach(l=>{const a=this.interface.events[l];z(this.filters,l,(...u)=>({address:this.address,topics:this.interface.encodeFilterTopics(a,u)})),s[a.name]||(s[a.name]=[]),s[a.name].push(l)}),Object.keys(s).forEach(l=>{const a=s[l];a.length===1?z(this.filters,l,this.filters[a[0]]):gt.warn(`Duplicate definition of ${l} (${a.join(", ")})`)})}if(z(this,"_runningEvents",{}),z(this,"_wrappedEmits",{}),e==null&>.throwArgumentError("invalid contract address or ENS name","addressOrName",e),z(this,"address",e),this.provider)z(this,"resolvedAddress",tu(this.provider,e));else try{z(this,"resolvedAddress",Promise.resolve(mt(e)))}catch{gt.throwError("provider is required to use ENS name as contract address",T.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch(s=>{});const i={},o={};Object.keys(this.interface.functions).forEach(s=>{const l=this.interface.functions[s];if(o[s]){gt.warn(`Duplicate ABI entry for ${JSON.stringify(s)}`);return}o[s]=!0;{const a=l.name;i[`%${a}`]||(i[`%${a}`]=[]),i[`%${a}`].push(s)}this[s]==null&&z(this,s,Op(this,l,!0)),this.functions[s]==null&&z(this.functions,s,Op(this,l,!1)),this.callStatic[s]==null&&z(this.callStatic,s,i1(this,l,!0)),this.populateTransaction[s]==null&&z(this.populateTransaction,s,c3(this,l)),this.estimateGas[s]==null&&z(this.estimateGas,s,f3(this,l))}),Object.keys(i).forEach(s=>{const l=i[s];if(l.length>1)return;s=s.substring(1);const a=l[0];try{this[s]==null&&z(this,s,this[a])}catch{}this.functions[s]==null&&z(this.functions,s,this.functions[a]),this.callStatic[s]==null&&z(this.callStatic,s,this.callStatic[a]),this.populateTransaction[s]==null&&z(this.populateTransaction,s,this.populateTransaction[a]),this.estimateGas[s]==null&&z(this.estimateGas,s,this.estimateGas[a])})}static getContractAddress(e){return Nh(e)}static getInterface(e){return ad.isInterface(e)?e:new ad(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then(()=>this):this._deployedPromise=this.provider.getCode(this.address,e).then(r=>(r==="0x"&>.throwError("contract not deployed",T.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||gt.throwError("sending a transactions require a signer",T.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const r=it(e||{});return["from","to"].forEach(function(n){r[n]!=null&>.throwError("cannot override "+n,T.errors.UNSUPPORTED_OPERATION,{operation:n})}),r.to=this.resolvedAddress,this.deployed().then(()=>this.signer.sendTransaction(r))}connect(e){typeof e=="string"&&(e=new Ph(e,this.provider));const r=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&z(r,"deployTransaction",this.deployTransaction),r}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return ld.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if(typeof e=="string"){if(e==="error")return this._normalizeRunningEvent(new p3);if(e==="event")return this._normalizeRunningEvent(new il("event",null));if(e==="*")return this._normalizeRunningEvent(new Bp(this.address,this.interface));const r=this.interface.getEvent(e);return this._normalizeRunningEvent(new Lp(this.address,this.interface,r))}if(e.topics&&e.topics.length>0){try{const n=e.topics[0];if(typeof n!="string")throw new Error("invalid topic");const i=this.interface.getEvent(n);return this._normalizeRunningEvent(new Lp(this.address,this.interface,i,e.topics))}catch{}const r={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new il(o1(r),r))}return this._normalizeRunningEvent(new Bp(this.address,this.interface))}_checkRunningEvents(e){if(e.listenerCount()===0){delete this._runningEvents[e.tag];const r=this._wrappedEmits[e.tag];r&&e.filter&&(this.provider.off(e.filter,r),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,r,n){const i=nr(r);return i.removeListener=()=>{n&&(e.removeListener(n),this._checkRunningEvents(e))},i.getBlock=()=>this.provider.getBlock(r.blockHash),i.getTransaction=()=>this.provider.getTransaction(r.transactionHash),i.getTransactionReceipt=()=>this.provider.getTransactionReceipt(r.transactionHash),e.prepareEvent(i),i}_addEventListener(e,r,n){if(this.provider||gt.throwError("events require a provider or a signer with a provider",T.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(r,n),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const i=o=>{let s=this._wrapEvent(e,o,r);if(s.decodeError==null)try{const l=e.getEmit(s);this.emit(e.filter,...l)}catch(l){s.decodeError=l.error}e.filter!=null&&this.emit("event",s),s.decodeError!=null&&this.emit("error",s.decodeError,s)};this._wrappedEmits[e.tag]=i,e.filter!=null&&this.provider.on(e.filter,i)}}queryFilter(e,r,n){const i=this._getRunningEvent(e),o=it(i.filter);return typeof r=="string"&&pe(r,32)?(n!=null&>.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),o.blockHash=r):(o.fromBlock=r??0,o.toBlock=n??"latest"),this.provider.getLogs(o).then(s=>s.map(l=>this._wrapEvent(i,l,null)))}on(e,r){return this._addEventListener(this._getRunningEvent(e),r,!1),this}once(e,r){return this._addEventListener(this._getRunningEvent(e),r,!0),this}emit(e,...r){if(!this.provider)return!1;const n=this._getRunningEvent(e),i=n.run(r)>0;return this._checkRunningEvents(n),i}listenerCount(e){return this.provider?e==null?Object.keys(this._runningEvents).reduce((r,n)=>r+this._runningEvents[n].listenerCount(),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(e==null){const r=[];for(let n in this._runningEvents)this._runningEvents[n].listeners().forEach(i=>{r.push(i)});return r}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(e==null){for(const n in this._runningEvents){const i=this._runningEvents[n];i.removeAllListeners(),this._checkRunningEvents(i)}return this}const r=this._getRunningEvent(e);return r.removeAllListeners(),this._checkRunningEvents(r),this}off(e,r){if(!this.provider)return this;const n=this._getRunningEvent(e);return n.removeListener(r),this._checkRunningEvents(n),this}removeListener(e,r){return this.off(e,r)}}class g3 extends m3{}class s1{constructor(e){z(this,"alphabet",e),z(this,"base",e.length),z(this,"_alphabetMap",{}),z(this,"_leader",e.charAt(0));for(let r=0;r0;)n.push(s%this.base),s=s/this.base|0}let i="";for(let o=0;r[o]===0&&o=0;--o)i+=this.alphabet[n[o]];return i}decode(e){if(typeof e!="string")throw new TypeError("Expected String");let r=[];if(e.length===0)return new Uint8Array(r);r.push(0);for(let n=0;n>=8;for(;o>0;)r.push(o&255),o>>=8}for(let n=0;e[n]===this._leader&&n0;e--){const r=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[r],t[r]=n}return t}const y3="networks/5.7.1",jp=new T(y3);function w3(t){return t&&typeof t.renetwork=="function"}function bn(t){const e=function(r,n){n==null&&(n={});const i=[];if(r.InfuraProvider&&n.infura!=="-")try{i.push(new r.InfuraProvider(t,n.infura))}catch{}if(r.EtherscanProvider&&n.etherscan!=="-")try{i.push(new r.EtherscanProvider(t,n.etherscan))}catch{}if(r.AlchemyProvider&&n.alchemy!=="-")try{i.push(new r.AlchemyProvider(t,n.alchemy))}catch{}if(r.PocketProvider&&n.pocket!=="-"){const o=["goerli","ropsten","rinkeby","sepolia"];try{const s=new r.PocketProvider(t,n.pocket);s.network&&o.indexOf(s.network.name)===-1&&i.push(s)}catch{}}if(r.CloudflareProvider&&n.cloudflare!=="-")try{i.push(new r.CloudflareProvider(t))}catch{}if(r.AnkrProvider&&n.ankr!=="-")try{const o=["ropsten"],s=new r.AnkrProvider(t,n.ankr);s.network&&o.indexOf(s.network.name)===-1&&i.push(s)}catch{}if(i.length===0)return null;if(r.FallbackProvider){let o=1;return n.quorum!=null?o=n.quorum:t==="homestead"&&(o=2),new r.FallbackProvider(i,o)}return i[0]};return e.renetwork=function(r){return bn(r)},e}function ru(t,e){const r=function(n,i){return n.JsonRpcProvider?new n.JsonRpcProvider(t,e):null};return r.renetwork=function(n){return ru(t,n)},r}const Up={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:bn("homestead")},Fp={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:bn("ropsten")},zp={chainId:63,name:"classicMordor",_defaultProvider:ru("https://www.ethercluster.com/mordor","classicMordor")},Wl={unspecified:{chainId:0,name:"unspecified"},homestead:Up,mainnet:Up,morden:{chainId:2,name:"morden"},ropsten:Fp,testnet:Fp,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:bn("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:bn("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:bn("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:bn("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:ru("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:zp,classicTestnet:zp,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:ru("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:bn("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:bn("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function Th(t){if(t==null)return null;if(typeof t=="number"){for(const n in Wl){const i=Wl[n];if(i.chainId===t)return{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress||null,_defaultProvider:i._defaultProvider||null}}return{chainId:t,name:"unknown"}}if(typeof t=="string"){const n=Wl[t];return n==null?null:{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress,_defaultProvider:n._defaultProvider||null}}const e=Wl[t.name];if(!e)return typeof t.chainId!="number"&&jp.throwArgumentError("invalid network chainId","network",t),t;t.chainId!==0&&t.chainId!==e.chainId&&jp.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;return r==null&&e._defaultProvider&&(w3(e._defaultProvider)?r=e._defaultProvider.renetwork(t):r=e._defaultProvider),{name:t.name,chainId:e.chainId,ensAddress:t.ensAddress||e.ensAddress||null,_defaultProvider:r}}const E3="web/5.7.1";var x3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};function A3(t,e){return x3(this,void 0,void 0,function*(){e==null&&(e={});const r={method:e.method||"GET",headers:e.headers||{},body:e.body||void 0};if(e.skipFetchSetup!==!0&&(r.mode="cors",r.cache="no-cache",r.credentials="same-origin",r.redirect="follow",r.referrer="client"),e.fetchOptions!=null){const s=e.fetchOptions;s.mode&&(r.mode=s.mode),s.cache&&(r.cache=s.cache),s.credentials&&(r.credentials=s.credentials),s.redirect&&(r.redirect=s.redirect),s.referrer&&(r.referrer=s.referrer)}const n=yield fetch(t,r),i=yield n.arrayBuffer(),o={};return n.headers.forEach?n.headers.forEach((s,l)=>{o[l.toLowerCase()]=s}):n.headers.keys().forEach(s=>{o[s.toLowerCase()]=n.headers.get(s)}),{headers:o,statusCode:n.status,statusMessage:n.statusText,body:se(new Uint8Array(i))}})}var b3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Br=new T(E3);function $p(t){return new Promise(e=>{setTimeout(e,t)})}function Qn(t,e){if(t==null)return null;if(typeof t=="string")return t;if(bh(t)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return wl(t)}catch{}return re(t)}return t}function _3(t){return mr(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function S3(t,e,r){const n=typeof t=="object"&&t.throttleLimit!=null?t.throttleLimit:12;Br.assertArgument(n>0&&n%1===0,"invalid connection throttle limit","connection.throttleLimit",n);const i=typeof t=="object"?t.throttleCallback:null,o=typeof t=="object"&&typeof t.throttleSlotInterval=="number"?t.throttleSlotInterval:100;Br.assertArgument(o>0&&o%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const s=typeof t=="object"?!!t.errorPassThrough:!1,l={};let a=null;const u={method:"GET"};let c=!1,d=2*60*1e3;if(typeof t=="string")a=t;else if(typeof t=="object"){if((t==null||t.url==null)&&Br.throwArgumentError("missing URL","connection.url",t),a=t.url,typeof t.timeout=="number"&&t.timeout>0&&(d=t.timeout),t.headers)for(const E in t.headers)l[E.toLowerCase()]={key:E,value:String(t.headers[E])},["if-none-match","if-modified-since"].indexOf(E.toLowerCase())>=0&&(c=!0);if(u.allowGzip=!!t.allowGzip,t.user!=null&&t.password!=null){a.substring(0,6)!=="https:"&&t.allowInsecureAuthentication!==!0&&Br.throwError("basic authentication requires a secure https url",T.errors.INVALID_ARGUMENT,{argument:"url",url:a,user:t.user,password:"[REDACTED]"});const E=t.user+":"+t.password;l.authorization={key:"Authorization",value:"Basic "+Ay(mr(E))}}t.skipFetchSetup!=null&&(u.skipFetchSetup=!!t.skipFetchSetup),t.fetchOptions!=null&&(u.fetchOptions=it(t.fetchOptions))}const p=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),v=a?a.match(p):null;if(v)try{const E={statusCode:200,statusMessage:"OK",headers:{"content-type":v[1]||"text/plain"},body:v[2]?xy(v[3]):_3(v[3])};let w=E.body;return r&&(w=r(E.body,E)),Promise.resolve(w)}catch(E){Br.throwError("processing response error",T.errors.SERVER_ERROR,{body:Qn(v[1],v[2]),error:E,requestBody:null,requestMethod:"GET",url:a})}e&&(u.method="POST",u.body=e,l["content-type"]==null&&(l["content-type"]={key:"Content-Type",value:"application/octet-stream"}),l["content-length"]==null&&(l["content-length"]={key:"Content-Length",value:String(e.length)}));const g={};Object.keys(l).forEach(E=>{const w=l[E];g[w.key]=w.value}),u.headers=g;const x=function(){let E=null;return{promise:new Promise(function(O,B){d&&(E=setTimeout(()=>{E!=null&&(E=null,B(Br.makeError("timeout",T.errors.TIMEOUT,{requestBody:Qn(u.body,g["content-type"]),requestMethod:u.method,timeout:d,url:a})))},d))}),cancel:function(){E!=null&&(clearTimeout(E),E=null)}}}(),S=function(){return b3(this,void 0,void 0,function*(){for(let E=0;E=300)&&(x.cancel(),Br.throwError("bad response",T.errors.SERVER_ERROR,{status:w.statusCode,headers:w.headers,body:Qn(_,w.headers?w.headers["content-type"]:null),requestBody:Qn(u.body,g["content-type"]),requestMethod:u.method,url:a})),r)try{const O=yield r(_,w);return x.cancel(),O}catch(O){if(O.throttleRetry&&E{let l=null;if(o!=null)try{l=JSON.parse(wl(o))}catch(a){Br.throwError("invalid JSON",T.errors.SERVER_ERROR,{body:o,error:a})}return r&&(l=r(l,s)),l},i=null;if(e!=null){i=mr(e);const o=typeof t=="string"?{url:t}:it(t);o.headers?Object.keys(o.headers).filter(l=>l.toLowerCase()==="content-type").length!==0||(o.headers=it(o.headers),o.headers["content-type"]="application/json"):o.headers={"content-type":"application/json"},t=o}return S3(t,i,n)}function ho(t,e){return e||(e={}),e=it(e),e.floor==null&&(e.floor=0),e.ceiling==null&&(e.ceiling=1e4),e.interval==null&&(e.interval=250),new Promise(function(r,n){let i=null,o=!1;const s=()=>o?!1:(o=!0,i&&clearTimeout(i),!0);e.timeout&&(i=setTimeout(()=>{s()&&n(new Error("timeout"))},e.timeout));const l=e.retryLimit;let a=0;function u(){return t().then(function(c){if(c!==void 0)s()&&r(c);else if(e.oncePoll)e.oncePoll.once("poll",u);else if(e.onceBlock)e.onceBlock.once("block",u);else if(!o){if(a++,a>l){s()&&n(new Error("retry limit reached"));return}let d=e.interval*parseInt(String(Math.random()*Math.pow(2,a)));de.ceiling&&(d=e.ceiling),setTimeout(u,d)}return null},function(c){s()&&n(c)})}u()})}var nu="qpzry9x8gf2tvdw0s3jn54khce6mua7l",md={};for(var Gl=0;Gl>25;return(t&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function l1(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=bo(e)^n>>5}for(e=bo(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=l1(t);if(typeof n=="string")throw new Error(n);for(var i=t+"1",o=0;o>5)throw new Error("Non 5-bit word");n=bo(n)^s,i+=nu.charAt(s)}for(o=0;o<6;++o)n=bo(n);for(n^=1,o=0;o<6;++o){var l=n>>(5-o)*5&31;i+=nu.charAt(l)}return i}function a1(t,e){if(e=e||90,t.length<8)return t+" too short";if(t.length>e)return"Exceeds length limit";var r=t.toLowerCase(),n=t.toUpperCase();if(t!==r&&t!==n)return"Mixed-case string "+t;t=r;var i=t.lastIndexOf("1");if(i===-1)return"No separator character for "+t;if(i===0)return"Missing prefix for "+t;var o=t.slice(0,i),s=t.slice(i+1);if(s.length<6)return"Data too short";var l=l1(o);if(typeof l=="string")return l;for(var a=[],u=0;u=s.length)&&a.push(d)}return l!==1?"Invalid checksum for "+t:{prefix:o,words:a}}function N3(){var t=a1.apply(null,arguments);if(typeof t=="object")return t}function P3(t){var e=a1.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function zu(t,e,r,n){for(var i=0,o=0,s=(1<=r;)o-=r,l.push(i>>o&s);if(n)o>0&&l.push(i<=e)return"Excess padding";if(i<this.data(d,!0);return e.transaction={hash:s,type:u,accessList:ee.allowNull(this.accessList.bind(this),null),blockHash:ee.allowNull(s,null),blockNumber:ee.allowNull(a,null),transactionIndex:ee.allowNull(a,null),confirmations:ee.allowNull(a,null),from:r,gasPrice:ee.allowNull(n),maxPriorityFeePerGas:ee.allowNull(n),maxFeePerGas:ee.allowNull(n),gasLimit:n,to:ee.allowNull(r,null),value:n,nonce:a,data:o,r:ee.allowNull(this.uint256),s:ee.allowNull(this.uint256),v:ee.allowNull(a),creates:ee.allowNull(r,null),raw:ee.allowNull(o)},e.transactionRequest={from:ee.allowNull(r),nonce:ee.allowNull(a),gasLimit:ee.allowNull(n),gasPrice:ee.allowNull(n),maxPriorityFeePerGas:ee.allowNull(n),maxFeePerGas:ee.allowNull(n),to:ee.allowNull(r),value:ee.allowNull(n),data:ee.allowNull(c),type:ee.allowNull(a),accessList:ee.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:s,address:r,topics:ee.arrayOf(s),data:o,logIndex:a,blockHash:s},e.receipt={to:ee.allowNull(this.address,null),from:ee.allowNull(this.address,null),contractAddress:ee.allowNull(r,null),transactionIndex:a,root:ee.allowNull(l),gasUsed:n,logsBloom:ee.allowNull(o),blockHash:s,transactionHash:s,logs:ee.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:ee.allowNull(a,null),cumulativeGasUsed:n,effectiveGasPrice:ee.allowNull(n),status:ee.allowNull(a),type:u},e.block={hash:ee.allowNull(s),parentHash:s,number:a,timestamp:a,nonce:ee.allowNull(l),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:ee.allowNull(r),extraData:o,transactions:ee.allowNull(ee.arrayOf(s)),baseFeePerGas:ee.allowNull(n)},e.blockWithTransactions=it(e.block),e.blockWithTransactions.transactions=ee.allowNull(ee.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:ee.allowNull(i,void 0),toBlock:ee.allowNull(i,void 0),blockHash:ee.allowNull(s,void 0),address:ee.allowNull(r,void 0),topics:ee.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:ee.allowNull(a),blockHash:ee.allowNull(s),transactionIndex:a,removed:ee.allowNull(this.boolean.bind(this)),address:r,data:ee.allowFalsish(o,"0x"),topics:ee.arrayOf(s),transactionHash:s,logIndex:a},e}accessList(e){return qi(e||[])}number(e){return e==="0x"?0:G.from(e).toNumber()}type(e){return e==="0x"||e==null?0:G.from(e).toNumber()}bigNumber(e){return G.from(e)}boolean(e){if(typeof e=="boolean")return e;if(typeof e=="string"){if(e=e.toLowerCase(),e==="true")return!0;if(e==="false")return!1}throw new Error("invalid boolean - "+e)}hex(e,r){return typeof e=="string"&&(!r&&e.substring(0,2)!=="0x"&&(e="0x"+e),pe(e))?e.toLowerCase():ss.throwArgumentError("invalid hash","value",e)}data(e,r){const n=this.hex(e,r);if(n.length%2!==0)throw new Error("invalid data; odd-length - "+e);return n}address(e){return mt(e)}callAddress(e){if(!pe(e,32))return null;const r=mt(It(e,12));return r===cA?null:r}contractAddress(e){return Nh(e)}blockTag(e){if(e==null)return"latest";if(e==="earliest")return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if(typeof e=="number"||pe(e))return Tu(e);throw new Error("invalid blockTag")}hash(e,r){const n=this.hex(e,r);return On(n)!==32?ss.throwArgumentError("invalid hash","value",e):n}difficulty(e){if(e==null)return null;const r=G.from(e);try{return r.toNumber()}catch{}return null}uint256(e){if(!pe(e))throw new Error("invalid uint256");return pt(e,32)}_block(e,r){e.author!=null&&e.miner==null&&(e.miner=e.author);const n=e._difficulty!=null?e._difficulty:e.difficulty,i=ee.check(r,e);return i._difficulty=n==null?null:G.from(n),i}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return ee.check(this.formats.transactionRequest,e)}transactionResponse(e){e.gas!=null&&e.gasLimit==null&&(e.gasLimit=e.gas),e.to&&G.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),e.input!=null&&e.data==null&&(e.data=e.input),e.to==null&&e.creates==null&&(e.creates=this.contractAddress(e)),(e.type===1||e.type===2)&&e.accessList==null&&(e.accessList=[]);const r=ee.check(this.formats.transaction,e);if(e.chainId!=null){let n=e.chainId;pe(n)&&(n=G.from(n).toNumber()),r.chainId=n}else{let n=e.networkId;n==null&&r.v==null&&(n=e.chainId),pe(n)&&(n=G.from(n).toNumber()),typeof n!="number"&&r.v!=null&&(n=(r.v-35)/2,n<0&&(n=0),n=parseInt(n)),typeof n!="number"&&(n=0),r.chainId=n}return r.blockHash&&r.blockHash.replace(/0/g,"")==="x"&&(r.blockHash=null),r}transaction(e){return a3(e)}receiptLog(e){return ee.check(this.formats.receiptLog,e)}receipt(e){const r=ee.check(this.formats.receipt,e);if(r.root!=null)if(r.root.length<=4){const n=G.from(r.root).toNumber();n===0||n===1?(r.status!=null&&r.status!==n&&ss.throwArgumentError("alt-root-status/status mismatch","value",{root:r.root,status:r.status}),r.status=n,delete r.root):ss.throwArgumentError("invalid alt-root-status","value.root",r.root)}else r.root.length!==66&&ss.throwArgumentError("invalid root hash","value.root",r.root);return r.status!=null&&(r.byzantium=!0),r}topics(e){return Array.isArray(e)?e.map(r=>this.topics(r)):e!=null?this.hash(e,!0):null}filter(e){return ee.check(this.formats.filter,e)}filterLog(e){return ee.check(this.formats.filterLog,e)}static check(e,r){const n={};for(const i in e)try{const o=e[i](r[i]);o!==void 0&&(n[i]=o)}catch(o){throw o.checkKey=i,o.checkValue=r[i],o}return n}static allowNull(e,r){return function(n){return n==null?r:e(n)}}static allowFalsish(e,r){return function(n){return n?e(n):r}}static arrayOf(e){return function(r){if(!Array.isArray(r))throw new Error("not an array");const n=[];return r.forEach(function(i){n.push(e(i))}),n}}}function u1(t){return t&&typeof t.isCommunityResource=="function"}function gd(t){return u1(t)&&t.isCommunityResource()}let qp=!1;function bl(){qp||(qp=!0,console.log("========= NOTICE ========="),console.log("Request-Rate Exceeded (this message will not be repeated)"),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.io/api-keys/"),console.log("=========================="))}var ae=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const he=new T($t),O3=10;function Wp(t){return t==null?"null":(On(t)!==32&&he.throwArgumentError("invalid topic","topic",t),t.toLowerCase())}function Gp(t){for(t=t.slice();t.length>0&&t[t.length-1]==null;)t.pop();return t.map(e=>{if(Array.isArray(e)){const r={};e.forEach(i=>{r[Wp(i)]=!0});const n=Object.keys(r);return n.sort(),n.join("|")}else return Wp(e)}).join("&")}function L3(t){return t===""?[]:t.split(/&/g).map(e=>{if(e==="")return[];const r=e.split("|").map(n=>n==="null"?null:n);return r.length===1?r[0]:r})}function Gi(t){if(typeof t=="string"){if(t=t.toLowerCase(),On(t)===32)return"tx:"+t;if(t.indexOf(":")===-1)return t}else{if(Array.isArray(t))return"filter:*:"+Gp(t);if(fb.isForkEvent(t))throw he.warn("not implemented"),new Error("not implemented");if(t&&typeof t=="object")return"filter:"+(t.address||"*")+":"+Gp(t.topics||[])}throw new Error("invalid event - "+t)}function ls(){return new Date().getTime()}function Vp(t){return new Promise(e=>{setTimeout(e,t)})}const B3=["block","network","pending","poll"];class D3{constructor(e,r,n){z(this,"tag",e),z(this,"listener",r),z(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return e[0]!=="tx"?null:e[1]}get filter(){const e=this.tag.split(":");if(e[0]!=="filter")return null;const r=e[1],n=L3(e[2]),i={};return n.length>0&&(i.topics=n),r&&r!=="*"&&(i.address=r),i}pollable(){return this.tag.indexOf(":")>=0||B3.indexOf(this.tag)>=0}}const j3={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function Yc(t){return pt(G.from(t).toHexString(),32)}function Kp(t){return pd.encode(Ut([t,It(Dp(Dp(t)),0,4)]))}const c1=new RegExp("^(ipfs)://(.*)$","i"),Qp=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),c1,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function wa(t,e){try{return wl(ol(t,e))}catch{}return null}function ol(t,e){if(t==="0x")return null;const r=G.from(It(t,e,e+32)).toNumber(),n=G.from(It(t,r,r+32)).toNumber();return It(t,r+32,r+32+n)}function Xc(t){return t.match(/^ipfs:\/\/ipfs\//i)?t=t.substring(12):t.match(/^ipfs:\/\//i)?t=t.substring(7):he.throwArgumentError("unsupported IPFS format","link",t),`https://gateway.ipfs.io/ipfs/${t}`}function Jp(t){const e=se(t);if(e.length>32)throw new Error("internal; should not happen");const r=new Uint8Array(32);return r.set(e,32-e.length),r}function U3(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}function f1(t){const e=[];let r=0;for(let n=0;nG.from(e).eq(1)).catch(e=>{if(e.code===T.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e})),this._supportsEip2544}_fetch(e,r){return ae(this,void 0,void 0,function*(){const n={to:this.address,ccipReadEnabled:!0,data:Xt([e,ma(this.name),r||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,n.data=Xt(["0x9061b923",f1([JA(this.name),n.data])]));try{let o=yield this.provider.call(n);return se(o).length%32===4&&he.throwError("resolver threw error",T.errors.CALL_EXCEPTION,{transaction:n,data:o}),i&&(o=ol(o,0)),o}catch(o){if(o.code===T.errors.CALL_EXCEPTION)return null;throw o}})}_fetchBytes(e,r){return ae(this,void 0,void 0,function*(){const n=yield this._fetch(e,r);return n!=null?ol(n,0):null})}_getAddress(e,r){const n=j3[String(e)];if(n==null&&he.throwError(`unsupported coin type: ${e}`,T.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),n.ilk==="eth")return this.provider.formatter.address(r);const i=se(r);if(n.p2pkh!=null){const o=r.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(o){const s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return Kp(Ut([[n.p2pkh],"0x"+o[2]]))}}if(n.p2sh!=null){const o=r.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(o){const s=parseInt(o[1],16);if(o[2].length===s*2&&s>=1&&s<=75)return Kp(Ut([[n.p2sh],"0x"+o[2]]))}}if(n.prefix!=null){const o=i[1];let s=i[0];if(s===0?o!==20&&o!==32&&(s=-1):s=-1,s>=0&&i.length===2+o&&o>=1&&o<=75){const l=Hp.toWords(i.slice(2));return l.unshift(s),Hp.encode(n.prefix,l)}}return null}getAddress(e){return ae(this,void 0,void 0,function*(){if(e==null&&(e=60),e===60)try{const i=yield this._fetch("0x3b3b57de");return i==="0x"||i===pA?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===T.errors.CALL_EXCEPTION)return null;throw i}const r=yield this._fetchBytes("0xf1cb7e06",Yc(e));if(r==null||r==="0x")return null;const n=this._getAddress(e,r);return n==null&&he.throwError("invalid or unsupported coin data",T.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:r}),n})}getAvatar(){return ae(this,void 0,void 0,function*(){const e=[{type:"name",content:this.name}];try{const r=yield this.getText("avatar");if(r==null)return null;for(let n=0;ns[a])}return he.throwError("invalid or unsupported content hash data",T.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return ae(this,void 0,void 0,function*(){let r=mr(e);r=Ut([Yc(64),Yc(r.length),r]),r.length%32!==0&&(r=Ut([r,pt("0x",32-e.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",re(r));return n==null||n==="0x"?null:wl(n)})}}let Zc=null,F3=1;class $u extends qo{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),z(this,"anyNetwork",e==="any"),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch(r=>{}),this._ready().catch(r=>{});else{const r=fr(new.target,"getNetwork")(e);r?(z(this,"_network",r),this.emit("network",r,null)):he.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return ae(this,void 0,void 0,function*(){if(this._network==null){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch{}e==null&&(e=yield this.detectNetwork()),e||he.throwError("no network detected",T.errors.UNKNOWN_ERROR,{}),this._network==null&&(this.anyNetwork?this._network=e:z(this,"_network",e),this.emit("network",e,null))}return this._network})}get ready(){return ho(()=>this._ready().then(e=>e,e=>{if(!(e.code===T.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return Zc==null&&(Zc=new ee),Zc}static getNetwork(e){return Th(e??"homestead")}ccipReadFetch(e,r,n){return ae(this,void 0,void 0,function*(){if(this.disableCcipRead||n.length===0)return null;const i=e.to.toLowerCase(),o=r.toLowerCase(),s=[];for(let l=0;l=0?null:JSON.stringify({data:o,sender:i}),d=yield Al({url:u,errorPassThrough:!0},c,(v,g)=>(v.status=g.statusCode,v));if(d.data)return d.data;const p=d.message||"unknown error";if(d.status>=400&&d.status<500)return he.throwError(`response not found during CCIP fetch: ${p}`,T.errors.SERVER_ERROR,{url:a,errorMessage:p});s.push(p)}return he.throwError(`error encountered during CCIP fetch: ${s.map(l=>JSON.stringify(l)).join(", ")}`,T.errors.SERVER_ERROR,{urls:n,errorMessages:s})})}_getInternalBlockNumber(e){return ae(this,void 0,void 0,function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const i=this._internalBlockNumber;try{const o=yield i;if(ls()-o.respTime<=e)return o.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const r=ls(),n=yt({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then(i=>null,i=>i)}).then(({blockNumber:i,networkError:o})=>{if(o)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),o;const s=ls();return i=G.from(i).toNumber(),i{this._internalBlockNumber===n&&(this._internalBlockNumber=null)}),(yield n).blockNumber})}poll(){return ae(this,void 0,void 0,function*(){const e=F3++,r=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(i){this.emit("error",i);return}if(this._setFastBlockNumber(n),this.emit("poll",e,n),n===this._lastBlockNumber){this.emit("didPoll",e);return}if(this._emitted.block===-2&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)he.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",he.makeError("network block skew detected",T.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let i=this._emitted.block+1;i<=n;i++)this.emit("block",i);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach(i=>{if(i==="block")return;const o=this._emitted[i];o!=="pending"&&n-o>12&&delete this._emitted[i]})),this._lastBlockNumber===-2&&(this._lastBlockNumber=n-1),this._events.forEach(i=>{switch(i.type){case"tx":{const o=i.hash;let s=this.getTransactionReceipt(o).then(l=>(!l||l.blockNumber==null||(this._emitted["t:"+o]=l.blockNumber,this.emit(o,l)),null)).catch(l=>{this.emit("error",l)});r.push(s);break}case"filter":{if(!i._inflight){i._inflight=!0,i._lastBlockNumber===-2&&(i._lastBlockNumber=n-1);const o=i.filter;o.fromBlock=i._lastBlockNumber+1,o.toBlock=n;const s=o.toBlock-this._maxFilterBlockRange;s>o.fromBlock&&(o.fromBlock=s),o.fromBlock<0&&(o.fromBlock=0);const l=this.getLogs(o).then(a=>{i._inflight=!1,a.length!==0&&a.forEach(u=>{u.blockNumber>i._lastBlockNumber&&(i._lastBlockNumber=u.blockNumber),this._emitted["b:"+u.blockHash]=u.blockNumber,this._emitted["t:"+u.transactionHash]=u.blockNumber,this.emit(o,u)})}).catch(a=>{this.emit("error",a),i._inflight=!1});r.push(l)}break}}}),this._lastBlockNumber=n,Promise.all(r).then(()=>{this.emit("didPoll",e)}).catch(i=>{this.emit("error",i)})})}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return ae(this,void 0,void 0,function*(){return he.throwError("provider does not support network detection",T.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})})}getNetwork(){return ae(this,void 0,void 0,function*(){const e=yield this._ready(),r=yield this.detectNetwork();if(e.chainId!==r.chainId){if(this.anyNetwork)return this._network=r,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",r,e),yield Vp(0),this._network;const n=he.makeError("underlying network changed",T.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:r});throw this.emit("error",n),n}return e})}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then(e=>{this._setFastBlockNumber(e)},e=>{}),this._fastBlockNumber!=null?this._fastBlockNumber:-1}get polling(){return this._poller!=null}set polling(e){e&&!this._poller?(this._poller=setInterval(()=>{this.poll()},this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout(()=>{this.poll(),this._bootstrapPoll=setTimeout(()=>{this._poller||this.poll(),this._bootstrapPoll=null},this.pollingInterval)},0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if(typeof e!="number"||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval(()=>{this.poll()},this._pollingInterval))}_getFastBlockNumber(){const e=ls();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then(r=>((this._fastBlockNumber==null||r>this._fastBlockNumber)&&(this._fastBlockNumber=r),this._fastBlockNumber))),this._fastBlockNumberPromise}_setFastBlockNumber(e){this._fastBlockNumber!=null&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,r,n){return ae(this,void 0,void 0,function*(){return this._waitForTransaction(e,r??1,n||0,null)})}_waitForTransaction(e,r,n,i){return ae(this,void 0,void 0,function*(){const o=yield this.getTransactionReceipt(e);return(o?o.confirmations:0)>=r?o:new Promise((s,l)=>{const a=[];let u=!1;const c=function(){return u?!0:(u=!0,a.forEach(p=>{p()}),!1)},d=p=>{p.confirmations{this.removeListener(e,d)}),i){let p=i.startBlock,v=null;const g=x=>ae(this,void 0,void 0,function*(){u||(yield Vp(1e3),this.getTransactionCount(i.from).then(S=>ae(this,void 0,void 0,function*(){if(!u){if(S<=i.nonce)p=x;else{{const E=yield this.getTransaction(e);if(E&&E.blockNumber!=null)return}for(v==null&&(v=p-3,v{u||this.once("block",g)}))});if(u)return;this.once("block",g),a.push(()=>{this.removeListener("block",g)})}if(typeof n=="number"&&n>0){const p=setTimeout(()=>{c()||l(he.makeError("timeout exceeded",T.errors.TIMEOUT,{timeout:n}))},n);p.unref&&p.unref(),a.push(()=>{clearTimeout(p)})}})})}getBlockNumber(){return ae(this,void 0,void 0,function*(){return this._getInternalBlockNumber(0)})}getGasPrice(){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return G.from(e)}catch(r){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:r})}})}getBalance(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getBalance",n);try{return G.from(i)}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getBalance",params:n,result:i,error:o})}})}getTransactionCount(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getTransactionCount",n);try{return G.from(i).toNumber()}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:i,error:o})}})}getCode(e,r){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const n=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(r)}),i=yield this.perform("getCode",n);try{return re(i)}catch(o){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getCode",params:n,result:i,error:o})}})}getStorageAt(e,r,n){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const i=yield yt({address:this._getAddress(e),blockTag:this._getBlockTag(n),position:Promise.resolve(r).then(s=>Tu(s))}),o=yield this.perform("getStorageAt",i);try{return re(o)}catch(s){return he.throwError("bad result from backend",T.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:o,error:s})}})}_wrapTransaction(e,r,n){if(r!=null&&On(r)!==32)throw new Error("invalid response - sendTransaction");const i=e;return r!=null&&e.hash!==r&&he.throwError("Transaction hash mismatch from Provider.sendTransaction.",T.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:r}),i.wait=(o,s)=>ae(this,void 0,void 0,function*(){o==null&&(o=1),s==null&&(s=0);let l;o!==0&&n!=null&&(l={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:n});const a=yield this._waitForTransaction(e.hash,o,s,l);return a==null&&o===0?null:(this._emitted["t:"+e.hash]=a.blockNumber,a.status===0&&he.throwError("transaction failed",T.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:a}),a)}),i}sendTransaction(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield Promise.resolve(e).then(o=>re(o)),n=this.formatter.transaction(e);n.confirmations==null&&(n.confirmations=0);const i=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const o=yield this.perform("sendTransaction",{signedTransaction:r});return this._wrapTransaction(n,o,i)}catch(o){throw o.transaction=n,o.transactionHash=n.hash,o}})}_getTransactionRequest(e){return ae(this,void 0,void 0,function*(){const r=yield e,n={};return["from","to"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?this._getAddress(o):null))}),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?G.from(o):null))}),["type"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o??null))}),r.accessList&&(n.accessList=this.formatter.accessList(r.accessList)),["data"].forEach(i=>{r[i]!=null&&(n[i]=Promise.resolve(r[i]).then(o=>o?re(o):null))}),this.formatter.transactionRequest(yield yt(n))})}_getFilter(e){return ae(this,void 0,void 0,function*(){e=yield e;const r={};return e.address!=null&&(r.address=this._getAddress(e.address)),["blockHash","topics"].forEach(n=>{e[n]!=null&&(r[n]=e[n])}),["fromBlock","toBlock"].forEach(n=>{e[n]!=null&&(r[n]=this._getBlockTag(e[n]))}),this.formatter.filter(yield yt(r))})}_call(e,r,n){return ae(this,void 0,void 0,function*(){n>=O3&&he.throwError("CCIP read exceeded maximum redirections",T.errors.SERVER_ERROR,{redirects:n,transaction:e});const i=e.to,o=yield this.perform("call",{transaction:e,blockTag:r});if(n>=0&&r==="latest"&&i!=null&&o.substring(0,10)==="0x556f1830"&&On(o)%32===4)try{const s=It(o,4),l=It(s,0,32);G.from(l).eq(i)||he.throwError("CCIP Read sender did not match",T.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:o});const a=[],u=G.from(It(s,32,64)).toNumber(),c=G.from(It(s,u,u+32)).toNumber(),d=It(s,u+32);for(let E=0;Eae(this,void 0,void 0,function*(){const o=yield this.perform("getBlock",i);if(o==null)return i.blockHash!=null&&this._emitted["b:"+i.blockHash]==null||i.blockTag!=null&&n>this._emitted.block?null:void 0;if(r){let s=null;for(let a=0;athis._wrapTransaction(a)),l}return this.formatter.block(o)}),{oncePoll:this})})}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return ho(()=>ae(this,void 0,void 0,function*(){const n=yield this.perform("getTransaction",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;const i=this.formatter.transactionResponse(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;s<=0&&(s=1),i.confirmations=s}return this._wrapTransaction(i)}),{oncePoll:this})})}getTransactionReceipt(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork(),e=yield e;const r={transactionHash:this.formatter.hash(e,!0)};return ho(()=>ae(this,void 0,void 0,function*(){const n=yield this.perform("getTransactionReceipt",r);if(n==null)return this._emitted["t:"+e]==null?null:void 0;if(n.blockHash==null)return;const i=this.formatter.receipt(n);if(i.blockNumber==null)i.confirmations=0;else if(i.confirmations==null){let s=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-i.blockNumber+1;s<=0&&(s=1),i.confirmations=s}return i}),{oncePoll:this})})}getLogs(e){return ae(this,void 0,void 0,function*(){yield this.getNetwork();const r=yield yt({filter:this._getFilter(e)}),n=yield this.perform("getLogs",r);return n.forEach(i=>{i.removed==null&&(i.removed=!1)}),ee.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)})}getEtherPrice(){return ae(this,void 0,void 0,function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})})}_getBlockTag(e){return ae(this,void 0,void 0,function*(){if(e=yield e,typeof e=="number"&&e<0){e%1&&he.throwArgumentError("invalid BlockTag","blockTag",e);let r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return r+=e,r<0&&(r=0),this.formatter.blockTag(r)}return this.formatter.blockTag(e)})}getResolver(e){return ae(this,void 0,void 0,function*(){let r=e;for(;;){if(r===""||r==="."||e!=="eth"&&r==="eth")return null;const n=yield this._getResolver(r,"getResolver");if(n!=null){const i=new vd(this,n,e);return r!==e&&!(yield i.supportsWildcard())?null:i}r=r.split(".").slice(1).join(".")}})}_getResolver(e,r){return ae(this,void 0,void 0,function*(){r==null&&(r="ENS");const n=yield this.getNetwork();n.ensAddress||he.throwError("network does not support ENS",T.errors.UNSUPPORTED_OPERATION,{operation:r,network:n.name});try{const i=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+ma(e).substring(2)});return this.formatter.callAddress(i)}catch{}return null})}resolveName(e){return ae(this,void 0,void 0,function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(n){if(pe(e))throw n}typeof e!="string"&&he.throwArgumentError("invalid ENS name","name",e);const r=yield this.getResolver(e);return r?yield r.getAddress():null})}lookupAddress(e){return ae(this,void 0,void 0,function*(){e=yield e,e=this.formatter.address(e);const r=e.substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(r,"lookupAddress");if(n==null)return null;const i=wa(yield this.call({to:n,data:"0x691f3431"+ma(r).substring(2)}),0);return(yield this.resolveName(i))!=e?null:i})}getAvatar(e){return ae(this,void 0,void 0,function*(){let r=null;if(pe(e)){const o=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",s=yield this._getResolver(o,"getAvatar");if(!s)return null;r=new vd(this,s,o);try{const l=yield r.getAvatar();if(l)return l.url}catch(l){if(l.code!==T.errors.CALL_EXCEPTION)throw l}try{const l=wa(yield this.call({to:s,data:"0x691f3431"+ma(o).substring(2)}),0);r=yield this.getResolver(l)}catch(l){if(l.code!==T.errors.CALL_EXCEPTION)throw l;return null}}else if(r=yield this.getResolver(e),!r)return null;const n=yield r.getAvatar();return n==null?null:n.url})}perform(e,r){return he.throwError(e+" not implemented",T.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_stopEvent(e){this.polling=this._events.filter(r=>r.pollable()).length>0}_addEventListener(e,r,n){const i=new D3(Gi(e),r,n);return this._events.push(i),this._startEvent(i),this}on(e,r){return this._addEventListener(e,r,!1)}once(e,r){return this._addEventListener(e,r,!0)}emit(e,...r){let n=!1,i=[],o=Gi(e);return this._events=this._events.filter(s=>s.tag!==o?!0:(setTimeout(()=>{s.listener.apply(this,r)},0),n=!0,s.once?(i.push(s),!1):!0)),i.forEach(s=>{this._stopEvent(s)}),n}listenerCount(e){if(!e)return this._events.length;let r=Gi(e);return this._events.filter(n=>n.tag===r).length}listeners(e){if(e==null)return this._events.map(n=>n.listener);let r=Gi(e);return this._events.filter(n=>n.tag===r).map(n=>n.listener)}off(e,r){if(r==null)return this.removeAllListeners(e);const n=[];let i=!1,o=Gi(e);return this._events=this._events.filter(s=>s.tag!==o||s.listener!=r||i?!0:(i=!0,n.push(s),!1)),n.forEach(s=>{this._stopEvent(s)}),this}removeAllListeners(e){let r=[];if(e==null)r=this._events,this._events=[];else{const n=Gi(e);this._events=this._events.filter(i=>i.tag!==n?!0:(r.push(i),!1))}return r.forEach(n=>{this._stopEvent(n)}),this}}var xn=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const wt=new T($t),z3=["call","estimateGas"];function Ps(t,e){if(t==null)return null;if(typeof t.message=="string"&&t.message.match("reverted")){const r=pe(t.data)?t.data:null;if(!e||r)return{message:t.message,data:r}}if(typeof t=="object"){for(const r in t){const n=Ps(t[r],e);if(n)return n}return null}if(typeof t=="string")try{return Ps(JSON.parse(t),e)}catch{}return null}function d1(t,e,r){const n=r.transaction||r.signedTransaction;if(t==="call"){const o=Ps(e,!0);if(o)return o.data;wt.throwError("missing revert data in call exception; Transaction reverted without a reason string",T.errors.CALL_EXCEPTION,{data:"0x",transaction:n,error:e})}if(t==="estimateGas"){let o=Ps(e.body,!1);o==null&&(o=Ps(e,!1)),o&&wt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{reason:o.message,method:t,transaction:n,error:e})}let i=e.message;throw e.code===T.errors.SERVER_ERROR&&e.error&&typeof e.error.message=="string"?i=e.error.message:typeof e.body=="string"?i=e.body:typeof e.responseText=="string"&&(i=e.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&wt.throwError("insufficient funds for intrinsic transaction cost",T.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:n}),i.match(/nonce (is )?too low/i)&&wt.throwError("nonce has already been used",T.errors.NONCE_EXPIRED,{error:e,method:t,transaction:n}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&wt.throwError("replacement fee too low",T.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:n}),i.match(/only replay-protected/i)&&wt.throwError("legacy pre-eip-155 transactions not supported",T.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:n}),z3.indexOf(t)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&wt.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:n}),e}function Yp(t){return new Promise(function(e){setTimeout(e,t)})}function $3(t){if(t.error){const e=new Error(t.error.message);throw e.code=t.error.code,e.data=t.error.data,e}return t.result}function as(t){return t&&t.toLowerCase()}const yd={};class Oh extends El{constructor(e,r,n){if(super(),e!==yd)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");z(this,"provider",r),n==null&&(n=0),typeof n=="string"?(z(this,"_address",this.provider.formatter.address(n)),z(this,"_index",null)):typeof n=="number"?(z(this,"_index",n),z(this,"_address",null)):wt.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(e){return wt.throwError("cannot alter JSON-RPC Signer connection",T.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new H3(yd,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then(e=>(e.length<=this._index&&wt.throwError("unknown account #"+this._index,T.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index])))}sendUncheckedTransaction(e){e=it(e);const r=this.getAddress().then(n=>(n&&(n=n.toLowerCase()),n));if(e.gasLimit==null){const n=it(e);n.from=r,e.gasLimit=this.provider.estimateGas(n)}return e.to!=null&&(e.to=Promise.resolve(e.to).then(n=>xn(this,void 0,void 0,function*(){if(n==null)return null;const i=yield this.provider.resolveName(n);return i==null&&wt.throwArgumentError("provided ENS name resolves to null","tx.to",n),i}))),yt({tx:yt(e),sender:r}).then(({tx:n,sender:i})=>{n.from!=null?n.from.toLowerCase()!==i&&wt.throwArgumentError("from address mismatch","transaction",e):n.from=i;const o=this.provider.constructor.hexlifyTransaction(n,{from:!0});return this.provider.send("eth_sendTransaction",[o]).then(s=>s,s=>(typeof s.message=="string"&&s.message.match(/user denied/i)&&wt.throwError("user rejected transaction",T.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:n}),d1("sendTransaction",s,o)))})}signTransaction(e){return wt.throwError("signing transactions is unsupported",T.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return xn(this,void 0,void 0,function*(){const r=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(e);try{return yield ho(()=>xn(this,void 0,void 0,function*(){const i=yield this.provider.getTransaction(n);if(i!==null)return this.provider._wrapTransaction(i,n,r)}),{oncePoll:this.provider})}catch(i){throw i.transactionHash=n,i}})}signMessage(e){return xn(this,void 0,void 0,function*(){const r=typeof e=="string"?mr(e):e,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[re(r),n.toLowerCase()])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),i}})}_legacySignMessage(e){return xn(this,void 0,void 0,function*(){const r=typeof e=="string"?mr(e):e,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),re(r)])}catch(i){throw typeof i.message=="string"&&i.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),i}})}_signTypedData(e,r,n){return xn(this,void 0,void 0,function*(){const i=yield sr.resolveNames(e,r,n,s=>this.provider.resolveName(s)),o=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[o.toLowerCase(),JSON.stringify(sr.getPayload(i.domain,r,i.value))])}catch(s){throw typeof s.message=="string"&&s.message.match(/user denied/i)&&wt.throwError("user rejected signing",T.errors.ACTION_REJECTED,{action:"_signTypedData",from:o,messageData:{domain:i.domain,types:r,value:i.value}}),s}})}unlock(e){return xn(this,void 0,void 0,function*(){const r=this.provider,n=yield this.getAddress();return r.send("personal_unlockAccount",[n.toLowerCase(),e,null])})}}class H3 extends Oh{sendTransaction(e){return this.sendUncheckedTransaction(e).then(r=>({hash:r,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:n=>this.provider.waitForTransaction(r,n)}))}}const q3={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class vi extends $u{constructor(e,r){let n=r;n==null&&(n=new Promise((i,o)=>{setTimeout(()=>{this.detectNetwork().then(s=>{i(s)},s=>{o(s)})},0)})),super(n),e||(e=fr(this.constructor,"defaultUrl")()),typeof e=="string"?z(this,"connection",Object.freeze({url:e})):z(this,"connection",Object.freeze(it(e))),this._nextId=42}get _cache(){return this._eventLoopCache==null&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout(()=>{this._cache.detectNetwork=null},0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return xn(this,void 0,void 0,function*(){yield Yp(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch{try{e=yield this.send("net_version",[])}catch{}}if(e!=null){const r=fr(this.constructor,"getNetwork");try{return r(G.from(e).toNumber())}catch(n){return wt.throwError("could not detect network",T.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:n})}}return wt.throwError("could not detect network",T.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new Oh(yd,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then(e=>e.map(r=>this.formatter.address(r)))}send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:nr(n),provider:this});const i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];const o=Al(this.connection,JSON.stringify(n),$3).then(s=>(this.emit("debug",{action:"response",request:n,response:s,provider:this}),s),s=>{throw this.emit("debug",{action:"response",error:s,request:n,provider:this}),s});return i&&(this._cache[e]=o,setTimeout(()=>{this._cache[e]=null},0)),o}prepareRequest(e,r){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[as(r.address),r.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[as(r.address),r.blockTag]];case"getCode":return["eth_getCode",[as(r.address),r.blockTag]];case"getStorageAt":return["eth_getStorageAt",[as(r.address),pt(r.position,32),r.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[r.signedTransaction]];case"getBlock":return r.blockTag?["eth_getBlockByNumber",[r.blockTag,!!r.includeTransactions]]:r.blockHash?["eth_getBlockByHash",[r.blockHash,!!r.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[r.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[r.transactionHash]];case"call":return["eth_call",[fr(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0}),r.blockTag]];case"estimateGas":return["eth_estimateGas",[fr(this.constructor,"hexlifyTransaction")(r.transaction,{from:!0})]];case"getLogs":return r.filter&&r.filter.address!=null&&(r.filter.address=as(r.filter.address)),["eth_getLogs",[r.filter]]}return null}perform(e,r){return xn(this,void 0,void 0,function*(){if(e==="call"||e==="estimateGas"){const i=r.transaction;if(i&&i.type!=null&&G.from(i.type).isZero()&&i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null){const o=yield this.getFeeData();o.maxFeePerGas==null&&o.maxPriorityFeePerGas==null&&(r=it(r),r.transaction=it(i),delete r.transaction.type)}}const n=this.prepareRequest(e,r);n==null&&wt.throwError(e+" not implemented",T.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(n[0],n[1])}catch(i){return d1(e,i,r)}})}_startEvent(e){e.tag==="pending"&&this._startPending(),super._startEvent(e)}_startPending(){if(this._pendingFilter!=null)return;const e=this,r=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=r,r.then(function(n){function i(){e.send("eth_getFilterChanges",[n]).then(function(o){if(e._pendingFilter!=r)return null;let s=Promise.resolve();return o.forEach(function(l){e._emitted["t:"+l.toLowerCase()]="pending",s=s.then(function(){return e.getTransaction(l).then(function(a){return e.emit("pending",a),null})})}),s.then(function(){return Yp(1e3)})}).then(function(){if(e._pendingFilter!=r){e.send("eth_uninstallFilter",[n]);return}return setTimeout(function(){i()},0),null}).catch(o=>{})}return i(),n}).catch(n=>{})}_stopEvent(e){e.tag==="pending"&&this.listenerCount("pending")===0&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,r){const n=it(q3);if(r)for(const o in r)r[o]&&(n[o]=!0);jx(e,n);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(o){if(e[o]==null)return;const s=Tu(G.from(e[o]));o==="gasLimit"&&(o="gas"),i[o]=s}),["from","to","data"].forEach(function(o){e[o]!=null&&(i[o]=re(e[o]))}),e.accessList&&(i.accessList=qi(e.accessList)),i}}let Cs=null;try{if(Cs=WebSocket,Cs==null)throw new Error("inject please")}catch{const e=new T($t);Cs=function(){e.throwError("WebSockets not supported in this environment",T.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var ef=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Vl=new T($t);let W3=1;class Hu extends vi{constructor(e,r){r==="any"&&Vl.throwError("WebSocketProvider does not support 'any' network yet",T.errors.UNSUPPORTED_OPERATION,{operation:"network:any"}),typeof e=="string"?super(e,r):super("_websocket",r),this._pollingInterval=-1,this._wsReady=!1,typeof e=="string"?z(this,"_websocket",new Cs(this.connection.url)):z(this,"_websocket",e),z(this,"_requests",{}),z(this,"_subs",{}),z(this,"_subIds",{}),z(this,"_detectNetwork",super.detectNetwork()),this.websocket.onopen=()=>{this._wsReady=!0,Object.keys(this._requests).forEach(i=>{this.websocket.send(this._requests[i].payload)})},this.websocket.onmessage=i=>{const o=i.data,s=JSON.parse(o);if(s.id!=null){const l=String(s.id),a=this._requests[l];if(delete this._requests[l],s.result!==void 0)a.callback(null,s.result),this.emit("debug",{action:"response",request:JSON.parse(a.payload),response:s.result,provider:this});else{let u=null;s.error?(u=new Error(s.error.message||"unknown error"),z(u,"code",s.error.code||null),z(u,"response",o)):u=new Error("unknown error"),a.callback(u,void 0),this.emit("debug",{action:"response",error:u,request:JSON.parse(a.payload),provider:this})}}else if(s.method==="eth_subscription"){const l=this._subs[s.params.subscription];l&&l.processFunc(s.params.result)}else console.warn("this should not happen")};const n=setInterval(()=>{this.emit("poll")},1e3);n.unref&&n.unref()}get websocket(){return this._websocket}detectNetwork(){return this._detectNetwork}get pollingInterval(){return 0}resetEventsBlock(e){Vl.throwError("cannot reset events block on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){Vl.throwError("cannot set polling interval on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return ef(this,void 0,void 0,function*(){return null})}set polling(e){e&&Vl.throwError("cannot set polling on WebSocketProvider",T.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,r){const n=W3++;return new Promise((i,o)=>{function s(a,u){return a?o(a):i(u)}const l=JSON.stringify({method:e,params:r,id:n,jsonrpc:"2.0"});this.emit("debug",{action:"request",request:JSON.parse(l),provider:this}),this._requests[String(n)]={callback:s,payload:l},this._wsReady&&this.websocket.send(l)})}static defaultUrl(){return"ws://localhost:8546"}_subscribe(e,r,n){return ef(this,void 0,void 0,function*(){let i=this._subIds[e];i==null&&(i=Promise.all(r).then(s=>this.send("eth_subscribe",s)),this._subIds[e]=i);const o=yield i;this._subs[o]={tag:e,processFunc:n}})}_startEvent(e){switch(e.type){case"block":this._subscribe("block",["newHeads"],r=>{const n=G.from(r.number).toNumber();this._emitted.block=n,this.emit("block",n)});break;case"pending":this._subscribe("pending",["newPendingTransactions"],r=>{this.emit("pending",r)});break;case"filter":this._subscribe(e.tag,["logs",this._getFilter(e.filter)],r=>{r.removed==null&&(r.removed=!1),this.emit(e.filter,this.formatter.filterLog(r))});break;case"tx":{const r=n=>{const i=n.hash;this.getTransactionReceipt(i).then(o=>{o&&this.emit(i,o)})};r(e),this._subscribe("tx",["newHeads"],n=>{this._events.filter(i=>i.type==="tx").forEach(r)});break}case"debug":case"poll":case"willPoll":case"didPoll":case"error":break;default:console.log("unhandled:",e);break}}_stopEvent(e){let r=e.tag;if(e.type==="tx"){if(this._events.filter(i=>i.type==="tx").length)return;r="tx"}else if(this.listenerCount(e.event))return;const n=this._subIds[r];n&&(delete this._subIds[r],n.then(i=>{this._subs[i]&&(delete this._subs[i],this.send("eth_unsubscribe",[i]))}))}destroy(){return ef(this,void 0,void 0,function*(){this.websocket.readyState===Cs.CONNECTING&&(yield new Promise(e=>{this.websocket.onopen=function(){e(!0)},this.websocket.onerror=function(){e(!1)}})),this.websocket.close(1e3)})}}var G3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const gs=new T($t);class h1 extends vi{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return G3(this,void 0,void 0,function*(){let r=this.network;return r==null&&(r=yield e.detectNetwork.call(this),r||gs.throwError("no network detected",T.errors.UNKNOWN_ERROR,{}),this._network==null&&(z(this,"_network",r),this.emit("network",r,null))),r})}}class Fn extends h1{constructor(e,r){gs.checkAbstract(new.target,Fn),e=fr(new.target,"getNetwork")(e),r=fr(new.target,"getApiKey")(r);const n=fr(new.target,"getUrl")(e,r);super(n,e),typeof r=="string"?z(this,"apiKey",r):r!=null&&Object.keys(r).forEach(i=>{z(this,i,r[i])})}_startPending(){gs.warn("WARNING: API provider does not support pending filters")}isCommunityResource(){return!1}getSigner(e){return gs.throwError("API provider does not support signing",T.errors.UNSUPPORTED_OPERATION,{operation:"getSigner"})}listAccounts(){return Promise.resolve([])}static getApiKey(e){return e}static getUrl(e,r){return gs.throwError("not implemented; sub-classes must override getUrl",T.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const Xp=new T($t),Ea="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class p1 extends Hu{constructor(e,r){const n=new Lh(e,r),i=n.connection.url.replace(/^http/i,"ws").replace(".alchemyapi.",".ws.alchemyapi.");super(i,n.network),z(this,"apiKey",n.apiKey)}isCommunityResource(){return this.apiKey===Ea}}class Lh extends Fn{static getWebSocketProvider(e,r){return new p1(e,r)}static getApiKey(e){return e==null?Ea:(e&&typeof e!="string"&&Xp.throwArgumentError("invalid apiKey","apiKey",e),e)}static getUrl(e,r){let n=null;switch(e.name){case"homestead":n="eth-mainnet.alchemyapi.io/v2/";break;case"goerli":n="eth-goerli.g.alchemy.com/v2/";break;case"matic":n="polygon-mainnet.g.alchemy.com/v2/";break;case"maticmum":n="polygon-mumbai.g.alchemy.com/v2/";break;case"arbitrum":n="arb-mainnet.g.alchemy.com/v2/";break;case"arbitrum-goerli":n="arb-goerli.g.alchemy.com/v2/";break;case"optimism":n="opt-mainnet.g.alchemy.com/v2/";break;case"optimism-goerli":n="opt-goerli.g.alchemy.com/v2/";break;default:Xp.throwArgumentError("unsupported network","network",arguments[0])}return{allowGzip:!0,url:"https://"+n+r,throttleCallback:(i,o)=>(r===Ea&&bl(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===Ea}}const V3=new T($t),Kl="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function K3(t){switch(t){case"homestead":return"rpc.ankr.com/eth/";case"ropsten":return"rpc.ankr.com/eth_ropsten/";case"rinkeby":return"rpc.ankr.com/eth_rinkeby/";case"goerli":return"rpc.ankr.com/eth_goerli/";case"matic":return"rpc.ankr.com/polygon/";case"arbitrum":return"rpc.ankr.com/arbitrum/"}return V3.throwArgumentError("unsupported network","name",t)}class m1 extends Fn{isCommunityResource(){return this.apiKey===Kl}static getApiKey(e){return e??Kl}static getUrl(e,r){r==null&&(r=Kl);const n={allowGzip:!0,url:"https://"+K3(e.name)+r,throttleCallback:(i,o)=>(r.apiKey===Kl&&bl(),Promise.resolve(!0))};return r.projectSecret!=null&&(n.user="",n.password=r.projectSecret),n}}var Q3=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Zp=new T($t);class g1 extends Fn{static getApiKey(e){return e!=null&&Zp.throwArgumentError("apiKey not supported for cloudflare","apiKey",e),null}static getUrl(e,r){let n=null;switch(e.name){case"homestead":n="https://cloudflare-eth.com/";break;default:Zp.throwArgumentError("unsupported network","network",arguments[0])}return n}perform(e,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return Q3(this,void 0,void 0,function*(){return e==="getBlockNumber"?(yield n.perform.call(this,"getBlock",{blockTag:"latest"})).number:n.perform.call(this,e,r)})}}var Ql=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const ti=new T($t);function em(t){const e={};for(let r in t){if(t[r]==null)continue;let n=t[r];r==="type"&&n===0||({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[r]?n=Tu(re(n)):r==="accessList"?n="["+qi(n).map(i=>`{address:"${i.address}",storageKeys:["${i.storageKeys.join('","')}"]}`).join(",")+"]":n=re(n),e[r]=n)}return e}function J3(t){if(t.status==0&&(t.message==="No records found"||t.message==="No transactions found"))return t.result;if(t.status!=1||typeof t.message!="string"||!t.message.match(/^OK/)){const e=new Error("invalid response");throw e.result=JSON.stringify(t),(t.result||"").toLowerCase().indexOf("rate limit")>=0&&(e.throttleRetry=!0),e}return t.result}function tm(t){if(t&&t.status==0&&t.message=="NOTOK"&&(t.result||"").toLowerCase().indexOf("rate limit")>=0){const e=new Error("throttled response");throw e.result=JSON.stringify(t),e.throttleRetry=!0,e}if(t.jsonrpc!="2.0"){const e=new Error("invalid response");throw e.result=JSON.stringify(t),e}if(t.error){const e=new Error(t.error.message||"unknown error");throw t.error.code&&(e.code=t.error.code),t.error.data&&(e.data=t.error.data),e}return t.result}function rm(t){if(t==="pending")throw new Error("pending not supported");return t==="latest"?t:parseInt(t.substring(2),16)}function tf(t,e,r){if(t==="call"&&e.code===T.errors.SERVER_ERROR){const i=e.error;if(i&&(i.message.match(/reverted/i)||i.message.match(/VM execution error/i))){let o=i.data;if(o&&(o="0x"+o.replace(/^.*0x/i,"")),pe(o))return o;ti.throwError("missing revert data in call exception",T.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let n=e.message;throw e.code===T.errors.SERVER_ERROR&&(e.error&&typeof e.error.message=="string"?n=e.error.message:typeof e.body=="string"?n=e.body:typeof e.responseText=="string"&&(n=e.responseText)),n=(n||"").toLowerCase(),n.match(/insufficient funds/)&&ti.throwError("insufficient funds for intrinsic transaction cost",T.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:r}),n.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&ti.throwError("nonce has already been used",T.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),n.match(/another transaction with same nonce/)&&ti.throwError("replacement fee too low",T.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:r}),n.match(/execution failed due to an exception|execution reverted/)&&ti.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",T.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}class v1 extends $u{constructor(e,r){super(e),z(this,"baseUrl",this.getBaseUrl()),z(this,"apiKey",r||null)}getBaseUrl(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return ti.throwArgumentError("unsupported network","network",this.network.name)}getUrl(e,r){const n=Object.keys(r).reduce((o,s)=>{const l=r[s];return l!=null&&(o+=`&${s}=${l}`),o},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.baseUrl}/api?module=${e}${n}${i}`}getPostUrl(){return`${this.baseUrl}/api`}getPostData(e,r){return r.module=e,r.apikey=this.apiKey,r}fetch(e,r,n){return Ql(this,void 0,void 0,function*(){const i=n?this.getPostUrl():this.getUrl(e,r),o=n?this.getPostData(e,r):null,s=e==="proxy"?tm:J3;this.emit("debug",{action:"request",request:i,provider:this});const l={url:i,throttleSlotInterval:1e3,throttleCallback:(c,d)=>(this.isCommunityResource()&&bl(),Promise.resolve(!0))};let a=null;o&&(l.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},a=Object.keys(o).map(c=>`${c}=${o[c]}`).join("&"));const u=yield Al(l,a,s||tm);return this.emit("debug",{action:"response",request:i,response:nr(u),provider:this}),u})}detectNetwork(){return Ql(this,void 0,void 0,function*(){return this.network})}perform(e,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return Ql(this,void 0,void 0,function*(){switch(e){case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getBalance":return this.fetch("account",{action:"balance",address:r.address,tag:r.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:r.address,tag:r.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:r.address,tag:r.blockTag});case"getStorageAt":return this.fetch("proxy",{action:"eth_getStorageAt",address:r.address,position:r.position,tag:r.blockTag});case"sendTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:r.signedTransaction},!0).catch(i=>tf("sendTransaction",i,r.signedTransaction));case"getBlock":if(r.blockTag)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:r.blockTag,boolean:r.includeTransactions?"true":"false"});throw new Error("getBlock by blockHash not implemented");case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:r.transactionHash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:r.transactionHash});case"call":{if(r.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const i=em(r.transaction);i.module="proxy",i.action="eth_call";try{return yield this.fetch("proxy",i,!0)}catch(o){return tf("call",o,r.transaction)}}case"estimateGas":{const i=em(r.transaction);i.module="proxy",i.action="eth_estimateGas";try{return yield this.fetch("proxy",i,!0)}catch(o){return tf("estimateGas",o,r.transaction)}}case"getLogs":{const i={action:"getLogs"};if(r.filter.fromBlock&&(i.fromBlock=rm(r.filter.fromBlock)),r.filter.toBlock&&(i.toBlock=rm(r.filter.toBlock)),r.filter.address&&(i.address=r.filter.address),r.filter.topics&&r.filter.topics.length>0&&(r.filter.topics.length>1&&ti.throwError("unsupported topic count",T.errors.UNSUPPORTED_OPERATION,{topics:r.filter.topics}),r.filter.topics.length===1)){const l=r.filter.topics[0];(typeof l!="string"||l.length!==66)&&ti.throwError("unsupported topic format",T.errors.UNSUPPORTED_OPERATION,{topic0:l}),i.topic0=l}const o=yield this.fetch("logs",i);let s={};for(let l=0;l{["contractAddress","to"].forEach(function(a){s[a]==""&&delete s[a]}),s.creates==null&&s.contractAddress!=null&&(s.creates=s.contractAddress);const l=this.formatter.transactionResponse(s);return s.timeStamp&&(l.timestamp=parseInt(s.timeStamp)),l})})}isCommunityResource(){return this.apiKey==null}}var iu=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};const Si=new T($t);function Jl(){return new Date().getTime()}function nm(t){let e=null;for(let r=0;re?null:(n+i)/2}function po(t){if(t===null)return"null";if(typeof t=="number"||typeof t=="boolean")return JSON.stringify(t);if(typeof t=="string")return t;if(G.isBigNumber(t))return t.toString();if(Array.isArray(t))return JSON.stringify(t.map(e=>po(e)));if(typeof t=="object"){const e=Object.keys(t);return e.sort(),"{"+e.map(r=>{let n=t[r];return typeof n=="function"?n="[function]":n=po(n),JSON.stringify(r)+":"+n}).join(",")+"}"}throw new Error("unknown value type: "+typeof t)}let Y3=1;function om(t){let e=null,r=null,n=new Promise(s=>{e=function(){r&&(clearTimeout(r),r=null),s()},r=setTimeout(e,t)});const i=s=>(n=n.then(s),n);function o(){return n}return{cancel:e,getPromise:o,wait:i}}const X3=[T.errors.CALL_EXCEPTION,T.errors.INSUFFICIENT_FUNDS,T.errors.NONCE_EXPIRED,T.errors.REPLACEMENT_UNDERPRICED,T.errors.UNPREDICTABLE_GAS_LIMIT],Z3=["address","args","errorArgs","errorSignature","method","transaction"];function Yl(t,e){const r={weight:t.weight};return Object.defineProperty(r,"provider",{get:()=>t.provider}),t.start&&(r.start=t.start),e&&(r.duration=e-t.start),t.done&&(t.error?r.error=t.error:r.result=t.result||null),r}function eS(t,e){return function(r){const n={};r.forEach(o=>{const s=t(o.result);n[s]||(n[s]={count:0,result:o.result}),n[s].count++});const i=Object.keys(n);for(let o=0;o=e)return s.result}}}function tS(t,e,r){let n=po;switch(e){case"getBlockNumber":return function(i){const o=i.map(l=>l.result);let s=im(i.map(l=>l.result),2);if(s!=null)return s=Math.ceil(s),o.indexOf(s+1)>=0&&s++,s>=t._highestBlockNumber&&(t._highestBlockNumber=s),t._highestBlockNumber};case"getGasPrice":return function(i){const o=i.map(s=>s.result);return o.sort(),o[Math.floor(o.length/2)]};case"getEtherPrice":return function(i){return im(i.map(o=>o.result))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(i){return i==null?null:(i=it(i),i.confirmations=-1,po(i))};break;case"getBlock":r.includeTransactions?n=function(i){return i==null?null:(i=it(i),i.transactions=i.transactions.map(o=>(o=it(o),o.confirmations=-1,o)),po(i))}:n=function(i){return i==null?null:po(i)};break;default:throw new Error("unknown method: "+e)}return eS(n,t.quorum)}function us(t,e){return iu(this,void 0,void 0,function*(){const r=t.provider;return r.blockNumber!=null&&r.blockNumber>=e||e===-1?r:ho(()=>new Promise((n,i)=>{setTimeout(function(){return r.blockNumber>=e?n(r):t.cancelled?n(null):n(void 0)},0)}),{oncePoll:r})})}function rS(t,e,r,n){return iu(this,void 0,void 0,function*(){let i=t.provider;switch(r){case"getBlockNumber":case"getGasPrice":return i[r]();case"getEtherPrice":if(i.getEtherPrice)return i.getEtherPrice();break;case"getBalance":case"getTransactionCount":case"getCode":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&pe(n.blockTag)&&(i=yield us(t,e)),r==="call"&&n.blockTag?i[r](n.transaction,n.blockTag):i[r](n.transaction);case"getTransaction":case"getTransactionReceipt":return i[r](n.transactionHash);case"getLogs":{let o=n.filter;return(o.fromBlock&&pe(o.fromBlock)||o.toBlock&&pe(o.toBlock))&&(i=yield us(t,e)),i.getLogs(o)}}return Si.throwError("unknown method error",T.errors.UNKNOWN_ERROR,{method:r,params:n})})}class y1 extends $u{constructor(e,r){e.length===0&&Si.throwArgumentError("missing providers","providers",e);const n=e.map((s,l)=>{if(qo.isProvider(s)){const c=gd(s)?2e3:750;return Object.freeze({provider:s,weight:1,stallTimeout:c,priority:1})}const a=it(s);a.priority==null&&(a.priority=1),a.stallTimeout==null&&(a.stallTimeout=gd(s)?2e3:750),a.weight==null&&(a.weight=1);const u=a.weight;return(u%1||u>512||u<1)&&Si.throwArgumentError("invalid weight; must be integer in [1, 512]",`providers[${l}].weight`,u),Object.freeze(a)}),i=n.reduce((s,l)=>s+l.weight,0);r==null?r=i/2:r>i&&Si.throwArgumentError("quorum will always fail; larger than total weight","quorum",r);let o=nm(n.map(s=>s.provider.network));o==null&&(o=new Promise((s,l)=>{setTimeout(()=>{this.detectNetwork().then(s,l)},0)})),super(o),z(this,"providerConfigs",Object.freeze(n)),z(this,"quorum",r),this._highestBlockNumber=-1}detectNetwork(){return iu(this,void 0,void 0,function*(){const e=yield Promise.all(this.providerConfigs.map(r=>r.provider.getNetwork()));return nm(e)})}perform(e,r){return iu(this,void 0,void 0,function*(){if(e==="sendTransaction"){const a=yield Promise.all(this.providerConfigs.map(u=>u.provider.sendTransaction(r.signedTransaction).then(c=>c.hash,c=>c)));for(let u=0;ua.priority-u.priority);const o=this._highestBlockNumber;let s=0,l=!0;for(;;){const a=Jl();let u=i.filter(v=>v.runner&&a-v.startv+g.weight,0);for(;u{v.staller=null}),v.runner=rS(v,o,e,r).then(x=>{v.done=!0,v.result=x,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:g,backend:Yl(v,Jl()),request:{method:e,params:nr(r)},provider:this})},x=>{v.done=!0,v.error=x,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:g,backend:Yl(v,Jl()),request:{method:e,params:nr(r)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:g,backend:Yl(v,null),request:{method:e,params:nr(r)},provider:this}),u+=v.weight}const c=[];i.forEach(v=>{v.done||!v.runner||(c.push(v.runner),v.staller&&c.push(v.staller.getPromise()))}),c.length&&(yield Promise.race(c));const d=i.filter(v=>v.done&&v.error==null);if(d.length>=this.quorum){const v=n(d);if(v!==void 0)return i.forEach(g=>{g.staller&&g.staller.cancel(),g.cancelled=!0}),v;l||(yield om(100).getPromise()),l=!1}const p=i.reduce((v,g)=>{if(!g.done||g.error==null)return v;const x=g.error.code;return X3.indexOf(x)>=0&&(v[x]||(v[x]={error:g.error,weight:0}),v[x].weight+=g.weight),v},{});if(Object.keys(p).forEach(v=>{const g=p[v];if(g.weight{E.staller&&E.staller.cancel(),E.cancelled=!0});const x=g.error,S={};Z3.forEach(E=>{x[E]!=null&&(S[E]=x[E])}),Si.throwError(x.reason||x.message,v,S)}),i.filter(v=>!v.done).length===0)break}return i.forEach(a=>{a.staller&&a.staller.cancel(),a.cancelled=!0}),Si.throwError("failed to meet quorum",T.errors.SERVER_ERROR,{method:e,params:r,results:i.map(a=>Yl(a)),provider:this})})}}const w1=null,xa=new T($t),vs="84842078b09946638c03157f83405213";class E1 extends Hu{constructor(e,r){const n=new Bh(e,r),i=n.connection;i.password&&xa.throwError("INFURA WebSocket project secrets unsupported",T.errors.UNSUPPORTED_OPERATION,{operation:"InfuraProvider.getWebSocketProvider()"});const o=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(o,e),z(this,"apiKey",n.projectId),z(this,"projectId",n.projectId),z(this,"projectSecret",n.projectSecret)}isCommunityResource(){return this.projectId===vs}}class Bh extends Fn{static getWebSocketProvider(e,r){return new E1(e,r)}static getApiKey(e){const r={apiKey:vs,projectId:vs,projectSecret:null};return e==null||(typeof e=="string"?r.projectId=e:e.projectSecret!=null?(xa.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),xa.assertArgument(typeof e.projectSecret=="string","invalid projectSecret","projectSecret","[REDACTED]"),r.projectId=e.projectId,r.projectSecret=e.projectSecret):e.projectId&&(r.projectId=e.projectId),r.apiKey=r.projectId),r}static getUrl(e,r){let n=null;switch(e?e.name:"unknown"){case"homestead":n="mainnet.infura.io";break;case"goerli":n="goerli.infura.io";break;case"sepolia":n="sepolia.infura.io";break;case"matic":n="polygon-mainnet.infura.io";break;case"maticmum":n="polygon-mumbai.infura.io";break;case"optimism":n="optimism-mainnet.infura.io";break;case"optimism-goerli":n="optimism-goerli.infura.io";break;case"arbitrum":n="arbitrum-mainnet.infura.io";break;case"arbitrum-goerli":n="arbitrum-goerli.infura.io";break;default:xa.throwError("unsupported network",T.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+n+"/v3/"+r.projectId,throttleCallback:(o,s)=>(r.projectId===vs&&bl(),Promise.resolve(!0))};return r.projectSecret!=null&&(i.user="",i.password=r.projectSecret),i}isCommunityResource(){return this.projectId===vs}}class nS extends vi{send(e,r){const n={method:e,params:r,id:this._nextId++,jsonrpc:"2.0"};this._pendingBatch==null&&(this._pendingBatch=[]);const i={request:n,resolve:null,reject:null},o=new Promise((s,l)=>{i.resolve=s,i.reject=l});return this._pendingBatch.push(i),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout(()=>{const s=this._pendingBatch;this._pendingBatch=null,this._pendingBatchAggregator=null;const l=s.map(a=>a.request);return this.emit("debug",{action:"requestBatch",request:nr(l),provider:this}),Al(this.connection,JSON.stringify(l)).then(a=>{this.emit("debug",{action:"response",request:l,response:a,provider:this}),s.forEach((u,c)=>{const d=a[c];if(d.error){const p=new Error(d.error.message);p.code=d.error.code,p.data=d.error.data,u.reject(p)}else u.resolve(d.result)})},a=>{this.emit("debug",{action:"response",error:a,request:l,provider:this}),s.forEach(u=>{u.reject(a)})})},10)),o}}const rf=new T($t),iS="ETHERS_JS_SHARED";class x1 extends Fn{static getApiKey(e){return e&&typeof e!="string"&&rf.throwArgumentError("invalid apiKey","apiKey",e),e||iS}static getUrl(e,r){rf.warn("NodeSmith will be discontinued on 2019-12-20; please migrate to another platform.");let n=null;switch(e.name){case"homestead":n="https://ethereum.api.nodesmith.io/v1/mainnet/jsonrpc";break;case"ropsten":n="https://ethereum.api.nodesmith.io/v1/ropsten/jsonrpc";break;case"rinkeby":n="https://ethereum.api.nodesmith.io/v1/rinkeby/jsonrpc";break;case"goerli":n="https://ethereum.api.nodesmith.io/v1/goerli/jsonrpc";break;case"kovan":n="https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";break;default:rf.throwArgumentError("unsupported network","network",arguments[0])}return n+"?apiKey="+r}}const sm=new T($t),lm="62e1ad51b37b8e00394bda3b";class A1 extends Fn{static getApiKey(e){const r={applicationId:null,loadBalancer:!0,applicationSecretKey:null};return e==null?r.applicationId=lm:typeof e=="string"?r.applicationId=e:e.applicationSecretKey!=null?(r.applicationId=e.applicationId,r.applicationSecretKey=e.applicationSecretKey):e.applicationId?r.applicationId=e.applicationId:sm.throwArgumentError("unsupported PocketProvider apiKey","apiKey",e),r}static getUrl(e,r){let n=null;switch(e?e.name:"unknown"){case"goerli":n="eth-goerli.gateway.pokt.network";break;case"homestead":n="eth-mainnet.gateway.pokt.network";break;case"kovan":n="poa-kovan.gateway.pokt.network";break;case"matic":n="poly-mainnet.gateway.pokt.network";break;case"maticmum":n="polygon-mumbai-rpc.gateway.pokt.network";break;case"rinkeby":n="eth-rinkeby.gateway.pokt.network";break;case"ropsten":n="eth-ropsten.gateway.pokt.network";break;default:sm.throwError("unsupported network",T.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i=`https://${n}/v1/lb/${r.applicationId}`,o={headers:{},url:i};return r.applicationSecretKey!=null&&(o.user="",o.password=r.applicationSecretKey),o}isCommunityResource(){return this.applicationId===lm}}const am=new T($t);let oS=1;function um(t,e){const r="Web3LegacyFetcher";return function(n,i){const o={method:n,params:i,id:oS++,jsonrpc:"2.0"};return new Promise((s,l)=>{this.emit("debug",{action:"request",fetcher:r,request:nr(o),provider:this}),e(o,(a,u)=>{if(a)return this.emit("debug",{action:"response",fetcher:r,error:a,request:o,provider:this}),l(a);if(this.emit("debug",{action:"response",fetcher:r,request:o,response:u,provider:this}),u.error){const c=new Error(u.error.message);return c.code=u.error.code,c.data=u.error.data,l(c)}s(u.result)})})}}function sS(t){return function(e,r){r==null&&(r=[]);const n={method:e,params:r};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:nr(n),provider:this}),t.request(n).then(i=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,response:i,provider:this}),i),i=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:n,error:i,provider:this}),i})}}class b1 extends vi{constructor(e,r){e==null&&am.throwArgumentError("missing provider","provider",e);let n=null,i=null,o=null;typeof e=="function"?(n="unknown:",i=e):(n=e.host||e.path||"",!n&&e.isMetaMask&&(n="metamask"),o=e,e.request?(n===""&&(n="eip-1193:"),i=sS(e)):e.sendAsync?i=um(e,e.sendAsync.bind(e)):e.send?i=um(e,e.send.bind(e)):am.throwArgumentError("unsupported provider","provider",e),n||(n="unknown:")),super(n,r),z(this,"jsonRpcFetchFunc",i),z(this,"provider",o)}send(e,r){return this.jsonRpcFetchFunc(e,r)}}const cm=new T($t);function lS(t,e){if(t==null&&(t="homestead"),typeof t=="string"){const n=t.match(/^(ws|http)s?:/i);if(n)switch(n[1].toLowerCase()){case"http":case"https":return new vi(t);case"ws":case"wss":return new Hu(t);default:cm.throwArgumentError("unsupported URL scheme","network",t)}}const r=Th(t);return(!r||!r._defaultProvider)&&cm.throwError("unsupported getDefaultProvider network",T.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:t}),r._defaultProvider({FallbackProvider:y1,AlchemyProvider:Lh,AnkrProvider:m1,CloudflareProvider:g1,EtherscanProvider:v1,InfuraProvider:Bh,JsonRpcProvider:vi,NodesmithProvider:x1,PocketProvider:A1,Web3Provider:b1,IpcProvider:w1},e)}const aS=Object.freeze(Object.defineProperty({__proto__:null,AlchemyProvider:Lh,AlchemyWebSocketProvider:p1,AnkrProvider:m1,BaseProvider:$u,CloudflareProvider:g1,EtherscanProvider:v1,FallbackProvider:y1,Formatter:ee,InfuraProvider:Bh,InfuraWebSocketProvider:E1,IpcProvider:w1,JsonRpcBatchProvider:nS,JsonRpcProvider:vi,JsonRpcSigner:Oh,NodesmithProvider:x1,PocketProvider:A1,Provider:qo,Resolver:vd,StaticJsonRpcProvider:h1,UrlJsonRpcProvider:Fn,Web3Provider:b1,WebSocketProvider:Hu,getDefaultProvider:lS,getNetwork:Th,isCommunityResourcable:u1,isCommunityResource:gd,showThrottleMessage:bl},Symbol.toStringTag,{value:"Module"})),uS="solidity/5.7.0",cS=new RegExp("^bytes([0-9]+)$"),fS=new RegExp("^(u?int)([0-9]*)$"),dS=new RegExp("^(.*)\\[([0-9]*)\\]$"),hS="0000000000000000000000000000000000000000000000000000000000000000",Yi=new T(uS);function _1(t,e,r){switch(t){case"address":return r?ha(e,32):se(e);case"string":return mr(e);case"bytes":return se(e);case"bool":return e=e?"0x01":"0x00",r?ha(e,32):se(e)}let n=t.match(fS);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!==0||i===0||i>256)&&Yi.throwArgumentError("invalid number type","type",t),r&&(i=256),e=G.from(e).toTwos(i),ha(e,i/8)}if(n=t.match(cS),n){const i=parseInt(n[1]);return(String(i)!==n[1]||i===0||i>32)&&Yi.throwArgumentError("invalid bytes type","type",t),se(e).byteLength!==i&&Yi.throwArgumentError(`invalid value for ${t}`,"value",e),r?se((e+hS).substring(0,66)):e}if(n=t.match(dS),n&&Array.isArray(e)){const i=n[1];parseInt(n[2]||String(e.length))!=e.length&&Yi.throwArgumentError(`invalid array length for ${t}`,"value",e);const s=[];return e.forEach(function(l){s.push(_1(i,l,!0))}),Ut(s)}return Yi.throwArgumentError("invalid type","type",t)}function pS(t,e){t.length!=e.length&&Yi.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);const r=[];return t.forEach(function(n,i){r.push(_1(n,e[i]))}),re(Ut(r))}function mS(t,e){return ut(pS(t,e))}var qu={},Cn={},S1={};const gS=Uo(rA);var vS={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const fm=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??typeof c!="object"?c:Object.assign({},e,c),r.forEach(p=>p(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(vS?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},k1=t=>t?fm(t):fm;var N1={exports:{}},P1={},C1={exports:{}},M1={};/** + * @license React + * use-sync-external-store-shim.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Bo=L;function yS(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var wS=typeof Object.is=="function"?Object.is:yS,ES=Bo.useState,xS=Bo.useEffect,AS=Bo.useLayoutEffect,bS=Bo.useDebugValue;function _S(t,e){var r=e(),n=ES({inst:{value:r,getSnapshot:e}}),i=n[0].inst,o=n[1];return AS(function(){i.value=r,i.getSnapshot=e,nf(i)&&o({inst:i})},[t,r,e]),xS(function(){return nf(i)&&o({inst:i}),t(function(){nf(i)&&o({inst:i})})},[t]),bS(r),r}function nf(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!wS(t,r)}catch{return!0}}function SS(t,e){return e()}var kS=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?SS:_S;M1.useSyncExternalStore=Bo.useSyncExternalStore!==void 0?Bo.useSyncExternalStore:kS;C1.exports=M1;var NS=C1.exports;/** + * @license React + * use-sync-external-store-shim/with-selector.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Wu=L,PS=NS;function CS(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var MS=typeof Object.is=="function"?Object.is:CS,IS=PS.useSyncExternalStore,RS=Wu.useRef,TS=Wu.useEffect,OS=Wu.useMemo,LS=Wu.useDebugValue;P1.useSyncExternalStoreWithSelector=function(t,e,r,n,i){var o=RS(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=OS(function(){function a(v){if(!u){if(u=!0,c=v,v=n(v),i!==void 0&&s.hasValue){var g=s.value;if(i(g,v))return d=g}return d=v}if(g=d,MS(c,v))return g;var x=n(v);return i!==void 0&&i(g,x)?g:(c=v,d=x)}var u=!1,c,d,p=r===void 0?null:r;return[function(){return a(e())},p===null?void 0:function(){return a(p())}]},[e,r,n,i]);var l=IS(t,o[0],o[1]);return TS(function(){s.hasValue=!0,s.value=l},[l]),LS(l),l};N1.exports=P1;var BS=N1.exports;const Gu=jo(BS),{useSyncExternalStoreWithSelector:DS}=Gu;function I1(t,e=t.getState,r){const n=DS(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const dm=t=>{const e=typeof t=="function"?k1(t):t,r=(n,i)=>I1(e,n,i);return Object.assign(r,e),r},R1=t=>t?dm(t):dm;var jS=t=>R1(t);const US=Object.freeze(Object.defineProperty({__proto__:null,create:R1,createStore:k1,default:jS,useStore:I1},Symbol.toStringTag,{value:"Module"})),FS=Uo(US);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createWeb3ReactStoreAndActions=t.MAX_SAFE_CHAIN_ID=void 0;const e=gS,r=FS;t.MAX_SAFE_CHAIN_ID=0xfffffffffffec;function n(l){if(!Number.isInteger(l)||l<=0||l>t.MAX_SAFE_CHAIN_ID)throw new Error(`Invalid chainId ${l}`)}function i(l){return(0,e.getAddress)(l)}const o={chainId:void 0,accounts:void 0,activating:!1};function s(){const l=(0,r.createStore)()(()=>o);let a=0;function u(){const p=++a;return l.setState(Object.assign(Object.assign({},o),{activating:!0})),()=>{a===p&&l.setState({activating:!1})}}function c(p){if(p.chainId!==void 0&&n(p.chainId),p.accounts!==void 0)for(let v=0;v{var g,x;const S=(g=p.chainId)!==null&&g!==void 0?g:v.chainId,E=(x=p.accounts)!==null&&x!==void 0?x:v.accounts;let w=v.activating;return w&&S&&E&&(w=!1),{chainId:S,accounts:E,activating:w}})}function d(){a++,l.setState(o)}return[l,{startActivation:u,update:c,resetState:d}]}t.createWeb3ReactStoreAndActions=s})(S1);var zS={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const hm=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??typeof c!="object"?c:Object.assign({},e,c),r.forEach(p=>p(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(zS?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},Dh=t=>t?hm(t):hm,{useSyncExternalStoreWithSelector:$S}=Gu;function T1(t,e=t.getState,r){const n=$S(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const pm=t=>{const e=typeof t=="function"?Dh(t):t,r=(n,i)=>T1(e,n,i);return Object.assign(r,e),r},O1=t=>t?pm(t):pm;var HS=t=>O1(t);const qS=Object.freeze(Object.defineProperty({__proto__:null,create:O1,createStore:Dh,default:HS,useStore:T1},Symbol.toStringTag,{value:"Module"})),WS=Uo(qS),{useSyncExternalStoreWithSelector:GS}=Gu;function L1(t,e=t.getState,r){const n=GS(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const mm=(t,e)=>{const r=Dh(t),n=(i,o=e)=>L1(r,i,o);return Object.assign(n,r),n},VS=(t,e)=>t?mm(t,e):mm,KS=Object.freeze(Object.defineProperty({__proto__:null,createWithEqualityFn:VS,useStoreWithEqualityFn:L1},Symbol.toStringTag,{value:"Module"})),QS=Uo(KS),JS=Uo(aS);var YS=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),XS=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ZS=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&YS(e,t,r);return XS(e,t),e},ek=Fe&&Fe.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(Cn,"__esModule",{value:!0});Cn.getPriorityConnector=Cn.getSelectedConnector=Cn.initializeConnector=void 0;const tk=S1,mo=L,gm=WS,rk=QS;let _o;function nk(){return ek(this,void 0,void 0,function*(){if(_o===void 0)try{const{Web3Provider:t}=yield Promise.resolve().then(()=>ZS(JS));_o=t}catch{console.debug("@ethersproject/providers not available"),_o=null}})}function ik(t){const[e,r]=(0,tk.createWeb3ReactStoreAndActions)(),n=t(r),i=fk(e),o=dk(i),s=hk(n,i,o);return[n,Object.assign(Object.assign(Object.assign({},i),o),s),e]}Cn.initializeConnector=ik;function ok({chainId:t,accounts:e,activating:r}){return!!(t&&e&&!r)}function B1(...t){function e(d){const p=t.findIndex(([v])=>d===v);if(p===-1)throw new Error("Connector not found");return p}function r(d){const p=t[e(d)][2];if(!p)throw new Error("Stores not passed");return p}function n(d){return t.map(([,{useChainId:v}])=>v())[e(d)]}function i(d){return t.map(([,{useAccounts:v}])=>v())[e(d)]}function o(d){return t.map(([,{useIsActivating:v}])=>v())[e(d)]}function s(d){return t.map(([,{useAccount:v}])=>v())[e(d)]}function l(d){return t.map(([,{useIsActive:v}])=>v())[e(d)]}function a(d,p){const v=e(d);return t.map(([,{useProvider:x}],S)=>x(p,S===v))[v]}function u(d,p){const v=e(d);return t.map(([,{useENSNames:x}],S)=>x(S===v?p:void 0))[v]}function c(d,p){const v=e(d);return t.map(([,{useENSName:x}],S)=>x(S===v?p:void 0))[v]}return{useSelectedStore:r,useSelectedChainId:n,useSelectedAccounts:i,useSelectedIsActivating:o,useSelectedAccount:s,useSelectedIsActive:l,useSelectedProvider:a,useSelectedENSNames:u,useSelectedENSName:c}}Cn.getSelectedConnector=B1;function sk(...t){const{useSelectedStore:e,useSelectedChainId:r,useSelectedAccounts:n,useSelectedIsActivating:i,useSelectedAccount:o,useSelectedIsActive:s,useSelectedProvider:l,useSelectedENSNames:a,useSelectedENSName:u}=B1(...t);function c(){const B=t.map(([,{useIsActive:j}])=>j()).findIndex(j=>j);return t[B===-1?0:B][0]}function d(){return e(c())}function p(){return r(c())}function v(){return n(c())}function g(){return i(c())}function x(){return o(c())}function S(){return s(c())}function E(O){return l(c(),O)}function w(O){return a(c(),O)}function _(O){return u(c(),O)}return{useSelectedStore:e,useSelectedChainId:r,useSelectedAccounts:n,useSelectedIsActivating:i,useSelectedAccount:o,useSelectedIsActive:s,useSelectedProvider:l,useSelectedENSNames:a,useSelectedENSName:u,usePriorityConnector:c,usePriorityStore:d,usePriorityChainId:p,usePriorityAccounts:v,usePriorityIsActivating:g,usePriorityAccount:x,usePriorityIsActive:S,usePriorityProvider:E,usePriorityENSNames:w,usePriorityENSName:_}}Cn.getPriorityConnector=sk;const lk=({chainId:t})=>t,ak=({accounts:t})=>t,uk=({activating:t})=>t,ck=(t,e)=>t===void 0&&e===void 0||t!==void 0&&t.length===(e==null?void 0:e.length)&&t.every((r,n)=>r===e[n]);function fk(t){function e(){return(0,gm.useStore)(t,lk)}function r(){return(0,rk.useStoreWithEqualityFn)(t,ak,ck)}function n(){return(0,gm.useStore)(t,uk)}return{useChainId:e,useAccounts:r,useIsActivating:n}}function dk({useChainId:t,useAccounts:e,useIsActivating:r}){function n(){var o;return(o=e())===null||o===void 0?void 0:o[0]}function i(){const o=t(),s=e(),l=r();return ok({chainId:o,accounts:s,activating:l})}return{useAccount:n,useIsActive:i}}function vm(t,e=[]){const[r,n]=(0,mo.useState)();return(0,mo.useEffect)(()=>{if(t&&e.length){let i=!1;return Promise.all(e.map(o=>t.lookupAddress(o))).then(o=>{i||n(o)}).catch(o=>{i||(console.debug("Could not fetch ENS names",o),n(new Array(e.length).fill(null)))}),()=>{i=!0,n(void 0)}}},[t,e]),r??new Array(e.length).fill(void 0)}function hk(t,{useAccounts:e,useChainId:r},{useAccount:n,useIsActive:i}){function o(a,u=!0){const c=i(),d=r(),[p,v]=(0,mo.useState)(_o!==void 0);return(0,mo.useEffect)(()=>{if(p)return;let g=!1;return nk().then(()=>{g||v(!0)}),()=>{g=!0}},[p]),(0,mo.useMemo)(()=>{if(u){if(t.customProvider)return t.customProvider;if(_o&&t.provider)return new _o(t.provider,a)}},[p,u,c,d,a])}function s(a){const u=e();return vm(a,u)}function l(a){var u;const c=n(),d=(0,mo.useMemo)(()=>c===void 0?void 0:[c],[c]);return(u=vm(a,d))===null||u===void 0?void 0:u[0]}return{useProvider:o,useENSNames:s,useENSName:l}}var Vu={},D1={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(a,u,c){this.fn=a,this.context=u,this.once=c||!1}function o(a,u,c,d,p){if(typeof c!="function")throw new TypeError("The listener must be a function");var v=new i(c,d||a,p),g=r?r+u:u;return a._events[g]?a._events[g].fn?a._events[g]=[a._events[g],v]:a._events[g].push(v):(a._events[g]=v,a._eventsCount++),a}function s(a,u){--a._eventsCount===0?a._events=new n:delete a._events[u]}function l(){this._events=new n,this._eventsCount=0}l.prototype.eventNames=function(){var u=[],c,d;if(this._eventsCount===0)return u;for(d in c=this._events)e.call(c,d)&&u.push(r?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},l.prototype.listeners=function(u){var c=r?r+u:u,d=this._events[c];if(!d)return[];if(d.fn)return[d.fn];for(var p=0,v=d.length,g=new Array(v);pe),this.eth_accounts=jest.fn(e=>e),this.eth_requestAccounts=jest.fn(e=>e)}request(e){if(!this.chainId)return Promise.reject(new Error);switch(e.method){case"eth_chainId":return Promise.resolve(this.eth_chainId(this.chainId));case"eth_accounts":return Promise.resolve(this.eth_accounts(this.accounts));case"eth_requestAccounts":return Promise.resolve(this.eth_requestAccounts(this.accounts));default:throw new Error(`Method not supported on mock: ${JSON.stringify(e)}`)}}emitConnect(e){this.emit("connect",{chainId:e})}emitDisconnect(e){this.emit("disconnect",e)}emitChainChanged(e){this.emit("chainChanged",e)}emitAccountsChanged(e){this.emit("accountsChanged",e)}}Vu.MockEIP1193Provider=gk;var Do={},vk=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),yk=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),wk=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&vk(e,t,r);return yk(e,t),e};Object.defineProperty(Do,"__esModule",{value:!0});Do.useWeb3React=Do.Web3ReactProvider=void 0;const ou=wk(L),Ek=Cn,j1=(0,ou.createContext)(void 0);function xk({children:t,connectors:e,connectorOverride:r,network:n,lookupENS:i=!0}){const o=(0,ou.useRef)(e);if(e.length!=o.current.length||e.some((V,Y)=>{const K=o.current[Y];return V[0]!==K[0]}))throw new Error("The connectors prop passed to Web3ReactProvider must be referentially static. If connectors is changing, try providing a key prop to Web3ReactProvider that changes every time connectors changes.");const s=(0,Ek.getPriorityConnector)(...e),{usePriorityConnector:l,useSelectedChainId:a,useSelectedAccounts:u,useSelectedIsActivating:c,useSelectedAccount:d,useSelectedIsActive:p,useSelectedProvider:v,useSelectedENSNames:g,useSelectedENSName:x}=s,S=l(),E=r??S,w=a(E),_=u(E),O=c(E),B=d(E),j=p(E),$=v(E,n),H=g(E,i?$:void 0),ie=x(E,i?$:void 0);return ou.default.createElement(j1.Provider,{value:{connector:E,chainId:w,accounts:_,isActivating:O,account:B,isActive:j,provider:$,ENSNames:H,ENSName:ie,hooks:s}},t)}Do.Web3ReactProvider=xk;function Ak(){const t=(0,ou.useContext)(j1);if(!t)throw Error("useWeb3React can only be used within the Web3ReactProvider component");return t}Do.useWeb3React=Ak;(function(t){var e=Fe&&Fe.__createBinding||(Object.create?function(n,i,o,s){s===void 0&&(s=o);var l=Object.getOwnPropertyDescriptor(i,o);(!l||("get"in l?!i.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(n,s,l)}:function(n,i,o,s){s===void 0&&(s=o),n[s]=i[o]}),r=Fe&&Fe.__exportStar||function(n,i){for(var o in n)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&e(i,n,o)};Object.defineProperty(t,"__esModule",{value:!0}),r(Cn,t),r(Vu,t),r(Do,t)})(qu);const of=[{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"approve",inputs:[{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"apps",inputs:[{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"balanceOf",inputs:[{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"contractURI",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"getApproved",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"getInitializedVersion",inputs:[],outputs:[{name:"",type:"uint64",internalType:"uint64"}],stateMutability:"view"},{type:"function",name:"getPackageId",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"pure"},{type:"function",name:"getPackageInfo",inputs:[{name:"package",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"tuple",internalType:"struct IKinodeAppStore.PackageInfo",components:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"getPackageInfo",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"tuple",internalType:"struct IKinodeAppStore.PackageInfo",components:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherKnsNodeId",type:"bytes32",internalType:"bytes32"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}]}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[{name:"_knsResolver",type:"address",internalType:"contract KNSRegistryResolver"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"isApprovedForAll",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"operator",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"knsResolver",inputs:[],outputs:[{name:"",type:"address",internalType:"contract KNSRegistryResolver"}],stateMutability:"view"},{type:"function",name:"name",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"ownerOf",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"proxiableUUID",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"registerApp",inputs:[{name:"packageName",type:"string",internalType:"string"},{name:"publisherName",type:"bytes",internalType:"bytes"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setApprovalForAll",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"approved",type:"bool",internalType:"bool"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"symbol",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"tokenURI",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"transferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"unlistPacakge",inputs:[{name:"package",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateContractURI",inputs:[{name:"uri",type:"string",internalType:"string"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateMetadata",inputs:[{name:"package",type:"uint256",internalType:"uint256"},{name:"metadataUrl",type:"string",internalType:"string"},{name:"metadataHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"upgradeToAndCall",inputs:[{name:"newImplementation",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"event",name:"AppMetadataUpdated",inputs:[{name:"package",type:"uint256",indexed:!0,internalType:"uint256"},{name:"metadataUrl",type:"string",indexed:!1,internalType:"string"},{name:"metadataHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"AppRegistered",inputs:[{name:"package",type:"uint256",indexed:!0,internalType:"uint256"},{name:"packageName",type:"string",indexed:!1,internalType:"string"},{name:"publisherName",type:"bytes",indexed:!1,internalType:"bytes"},{name:"metadataUrl",type:"string",indexed:!1,internalType:"string"},{name:"metadataHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"Approval",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"ApprovalForAll",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"operator",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint64",indexed:!1,internalType:"uint64"}],anonymous:!1},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Transfer",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"AddressEmptyCode",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{name:"implementation",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ERC721IncorrectOwner",inputs:[{name:"sender",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InsufficientApproval",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC721InvalidApprover",inputs:[{name:"approver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOperator",inputs:[{name:"operator",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidReceiver",inputs:[{name:"receiver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidSender",inputs:[{name:"sender",type:"address",internalType:"address"}]},{type:"error",name:"ERC721NonexistentToken",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"FailedInnerCall",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"OwnableInvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{name:"account",type:"address",internalType:"address"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{name:"slot",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"Unauthorized",inputs:[]}];class wd{static createInterface(){return new ad(of)}static connect(e,r){return new g3(e,of,r)}}zh(wd,"abi",of);var U1={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ym=qr.createContext&&qr.createContext(U1),bk=["attr","size","title"];function _k(t,e){if(t==null)return{};var r=Sk(t,e),n,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Sk(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,o;for(o=0;o=0)&&(r[i]=t[i]);return r}function su(){return su=Object.assign?Object.assign.bind():function(t){for(var e=1;eqr.createElement(e.tag,lu({key:r},e.attr),F1(e.child)))}function zn(t){return e=>qr.createElement(Ck,su({attr:lu({},t.attr)},e),F1(t.child))}function Ck(t){var e=r=>{var{attr:n,size:i,title:o}=t,s=_k(t,bk),l=i||r.size||"1em",a;return r.className&&(a=r.className),t.className&&(a=(a?a+" ":"")+t.className),qr.createElement("svg",su({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,n,s,{className:a,style:lu(lu({color:t.color||r.color},r.style),t.style),height:l,width:l,xmlns:"http://www.w3.org/2000/svg"}),o&&qr.createElement("title",null,o),t.children)};return ym!==void 0?qr.createElement(ym.Consumer,null,r=>e(r)):e(U1)}function Mk(t){return zn({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M257.5 445.1l-22.2 22.2c-9.4 9.4-24.6 9.4-33.9 0L7 273c-9.4-9.4-9.4-24.6 0-33.9L201.4 44.7c9.4-9.4 24.6-9.4 33.9 0l22.2 22.2c9.5 9.5 9.3 25-.4 34.3L136.6 216H424c13.3 0 24 10.7 24 24v32c0 13.3-10.7 24-24 24H136.6l120.5 114.8c9.8 9.3 10 24.8.4 34.3z"},child:[]}]})(t)}function Ik(t){return zn({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"},child:[]}]})(t)}function Rk(t){return zn({tag:"svg",attr:{viewBox:"0 0 320 512"},child:[{tag:"path",attr:{d:"M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"},child:[]}]})(t)}function Tk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(t)}function Ok(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"},child:[]}]})(t)}function Lk(t){return zn({tag:"svg",attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"},child:[]}]})(t)}function Bk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"},child:[]}]})(t)}function z1(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M296 384h-80c-13.3 0-24-10.7-24-24V192h-87.7c-17.8 0-26.7-21.5-14.1-34.1L242.3 5.7c7.5-7.5 19.8-7.5 27.3 0l152.2 152.2c12.6 12.6 3.7 34.1-14.1 34.1H320v168c0 13.3-10.7 24-24 24zm216-8v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h136v8c0 30.9 25.1 56 56 56h80c30.9 0 56-25.1 56-56v-8h136c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z"},child:[]}]})(t)}function Dk(t){return zn({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm101.8-262.2L295.6 256l62.2 62.2c4.7 4.7 4.7 12.3 0 17l-22.6 22.6c-4.7 4.7-12.3 4.7-17 0L256 295.6l-62.2 62.2c-4.7 4.7-12.3 4.7-17 0l-22.6-22.6c-4.7-4.7-4.7-12.3 0-17l62.2-62.2-62.2-62.2c-4.7-4.7-4.7-12.3 0-17l22.6-22.6c4.7-4.7 12.3-4.7 17 0l62.2 62.2 62.2-62.2c4.7-4.7 12.3-4.7 17 0l22.6 22.6c4.7 4.7 4.7 12.3 0 17z"},child:[]}]})(t)}var jk={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Em=t=>{let e;const r=new Set,n=(a,u)=>{const c=typeof a=="function"?a(e):a;if(!Object.is(c,e)){const d=e;e=u??(typeof c!="object"||c===null)?c:Object.assign({},e,c),r.forEach(p=>p(e,d))}},i=()=>e,l={setState:n,getState:i,subscribe:a=>(r.add(a),()=>r.delete(a)),destroy:()=>{(jk?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}};return e=t(n,i,l),l},Uk=t=>t?Em(t):Em;var $1={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const{useDebugValue:Fk}=qr,{useSyncExternalStoreWithSelector:zk}=Gu;let xm=!1;function $k(t,e=t.getState,r){($1?"production":void 0)!=="production"&&r&&!xm&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),xm=!0);const n=zk(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return Fk(n),n}const Am=t=>{($1?"production":void 0)!=="production"&&typeof t!="function"&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");const e=typeof t=="function"?Uk(t):t,r=(n,i)=>$k(e,n,i);return Object.assign(r,e),r},Hk=t=>t?Am(t):Am;var qk={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};function H1(t,e){let r;try{r=t()}catch{return}return{getItem:i=>{var o;const s=a=>a===null?null:JSON.parse(a,e==null?void 0:e.reviver),l=(o=r.getItem(i))!=null?o:null;return l instanceof Promise?l.then(s):s(l)},setItem:(i,o)=>r.setItem(i,JSON.stringify(o,e==null?void 0:e.replacer)),removeItem:i=>r.removeItem(i)}}const sl=t=>e=>{try{const r=t(e);return r instanceof Promise?r:{then(n){return sl(n)(r)},catch(n){return this}}}catch(r){return{then(n){return this},catch(n){return sl(n)(r)}}}},Wk=(t,e)=>(r,n,i)=>{let o={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:S=>S,version:0,merge:(S,E)=>({...E,...S}),...e},s=!1;const l=new Set,a=new Set;let u;try{u=o.getStorage()}catch{}if(!u)return t((...S)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...S)},n,i);const c=sl(o.serialize),d=()=>{const S=o.partialize({...n()});let E;const w=c({state:S,version:o.version}).then(_=>u.setItem(o.name,_)).catch(_=>{E=_});if(E)throw E;return w},p=i.setState;i.setState=(S,E)=>{p(S,E),d()};const v=t((...S)=>{r(...S),d()},n,i);let g;const x=()=>{var S;if(!u)return;s=!1,l.forEach(w=>w(n()));const E=((S=o.onRehydrateStorage)==null?void 0:S.call(o,n()))||void 0;return sl(u.getItem.bind(u))(o.name).then(w=>{if(w)return o.deserialize(w)}).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==o.version){if(o.migrate)return o.migrate(w.state,w.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return w.state}).then(w=>{var _;return g=o.merge(w,(_=n())!=null?_:v),r(g,!0),d()}).then(()=>{E==null||E(g,void 0),s=!0,a.forEach(w=>w(g))}).catch(w=>{E==null||E(void 0,w)})};return i.persist={setOptions:S=>{o={...o,...S},S.getStorage&&(u=S.getStorage())},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>x(),hasHydrated:()=>s,onHydrate:S=>(l.add(S),()=>{l.delete(S)}),onFinishHydration:S=>(a.add(S),()=>{a.delete(S)})},x(),g||v},Gk=(t,e)=>(r,n,i)=>{let o={storage:H1(()=>localStorage),partialize:x=>x,version:0,merge:(x,S)=>({...S,...x}),...e},s=!1;const l=new Set,a=new Set;let u=o.storage;if(!u)return t((...x)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...x)},n,i);const c=()=>{const x=o.partialize({...n()});return u.setItem(o.name,{state:x,version:o.version})},d=i.setState;i.setState=(x,S)=>{d(x,S),c()};const p=t((...x)=>{r(...x),c()},n,i);let v;const g=()=>{var x,S;if(!u)return;s=!1,l.forEach(w=>{var _;return w((_=n())!=null?_:p)});const E=((S=o.onRehydrateStorage)==null?void 0:S.call(o,(x=n())!=null?x:p))||void 0;return sl(u.getItem.bind(u))(o.name).then(w=>{if(w)if(typeof w.version=="number"&&w.version!==o.version){if(o.migrate)return o.migrate(w.state,w.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return w.state}).then(w=>{var _;return v=o.merge(w,(_=n())!=null?_:p),r(v,!0),c()}).then(()=>{E==null||E(v,void 0),v=n(),s=!0,a.forEach(w=>w(v))}).catch(w=>{E==null||E(void 0,w)})};return i.persist={setOptions:x=>{o={...o,...x},x.storage&&(u=x.storage)},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>g(),hasHydrated:()=>s,onHydrate:x=>(l.add(x),()=>{l.delete(x)}),onFinishHydration:x=>(a.add(x),()=>{a.delete(x)})},o.skipHydration||g(),v||p},Vk=(t,e)=>"getStorage"in e||"serialize"in e||"deserialize"in e?((qk?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),Wk(t,e)):Gk(t,e),Kk=Vk;var Dr=(t=>(t[t.OK=200]="OK",t[t.CREATED=201]="CREATED",t[t.ACCEPTED=202]="ACCEPTED",t[t.NO_CONTENT=204]="NO_CONTENT",t[t.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",t[t.FOUND=302]="FOUND",t[t.SEE_OTHER=303]="SEE_OTHER",t[t.NOT_MODIFIED=304]="NOT_MODIFIED",t[t.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",t[t.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",t[t.BAD_REQUEST=400]="BAD_REQUEST",t[t.UNAUTHORIZED=401]="UNAUTHORIZED",t[t.FORBIDDEN=403]="FORBIDDEN",t[t.NOT_FOUND=404]="NOT_FOUND",t[t.PAYLOAD_TOO_LARGE=413]="PAYLOAD_TOO_LARGE",t[t.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",t[t.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",t[t.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",t[t.BAD_GATEWAY=502]="BAD_GATEWAY",t[t.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",t))(Dr||{});const xe=t=>`${t.package}:${t.publisher}`,cs=t=>{var e;return((e=t.metadata)==null?void 0:e.name)||xe(t)},sf=t=>{var e,r;return t.publisher==="sys"?"system":(e=t.state)!=null&&e.our_version&&!((r=t.state)!=null&&r.capsApproved)?"downloaded":t.metadata?"installed":"local"},or="/main:app_store:sys",Xl=(t,e)=>t.package===e.package&&t.publisher===e.publisher,Qo=Hk()(Kk((t,e)=>({myApps:{downloaded:[],installed:[],local:[],system:[]},listedApps:[],searchResults:[],query:"",getMyApps:async()=>{const i=(await(await fetch(`${or}/apps`)).json()).reduce((o,s)=>{const l=sf(s);return o[l].push(s),o},{downloaded:[],installed:[],local:[],system:[]});return t(()=>({myApps:i})),i},getListedApps:async()=>{const n=await(await fetch(`${or}/apps/listed`)).json();return t({listedApps:n}),n},getMyApp:async r=>{const i=await(await fetch(`${or}/apps/${xe(r)}`)).json(),o=sf(i),s=e().myApps;s[o]=s[o].map(a=>Xl(a,i)?i:a);const l=[...e().listedApps].map(a=>Xl(a,i)?i:a);return t({myApps:s,listedApps:l}),i},installApp:async r=>{if((await fetch(`${or}/apps/${xe(r)}/caps`,{method:"POST"})).status!==Dr.OK)throw new Error(`Failed to approve caps for app: ${xe(r)}`);if((await fetch(`${or}/apps/${xe(r)}`,{method:"POST"})).status!==Dr.CREATED)throw new Error(`Failed to install app: ${xe(r)}`)},updateApp:async r=>{if((await fetch(`${or}/apps/${xe(r)}`,{method:"PUT"})).status!==Dr.NO_CONTENT)throw new Error(`Failed to update app: ${xe(r)}`)},uninstallApp:async r=>{if(!confirm(`Are you sure you want to remove ${xe(r)}?`))return;if((await fetch(`${or}/apps/${xe(r)}`,{method:"DELETE"})).status!==Dr.NO_CONTENT)throw new Error(`Failed to remove app: ${xe(r)}`);const i={...e().myApps},o=sf(r);i[o]=i[o].filter(l=>!Xl(l,r));const s=e().listedApps.map(l=>Xl(l,r)?{...l,state:void 0,installed:!1}:l);t({myApps:i,listedApps:s})},getListedApp:async r=>{const n=await fetch(`${or}/apps/listed/${r}`);if(n.status!==Dr.OK)throw new Error(`Failed to get app: ${r}`);return await n.json()},downloadApp:async r=>{if((await fetch(`${or}/apps/listed/${xe(r)}`,{method:"POST"})).status!==Dr.CREATED)throw new Error(`Failed to get app: ${xe(r)}`)},getCaps:async r=>{const n=await fetch(`${or}/apps/${xe(r)}/caps`);if(n.status!==Dr.OK)throw new Error(`Failed to get app: ${xe(r)}`);return(await n.json())[0]},approveCaps:async r=>{if((await fetch(`${or}/apps/${xe(r)}/caps`,{method:"POST"})).status!==Dr.OK)throw new Error(`Failed to get app: ${xe(r)}`)},setMirroring:async(r,n)=>{if((await fetch(`${or}/apps/${xe(r)}/mirror`,{method:n?"PUT":"DELETE"})).status!==Dr.OK)throw new Error(`Failed to start mirror: ${xe(r)}`);e().getMyApp(r)},setAutoUpdate:async(r,n)=>{if((await fetch(`${or}/apps/${xe(r)}/auto-update`,{method:n?"PUT":"DELETE"})).status!==Dr.OK)throw new Error(`Failed to change auto update: ${xe(r)}`);e().getMyApp(r)},get:e,set:t}),{name:"app_store",storage:H1(()=>sessionStorage)}));function q1({app:t,size:e="medium",...r}){var i,o;const n=Iu();return I.jsxs("div",{...r,className:`app-header row ${e} ${r.className||""}`,onClick:()=>n(`/app-details/${xe(t)}`),children:[I.jsx("img",{src:((i=t.metadata)==null?void 0:i.image)||"https://png.pngtree.com/png-vector/20190215/ourmid/pngtree-vector-question-mark-icon-png-image_515448.jpg",alt:"app icon"}),I.jsx("div",{className:"col title",children:I.jsx("div",{className:"app-name ellipsis",children:((o=t.metadata)==null?void 0:o.name)||xe(t)})})]})}const Qk=({show:t,hide:e,hideClose:r=!1,title:n,...i})=>{const o=s=>{s.stopPropagation()};return t?I.jsx("div",{className:`modal-backdrop ${t?"show":""}`,onClick:e,children:I.jsxs("div",{...i,className:`col modal ${i.className||""}`,onClick:o,children:[!!n&&I.jsx("h3",{className:"modal-title",children:n}),!r&&I.jsx(Lk,{className:"close",onClick:e}),I.jsx("div",{className:"col modal-content",onClick:o,children:i.children})]})}):null};function Ed({msg:t}){return I.jsxs("div",{id:"loading",className:"col center",children:[I.jsx("h3",{children:t}),I.jsxs("div",{id:"loader",children:[" ",I.jsx("div",{})," ",I.jsx("div",{})," ",I.jsx("div",{})," ",I.jsx("div",{})," "]})]})}function W1({app:t,...e}){var H,ie,V,Y;const{updateApp:r,downloadApp:n,installApp:i,getCaps:o,getMyApp:s}=Qo(),[l,a]=L.useState(!1),[u,c]=L.useState(((ie=(H=t.metadata)==null?void 0:H.properties.mirrors)==null?void 0:ie[0])||""),[d,p]=L.useState([]),[v,g]=L.useState(""),{clean:x,installed:S,downloaded:E,updatable:w,verified:_}=L.useMemo(()=>{var N,b,M,R,k,h;const K=((N=t.metadata)==null?void 0:N.properties.current_version)&&((M=t.metadata)==null?void 0:M.properties.code_hashes[(b=t.metadata)==null?void 0:b.properties.current_version]),C=t.installed,f=!!t.state,m=(R=t.state)==null?void 0:R.verified,A=!!((k=t.state)!=null&&k.our_version&&K)&&((h=t.state)==null?void 0:h.our_version)!==K&&t.publisher!==window.our.node;return{clean:!C&&!f&&!A,installed:C,downloaded:f,updatable:A,verified:m}},[t]),O=L.useCallback(async()=>{S&&!w?window.alert("App is installed"):(E&&o(t).then(K=>{p(K.request_capabilities)}),a(!0))},[t,S,E,w,a,o]),B=L.useCallback(async()=>{try{g(`Downloading ${cs(t)}...`),await n(t);const K=setInterval(()=>{s(t).then(()=>{g(""),a(!1),clearInterval(K)}).catch(console.log)},2e3)}catch(K){console.error(K),window.alert(`Failed to download app from ${u}, please try a different mirror.`),g("")}},[u,t,n,s]),j=L.useCallback(async()=>{try{g(`Installing ${cs(t)}...`),await i(t);const K=setInterval(()=>{s(t).then(C=>{C.installed&&(g(""),a(!1),clearInterval(K))}).catch(console.log)},2e3)}catch(K){console.error(K),window.alert("Failed to install, please try again."),g("")}},[t,i,s]),$=L.useCallback(async()=>{try{g(`Updating ${cs(t)}...`),await r(t);const K=setInterval(()=>{s(t).then(C=>{C.installed&&(g(""),a(!1),clearInterval(K))}).catch(console.log)},2e3)}catch(K){console.error(K),window.alert("Failed to update, please try again."),g("")}},[t,r,s]);return I.jsxs(I.Fragment,{children:[I.jsx("button",{...e,type:"button",className:`unstyled action-btn ${e.className||""}`,onClick:O,children:S&&w?"Update":S?"Installed":E&&_?"Install":E&&!_?"Install (warning: unverified code hash!)":"Download"}),I.jsx(Qk,{show:l,hide:()=>a(!1),children:v?I.jsx(Ed,{msg:v}):x?I.jsxs(I.Fragment,{children:[I.jsxs("h3",{children:["Download ",(V=t.metadata)==null?void 0:V.name,"?"]}),I.jsx("h4",{style:{margin:0},children:"Select Mirror"}),I.jsx("select",{style:{margin:"1em 0"},value:u,onChange:K=>c(K.target.value),children:(Y=t.metadata)==null?void 0:Y.properties.mirrors.map(K=>I.jsx("option",{value:K,children:K},K))}),I.jsx("button",{type:"button",onClick:B,children:"Download"})]}):E?I.jsxs(I.Fragment,{children:[I.jsx("h3",{children:"Approve App Permissions"}),I.jsxs("h4",{style:{margin:0},children:[cs(t)," needs the following permissions:"]}),I.jsx("ul",{className:"col",style:{margin:"1em 0",alignItems:"flex-start"},children:d.map(K=>I.jsx("li",{children:K},K))}),I.jsx("button",{type:"button",onClick:j,children:"Approve & Install"})]}):I.jsxs(I.Fragment,{children:[I.jsx("h3",{children:"Approve App Permissions"}),I.jsxs("h4",{style:{margin:0},children:[cs(t)," needs the following permissions:"]}),I.jsx("br",{}),I.jsx("ul",{className:"col",style:{margin:"1em 0",alignItems:"flex-start"},children:d.map(K=>I.jsx("li",{children:K},K))}),I.jsx("button",{type:"button",onClick:$,children:"Approve & Update"})]})})]})}const G1=t=>!!t&&t[0]==="o",bm=Qs.unstable_batchedUpdates||(t=>t()),Vi=(t,e,r=1e-4)=>Math.abs(t-e)t===!0||!!(t&&t[e]),hr=(t,e)=>typeof t=="function"?t(e):t,V1="_szhsinMenu",Jk=t=>t[V1],Yk=(t,e)=>Object.defineProperty(e,V1,{value:t}),Ku=(t,e)=>(e&&Object.keys(e).forEach(r=>{const n=t[r],i=e[r];typeof i=="function"&&n?t[r]=(...o)=>{i(...o),n(...o)}:t[r]=i}),t),Xk=t=>{if(typeof t!="string")return{top:0,right:0,bottom:0,left:0};const e=t.trim().split(/\s+/,4).map(parseFloat),r=isNaN(e[0])?0:e[0],n=isNaN(e[1])?r:e[1];return{top:r,right:n,bottom:isNaN(e[2])?r:e[2],left:isNaN(e[3])?n:e[3]}},lf=t=>{for(;t;){if(t=t.parentNode,!t||t===document.body||!t.parentNode)return;const{overflow:e,overflowX:r,overflowY:n}=getComputedStyle(t);if(/auto|scroll|overlay|hidden/.test(e+n+r))return t}};function K1(t,e){return{"aria-disabled":t||void 0,tabIndex:e?0:-1}}function _m(t,e){for(let r=0;rL.useMemo(()=>{const i=e?`${t}__${e}`:t;let o=i;r&&Object.keys(r).forEach(l=>{const a=r[l];a&&(o+=` ${i}--${a===!0?l:`${l}-${a}`}`)});let s=typeof n=="function"?n(r):n;return typeof s=="string"&&(s=s.trim(),s&&(o+=` ${s}`)),o},[t,e,r,n]),Zk="szh-menu-container",Aa="szh-menu",e4="szh-menu-button",t4="arrow",r4="item",Q1=L.createContext(),J1=L.createContext({}),Sm=L.createContext({}),Y1=L.createContext({}),n4=L.createContext({}),jh=L.createContext({}),$r=Object.freeze({ENTER:"Enter",ESC:"Escape",SPACE:" ",HOME:"Home",END:"End",LEFT:"ArrowLeft",RIGHT:"ArrowRight",UP:"ArrowUp",DOWN:"ArrowDown"}),xt=Object.freeze({RESET:0,SET:1,UNSET:2,INCREASE:3,DECREASE:4,FIRST:5,LAST:6,SET_INDEX:7}),ul=Object.freeze({CLICK:"click",CANCEL:"cancel",BLUR:"blur",SCROLL:"scroll"}),Ms=Object.freeze({FIRST:"first",LAST:"last"}),i4=Object.freeze({entering:"opening",entered:"open",exiting:"closing",exited:"closed"}),af="absolute",o4="presentation",X1="menuitem",km={"aria-hidden":!0,role:X1},s4=Yk("MenuButton",L.forwardRef(function({className:e,isOpen:r,disabled:n,children:i,...o},s){const l=L.useMemo(()=>({open:r}),[r]);return I.jsx("button",{"aria-haspopup":!0,"aria-expanded":r,"aria-disabled":n||void 0,type:"button",disabled:n,...o,ref:s,className:al({block:e4,modifiers:l,className:e}),children:i})})),l4=({className:t,containerRef:e,containerProps:r,children:n,isOpen:i,theming:o,transition:s,onClose:l})=>{const a=ll(s,"item"),u=({key:d})=>{switch(d){case $r.ESC:hr(l,{key:d,reason:ul.CANCEL});break}},c=d=>{i&&!d.currentTarget.contains(d.relatedTarget)&&hr(l,{reason:ul.BLUR})};return I.jsx("div",{...Ku({onKeyDown:u,onBlur:c},r),className:al({block:Zk,modifiers:L.useMemo(()=>({theme:o,itemTransition:a}),[o,a]),className:t}),style:{position:"absolute",...r==null?void 0:r.style},ref:e,children:n})},a4=()=>{let t,e=0;return{toggle:r=>{r?e++:e--,e=Math.max(e,0)},on:(r,n,i)=>{e?t||(t=setTimeout(()=>{t=0,n()},r)):i==null||i()},off:()=>{t&&(clearTimeout(t),t=0)}}},u4=(t,e)=>{const[r,n]=L.useState(),o=L.useRef({items:[],hoverIndex:-1,sorted:!1}).current,s=L.useCallback((a,u)=>{const{items:c}=o;if(!a)o.items=[];else if(u)c.push(a);else{const d=c.indexOf(a);d>-1&&(c.splice(d,1),a.contains(document.activeElement)&&(e.current.focus(),n()))}o.hoverIndex=-1,o.sorted=!1},[o,e]),l=L.useCallback((a,u,c)=>{const{items:d,hoverIndex:p}=o,v=()=>{if(o.sorted)return;const S=t.current.querySelectorAll(".szh-menu__item");d.sort((E,w)=>_m(S,E)-_m(S,w)),o.sorted=!0};let g=-1,x;switch(a){case xt.RESET:break;case xt.SET:x=u;break;case xt.UNSET:x=S=>S===u?void 0:S;break;case xt.FIRST:v(),g=0,x=d[g];break;case xt.LAST:v(),g=d.length-1,x=d[g];break;case xt.SET_INDEX:v(),g=c,x=d[g];break;case xt.INCREASE:v(),g=p,g<0&&(g=d.indexOf(u)),g++,g>=d.length&&(g=0),x=d[g];break;case xt.DECREASE:v(),g=p,g<0&&(g=d.indexOf(u)),g--,g<0&&(g=d.length-1),x=d[g];break}x||(g=-1),n(x),o.hoverIndex=g},[t,o]);return{hoverItem:r,dispatch:l,updateItems:s}},c4=(t,e,r,n)=>{const i=e.current.getBoundingClientRect(),o=t.current.getBoundingClientRect(),s=r===window?{left:0,top:0,right:document.documentElement.clientWidth,bottom:window.innerHeight}:r.getBoundingClientRect(),l=Xk(n),a=g=>g+o.left-s.left-l.left,u=g=>g+o.left+i.width-s.right+l.right,c=g=>g+o.top-s.top-l.top,d=g=>g+o.top+i.height-s.bottom+l.bottom;return{menuRect:i,containerRect:o,getLeftOverflow:a,getRightOverflow:u,getTopOverflow:c,getBottomOverflow:d,confineHorizontally:g=>{let x=a(g);if(x<0)g-=x;else{const S=u(g);S>0&&(g-=S,x=a(g),x<0&&(g-=x))}return g},confineVertically:g=>{let x=c(g);if(x<0)g-=x;else{const S=d(g);S>0&&(g-=S,x=c(g),x<0&&(g-=x))}return g}}},f4=({arrowRef:t,menuY:e,anchorRect:r,containerRect:n,menuRect:i})=>{let o=r.top-n.top-e+r.height/2;const s=t.current.offsetHeight*1.25;return o=Math.max(s,o),o=Math.min(o,i.height-s),o},d4=({anchorRect:t,containerRect:e,menuRect:r,placeLeftorRightY:n,placeLeftX:i,placeRightX:o,getLeftOverflow:s,getRightOverflow:l,confineHorizontally:a,confineVertically:u,arrowRef:c,arrow:d,direction:p,position:v})=>{let g=p,x=n;v!=="initial"&&(x=u(x),v==="anchor"&&(x=Math.min(x,t.bottom-e.top),x=Math.max(x,t.top-e.top-r.height)));let S,E,w;return g==="left"?(S=i,v!=="initial"&&(E=s(S),E<0&&(w=l(o),(w<=0||-E>w)&&(S=o,g="right")))):(S=o,v!=="initial"&&(w=l(S),w>0&&(E=s(i),(E>=0||-E{let o=r.left-n.left-e+r.width/2;const s=t.current.offsetWidth*1.25;return o=Math.max(s,o),o=Math.min(o,i.width-s),o},p4=({anchorRect:t,containerRect:e,menuRect:r,placeToporBottomX:n,placeTopY:i,placeBottomY:o,getTopOverflow:s,getBottomOverflow:l,confineHorizontally:a,confineVertically:u,arrowRef:c,arrow:d,direction:p,position:v})=>{let g=p==="top"?"top":"bottom",x=n;v!=="initial"&&(x=a(x),v==="anchor"&&(x=Math.min(x,t.right-e.left),x=Math.max(x,t.left-e.left-r.width)));let S,E,w;return g==="top"?(S=i,v!=="initial"&&(E=s(S),E<0&&(w=l(o),(w<=0||-E>w)&&(S=o,g="bottom")))):(S=o,v!=="initial"&&(w=l(S),w>0&&(E=s(i),(E>=0||-E{const{menuRect:u,containerRect:c}=a,d=r==="left"||r==="right";let p=d?n:i,v=d?i:n;if(t){const B=l.current;d?p+=B.offsetWidth:v+=B.offsetHeight}const g=s.left-c.left-u.width-p,x=s.right-c.left+p,S=s.top-c.top-u.height-v,E=s.bottom-c.top+v;let w,_;e==="end"?(w=s.right-c.left-u.width,_=s.bottom-c.top-u.height):e==="center"?(w=s.left-c.left-(u.width-s.width)/2,_=s.top-c.top-(u.height-s.height)/2):(w=s.left-c.left,_=s.top-c.top),w+=p,_+=v;const O={...a,anchorRect:s,placeLeftX:g,placeRightX:x,placeLeftorRightY:_,placeTopY:S,placeBottomY:E,placeToporBottomX:w,arrowRef:l,arrow:t,direction:r,position:o};switch(r){case"left":case"right":return d4(O);case"top":case"bottom":default:return p4(O)}},ba=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?L.useLayoutEffect:L.useEffect;function Nm(t,e){typeof t=="function"?t(e):t.current=e}const Uh=(t,e)=>L.useMemo(()=>t?e?r=>{Nm(t,r),Nm(e,r)}:t:e,[t,e]),Pm=-9999,g4=({ariaLabel:t,menuClassName:e,menuStyle:r,arrow:n,arrowProps:i={},anchorPoint:o,anchorRef:s,containerRef:l,containerProps:a,focusProps:u,externalRef:c,parentScrollingRef:d,align:p="start",direction:v="bottom",position:g="auto",overflow:x="visible",setDownOverflow:S,repositionFlag:E,captureFocus:w=!0,state:_,endTransition:O,isDisabled:B,menuItemFocus:j,gap:$=0,shift:H=0,children:ie,onClose:V,...Y})=>{const[K,C]=L.useState({x:Pm,y:Pm}),[f,m]=L.useState({}),[A,N]=L.useState(),[b,M]=L.useState(v),[R]=L.useState(a4),[k,h]=L.useReducer(ne=>ne+1,1),{transition:P,boundingBoxRef:te,boundingBoxPadding:y,rootMenuRef:D,rootAnchorRef:U,scrollNodesRef:F,reposition:W,viewScroll:oe,submenuCloseDelay:X}=L.useContext(jh),{submenuCtx:Q,reposSubmenu:Je=E}=L.useContext(Sm),J=L.useRef(null),le=L.useRef(),Qr=L.useRef(),Te=L.useRef(!1),Ne=L.useRef({width:0,height:0}),Jr=L.useRef(()=>{}),{hoverItem:Pe,dispatch:ce,updateItems:wr}=u4(J,le),fe=G1(_),Oe=ll(P,"open"),Yr=ll(P,"close"),me=F.current,ze=ne=>{switch(ne.key){case $r.HOME:ce(xt.FIRST);break;case $r.END:ce(xt.LAST);break;case $r.UP:ce(xt.DECREASE,Pe);break;case $r.DOWN:ce(xt.INCREASE,Pe);break;case $r.SPACE:ne.target&&ne.target.className.indexOf(Aa)!==-1&&ne.preventDefault();return;default:return}ne.preventDefault(),ne.stopPropagation()},gn=()=>{_==="closing"&&N(),hr(O)},$e=ne=>{ne.stopPropagation(),R.on(X,()=>{ce(xt.RESET),le.current.focus()})},He=ne=>{ne.target===ne.currentTarget&&R.off()},Ht=L.useCallback(ne=>{var ot;const ge=s?(ot=s.current)==null?void 0:ot.getBoundingClientRect():o?{left:o.x,right:o.x,top:o.y,bottom:o.y,width:0,height:0}:null;if(!ge)return;me.menu||(me.menu=(te?te.current:lf(D.current))||window);const de=c4(l,J,me.menu,y);let{arrowX:rt,arrowY:be,x:_e,y:Ct,computedDirection:Me}=m4({arrow:n,align:p,direction:v,gap:$,shift:H,position:g,anchorRect:ge,arrowRef:Qr,positionHelpers:de});const{menuRect:je}=de;let Kt=je.height;if(!ne&&x!=="visible"){const{getTopOverflow:Ve,getBottomOverflow:Ke}=de;let Qt,Ie;const Ue=Ne.current.height,Er=Ke(Ct);if(Er>0||Vi(Er,0)&&Vi(Kt,Ue))Qt=Kt-Er,Ie=Er;else{const ke=Ve(Ct);(ke<0||Vi(ke,0)&&Vi(Kt,Ue))&&(Qt=Kt+ke,Ie=0-ke,Qt>=0&&(Ct-=ke))}Qt>=0?(Kt=Qt,N({height:Qt,overflowAmt:Ie})):N()}n&&m({x:rt,y:be}),C({x:_e,y:Ct}),M(Me),Ne.current={width:je.width,height:Kt}},[n,p,y,v,$,H,g,x,o,s,l,te,D,me]);ba(()=>{fe&&(Ht(),Te.current&&h()),Te.current=fe,Jr.current=Ht},[fe,Ht,Je]),ba(()=>{A&&!S&&(J.current.scrollTop=0)},[A,S]),ba(()=>wr,[wr]),L.useEffect(()=>{let{menu:ne}=me;if(!fe||!ne)return;if(ne=ne.addEventListener?ne:window,!me.anchors){me.anchors=[];let rt=lf(U&&U.current);for(;rt&&rt!==ne;)me.anchors.push(rt),rt=lf(rt)}let ot=oe;if(me.anchors.length&&ot==="initial"&&(ot="auto"),ot==="initial")return;const ge=()=>{ot==="auto"?bm(()=>Ht(!0)):hr(V,{reason:ul.SCROLL})},de=me.anchors.concat(oe!=="initial"?ne:[]);return de.forEach(rt=>rt.addEventListener("scroll",ge)),()=>de.forEach(rt=>rt.removeEventListener("scroll",ge))},[U,me,fe,V,oe,Ht]);const Le=!!A&&A.overflowAmt>0;L.useEffect(()=>{if(Le||!fe||!d)return;const ne=()=>bm(Ht),ot=d.current;return ot.addEventListener("scroll",ne),()=>ot.removeEventListener("scroll",ne)},[fe,Le,d,Ht]),L.useEffect(()=>{if(typeof ResizeObserver!="function"||W==="initial")return;const ne=new ResizeObserver(([ge])=>{const{borderBoxSize:de,target:rt}=ge;let be,_e;if(de){const{inlineSize:Ct,blockSize:Me}=de[0]||de;be=Ct,_e=Me}else{const Ct=rt.getBoundingClientRect();be=Ct.width,_e=Ct.height}be===0||_e===0||Vi(be,Ne.current.width,1)&&Vi(_e,Ne.current.height,1)||Qs.flushSync(()=>{Jr.current(),h()})}),ot=J.current;return ne.observe(ot,{box:"border-box"}),()=>ne.unobserve(ot)},[W]),L.useEffect(()=>{if(!fe){ce(xt.RESET),Yr||N();return}const{position:ne,alwaysUpdate:ot}=j||{},ge=()=>{ne===Ms.FIRST?ce(xt.FIRST):ne===Ms.LAST?ce(xt.LAST):ne>=-1&&ce(xt.SET_INDEX,void 0,ne)};if(ot)ge();else if(w){const de=setTimeout(()=>{const rt=J.current;rt&&!rt.contains(document.activeElement)&&(le.current.focus(),ge())},Oe?170:100);return()=>clearTimeout(de)}},[fe,Oe,Yr,w,j,ce]);const qe=L.useMemo(()=>({isParentOpen:fe,submenuCtx:R,dispatch:ce,updateItems:wr}),[fe,R,ce,wr]);let Rr,Ce;A&&(S?Ce=A.overflowAmt:Rr=A.height);const We=L.useMemo(()=>({reposSubmenu:k,submenuCtx:R,overflow:x,overflowAmt:Ce,parentMenuRef:J,parentDir:b}),[k,R,x,Ce,b]),vn=Rr>=0?{maxHeight:Rr,overflow:x}:void 0,Be=L.useMemo(()=>({state:_,dir:b}),[_,b]),Ge=L.useMemo(()=>({dir:b}),[b]),yn=al({block:Aa,element:t4,modifiers:Ge,className:i.className}),De=I.jsxs("ul",{role:"menu","aria-label":t,...K1(B),...Ku({onPointerEnter:Q==null?void 0:Q.off,onPointerMove:$e,onPointerLeave:He,onKeyDown:ze,onAnimationEnd:gn},Y),ref:Uh(c,J),className:al({block:Aa,modifiers:Be,className:e}),style:{...r,...vn,margin:0,display:_==="closed"?"none":void 0,position:af,left:K.x,top:K.y},children:[I.jsx("li",{tabIndex:-1,style:{position:af,left:0,top:0,display:"block",outline:"none"},ref:le,...km,...u}),n&&I.jsx("li",{...km,...i,className:yn,style:{display:"block",position:af,left:f.x,top:f.y,...i.style},ref:Qr}),I.jsx(Sm.Provider,{value:We,children:I.jsx(J1.Provider,{value:qe,children:I.jsx(Q1.Provider,{value:Pe,children:hr(ie,Be)})})})]});return a?I.jsx(l4,{...a,isOpen:fe,children:De}):De},v4=L.forwardRef(function({"aria-label":e,className:r,containerProps:n,initialMounted:i,unmountOnClose:o,transition:s,transitionTimeout:l,boundingBoxRef:a,boundingBoxPadding:u,reposition:c="auto",submenuOpenDelay:d=300,submenuCloseDelay:p=150,viewScroll:v="initial",portal:g,theming:x,onItemClick:S,...E},w){const _=L.useRef(null),O=L.useRef({}),{anchorRef:B,state:j,onClose:$}=E,H=L.useMemo(()=>({initialMounted:i,unmountOnClose:o,transition:s,transitionTimeout:l,boundingBoxRef:a,boundingBoxPadding:u,rootMenuRef:_,rootAnchorRef:B,scrollNodesRef:O,reposition:c,viewScroll:v,submenuOpenDelay:d,submenuCloseDelay:p}),[i,o,s,l,B,a,u,c,v,d,p]),ie=L.useMemo(()=>({handleClick(Y,K){Y.stopPropagation||hr(S,Y);let C=Y.keepOpen;C===void 0&&(C=K&&Y.key===$r.SPACE),C||hr($,{value:Y.value,key:Y.key,reason:ul.CLICK})},handleClose(Y){hr($,{key:Y,reason:ul.CLICK})}}),[S,$]);if(!j)return null;const V=I.jsx(jh.Provider,{value:H,children:I.jsx(Y1.Provider,{value:ie,children:I.jsx(g4,{...E,ariaLabel:e||"Menu",externalRef:w,containerRef:_,containerProps:{className:r,containerRef:_,containerProps:n,theming:x,transition:s,onClose:$}})})});return g===!0&&typeof document<"u"?Qs.createPortal(V,document.body):g?g.target?Qs.createPortal(V,g.target):g.stablePosition?null:V:V}),xd=0,Ad=1,au=2,uu=3,cu=4,y4=5,Z1=6,w4=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],ew=t=>({_s:t,status:w4[t],isEnter:tcu}),bd=t=>t?Z1:y4,E4=(t,e)=>{switch(t){case Ad:case xd:return au;case cu:case uu:return bd(e)}},x4=t=>typeof t=="object"?[t.enter,t.exit]:[t,t],A4=(t,e)=>setTimeout(()=>{isNaN(document.body.offsetTop)||t(e+1)},0),Cm=(t,e,r,n,i)=>{clearTimeout(n.current);const o=ew(t);e(o),r.current=o,i&&i({current:o})},b4=({enter:t=!0,exit:e=!0,preEnter:r,preExit:n,timeout:i,initialEntered:o,mountOnEnter:s,unmountOnExit:l,onStateChange:a}={})=>{const[u,c]=L.useState(()=>ew(o?au:bd(s))),d=L.useRef(u),p=L.useRef(),[v,g]=x4(i),x=L.useCallback(()=>{const E=E4(d.current._s,l);E&&Cm(E,c,d,p,a)},[a,l]),S=L.useCallback(E=>{const w=O=>{switch(Cm(O,c,d,p,a),O){case Ad:v>=0&&(p.current=setTimeout(x,v));break;case cu:g>=0&&(p.current=setTimeout(x,g));break;case xd:case uu:p.current=A4(w,O);break}},_=d.current.isEnter;typeof E!="boolean"&&(E=!_),E?!_&&w(t?r?xd:Ad:au):_&&w(e?n?uu:cu:bd(l))},[x,a,t,e,r,n,v,g,l]);return L.useEffect(()=>()=>clearTimeout(p.current),[]),[u,S,x]},_4=({initialOpen:t,initialMounted:e,unmountOnClose:r,transition:n,transitionTimeout:i=500}={})=>{const[{status:o},s,l]=b4({initialEntered:t,mountOnEnter:!e,unmountOnExit:r,timeout:i,enter:ll(n,"open"),exit:ll(n,"close")});return[{state:i4[o],endTransition:l},s]},S4=t=>{const[e,r]=_4(t),[n,i]=L.useState(),o=(s,l)=>{i({position:s,alwaysUpdate:l}),r(!0)};return[{menuItemFocus:n,...e},r,o]},k4=(t,e)=>{const[r]=L.useState({});return{onMouseDown:()=>{r.v=t&&t!=="closed"},onClick:n=>r.v?r.v=!1:e(!0,n)}},N4=(t,e)=>{const r=L.useRef(e);L.useEffect(()=>{r.current!==e&&hr(t,{open:e}),r.current=e},[t,e])},P4=L.forwardRef(function({"aria-label":e,captureFocus:r,initialOpen:n,menuButton:i,instanceRef:o,onMenuChange:s,...l},a){const[u,c,d]=S4(l),{state:p}=u,v=G1(p),g=L.useRef(null),x=k4(p,(B,j)=>d(j.detail?void 0:Ms.FIRST)),S=L.useCallback(B=>{c(!1),B.key&&g.current.focus()},[c]),E=B=>{switch(B.key){case $r.UP:d(Ms.LAST);break;case $r.DOWN:d(Ms.FIRST);break;default:return}B.preventDefault()},w=hr(i,{open:v});if(!w||!w.type)throw new Error("Menu requires a menuButton prop.");const _={ref:Uh(w.ref,g),...Ku({onKeyDown:E,...x},w.props)};Jk(w.type)==="MenuButton"&&(_.isOpen=v);const O=L.cloneElement(w,_);return N4(s,v),L.useImperativeHandle(o,()=>({openMenu:d,closeMenu:()=>c(!1)})),I.jsxs(L.Fragment,{children:[O,I.jsx(v4,{...l,...u,"aria-label":e||(typeof w.props.children=="string"?w.props.children:"Menu"),anchorRef:g,ref:a,onClose:S})]})}),C4=(t,e)=>{const r=L.memo(e),n=L.forwardRef((i,o)=>{const s=L.useRef(null);return I.jsx(r,{...i,itemRef:s,externalRef:o,isHovering:L.useContext(Q1)===s.current})});return n.displayName=`WithHovering(${t})`,n},M4=(t,e,r)=>{ba(()=>{if(t)return;const n=e.current;return r(n,!0),()=>{r(n)}},[t,e,r])},I4=(t,e,r,n)=>{const{submenuCloseDelay:i}=L.useContext(jh),{isParentOpen:o,submenuCtx:s,dispatch:l,updateItems:a}=L.useContext(J1),u=()=>{!r&&!n&&l(xt.SET,t.current)},c=()=>{!n&&l(xt.UNSET,t.current)},d=g=>{r&&!g.currentTarget.contains(g.relatedTarget)&&c()},p=g=>{n||(g.stopPropagation(),s.on(i,u,u))},v=(g,x)=>{s.off(),!x&&c()};return M4(n,t,a),L.useEffect(()=>{r&&o&&e.current&&e.current.focus()},[e,r,o]),{setHover:u,onBlur:d,onPointerMove:p,onPointerLeave:v}},Ki=C4("MenuItem",function({className:e,value:r,href:n,type:i,checked:o,disabled:s,children:l,onClick:a,isHovering:u,itemRef:c,externalRef:d,...p}){const v=!!s,{setHover:g,...x}=I4(c,c,u,v),S=L.useContext(Y1),E=L.useContext(n4),w=i==="radio",_=i==="checkbox",O=!!n&&!v&&!w&&!_,B=w?E.value===r:_?!!o:!1,j=Y=>{if(v){Y.stopPropagation(),Y.preventDefault();return}const K={value:r,syntheticEvent:Y};Y.key!==void 0&&(K.key=Y.key),_&&(K.checked=!B),w&&(K.name=E.name),hr(a,K),w&&hr(E.onRadioChange,K),S.handleClick(K,_||w)},$=Y=>{if(u)switch(Y.key){case $r.ENTER:Y.preventDefault();case $r.SPACE:O?c.current.click():j(Y)}},H=L.useMemo(()=>({type:i,disabled:v,hover:u,checked:B,anchor:O}),[i,v,u,B,O]),ie=Ku({...x,onPointerDown:g,onKeyDown:$,onClick:j},p),V={role:w?"menuitemradio":_?"menuitemcheckbox":X1,"aria-checked":w||_?B:void 0,...K1(v,u),...ie,ref:Uh(d,c),className:al({block:Aa,element:r4,modifiers:H,className:e}),children:L.useMemo(()=>hr(l,H),[l,H])};return O?I.jsx("li",{role:o4,children:I.jsx("a",{href:n,...V})}):I.jsx("li",{...V})});function Mm({...t}){return I.jsx(P4,{...t,className:"dropdown "+t.className,menuButton:I.jsx(s4,{className:"unstyled",children:I.jsx(Ok,{style:{marginBottom:"-0.125em"}})}),children:t.children})}function R4({app:t}){var s,l,a,u,c;const{uninstallApp:e,setMirroring:r,setAutoUpdate:n}=Qo(),i=Iu();return!t.state?t.metadata?I.jsxs(Mm,{children:[((s=t.metadata)==null?void 0:s.description)&&I.jsx(Ki,{className:"action-entry",onClick:()=>i(`/app-details/${xe(t)}`),children:"View Details"}),((l=t.metadata)==null?void 0:l.external_url)&&I.jsx(Ki,{children:I.jsx("a",{style:{color:"inherit",whiteSpace:"nowrap",cursor:"pointer",marginTop:"0.25em"},target:"_blank",href:(a=t.metadata)==null?void 0:a.external_url,children:"View Site"})})]}):I.jsx("div",{style:{width:24}}):I.jsxs(Mm,{children:[I.jsx(Ki,{className:"action-entry",onClick:()=>i(`/app-details/${xe(t)}`),children:"View Details"}),t.installed&&I.jsxs(I.Fragment,{children:[I.jsx(Ki,{className:"action-entry",onClick:()=>e(t),children:"Uninstall"}),I.jsxs(Ki,{className:"action-entry",onClick:()=>{var d;return r(t,!((d=t.state)!=null&&d.mirroring))},children:[(u=t.state)!=null&&u.mirroring?"Stop":"Start"," Mirroring"]}),I.jsxs(Ki,{className:"action-entry",onClick:()=>{var d;return n(t,!((d=t.state)!=null&&d.auto_update))},children:[(c=t.state)!=null&&c.auto_update?"Disable":"Enable"," Auto Update"]})]})]})}function ys({app:t,...e}){var r;return L.createElement("div",{...e,key:xe(t),className:"app-entry row between"},I.jsx(q1,{app:t,size:"small"}),I.jsxs("div",{className:"app-actions row",children:[!((r=t.state)!=null&&r.capsApproved)&&I.jsx(W1,{app:t,style:{marginRight:"1em"}}),I.jsx(R4,{app:t})]}))}const _d="/my-apps";function Qu({value:t="",onChange:e=()=>null,hideSearch:r=!1}){const n=Iu(),i=xh(),o=qr.useRef(null),s=i.key!=="default",l=i.pathname===_d;return I.jsxs("div",{className:"search-header row between",children:[i.pathname!=="/"?I.jsx("button",{className:"back-btn col center",onClick:()=>n(s?-1:"/"),children:I.jsx(Mk,{})}):I.jsx("button",{className:"back-btn col center",onClick:()=>n("/publish"),children:I.jsx(z1,{})}),!r&&I.jsxs("div",{className:"searchbar row",children:[I.jsx(Bk,{className:"search-icon",onClick:()=>{var a;return(a=o.current)==null?void 0:a.focus()}}),I.jsx("input",{ref:o,onChange:a=>e(a.target.value),value:t,placeholder:"Search for apps..."}),t.length>0&&I.jsx(Dk,{className:"search-icon",style:{margin:"0 -0.25em 0 0.25em"},onClick:()=>e("")})]}),I.jsx("div",{className:"row",children:I.jsxs("button",{className:`my-pkg-btn row ${l?"selected":""}`,onClick:()=>n(l?-1:_d),children:[I.jsx(Tk,{style:{marginRight:"0.5em"}}),"My Packages"]})})]})}function T4(t){const{listedApps:e,getListedApps:r}=Qo(),[n,i]=L.useState("Recently published"),[o,s]=L.useState(""),[l,a]=L.useState(e),[u,c]=L.useState(1),d=L.useMemo(()=>Array.from({length:Math.ceil(l.length/10)},(g,x)=>x+1),[l]);L.useEffect(()=>{const g=(u-1)*10,x=g+10;a(e.slice(g,x))},[e]),L.useEffect(()=>{r().then(g=>{a(Object.values(g))}).catch(g=>console.error(g))},[]);const p=L.useCallback(async g=>{},[]),v=L.useCallback(g=>{s(g);const x=e.filter(S=>{var E,w,_,O;return S.package.toLowerCase().includes(g.toLowerCase())||((w=(E=S.metadata)==null?void 0:E.description)==null?void 0:w.toLowerCase().includes(g.toLowerCase()))||((O=(_=S.metadata)==null?void 0:_.description)==null?void 0:O.toLowerCase().includes(g.toLowerCase()))},[e]);a(x)},[e]);return I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{value:o,onChange:v}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"New"}),I.jsxs("select",{value:n,onChange:g=>{i(g.target.value),p(g.target.value)},style:{marginBottom:"-1em"},children:[I.jsx("option",{children:"Recently published"}),I.jsx("option",{children:"Most popular"}),I.jsx("option",{children:"Best rating"}),I.jsx("option",{children:"Recently updated"})]})]}),I.jsxs("div",{className:"new card col",style:{flex:1,overflowY:"scroll"},children:[l.map(g=>{var x;return I.jsx(ys,{app:g},xe(g)+(((x=g.state)==null?void 0:x.our_version)||""))}),d.length>1&&I.jsxs("div",{className:"row",style:{alignSelf:"center"},children:[u!==d[0]&&I.jsx(Ik,{onClick:()=>c(u-1)}),d.map(g=>I.jsx("div",{className:`page-selector ${g===u?"selected":""}`,onClick:()=>c(g),children:g},`page-${g}`)),u!==d[d.length-1]&&I.jsx(Rk,{onClick:()=>c(u+1)})]})]})]})}function O4(t){const{myApps:e,getMyApps:r}=Qo(),n=Iu(),[i,o]=L.useState(""),[s,l]=L.useState(e);L.useEffect(()=>{r().then(l).catch(u=>console.error(u))},[]);const a=L.useCallback(u=>{o(u);const c=Object.keys(e).reduce((d,p)=>(d[p]=e[p].filter(v=>{var g,x,S,E;return v.package.toLowerCase().includes(u.toLowerCase())||((x=(g=v.metadata)==null?void 0:g.description)==null?void 0:x.toLowerCase().includes(u.toLowerCase()))||((E=(S=v.metadata)==null?void 0:S.description)==null?void 0:E.toLowerCase().includes(u.toLowerCase()))}),d),{downloaded:[],installed:[],local:[],system:[]});l(c)},[e]);return I.jsxs("div",{style:{width:"100%",height:"100%"},children:[I.jsx(Qu,{value:i,onChange:a}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"My Packages"}),I.jsxs("button",{className:"row",onClick:()=>n("/publish"),children:[I.jsx(z1,{style:{marginRight:"0.5em"}}),"Publish Package"]})]}),I.jsx("div",{className:"my-apps-list",children:I.jsxs("div",{className:"new card col",children:[I.jsx("h3",{children:"Downloaded"}),(s.downloaded||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"Installed"}),(s.installed||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"Local"}),(s.local||[]).map(u=>I.jsx(ys,{app:u},xe(u))),I.jsx("h3",{children:"System"}),(s.system||[]).map(u=>I.jsx(ys,{app:u},xe(u)))]})})]})}function L4(t){var u,c,d,p,v,g,x;const{myApps:e,listedApps:r,getListedApp:n}=Qo(),i=lx(),[o,s]=L.useState(void 0);L.useEffect(()=>{const S=e.local.find(E=>xe(E)===i.id);if(S)return s(S);if(i.id){const E=r.find(w=>xe(w)===i.id);E?s(E):n(i.id).then(w=>s(w)).catch(console.error)}},[i.id]);const l=L.useMemo(()=>{var S;return((S=o==null?void 0:o.metadata)==null?void 0:S.properties.current_version)||"Unknown"},[o]),a=((u=o==null?void 0:o.state)==null?void 0:u.our_version)||((p=(c=o==null?void 0:o.metadata)==null?void 0:c.properties.code_hashes)==null?void 0:p[(d=o==null?void 0:o.metadata)==null?void 0:d.properties.current_version])||"";return I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{value:"",onChange:()=>null,hideSearch:!0}),I.jsx("div",{className:"card",style:{marginTop:"1em"},children:o?I.jsxs(I.Fragment,{children:[I.jsxs("div",{className:"row between",children:[I.jsx(q1,{app:o,size:"large"}),I.jsx(W1,{app:o,style:{marginRight:"0.5em"}})]}),I.jsxs("div",{className:"col",style:{marginTop:"1em"},children:[I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Description"}),I.jsx("div",{className:"value",children:(((v=o.metadata)==null?void 0:v.description)||"No description given").slice(0,2e3)})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Publisher"}),I.jsx("div",{className:"value underline",children:o.publisher})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Version"}),I.jsx("div",{className:"value",children:l})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Mirrors"}),I.jsx("div",{className:"col",children:(((g=o.metadata)==null?void 0:g.properties.mirrors)||[]).map((S,E)=>I.jsx("div",{className:"value underline",children:S},E+S))})]}),I.jsxs("div",{className:"app-details row",children:[I.jsx("div",{className:"title",children:"Hash"}),I.jsx("div",{className:"value",style:{wordBreak:"break-all"},children:a})]})]}),I.jsx("div",{className:"app-screenshots row",children:(((x=o.metadata)==null?void 0:x.properties.screenshots)||[]).map((S,E)=>I.jsx("img",{src:S},E+S))})]}):I.jsxs(I.Fragment,{children:[I.jsx("h3",{children:"App details not found for "}),I.jsx("h3",{children:i.id})]})})]})}var _a=(t=>(t[t.SEPOLIA=11155111]="SEPOLIA",t[t.OPTIMISM=10]="OPTIMISM",t[t.OPTIMISM_GOERLI=420]="OPTIMISM_GOERLI",t[t.LOCAL=1337]="LOCAL",t))(_a||{});const fu="0xaa36a7",Im="0xa",Rm={11155111:"0x18c39eB547A0060C6034f8bEaFB947D1C16eADF1"},B4="4902",Tm={[fu]:{chainId:fu,chainName:"Sepolia",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:["https://rpc.sepolia.org"],blockExplorerUrls:["https://sepolia.etherscan.io"]},[Im]:{chainId:Im,chainName:"Optimism",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:["https://mainnet.optimism.io"],blockExplorerUrls:["https://optimistic.etherscan.io"]}},D4=t=>{switch(t){case"1":case"0x1":return"Ethereum";case"10":case"a":case"0xa":return"Optimism";case"42161":return"Arbitrum";case"11155111":case"aa36a7":case"0xaa36a7":return"Sepolia";default:return"Unknown"}},Om=async t=>{var r,n,i;let e=await((r=window.ethereum)==null?void 0:r.request({method:"net_version"}).catch(()=>"1"));if(e="0x"+(typeof e=="string"?e.replace(/^0x/,""):e.toString(16)),!Tm[t]){console.error(`Invalid chain ID: ${t}`);return}if(t!==e)try{await((n=window.ethereum)==null?void 0:n.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]}))}catch(o){if(String(o).includes(B4))await((i=window.ethereum)==null?void 0:i.request({method:"wallet_addEthereumChain",params:[Tm[t]]}));else throw window.alert(`You must enable the ${D4(t)} network in your wallet.`),new Error(`User cancelled connection to ${t}`)}};var cl={},Ju={};Object.defineProperty(Ju,"__esModule",{value:!0});Ju.Connector=void 0;class j4{constructor(e,r){this.actions=e,this.onError=r}resetState(){this.actions.resetState()}}Ju.Connector=j4;var uf,Lm;function U4(){if(Lm)return uf;Lm=1;function t({mustBeMetaMask:e=!1,silent:r=!1,timeout:n=3e3}={}){o();let i=!1;return new Promise(s=>{window.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout(()=>{l()},n));function l(){if(i)return;i=!0,window.removeEventListener("ethereum#initialized",l);const{ethereum:a}=window;a&&(!e||a.isMetaMask)?s(a):(!r&&console.error("@metamask/detect-provider:",e&&a?"Non-MetaMask window.ethereum detected.":"Unable to detect window.ethereum."),s(null))}});function o(){if(typeof e!="boolean")throw new Error("@metamask/detect-provider: Expected option 'mustBeMetaMask' to be a boolean.");if(typeof r!="boolean")throw new Error("@metamask/detect-provider: Expected option 'silent' to be a boolean.");if(typeof n!="number")throw new Error("@metamask/detect-provider: Expected option 'timeout' to be a number.")}}return uf=t,uf}var F4=Fe&&Fe.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),z4=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),$4=Fe&&Fe.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&F4(e,t,r);return z4(e,t),e},Qi=Fe&&Fe.__awaiter||function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function l(c){try{u(n.next(c))}catch(d){s(d)}}function a(c){try{u(n.throw(c))}catch(d){s(d)}}function u(c){c.done?o(c.value):i(c.value).then(l,a)}u((n=n.apply(t,e||[])).next())})};Object.defineProperty(cl,"__esModule",{value:!0});var tw=cl.MetaMask=cl.NoMetaMaskError=void 0;const H4=Ju;class fl extends Error{constructor(){super("MetaMask not installed"),this.name=fl.name,Object.setPrototypeOf(this,fl.prototype)}}cl.NoMetaMaskError=fl;function Zl(t){return Number.parseInt(t,16)}class q4 extends H4.Connector{constructor({actions:e,options:r,onError:n}){super(e,n),this.options=r}isomorphicInitialize(){return Qi(this,void 0,void 0,function*(){if(!this.eagerConnection)return this.eagerConnection=Promise.resolve().then(()=>$4(U4())).then(e=>Qi(this,void 0,void 0,function*(){var r,n;const i=yield e.default(this.options);i&&(this.provider=i,!((r=this.provider.providers)===null||r===void 0)&&r.length&&(this.provider=(n=this.provider.providers.find(o=>o.isMetaMask))!==null&&n!==void 0?n:this.provider.providers[0]),this.provider.on("connect",({chainId:o})=>{this.actions.update({chainId:Zl(o)})}),this.provider.on("disconnect",o=>{var s;if(o.code===1013){console.debug('MetaMask logged connection error 1013: "Try again later"');return}this.actions.resetState(),(s=this.onError)===null||s===void 0||s.call(this,o)}),this.provider.on("chainChanged",o=>{this.actions.update({chainId:Zl(o)})}),this.provider.on("accountsChanged",o=>{o.length===0?this.actions.resetState():this.actions.update({accounts:o})}))}))})}connectEagerly(){return Qi(this,void 0,void 0,function*(){const e=this.actions.startActivation();try{if(yield this.isomorphicInitialize(),!this.provider)return e();const r=yield this.provider.request({method:"eth_accounts"});if(!r.length)throw new Error("No accounts returned");const n=yield this.provider.request({method:"eth_chainId"});this.actions.update({chainId:Zl(n),accounts:r})}catch(r){console.debug("Could not connect eagerly",r),this.actions.resetState()}})}activate(e){var r,n;return Qi(this,void 0,void 0,function*(){let i;return!((n=(r=this.provider)===null||r===void 0?void 0:r.isConnected)===null||n===void 0)&&n.call(r)||(i=this.actions.startActivation()),this.isomorphicInitialize().then(()=>Qi(this,void 0,void 0,function*(){if(!this.provider)throw new fl;const o=yield this.provider.request({method:"eth_requestAccounts"}),s=yield this.provider.request({method:"eth_chainId"}),l=Zl(s),a=typeof e=="number"?e:e==null?void 0:e.chainId;if(!a||l===a)return this.actions.update({chainId:l,accounts:o});const u=`0x${a.toString(16)}`;return this.provider.request({method:"wallet_switchEthereumChain",params:[{chainId:u}]}).catch(c=>{var d,p;if((((p=(d=c.data)===null||d===void 0?void 0:d.originalError)===null||p===void 0?void 0:p.code)||c.code)===4902&&typeof e!="number"){if(!this.provider)throw new Error("No provider");return this.provider.request({method:"wallet_addEthereumChain",params:[Object.assign(Object.assign({},e),{chainId:u})]})}throw c}).then(()=>this.activate(a))})).catch(o=>{throw i==null||i(),o})})}watchAsset({address:e,symbol:r,decimals:n,image:i}){return Qi(this,void 0,void 0,function*(){if(!this.provider)throw new Error("No provider");return this.provider.request({method:"wallet_watchAsset",params:{type:"ERC20",options:{address:e,symbol:r,decimals:n,image:i}}}).then(o=>{if(!o)throw new Error("Rejected");return!0})})}}tw=cl.MetaMask=q4;const[rw,Fh]=qu.initializeConnector(t=>new tw({actions:t}));function W4(t){const e=t.split("."),r=new Uint8Array(t.length+e.length);let n=0;for(const i of e){const o=i.length;r[n]=o,n++;for(let s=0;si.toString(16).padStart(2,"0")).join("")}`}const{useIsActivating:G4}=Fh;function V4({provider:t,packageAbi:e}){const{listedApps:r}=Qo(),{account:n,isActive:i}=qu.useWeb3React(),o=G4(),[s,l]=L.useState(""),[a,u]=L.useState(),[c,d]=L.useState(!1),[p,v]=L.useState(""),[g,x]=L.useState(""),[S,E]=L.useState(""),[w,_]=L.useState(""),[O,B]=L.useState(!1),j=L.useCallback(async()=>{await rw.activate().catch(()=>{});try{Om(fu)}catch(V){console.error(V)}},[]),$=L.useCallback(async()=>{if(!S){_("");return}try{const Y=await(await fetch(S)).text();let K=JSON.parse(Y);if(!K.properties||!K.properties.package_name||!K.properties.publisher||!K.properties.current_version||!K.properties.mirrors||!K.properties.code_hashes)throw new Error("Invalid metadata");const C=ut(mr(Y));_(C),v(K.properties.package_name),x(K.properties.publisher)}catch{window.alert("Error calculating metadata hash. Please ensure the URL is valid, that the metadata is in JSON format, and that it conforms to the Erc721 metadata format for kinode packages. Read more here: TODO")}},[S]),H=L.useCallback(async V=>{V.preventDefault(),V.stopPropagation();let Y=w;try{if(!Y){const f=await fetch(S);await f.json();const m=await f.text();Y=ut(mr(m))}l("Please confirm the transaction in your wallet");const K=W4(g);await Om(fu);const C=await(O?e.updateMetadata(G.from(mS(["string","bytes"],[p,K])),S,Y):e.registerApp(p,K,S,Y));await new Promise(f=>setTimeout(f,2e3)),l("Publishing package..."),await C.wait(),u({packageName:p,publisherId:g}),v(""),x(g),E(""),_(""),B(!1)}catch(K){console.error(K),window.alert("Error publishing package. Please ensure the package name and publisher ID are valid, and the metadata is in JSON format.")}finally{l("")}},[p,O,g,S,w,e,u,v,x,E,_,B]),ie=L.useCallback(async()=>{O||p&&g&&r.find(V=>V.package===p&&V.publisher===g)&&B(!0)},[r,p,g,O,B]);return I.jsxs("div",{style:{width:"100%"},children:[I.jsx(Qu,{hideSearch:!0}),I.jsxs("div",{className:"row between",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"Publish Package"}),!!n&&I.jsxs("div",{style:{textAlign:"right",lineHeight:1.5},children:[" ","Connected as"," ",(n==null?void 0:n.slice(0,6))+"..."+(n==null?void 0:n.slice(n.length-6))]})]}),s?I.jsx("div",{className:"col center",children:I.jsx(Ed,{msg:s})}):a?I.jsxs("div",{className:"col center",children:[I.jsx("h3",{style:{marginBottom:"0.5em"},children:"Package Published!"}),I.jsxs("div",{style:{marginBottom:"0.5em"},children:[I.jsx("strong",{children:"Package Name:"})," ",a.packageName]}),I.jsxs("div",{style:{marginBottom:"0.5em"},children:[I.jsx("strong",{children:"Publisher ID:"})," ",a.publisherId]}),I.jsx("button",{className:"my-pkg-btn row",style:{marginTop:"1em"},onClick:()=>u(void 0),children:"Publish Another Package"})]}):!n||!i?I.jsxs(I.Fragment,{children:[I.jsx("h4",{style:{},children:"Please connect your wallet to publish a package"}),I.jsx("button",{className:"my-pkg-btn row",onClick:j,children:"Connect Wallet"})]}):o?I.jsx(Ed,{msg:"Approve connection in your wallet"}):I.jsxs("form",{className:"new card col",style:{flex:1,overflowY:"scroll"},onSubmit:H,children:[I.jsxs("div",{className:"row between",style:{cursor:"pointer",padding:"0.5em",margin:"0 0 0.5em -0.5em"},onClick:()=>B(!O),children:[I.jsx("input",{type:"checkbox",checked:O,readOnly:!0}),I.jsx("label",{htmlFor:"update",style:{cursor:"pointer"},children:"Update existing package"})]}),I.jsxs("div",{className:"col f-width",children:[I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsxs("label",{htmlFor:"metadata-url",children:["Metadata URL",I.jsx("span",{style:{marginLeft:"2em",fontSize:"0.9em",textDecoration:"underline",cursor:"pointer"},onClick:()=>d(!c),children:"What is this?"})]}),c&&I.jsxs("div",{style:{textAlign:"left",marginBottom:"0.5em"},children:["Metadata is a JSON file that describes your package.",I.jsx("br",{})," You can"," ",I.jsx("a",{target:"_blank",href:"https://pongo-uploads.s3.us-east-2.amazonaws.com/sample_metadata.json",children:"download a template here"}),"."]}),I.jsx("input",{style:{minWidth:"80%"},id:"metadata-url",type:"text",required:!0,value:S,onChange:V=>E(V.target.value),onBlur:$,placeholder:"https://my-site/metadata.json"})]}),I.jsx("label",{htmlFor:"package-name",children:"Package Name"}),I.jsx("input",{style:{minWidth:"80%"},readOnly:!0,id:"package-name",type:"text",required:!0,placeholder:"Retreived automatically from metadata URL",value:p,onBlur:ie})]}),I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsx("label",{htmlFor:"publisher-id",children:"Publisher ID"}),I.jsx("input",{style:{minWidth:"80%"},readOnly:!0,id:"publisher-id",type:"text",required:!0,placeholder:"Retreived automatically from metadata URL",value:g,onBlur:ie})]}),I.jsxs("div",{className:"col f-width",style:{marginTop:"1em"},children:[I.jsx("label",{htmlFor:"metadata-hash",children:"Metadata Hash"}),I.jsx("input",{style:{minWidth:"80%"},readOnly:!0,id:"metadata-hash",type:"text",value:w,onChange:V=>_(V.target.value),placeholder:"Calculated automatically from metadata URL"})]}),I.jsx("button",{type:"submit",className:"primary",style:{marginTop:"1em"},children:"Publish"})]})]})}var K4={VITE_SEPOLIA_RPC_URL:"https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",VITE_OPTIMISM_RPC_URL:"https://mainnet.optimism.io/",BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const Q4=[[rw,Fh]],{useProvider:J4}=Fh,Y4="https://eth-sepolia.g.alchemy.com/v2/IyK9MyYxeSXOxLbdpI44d_Ayw58WH2M7",Is="/main:app_store:sys";window.our&&(window.our.process=Is==null?void 0:Is.replace("/",""));const X4=`${K4.VITE_NODE_URL||"http://localhost:8080"}${Is}`;function Z4(){const t=J4(),[e,r]=L.useState(!0),[n,i]=L.useState(wd.connect(Rm[_a.SEPOLIA],new vi(Y4)));if(L.useEffect(()=>{t==null||t.getNetwork().then(s=>{s.chainId===_a.SEPOLIA&&i(wd.connect(Rm[_a.SEPOLIA],t.getSigner()))})},[t]),L.useEffect(()=>{},[]),!e)return I.jsxs("div",{className:"node-not-connected",children:[I.jsx("h2",{style:{color:"red"},children:"Node not connected"}),I.jsxs("h4",{children:["You need to start a node at ",X4," before you can use this UI in development."]})]});const o={provider:t,packageAbi:n};return I.jsx(qu.Web3ReactProvider,{connectors:Q4,children:I.jsx(_x,{basename:Is,children:I.jsxs(Ax,{children:[I.jsx(ms,{path:"/",element:I.jsx(T4,{...o})}),I.jsx(ms,{path:_d,element:I.jsx(O4,{...o})}),I.jsx(ms,{path:"/app-details/:id",element:I.jsx(L4,{...o})}),I.jsx(ms,{path:"/publish",element:I.jsx(V4,{...o})})]})})})}cf.createRoot(document.getElementById("root")).render(I.jsx(qr.StrictMode,{children:I.jsx(Z4,{})})); diff --git a/kinode/packages/app_store/pkg/ui/index.html b/kinode/packages/app_store/pkg/ui/index.html index ba5860101..29fe23650 100644 --- a/kinode/packages/app_store/pkg/ui/index.html +++ b/kinode/packages/app_store/pkg/ui/index.html @@ -18,7 +18,7 @@ content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1.00001, viewport-fit=cover" /> - + From 56a0b21eea8d886bb6483f3008c628265c934de2 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Thu, 15 Feb 2024 11:48:31 -0500 Subject: [PATCH 075/171] cleaning --- kinode/packages/app_store/app_store/src/api.rs | 2 -- kinode/packages/app_store/app_store/src/http_api.rs | 1 - 2 files changed, 3 deletions(-) diff --git a/kinode/packages/app_store/app_store/src/api.rs b/kinode/packages/app_store/app_store/src/api.rs index f5ea8a901..f63021bf4 100644 --- a/kinode/packages/app_store/app_store/src/api.rs +++ b/kinode/packages/app_store/app_store/src/api.rs @@ -34,7 +34,6 @@ pub enum LocalRequest { /// /// If requested, will return a NewPackageResponse indicating success/failure. /// This is used for locally installing a package. - /// TODO could switch this to Erc721Metadata NewPackage { package: PackageId, /// Sets whether we will mirror this package for others @@ -53,7 +52,6 @@ pub enum LocalRequest { /// when a new version is posted to the listings contract auto_update: bool, /// The version hash we're looking for. If None, will download the latest. - /// TODO could switch this to more friendly version numbers e.g 1.0.1 given new metadata structure desired_version_hash: Option, }, /// Select a downloaded package and install it. Will only succeed if the diff --git a/kinode/packages/app_store/app_store/src/http_api.rs b/kinode/packages/app_store/app_store/src/http_api.rs index 03a9b2318..b8ffaccff 100644 --- a/kinode/packages/app_store/app_store/src/http_api.rs +++ b/kinode/packages/app_store/app_store/src/http_api.rs @@ -243,7 +243,6 @@ fn serve_paths( let mirrors: &Vec = pkg_listing .metadata .as_ref() - // TODO better error handling - this will be common! .expect("Package does not have metadata") .properties .mirrors From 615cd91a05faf40d4c8f75eff7633a5d47e3a4cc Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Thu, 15 Feb 2024 11:58:31 -0500 Subject: [PATCH 076/171] merge conflict errors --- kinode/packages/app_store/app_store/src/http_api.rs | 6 ++---- kinode/packages/app_store/app_store/src/lib.rs | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/kinode/packages/app_store/app_store/src/http_api.rs b/kinode/packages/app_store/app_store/src/http_api.rs index 1d13d4396..3e1d4145e 100644 --- a/kinode/packages/app_store/app_store/src/http_api.rs +++ b/kinode/packages/app_store/app_store/src/http_api.rs @@ -189,7 +189,7 @@ fn serve_paths( } Method::PUT => { // update an app - let pkg_listing: &PackageListing = state + let _pkg_listing: &PackageListing = state .get_listing(&package_id) .ok_or(anyhow::anyhow!("No package"))?; let pkg_state: &PackageState = state @@ -281,9 +281,7 @@ fn serve_paths( .expect("Package does not have metadata") .properties .mirrors - .as_ref() - .ok_or(anyhow::anyhow!("No mirrors for package {package_id}"))?; - + .as_ref(); // TODO select on FE let download_from = body_json .get("download_from") diff --git a/kinode/packages/app_store/app_store/src/lib.rs b/kinode/packages/app_store/app_store/src/lib.rs index 28b5f043c..e1556e02d 100644 --- a/kinode/packages/app_store/app_store/src/lib.rs +++ b/kinode/packages/app_store/app_store/src/lib.rs @@ -378,7 +378,7 @@ pub fn start_download( } fn handle_receive_download( - _our: &Address, + our: &Address, state: &mut State, package_name: &str, requested_packages: &mut HashMap, From f7c63f4f5726e8fc80182d4ee59e10c24a1b1234 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Thu, 15 Feb 2024 11:59:14 -0500 Subject: [PATCH 077/171] cleaning --- kinode/packages/app_store/app_store/src/http_api.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/kinode/packages/app_store/app_store/src/http_api.rs b/kinode/packages/app_store/app_store/src/http_api.rs index 3e1d4145e..65953bf59 100644 --- a/kinode/packages/app_store/app_store/src/http_api.rs +++ b/kinode/packages/app_store/app_store/src/http_api.rs @@ -282,7 +282,6 @@ fn serve_paths( .properties .mirrors .as_ref(); - // TODO select on FE let download_from = body_json .get("download_from") .unwrap_or(&json!(mirrors From bcd68fdf6b4ab44bd08867042f587337e8db1112 Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Thu, 15 Feb 2024 15:11:32 -0300 Subject: [PATCH 078/171] cli printfix2 --- kinode/src/main.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kinode/src/main.rs b/kinode/src/main.rs index aaa37515e..b080f07c1 100644 --- a/kinode/src/main.rs +++ b/kinode/src/main.rs @@ -189,7 +189,6 @@ async fn main() { } }; - println!("wtf here are the matches: {:?}", matches); #[cfg(not(feature = "simulation-mode"))] let (rpc_url, is_detached) = (matches.get_one::("rpc").cloned(), false); #[cfg(not(feature = "simulation-mode"))] @@ -207,7 +206,7 @@ async fn main() { eth_provider = ProviderInput::WS(url); } (None, Some(node)) => { - println!("trying to use node for rpc: {}", node); + println!("trying to use remote node for rpc: {}", node); eth_provider = ProviderInput::Node(node); } (None, None) => { From 981f5c220dbec1c073d0a0c95196ee6190208f31 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Thu, 15 Feb 2024 13:57:35 -0500 Subject: [PATCH 079/171] app_store metadata updated --- kinode/packages/app_store/metadata.json | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kinode/packages/app_store/metadata.json b/kinode/packages/app_store/metadata.json index 52a7e3a3f..43106e135 100644 --- a/kinode/packages/app_store/metadata.json +++ b/kinode/packages/app_store/metadata.json @@ -4,12 +4,11 @@ "image": "", "properties": { "package_name": "app_store", - "current_version": "0.2.0", + "current_version": "0.3.0", "publisher": "sys", "mirrors": [], "code_hashes": { - "0.2.0": "", - "0.1.0": "" + "0.3.0": "" } }, "external_url": "https://kinode.org", From bf939f52bac1ee64ffb3985d807f782f78d33cc0 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Thu, 15 Feb 2024 13:58:22 -0500 Subject: [PATCH 080/171] chess metadata updated --- kinode/packages/chess/metadata.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kinode/packages/chess/metadata.json b/kinode/packages/chess/metadata.json index d531d6b13..b40ba7bcd 100644 --- a/kinode/packages/chess/metadata.json +++ b/kinode/packages/chess/metadata.json @@ -8,8 +8,7 @@ "publisher": "sys", "mirrors": [], "code_hashes": { - "0.2.0": "", - "0.1.0": "" + "0.2.0": "" } }, "external_url": "https://kinode.org", From 516a8284af9c1c41fed19b4e11357de9cf405082 Mon Sep 17 00:00:00 2001 From: Drew Tada Date: Thu, 15 Feb 2024 13:59:21 -0500 Subject: [PATCH 081/171] docstring added to Erc721Metadata --- lib/src/core.rs | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/src/core.rs b/lib/src/core.rs index 338ba9bdc..bfbd8203a 100644 --- a/lib/src/core.rs +++ b/lib/src/core.rs @@ -1042,7 +1042,15 @@ impl std::fmt::Display for PersistedProcess { } } -/// the type that gets deserialized from `metadata.json` in a package +/// Represents the metadata associated with a kinode package, which is an ERC721 compatible token. +/// This is deserialized from the `metadata.json` file in a package. +/// Fields: +/// - `name`: An optional field representing the display name of the package. This does not have to be unique, and is not used for identification purposes. +/// - `description`: An optional field providing a description of the package. +/// - `image`: An optional field containing a URL to an image representing the package. +/// - `external_url`: An optional field containing a URL for more information about the package. For example, a link to the github repository. +/// - `animation_url`: An optional field containing a URL to an animation or video representing the package. +/// - `properties`: A requried field containing important information about the package. #[derive(Clone, Debug, Serialize, Deserialize)] pub struct Erc721Metadata { pub name: Option, @@ -1053,6 +1061,18 @@ pub struct Erc721Metadata { pub properties: Erc721Properties, } +/// Represents critical fields of a kinode package in an ERC721 compatible format. +/// This follows the [ERC1155](https://github.com/ethereum/ercs/blob/master/ERCS/erc-1155.md#erc-1155-metadata-uri-json-schema) metadata standard. +/// +/// Fields: +/// - `package_name`: The unique name of the package, used in the `PackageId`, e.g. `package_name:publisher`. +/// - `publisher`: The KNS identity of the package publisher used in the `PackageId`, e.g. `package_name:publisher` +/// - `current_version`: A string representing the current version of the package, e.g. `1.0.0`. +/// - `mirrors`: A list of NodeIds where the package can be found, providing redundancy. +/// - `code_hashes`: A map from version names to their respective SHA-256 hashes. +/// - `license`: An optional field containing the license of the package. +/// - `screenshots`: An optional field containing a list of URLs to screenshots of the package. +/// - `wit_version`: An optional field containing the version of the WIT standard that the package adheres to. #[derive(Clone, Debug, Serialize, Deserialize)] pub struct Erc721Properties { pub package_name: String, From 9d9ea85d2fac0b0dd3d8ec83dcf6478365f60714 Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Thu, 15 Feb 2024 16:42:32 -0300 Subject: [PATCH 082/171] eth: review1 --- ...lt_routers.json => default_providers.json} | 13 -------- kinode/packages/kns_indexer/pkg/manifest.json | 2 +- kinode/src/eth/provider.rs | 2 +- kinode/src/kernel/mod.rs | 9 ++++-- kinode/src/main.rs | 31 +++++++++---------- lib/src/eth.rs | 5 +-- 6 files changed, 25 insertions(+), 37 deletions(-) rename kinode/{default_routers.json => default_providers.json} (61%) diff --git a/kinode/default_routers.json b/kinode/default_providers.json similarity index 61% rename from kinode/default_routers.json rename to kinode/default_providers.json index bfaaba15b..964698dff 100644 --- a/kinode/default_routers.json +++ b/kinode/default_providers.json @@ -25,18 +25,5 @@ "ip": "147.135.114.167", "port": 9004, "routers": [] - }, - { - "name": "jugodenaranja.os", - "owner": "ass", - "node": "0x", - "public_key": "0xf8a3e9667756306a0a25894a8cfe053dc9e7f34e6a61b8d65e92b79f77e05dff", - "ip": "0.0.0.0", - "port": 0, - "routers": [ - "0xb35eb347deb896bc3fb6132a07fca1601f83462385ed11e835c24c33ba4ef73d", - "0xd827ae579fafa604af79fbed977e8abe048497f10885c6473dfd343a3b7b4458", - "0x96e36331c8f0882f2c0c46c13b15d812def04fe8606d503bc0e2be39db26486a" - ] } ] \ No newline at end of file diff --git a/kinode/packages/kns_indexer/pkg/manifest.json b/kinode/packages/kns_indexer/pkg/manifest.json index 531fc0029..d29393b94 100644 --- a/kinode/packages/kns_indexer/pkg/manifest.json +++ b/kinode/packages/kns_indexer/pkg/manifest.json @@ -3,7 +3,7 @@ "process_name": "kns_indexer", "process_wasm_path": "/kns_indexer.wasm", "on_exit": "Restart", - "request_networking": true, + "request_networking": false, "request_capabilities": [ "eth:distro:sys", "http_server:distro:sys", diff --git a/kinode/src/eth/provider.rs b/kinode/src/eth/provider.rs index f05ea9896..eb58f6f64 100644 --- a/kinode/src/eth/provider.rs +++ b/kinode/src/eth/provider.rs @@ -36,7 +36,7 @@ pub async fn provider( // Initialize the provider conditionally based on rpc_url // Todo: make provider support multiple transports, one direct and another passthrough. let provider_config = match provider_node { - ProviderInput::WS(rpc_url) => { + ProviderInput::Ws(rpc_url) => { // Validate and parse the WebSocket URL match Url::parse(&rpc_url)?.scheme() { "ws" | "wss" => { diff --git a/kinode/src/kernel/mod.rs b/kinode/src/kernel/mod.rs index 8ca9f6025..78a881095 100644 --- a/kinode/src/kernel/mod.rs +++ b/kinode/src/kernel/mod.rs @@ -672,7 +672,7 @@ pub async fn kernel( home_directory_path: String, contract_address: String, runtime_extensions: Vec<(t::ProcessId, t::MessageSender, bool)>, - routers: Vec, + default_pki_entries: Vec, ) -> Result<()> { let mut config = Config::new(); config.cache_config_load_default().unwrap(); @@ -828,7 +828,7 @@ pub async fn kernel( }) .await .expect("fatal: kernel event loop died"); - // sending hard coded routers into networking for bootstrapped rpc + // sending hard coded pki entries into networking for bootstrapped rpc send_to_loop .send(t::KernelMessage { id: rand::random(), @@ -844,7 +844,10 @@ pub async fn kernel( message: t::Message::Request(t::Request { inherit: false, expects_response: None, - body: rmp_serde::to_vec(&crate::net::NetActions::KnsBatchUpdate(routers)).unwrap(), + body: rmp_serde::to_vec(&crate::net::NetActions::KnsBatchUpdate( + default_pki_entries, + )) + .unwrap(), metadata: None, capabilities: vec![], }), diff --git a/kinode/src/main.rs b/kinode/src/main.rs index b080f07c1..e5794e3c1 100644 --- a/kinode/src/main.rs +++ b/kinode/src/main.rs @@ -46,8 +46,8 @@ const VERSION: &str = env!("CARGO_PKG_VERSION"); #[cfg(not(feature = "simulation-mode"))] const REVEAL_IP: bool = true; -/// default routers as a fallbac -const DEFAULT_ROUTERS: &str = include_str!("../default_routers.json"); +/// default routers as a eth-provider fallback +const DEFAULT_PROVIDERS: &str = include_str!("../default_providers.json"); async fn serve_register_fe( home_directory_path: &str, @@ -178,14 +178,14 @@ async fn main() { } } - // default routers + // default eth providers/routers type KnsUpdate = crate::net::KnsUpdate; - let routers: Vec = - match fs::read_to_string(format!("{}/.routers", home_directory_path)).await { + let default_pki_entries: Vec = + match fs::read_to_string(format!("{}/.default_providers", home_directory_path)).await { Ok(contents) => serde_json::from_str(&contents).unwrap(), Err(_) => { - let routers: Vec = serde_json::from_str(DEFAULT_ROUTERS).unwrap(); - routers + let defaults: Vec = serde_json::from_str(DEFAULT_PROVIDERS).unwrap(); + defaults } }; @@ -200,25 +200,22 @@ async fn main() { match (rpc_url, rpc_node) { (Some(url), Some(_)) => { println!("passed both node and url for rpc, using url."); - eth_provider = ProviderInput::WS(url); + eth_provider = ProviderInput::Ws(url); } (Some(url), None) => { - eth_provider = ProviderInput::WS(url); + eth_provider = ProviderInput::Ws(url); } (None, Some(node)) => { println!("trying to use remote node for rpc: {}", node); eth_provider = ProviderInput::Node(node); } (None, None) => { - let random_router = routers.choose(&mut rand::thread_rng()).unwrap(); - let default_router = random_router.name.clone(); + let random_provider = default_pki_entries.choose(&mut rand::thread_rng()).unwrap(); + let default_provider = random_provider.name.clone(); - println!( - "no rpc provided, using a default router: {}", - default_router - ); + println!("no rpc provided, using a default: {}", default_provider); - eth_provider = ProviderInput::Node(default_router); + eth_provider = ProviderInput::Node(default_provider); } } @@ -509,7 +506,7 @@ async fn main() { home_directory_path.clone(), contract_address.to_string(), runtime_extensions, - routers, + default_pki_entries, )); #[cfg(not(feature = "simulation-mode"))] tasks.spawn(net::networking( diff --git a/lib/src/eth.rs b/lib/src/eth.rs index 041bfec2b..a000637ff 100644 --- a/lib/src/eth.rs +++ b/lib/src/eth.rs @@ -21,7 +21,8 @@ pub enum EthAction { params: serde_json::Value, }, } -/// Incoming subscription update. + +/// Incoming Request for subscription updates that processes will receive. #[derive(Debug, Serialize, Deserialize)] pub struct EthSub { pub id: u64, @@ -92,6 +93,6 @@ pub fn to_static_str(method: &str) -> Option<&'static str> { } pub enum ProviderInput { - WS(String), + Ws(String), Node(String), } From 4ef0d654ea64ca9bef3c43ffdda6900b34656a1e Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Thu, 15 Feb 2024 18:13:00 -0300 Subject: [PATCH 083/171] ethsub result type --- .../packages/app_store/app_store/Cargo.toml | 2 +- .../packages/app_store/app_store/src/lib.rs | 11 ++- .../kns_indexer/kns_indexer/Cargo.toml | 2 +- .../kns_indexer/kns_indexer/src/lib.rs | 10 ++- kinode/src/eth/provider.rs | 77 ++++++++++++------- lib/src/eth.rs | 13 +++- 6 files changed, 77 insertions(+), 38 deletions(-) diff --git a/kinode/packages/app_store/app_store/Cargo.toml b/kinode/packages/app_store/app_store/Cargo.toml index d8e4d8664..0fe63e6c4 100644 --- a/kinode/packages/app_store/app_store/Cargo.toml +++ b/kinode/packages/app_store/app_store/Cargo.toml @@ -9,7 +9,7 @@ alloy-primitives = "0.6.2" alloy-sol-types = "0.6.2" anyhow = "1.0" bincode = "1.3.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "9231881" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "ad17eaa" } rand = "0.8" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/kinode/packages/app_store/app_store/src/lib.rs b/kinode/packages/app_store/app_store/src/lib.rs index 287f86814..e773004c9 100644 --- a/kinode/packages/app_store/app_store/src/lib.rs +++ b/kinode/packages/app_store/app_store/src/lib.rs @@ -1,5 +1,6 @@ use kinode_process_lib::eth::{ - get_logs, subscribe, unsubscribe, Address as EthAddress, EthSub, Filter, SubscriptionResult, + get_logs, subscribe, unsubscribe, Address as EthAddress, EthSub, EthSubResult, Filter, + SubscriptionResult, }; use kinode_process_lib::http::{bind_http_path, serve_ui, HttpServerRequest}; use kinode_process_lib::kernel_types as kt; @@ -58,7 +59,7 @@ pub enum Req { RemoteRequest(RemoteRequest), FTWorkerCommand(FTWorkerCommand), FTWorkerResult(FTWorkerResult), - Eth(EthSub), + Eth(EthSubResult), Http(HttpServerRequest), } @@ -184,11 +185,13 @@ fn handle_message( Req::FTWorkerResult(r) => { println!("app store: got weird ft_worker result: {r:?}"); } - Req::Eth(sub) => { + Req::Eth(eth_result) => { if source.node() != our.node() || source.process != "eth:distro:sys" { return Err(anyhow::anyhow!("eth sub event from weird addr: {source}")); } - handle_eth_sub_event(our, &mut state, sub.result)?; + if let Ok(EthSub { result, .. }) = eth_result { + handle_eth_sub_event(our, &mut state, result)?; + } } Req::Http(incoming) => { if source.node() != our.node() diff --git a/kinode/packages/kns_indexer/kns_indexer/Cargo.toml b/kinode/packages/kns_indexer/kns_indexer/Cargo.toml index 664b7df33..ee9f411bb 100644 --- a/kinode/packages/kns_indexer/kns_indexer/Cargo.toml +++ b/kinode/packages/kns_indexer/kns_indexer/Cargo.toml @@ -10,7 +10,7 @@ alloy-primitives = "0.6.2" alloy-sol-types = "0.6.2" bincode = "1.3.3" hex = "0.4.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "9231881" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "ad17eaa" } rmp-serde = "1.1.2" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/kinode/packages/kns_indexer/kns_indexer/src/lib.rs b/kinode/packages/kns_indexer/kns_indexer/src/lib.rs index 19898f865..ca98d3fab 100644 --- a/kinode/packages/kns_indexer/kns_indexer/src/lib.rs +++ b/kinode/packages/kns_indexer/kns_indexer/src/lib.rs @@ -4,7 +4,7 @@ use kinode_process_lib::{ await_message, eth::{ get_block_number, get_logs, subscribe, Address as EthAddress, BlockNumberOrTag, EthSub, - Filter, Log, SubscriptionResult, + EthSubResult, Filter, Log, SubscriptionResult, }, get_typed_state, print_to_terminal, println, set_state, Address, Message, Request, Response, }; @@ -253,12 +253,14 @@ fn handle_eth_message( pending_requests: &mut BTreeMap>, body: &[u8], ) -> anyhow::Result<()> { - let Ok(res) = serde_json::from_slice::(body) else { + let Ok(eth_result) = serde_json::from_slice::(body) else { return Err(anyhow::anyhow!("kns_indexer: got invalid message")); }; - if let SubscriptionResult::Log(log) = res.result { - handle_log(our, state, &log)?; + if let Ok(EthSub { result, .. }) = eth_result { + if let SubscriptionResult::Log(log) = result { + handle_log(our, state, &log)?; + } } // check the pending_requests btreemap to see if there are any requests that diff --git a/kinode/src/eth/provider.rs b/kinode/src/eth/provider.rs index eb58f6f64..4c56e761e 100644 --- a/kinode/src/eth/provider.rs +++ b/kinode/src/eth/provider.rs @@ -243,28 +243,29 @@ async fn handle_local_request( EthResponse::Response { value: response } } }; - - let response = KernelMessage { - id: km.id, - source: Address { - node: our.to_string(), - process: ETH_PROCESS_ID.clone(), - }, - target: km.source.clone(), - rsvp: None, - message: Message::Response(( - Response { - inherit: false, - body: serde_json::to_vec(&return_body).unwrap(), - metadata: req.metadata.clone(), - capabilities: vec![], - }, - None, - )), - lazy_load_blob: None, - }; - - let _ = send_to_loop.send(response).await; + if let Some(_) = req.expects_response { + let _ = send_to_loop + .send(KernelMessage { + id: km.id, + source: Address { + node: our.to_string(), + process: ETH_PROCESS_ID.clone(), + }, + target: km.source.clone(), + rsvp: km.rsvp.clone(), + message: Message::Response(( + Response { + inherit: false, + body: serde_json::to_vec(&return_body).unwrap(), + metadata: req.metadata.clone(), + capabilities: vec![], + }, + None, + )), + lazy_load_blob: None, + }) + .await; + } Ok(()) } @@ -407,10 +408,33 @@ async fn handle_subscription_stream( ) -> Result<(), EthError> { match rx.recv().await { Err(e) => { - return Err(EthError::SubscriptionClosed(sub_id))?; + let error = Err(EthError::SubscriptionClosed(sub_id))?; + let _ = send_to_loop + .send(KernelMessage { + id: rand::random(), + source: Address { + node: our, + process: ETH_PROCESS_ID.clone(), + }, + target: target.clone(), + rsvp: rsvp.clone(), + message: Message::Request(Request { + inherit: false, + expects_response: None, + body: serde_json::to_vec(&EthSubResult::Err(EthSubError { + id: sub_id, + error: e.to_string(), + })) + .unwrap(), + metadata: None, + capabilities: vec![], + }), + lazy_load_blob: None, + }) + .await + .unwrap(); } Ok(value) => { - // this should not return in case of one failed event? let event: SubscriptionResult = serde_json::from_str(value.get()).map_err(|_| { EthError::RpcError("eth: failed to deserialize subscription result".to_string()) })?; @@ -426,10 +450,10 @@ async fn handle_subscription_stream( message: Message::Request(Request { inherit: false, expects_response: None, - body: serde_json::to_vec(&EthSub { + body: serde_json::to_vec(&EthSubResult::Ok(EthSub { id: sub_id, result: event, - }) + })) .unwrap(), metadata: None, capabilities: vec![], @@ -443,7 +467,6 @@ async fn handle_subscription_stream( Err(EthError::SubscriptionClosed(sub_id)) } -// todo, always send errors or no? general runtime question for other modules too. fn make_error_message(our_node: String, km: KernelMessage, error: EthError) -> KernelMessage { let source = km.rsvp.unwrap_or_else(|| Address { node: our_node.clone(), diff --git a/lib/src/eth.rs b/lib/src/eth.rs index a000637ff..e36564b96 100644 --- a/lib/src/eth.rs +++ b/lib/src/eth.rs @@ -22,13 +22,24 @@ pub enum EthAction { }, } -/// Incoming Request for subscription updates that processes will receive. +/// Incoming Result type for subscription updates or errors that processes will receive. +pub type EthSubResult = Result; + +/// Incoming Request type for subscription updates. #[derive(Debug, Serialize, Deserialize)] pub struct EthSub { pub id: u64, pub result: SubscriptionResult, } +/// Incoming Request for subscription errors that processes will receive. +/// If your subscription is closed unexpectedly, you will receive this. +#[derive(Debug, Serialize, Deserialize)] +pub struct EthSubError { + pub id: u64, + pub error: String, +} + /// The Response type which a process will get from requesting with an [`EthAction`] will be /// of the form `Result<(), EthError>`, serialized and deserialized using `serde_json::to_vec` /// and `serde_json::from_slice`. From cac63650abb274bceedf62277c3223fdba7ef299 Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Thu, 15 Feb 2024 19:06:36 -0300 Subject: [PATCH 084/171] add default provider nodehashes, resubs --- kinode/default_providers.json | 12 ++++++------ kinode/packages/app_store/app_store/src/lib.rs | 2 ++ .../packages/kns_indexer/kns_indexer/src/lib.rs | 17 ++++++++++++----- 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/kinode/default_providers.json b/kinode/default_providers.json index 964698dff..571526b84 100644 --- a/kinode/default_providers.json +++ b/kinode/default_providers.json @@ -1,8 +1,8 @@ [ { "name": "default-router-1.os", - "owner": "dr. who", - "node": "0x", + "owner": "", + "node": "0xb35eb347deb896bc3fb6132a07fca1601f83462385ed11e835c24c33ba4ef73d", "public_key": "0xb1b1cf23c89f651aac3e5fd4decb04aa177ab0ec8ce5f1d3877b90bb6f5779db", "ip": "147.135.114.167", "port": 9002, @@ -10,8 +10,8 @@ }, { "name": "default-router-2.os", - "owner": "foo", - "node": "0x", + "owner": "", + "node": "0xd827ae579fafa604af79fbed977e8abe048497f10885c6473dfd343a3b7b4458", "public_key": "0xab9f1a996db3a4e1dbcd31d765daedeb3af9af4f570c0968463b5be3a7d1e992", "ip": "147.135.114.167", "port": 9003, @@ -19,8 +19,8 @@ }, { "name": "default-router-s3.os", - "owner": "bar", - "node": "0x", + "owner": "", + "node": "0x96e36331c8f0882f2c0c46c13b15d812def04fe8606d503bc0e2be39db26486a", "public_key": "0x536e30785e64dd0349a697285af365b5ed7c4d300010139261cfc4dbdd5b254b", "ip": "147.135.114.167", "port": 9004, diff --git a/kinode/packages/app_store/app_store/src/lib.rs b/kinode/packages/app_store/app_store/src/lib.rs index e773004c9..c39f1f201 100644 --- a/kinode/packages/app_store/app_store/src/lib.rs +++ b/kinode/packages/app_store/app_store/src/lib.rs @@ -191,6 +191,8 @@ fn handle_message( } if let Ok(EthSub { result, .. }) = eth_result { handle_eth_sub_event(our, &mut state, result)?; + } else { + println!("app store: got eth sub error: {eth_result:?}"); } } Req::Http(incoming) => { diff --git a/kinode/packages/kns_indexer/kns_indexer/src/lib.rs b/kinode/packages/kns_indexer/kns_indexer/src/lib.rs index ca98d3fab..fdd673433 100644 --- a/kinode/packages/kns_indexer/kns_indexer/src/lib.rs +++ b/kinode/packages/kns_indexer/kns_indexer/src/lib.rs @@ -194,7 +194,7 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> { set_state(&bincode::serialize(&state)?); - subscribe(1, filter)?; + subscribe(1, filter.clone())?; let mut pending_requests: BTreeMap> = BTreeMap::new(); @@ -210,7 +210,7 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> { }; if source.process == "eth:distro:sys" { - handle_eth_message(&our, &mut state, &mut pending_requests, &body)?; + handle_eth_message(&our, &mut state, &mut pending_requests, &body, &filter)?; } else { let Ok(request) = serde_json::from_slice::(&body) else { println!("kns_indexer: got invalid message"); @@ -252,14 +252,21 @@ fn handle_eth_message( state: &mut State, pending_requests: &mut BTreeMap>, body: &[u8], + filter: &Filter, ) -> anyhow::Result<()> { let Ok(eth_result) = serde_json::from_slice::(body) else { return Err(anyhow::anyhow!("kns_indexer: got invalid message")); }; - if let Ok(EthSub { result, .. }) = eth_result { - if let SubscriptionResult::Log(log) = result { - handle_log(our, state, &log)?; + match eth_result { + Ok(EthSub { result, .. }) => { + if let SubscriptionResult::Log(log) = result { + handle_log(our, state, &log)?; + } + } + Err(e) => { + println!("kns_indexer: got sub error, resubscribing.. {:?}", e.error); + subscribe(1, filter.clone())?; } } From 7019ce57db72f92645088f088c39e281aa1c9e0c Mon Sep 17 00:00:00 2001 From: bitful-pannul Date: Thu, 15 Feb 2024 19:57:46 -0300 Subject: [PATCH 085/171] merge process_lib da-metadata work --- kinode/packages/app_store/app_store/Cargo.toml | 2 +- kinode/packages/kns_indexer/kns_indexer/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kinode/packages/app_store/app_store/Cargo.toml b/kinode/packages/app_store/app_store/Cargo.toml index 0fe63e6c4..9bf8629e1 100644 --- a/kinode/packages/app_store/app_store/Cargo.toml +++ b/kinode/packages/app_store/app_store/Cargo.toml @@ -9,7 +9,7 @@ alloy-primitives = "0.6.2" alloy-sol-types = "0.6.2" anyhow = "1.0" bincode = "1.3.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "ad17eaa" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "d7511c2" } rand = "0.8" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/kinode/packages/kns_indexer/kns_indexer/Cargo.toml b/kinode/packages/kns_indexer/kns_indexer/Cargo.toml index ee9f411bb..3d6e30f18 100644 --- a/kinode/packages/kns_indexer/kns_indexer/Cargo.toml +++ b/kinode/packages/kns_indexer/kns_indexer/Cargo.toml @@ -10,7 +10,7 @@ alloy-primitives = "0.6.2" alloy-sol-types = "0.6.2" bincode = "1.3.3" hex = "0.4.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "ad17eaa" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "d7511c2" } rmp-serde = "1.1.2" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" From 6e985cca35afebfc4324f18a7588e43602b41c18 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Thu, 15 Feb 2024 20:23:10 -0300 Subject: [PATCH 086/171] kernel: instant timeout if local target can't be reached --- kinode/src/kernel/mod.rs | 58 +++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/kinode/src/kernel/mod.rs b/kinode/src/kernel/mod.rs index 4e3e03464..470e3ce52 100644 --- a/kinode/src/kernel/mod.rs +++ b/kinode/src/kernel/mod.rs @@ -654,7 +654,7 @@ async fn start_process( } /// the OS kernel. contains event loop which handles all message-passing between -/// all processes (WASM apps) and also runtime tasks. +/// all processes (Wasm apps) and also runtime tasks. pub async fn kernel( our: t::Identity, keypair: Arc, @@ -926,7 +926,7 @@ pub async fn kernel( } ) { // capabilities are not correct! skip this message. - // TODO: some kind of error thrown back at process? + throw_timeout(&our.name, &senders, &kernel_message).await; let _ = send_to_terminal.send( t::Printout { verbosity: 0, @@ -982,9 +982,11 @@ pub async fn kernel( && kernel_message.source.process != *VFS_PROCESS_ID { let Some(persisted_source) = process_map.get(&kernel_message.source.process) else { + throw_timeout(&our.name, &senders, &kernel_message).await; continue }; let Some(persisted_target) = process_map.get(&kernel_message.target.process) else { + throw_timeout(&our.name, &senders, &kernel_message).await; continue }; if !persisted_target.public && !persisted_source.capabilities.contains_key(&t::Capability { @@ -995,7 +997,7 @@ pub async fn kernel( params: "\"messaging\"".into(), }) { // capabilities are not correct! skip this message. - // TODO some kind of error thrown back at process? + throw_timeout(&our.name, &senders, &kernel_message).await; let _ = send_to_terminal.send( t::Printout { verbosity: 0, @@ -1022,7 +1024,7 @@ pub async fn kernel( let _ = send_to_terminal.send( t::Printout { verbosity: 3, - content: format!("event loop: got message: {}", kernel_message) + content: format!("{}", kernel_message) } ).await; @@ -1050,26 +1052,13 @@ pub async fn kernel( // pass message to appropriate runtime module or process match senders.get(&kernel_message.target.process) { Some(ProcessSender::Userspace(sender)) => { - let target = kernel_message.target.process.clone(); - match sender.send(Ok(kernel_message)).await { - Ok(()) => continue, - Err(_e) => { - let _ = send_to_terminal - .send(t::Printout { - verbosity: 0, - content: format!( - "event loop: process {} appears to have died", - target - ) - }) - .await; - } - } + let _ = sender.send(Ok(kernel_message)).await; } Some(ProcessSender::Runtime(sender)) => { sender.send(kernel_message).await.expect("event loop: fatal: runtime module died"); } None => { + throw_timeout(&our.name, &senders, &kernel_message).await; send_to_terminal .send(t::Printout { verbosity: 0, @@ -1183,3 +1172,34 @@ pub async fn kernel( } } } + +async fn throw_timeout( + our_name: &str, + senders: &HashMap, + km: &t::KernelMessage, +) { + if let t::Message::Request(req) = &km.message { + if req.expects_response.is_some() { + match senders.get(&km.source.process) { + Some(ProcessSender::Userspace(sender)) => { + let _ = sender + .send(Err(t::WrappedSendError { + id: km.id, + source: t::Address { + node: our_name.to_string(), + process: KERNEL_PROCESS_ID.clone(), + }, + error: t::SendError { + kind: t::SendErrorKind::Timeout, + target: km.target.clone(), + lazy_load_blob: km.lazy_load_blob.clone(), + message: km.message.clone(), + }, + })) + .await; + } + _ => return, + } + } + } +} From ac0d8e371fbd989238e83fd56290a5cdef1bc688 Mon Sep 17 00:00:00 2001 From: hosted-fornet Date: Thu, 15 Feb 2024 15:50:48 -0800 Subject: [PATCH 087/171] bump `kit` version --- Cargo.lock | 68 +++++++++++++++++------------------------------ kinode/Cargo.toml | 2 +- 2 files changed, 25 insertions(+), 45 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0b7448f56..aaf5b4869 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -319,7 +319,7 @@ dependencies = [ "http 0.2.11", "serde_json", "tokio", - "tokio-tungstenite 0.20.1", + "tokio-tungstenite", "tracing", "ws_stream_wasm", ] @@ -609,6 +609,16 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "autocontext" +version = "0.1.0" +source = "git+https://github.com/hosted-fornet/autocontext?rev=ff00142#ff00142d852870f4fb4de580ddf7caa77302787f" +dependencies = [ + "anyhow", + "quote", + "syn 2.0.48", +] + [[package]] name = "backtrace" version = "0.3.69" @@ -2594,7 +2604,7 @@ dependencies = [ "thiserror", "tokio", "tokio-stream", - "tokio-tungstenite 0.20.1", + "tokio-tungstenite", "url", "uuid", "walkdir", @@ -2631,8 +2641,12 @@ dependencies = [ [[package]] name = "kinode_process_lib" version = "0.6.0" -source = "git+https://github.com/uqbar-dao/process_lib.git?rev=12bf9ee#12bf9eefeb9237db5e5165647fa91b437b05e169" +source = "git+https://github.com/kinode-dao/process_lib?rev=3232423#323242399efdcdad02e7f31bb6a9cc5eec048610" dependencies = [ + "alloy-json-rpc", + "alloy-primitives", + "alloy-rpc-types", + "alloy-transport", "anyhow", "bincode", "http 1.0.0", @@ -2648,12 +2662,8 @@ dependencies = [ [[package]] name = "kinode_process_lib" version = "0.6.0" -source = "git+https://github.com/kinode-dao/process_lib?rev=3232423#323242399efdcdad02e7f31bb6a9cc5eec048610" +source = "git+https://github.com/kinode-dao/process_lib.git?rev=9d185e1#9d185e1e264c93af53d004ba32520fd5d046e7e5" dependencies = [ - "alloy-json-rpc", - "alloy-primitives", - "alloy-rpc-types", - "alloy-transport", "anyhow", "bincode", "http 1.0.0", @@ -2669,16 +2679,17 @@ dependencies = [ [[package]] name = "kit" version = "0.1.0" -source = "git+https://github.com/kinode-dao/kit?rev=665025c#665025c06f495a826e8a4e0a23e3dce59dcb1832" +source = "git+https://github.com/kinode-dao/kit?rev=f96cdaa#f96cdaa022ec8d0ff675bce3b92bd436236881ea" dependencies = [ "anyhow", + "autocontext", "base64 0.21.7", "clap", "dirs 5.0.1", "futures-util", "git2", "hex", - "kinode_process_lib 0.6.0 (git+https://github.com/uqbar-dao/process_lib.git?rev=12bf9ee)", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib.git?rev=9d185e1)", "nix", "regex", "reqwest", @@ -2688,7 +2699,7 @@ dependencies = [ "serde_json", "thiserror", "tokio", - "tokio-tungstenite 0.21.0", + "tokio-tungstenite", "toml 0.8.10", "walkdir", "zip", @@ -4739,22 +4750,10 @@ dependencies = [ "rustls", "tokio", "tokio-rustls", - "tungstenite 0.20.1", + "tungstenite", "webpki-roots", ] -[[package]] -name = "tokio-tungstenite" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" -dependencies = [ - "futures-util", - "log", - "tokio", - "tungstenite 0.21.0", -] - [[package]] name = "tokio-util" version = "0.7.10" @@ -4976,25 +4975,6 @@ dependencies = [ "utf-8", ] -[[package]] -name = "tungstenite" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" -dependencies = [ - "byteorder", - "bytes", - "data-encoding", - "http 1.0.0", - "httparse", - "log", - "rand 0.8.5", - "sha1", - "thiserror", - "url", - "utf-8", -] - [[package]] name = "typenum" version = "1.17.0" @@ -5222,7 +5202,7 @@ dependencies = [ "serde_urlencoded", "tokio", "tokio-stream", - "tokio-tungstenite 0.20.1", + "tokio-tungstenite", "tokio-util", "tower-service", "tracing", diff --git a/kinode/Cargo.toml b/kinode/Cargo.toml index 2a0299202..a713b7d60 100644 --- a/kinode/Cargo.toml +++ b/kinode/Cargo.toml @@ -14,7 +14,7 @@ path = "src/main.rs" [build-dependencies] anyhow = "1.0.71" -kit = { git = "https://github.com/kinode-dao/kit", rev = "665025c" } +kit = { git = "https://github.com/kinode-dao/kit", rev = "f96cdaa" } rayon = "1.8.1" sha2 = "0.10" tokio = "1.28" From f66722534981effc5b04464a0119c4fa7a50c7e6 Mon Sep 17 00:00:00 2001 From: hosted-fornet Date: Thu, 15 Feb 2024 17:11:11 -0800 Subject: [PATCH 088/171] bugfix: simulation mode --- kinode/src/main.rs | 48 +++++++++++++++++++++---------------------- kinode/src/net/mod.rs | 6 ++++-- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/kinode/src/main.rs b/kinode/src/main.rs index e5794e3c1..ae5626c76 100644 --- a/kinode/src/main.rs +++ b/kinode/src/main.rs @@ -109,21 +109,17 @@ async fn main() { arg!(--testnet "If set, use Sepolia testnet") .default_value("false") .value_parser(value_parser!(bool)), - ); - - #[cfg(not(feature = "simulation-mode"))] - let app = app - .arg(arg!(--rpc "Ethereum RPC endpoint (must be wss://)").required(false)) - .arg(arg!(--rpcnode "RPC node provider must be a valid address").required(false)) + ) .arg( arg!(--public "If set, allow rpc passthrough") .default_value("false") .value_parser(value_parser!(bool)), - ); + ) + .arg(arg!(--rpcnode "RPC node provider must be a valid address").required(false)) + .arg(arg!(--rpc "Ethereum RPC endpoint (must be wss://)").required(false)); #[cfg(feature = "simulation-mode")] let app = app - .arg(arg!(--rpc "Ethereum RPC endpoint (must be wss://)")) .arg(arg!(--password "Networking password")) .arg(arg!(--"fake-node-name" "Name of fake node to boot")) .arg( @@ -194,20 +190,34 @@ async fn main() { #[cfg(not(feature = "simulation-mode"))] let (rpc_node, _is_detached) = (matches.get_one::("rpcnode").cloned(), false); + //#[cfg(feature = "simulation-mode")] + let (rpc_url, rpc_node, password, network_router_port, fake_node_name, is_detached) = ( + matches.get_one::("rpc"), + matches.get_one::("rpcnode"), + matches.get_one::("password"), + matches + .get_one::("network-router-port") + .unwrap() + .clone(), + matches.get_one::("fake-node-name"), + matches.get_one::("detached").unwrap().clone(), + ); + + type ProviderInput = lib::eth::ProviderInput; let eth_provider: ProviderInput; match (rpc_url, rpc_node) { (Some(url), Some(_)) => { println!("passed both node and url for rpc, using url."); - eth_provider = ProviderInput::Ws(url); + eth_provider = ProviderInput::Ws(url.clone()); } (Some(url), None) => { - eth_provider = ProviderInput::Ws(url); + eth_provider = ProviderInput::Ws(url.clone()); } (None, Some(node)) => { println!("trying to use remote node for rpc: {}", node); - eth_provider = ProviderInput::Node(node); + eth_provider = ProviderInput::Node(node.clone()); } (None, None) => { let random_provider = default_pki_entries.choose(&mut rand::thread_rng()).unwrap(); @@ -219,18 +229,6 @@ async fn main() { } } - #[cfg(feature = "simulation-mode")] - let (rpc_url, password, network_router_port, fake_node_name, is_detached) = ( - matches.get_one::("rpc"), - matches.get_one::("password"), - matches - .get_one::("network-router-port") - .unwrap() - .clone(), - matches.get_one::("fake-node-name"), - matches.get_one::("detached").unwrap().clone(), - ); - if let Err(e) = fs::create_dir_all(home_directory_path).await { panic!("failed to create home directory: {:?}", e); } @@ -342,7 +340,6 @@ async fn main() { &home_directory_path, our_ip.to_string(), http_server_port.clone(), - rpc_url.clone(), on_testnet, // true if testnet mode ) .await @@ -588,7 +585,8 @@ async fn main() { if let Some(rpc_url) = rpc_url { tasks.spawn(eth::provider::provider( our.name.clone(), - rpc_url.clone(), + eth_provider, + public, kernel_message_sender.clone(), eth_provider_receiver, print_sender.clone(), diff --git a/kinode/src/net/mod.rs b/kinode/src/net/mod.rs index a565759c0..88b46e386 100644 --- a/kinode/src/net/mod.rs +++ b/kinode/src/net/mod.rs @@ -14,12 +14,14 @@ use { }, }; -#[cfg(not(feature = "simulation-mode"))] +//#[cfg(not(feature = "simulation-mode"))] mod types; #[cfg(not(feature = "simulation-mode"))] mod utils; +//#[cfg(not(feature = "simulation-mode"))] +pub use crate::net::types::*; #[cfg(not(feature = "simulation-mode"))] -pub use crate::net::{types::*, utils::*}; +pub use crate::net::utils::*; #[cfg(not(feature = "simulation-mode"))] use lib::types::core::*; From 98464d5e6077378f904b24436a61b48093283bd4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 01:11:36 +0000 Subject: [PATCH 089/171] Format Rust code using rustfmt --- kinode/src/main.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/kinode/src/main.rs b/kinode/src/main.rs index ae5626c76..1a168a10f 100644 --- a/kinode/src/main.rs +++ b/kinode/src/main.rs @@ -203,7 +203,6 @@ async fn main() { matches.get_one::("detached").unwrap().clone(), ); - type ProviderInput = lib::eth::ProviderInput; let eth_provider: ProviderInput; From 561a3742e04271c4a4e406f075c5aba321bede67 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Fri, 16 Feb 2024 12:29:32 -0300 Subject: [PATCH 090/171] nits --- kinode/src/eth/provider.rs | 2 +- kinode/src/main.rs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/kinode/src/eth/provider.rs b/kinode/src/eth/provider.rs index 4c56e761e..d34893abe 100644 --- a/kinode/src/eth/provider.rs +++ b/kinode/src/eth/provider.rs @@ -153,7 +153,7 @@ async fn handle_message( } Message::Response(_) => { // handle passthrough responses, send to rsvp. - if km.source.process == ProcessId::from_str("eth:distro:sys").unwrap() { + if km.source.process == "eth:distro:sys" { if let Some(rsvp) = &km.rsvp { let _ = send_to_loop .send(KernelMessage { diff --git a/kinode/src/main.rs b/kinode/src/main.rs index 1a168a10f..bba8f84d8 100644 --- a/kinode/src/main.rs +++ b/kinode/src/main.rs @@ -190,7 +190,7 @@ async fn main() { #[cfg(not(feature = "simulation-mode"))] let (rpc_node, _is_detached) = (matches.get_one::("rpcnode").cloned(), false); - //#[cfg(feature = "simulation-mode")] + #[cfg(feature = "simulation-mode")] let (rpc_url, rpc_node, password, network_router_port, fake_node_name, is_detached) = ( matches.get_one::("rpc"), matches.get_one::("rpcnode"), @@ -320,6 +320,7 @@ async fn main() { "login or register at http://localhost:{}\r", http_server_port ); + #[cfg(not(feature = "simulation-mode"))] let (our, encoded_keyfile, decoded_keyfile) = serve_register_fe( home_directory_path, @@ -328,6 +329,7 @@ async fn main() { on_testnet, // true if testnet mode ) .await; + #[cfg(feature = "simulation-mode")] let (our, encoded_keyfile, decoded_keyfile) = match fake_node_name { None => { From 86bce13cb8743ed1dd719985bfbc6bbbc078908e Mon Sep 17 00:00:00 2001 From: hosted-fornet Date: Fri, 16 Feb 2024 08:49:55 -0800 Subject: [PATCH 091/171] fix: get normal & simulation-mode working --- kinode/src/main.rs | 45 +++++++++++++++++++++------------------------ 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/kinode/src/main.rs b/kinode/src/main.rs index bba8f84d8..44b5f6f7c 100644 --- a/kinode/src/main.rs +++ b/kinode/src/main.rs @@ -141,6 +141,21 @@ async fn main() { }; let on_testnet = *matches.get_one::("testnet").unwrap(); let public = *matches.get_one::("public").unwrap(); + let rpc_url = matches.get_one::("rpc").cloned(); + let rpc_node = matches.get_one::("rpcnode").cloned(); + + #[cfg(not(feature = "simulation-mode"))] + let is_detached = false; + #[cfg(feature = "simulation-mode")] + let (password, network_router_port, fake_node_name, is_detached) = ( + matches.get_one::("password"), + matches + .get_one::("network-router-port") + .unwrap() + .clone(), + matches.get_one::("fake-node-name"), + *matches.get_one::("detached").unwrap(), + ); let contract_address = if on_testnet { register::KNS_SEPOLIA_ADDRESS @@ -185,36 +200,18 @@ async fn main() { } }; - #[cfg(not(feature = "simulation-mode"))] - let (rpc_url, is_detached) = (matches.get_one::("rpc").cloned(), false); - #[cfg(not(feature = "simulation-mode"))] - let (rpc_node, _is_detached) = (matches.get_one::("rpcnode").cloned(), false); - - #[cfg(feature = "simulation-mode")] - let (rpc_url, rpc_node, password, network_router_port, fake_node_name, is_detached) = ( - matches.get_one::("rpc"), - matches.get_one::("rpcnode"), - matches.get_one::("password"), - matches - .get_one::("network-router-port") - .unwrap() - .clone(), - matches.get_one::("fake-node-name"), - matches.get_one::("detached").unwrap().clone(), - ); - type ProviderInput = lib::eth::ProviderInput; let eth_provider: ProviderInput; - match (rpc_url, rpc_node) { + match (rpc_url.clone(), rpc_node) { (Some(url), Some(_)) => { println!("passed both node and url for rpc, using url."); - eth_provider = ProviderInput::Ws(url.clone()); + eth_provider = ProviderInput::Ws(url); } (Some(url), None) => { - eth_provider = ProviderInput::Ws(url.clone()); + eth_provider = ProviderInput::Ws(url); } - (None, Some(node)) => { + (None, Some(ref node)) => { println!("trying to use remote node for rpc: {}", node); eth_provider = ProviderInput::Node(node.clone()); } @@ -336,7 +333,7 @@ async fn main() { match password { None => match rpc_url { None => panic!(""), - Some(rpc_url) => { + Some(ref rpc_url) => { serve_register_fe( &home_directory_path, our_ip.to_string(), @@ -583,7 +580,7 @@ async fn main() { print_sender.clone(), )); #[cfg(feature = "simulation-mode")] - if let Some(rpc_url) = rpc_url { + if let Some(ref rpc_url) = rpc_url { tasks.spawn(eth::provider::provider( our.name.clone(), eth_provider, From a3b8a610283d363d5e725eaf677e2e81bf7bf0da Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Fri, 16 Feb 2024 14:49:50 -0300 Subject: [PATCH 092/171] add testnet/mainnet default providers --- kinode/default_providers_mainnet.json | 29 +++++++++++++++++++ ...rs.json => default_providers_testnet.json} | 2 +- kinode/src/eth/provider.rs | 18 +++++------- kinode/src/main.rs | 11 +++---- 4 files changed, 43 insertions(+), 17 deletions(-) create mode 100644 kinode/default_providers_mainnet.json rename kinode/{default_providers.json => default_providers_testnet.json} (95%) diff --git a/kinode/default_providers_mainnet.json b/kinode/default_providers_mainnet.json new file mode 100644 index 000000000..46f041c27 --- /dev/null +++ b/kinode/default_providers_mainnet.json @@ -0,0 +1,29 @@ +[ + { + "name": "default-router-1.os", + "owner": "", + "node": "0xb35eb347deb896bc3fb6132a07fca1601f83462385ed11e835c24c33ba4ef73d", + "public_key": "0xb1b1cf23c89f651aac3e5fd4decb04aa177ab0ec8ce5f1d3877b90bb6f5779db", + "ip": "147.135.114.167", + "port": 9005, + "routers": [] + }, + { + "name": "default-router-2.os", + "owner": "", + "node": "0xd827ae579fafa604af79fbed977e8abe048497f10885c6473dfd343a3b7b4458", + "public_key": "0xab9f1a996db3a4e1dbcd31d765daedeb3af9af4f570c0968463b5be3a7d1e992", + "ip": "147.135.114.167", + "port": 9006, + "routers": [] + }, + { + "name": "default-router-3.os", + "owner": "", + "node": "0x96e36331c8f0882f2c0c46c13b15d812def04fe8606d503bc0e2be39db26486a", + "public_key": "0x536e30785e64dd0349a697285af365b5ed7c4d300010139261cfc4dbdd5b254b", + "ip": "147.135.114.167", + "port": 9007, + "routers": [] + } +] \ No newline at end of file diff --git a/kinode/default_providers.json b/kinode/default_providers_testnet.json similarity index 95% rename from kinode/default_providers.json rename to kinode/default_providers_testnet.json index 571526b84..af47dce33 100644 --- a/kinode/default_providers.json +++ b/kinode/default_providers_testnet.json @@ -18,7 +18,7 @@ "routers": [] }, { - "name": "default-router-s3.os", + "name": "default-router-3.os", "owner": "", "node": "0x96e36331c8f0882f2c0c46c13b15d812def04fe8606d503bc0e2be39db26486a", "public_key": "0x536e30785e64dd0349a697285af365b5ed7c4d300010139261cfc4dbdd5b254b", diff --git a/kinode/src/eth/provider.rs b/kinode/src/eth/provider.rs index d34893abe..4f45a605f 100644 --- a/kinode/src/eth/provider.rs +++ b/kinode/src/eth/provider.rs @@ -67,24 +67,20 @@ pub async fn provider( let connections = Arc::new(connections); // add whitelist, logic in provider middleware? - let public = Arc::new(public); - while let Some(km) = recv_in_client.recv().await { // clone Arcs let our = our.clone(); let send_to_loop = send_to_loop.clone(); let provider_config = provider_config.clone(); let connections = connections.clone(); - let public = public.clone(); - tokio::spawn(async move { if let Err(e) = handle_message( &our, &km, &send_to_loop, - provider_config.clone(), - connections.clone(), - public.clone(), + provider_config, + connections, + public, ) .await { @@ -103,7 +99,7 @@ async fn handle_message( send_to_loop: &MessageSender, provider_config: Arc, connections: Arc>>>, - public: Arc, + public: bool, ) -> Result<(), EthError> { match &km.message { Message::Request(req) => { @@ -181,7 +177,7 @@ async fn handle_local_request( send_to_loop: &MessageSender, provider: &Provider, connections: Arc>>>, - public: Arc, + public: bool, ) -> Result<(), EthError> { let Message::Request(req) = &km.message else { return Err(EthError::InvalidMethod( @@ -278,7 +274,7 @@ async fn handle_remote_request( send_to_loop: &MessageSender, provider: Option<&Provider>, connections: Arc>>>, - public: Arc, + public: bool, ) -> Result<(), EthError> { let Message::Request(req) = &km.message else { return Err(EthError::InvalidMethod( @@ -290,7 +286,7 @@ async fn handle_remote_request( // we need some sort of agreement perhaps on rpc providing. // even with an agreement, fake ethsubevents could be sent to us. // light clients could verify blocks perhaps... - if !*public { + if !public { return Err(EthError::PermissionDenied("not on the list.".to_string())); } diff --git a/kinode/src/main.rs b/kinode/src/main.rs index 44b5f6f7c..1cbc710ff 100644 --- a/kinode/src/main.rs +++ b/kinode/src/main.rs @@ -47,7 +47,8 @@ const VERSION: &str = env!("CARGO_PKG_VERSION"); const REVEAL_IP: bool = true; /// default routers as a eth-provider fallback -const DEFAULT_PROVIDERS: &str = include_str!("../default_providers.json"); +const DEFAULT_PROVIDERS_TESTNET: &str = include_str!("../default_providers_testnet.json"); +const DEFAULT_PROVIDERS_MAINNET: &str = include_str!("../default_providers_mainnet.json"); async fn serve_register_fe( home_directory_path: &str, @@ -194,10 +195,10 @@ async fn main() { let default_pki_entries: Vec = match fs::read_to_string(format!("{}/.default_providers", home_directory_path)).await { Ok(contents) => serde_json::from_str(&contents).unwrap(), - Err(_) => { - let defaults: Vec = serde_json::from_str(DEFAULT_PROVIDERS).unwrap(); - defaults - } + Err(_) => match on_testnet { + true => serde_json::from_str(DEFAULT_PROVIDERS_TESTNET).unwrap(), + false => serde_json::from_str(DEFAULT_PROVIDERS_MAINNET).unwrap(), + }, }; type ProviderInput = lib::eth::ProviderInput; From 3726f8325e36fb298b73a66956c8c5de40790157 Mon Sep 17 00:00:00 2001 From: hosted-fornet Date: Fri, 16 Feb 2024 10:54:24 -0800 Subject: [PATCH 093/171] bump kit version --- kinode/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kinode/Cargo.toml b/kinode/Cargo.toml index a713b7d60..c14595431 100644 --- a/kinode/Cargo.toml +++ b/kinode/Cargo.toml @@ -14,7 +14,7 @@ path = "src/main.rs" [build-dependencies] anyhow = "1.0.71" -kit = { git = "https://github.com/kinode-dao/kit", rev = "f96cdaa" } +kit = { git = "https://github.com/kinode-dao/kit", rev = "83d1e86" } rayon = "1.8.1" sha2 = "0.10" tokio = "1.28" From 31d4a685034e28e10edf1b0bd5a6d8c37aa3fbe4 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Fri, 16 Feb 2024 16:46:43 -0300 Subject: [PATCH 094/171] remove old .env.example file, add get_block script for testing --- .env.example | 20 ------------- Cargo.lock | 10 +++++++ Cargo.toml | 2 +- .../packages/kns_indexer/get_block/Cargo.toml | 17 +++++++++++ .../packages/kns_indexer/get_block/src/lib.rs | 29 +++++++++++++++++++ kinode/packages/kns_indexer/pkg/scripts.json | 13 +++++++++ 6 files changed, 70 insertions(+), 21 deletions(-) delete mode 100644 .env.example create mode 100644 kinode/packages/kns_indexer/get_block/Cargo.toml create mode 100644 kinode/packages/kns_indexer/get_block/src/lib.rs create mode 100644 kinode/packages/kns_indexer/pkg/scripts.json diff --git a/.env.example b/.env.example deleted file mode 100644 index 0bf65bf99..000000000 --- a/.env.example +++ /dev/null @@ -1,20 +0,0 @@ -### node filesystem config, adjust according to your needs. -### note, will run with default values if no .env is found. - -### for example, if you use remote s3, you might want to set chunk_size to 5mb, and adjust flush_to_cold_interval - -### Default values automatically set (s3 defaults to None) - -# MEM_BUFFER_LIMIT=5242880 # 5mb -# READ_CACHE_LIMIT=5242880 # 5mb -# CHUNK_SIZE=262144 # 256kb -# FLUSH_TO_COLD_INTERVAL=60 # 60s -# ENCRYPTION=true # true -# CLOUD_ENABLED=false # false, controls whether new writes will be to s3 or local - -### Example s3 config -# S3_ACCESS_KEY=minioadmin -# S3_SECRET__KEY=minioadmin -# S3_REGION=eu-north-1 -# S3_BUCKET=mylittlebucket -# S3_ENDPOINT=http://localhost:9000 diff --git a/Cargo.lock b/Cargo.lock index aaf5b4869..affc5680e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1963,6 +1963,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "get_block" +version = "0.1.0" +dependencies = [ + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=3232423)", + "serde", + "serde_json", + "wit-bindgen", +] + [[package]] name = "getrandom" version = "0.2.12" diff --git a/Cargo.toml b/Cargo.toml index 5e8178580..cbd8822cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ members = [ "kinode/packages/app_store/download", "kinode/packages/app_store/install", "kinode/packages/app_store/uninstall", "kinode/packages/chess/chess", "kinode/packages/homepage/homepage", - "kinode/packages/kns_indexer/kns_indexer", + "kinode/packages/kns_indexer/kns_indexer", "kinode/packages/kns_indexer/get_block", "kinode/packages/terminal/terminal", "kinode/packages/terminal/alias", "kinode/packages/terminal/cat", "kinode/packages/terminal/echo", "kinode/packages/terminal/hi", "kinode/packages/terminal/m", "kinode/packages/terminal/top", "kinode/packages/tester/tester", "kinode/packages/tester/test_runner", diff --git a/kinode/packages/kns_indexer/get_block/Cargo.toml b/kinode/packages/kns_indexer/get_block/Cargo.toml new file mode 100644 index 000000000..c604f349e --- /dev/null +++ b/kinode/packages/kns_indexer/get_block/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "get_block" +version = "0.1.0" +edition = "2021" + + +[dependencies] +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "3232423" } +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +wit-bindgen = { git = "https://github.com/bytecodealliance/wit-bindgen", rev = "21a46c7" } + +[lib] +crate-type = ["cdylib"] + +[package.metadata.component] +package = "kinode:process" diff --git a/kinode/packages/kns_indexer/get_block/src/lib.rs b/kinode/packages/kns_indexer/get_block/src/lib.rs new file mode 100644 index 000000000..61a0e9f0b --- /dev/null +++ b/kinode/packages/kns_indexer/get_block/src/lib.rs @@ -0,0 +1,29 @@ +use kinode_process_lib::{ + await_next_request_body, call_init, eth::get_block_number, println, Address, Request, SendError, +}; + +wit_bindgen::generate!({ + path: "wit", + world: "process", + exports: { + world: Component, + }, +}); + +call_init!(init); + +fn init(our: Address) { + let Ok(_args) = await_next_request_body() else { + println!("get_block: failed to get args, aborting"); + return; + }; + + match get_block_number() { + Ok(block_number) => { + println!("latest block number: {block_number}"); + } + Err(e) => { + println!("get_block: failed to get block number: {}", e); + } + } +} diff --git a/kinode/packages/kns_indexer/pkg/scripts.json b/kinode/packages/kns_indexer/pkg/scripts.json new file mode 100644 index 000000000..8d4119cab --- /dev/null +++ b/kinode/packages/kns_indexer/pkg/scripts.json @@ -0,0 +1,13 @@ +{ + "get_block.wasm": { + "root": false, + "public": false, + "request_networking": false, + "request_capabilities": [ + "eth:distro:sys" + ], + "grant_capabilities": [ + "eth:distro:sys" + ] + } +} \ No newline at end of file From b52768d1799966692a45927dea74f92af543af79 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Sat, 17 Feb 2024 19:34:29 -0300 Subject: [PATCH 095/171] WIP: multi-provider model --- kinode/src/eth/provider.rs | 724 ++++++++++++++++++------------------- kinode/src/kernel/mod.rs | 8 +- kinode/src/main.rs | 84 ++--- kinode/src/net/types.rs | 35 +- lib/src/core.rs | 36 ++ lib/src/eth.rs | 18 +- lib/src/net.rs | 0 7 files changed, 444 insertions(+), 461 deletions(-) create mode 100644 lib/src/net.rs diff --git a/kinode/src/eth/provider.rs b/kinode/src/eth/provider.rs index 4f45a605f..24935fa28 100644 --- a/kinode/src/eth/provider.rs +++ b/kinode/src/eth/provider.rs @@ -7,389 +7,383 @@ use anyhow::Result; use dashmap::DashMap; use lib::types::core::*; use lib::types::eth::*; +use serde::{Deserialize, Serialize}; use std::str::FromStr; use std::sync::Arc; use tokio::task::JoinHandle; use url::Url; -/// Provider config. Can currently be a node or a ws provider instance. -/// Future: add chainId configs, several nodes and fallbacks. -pub enum ProviderConfig { - Node(String), - Provider(Provider), -} - /// The ETH provider runtime process is responsible for connecting to one or more ETH RPC providers -/// and using them to service indexing requests from other apps. This could also be done by a wasm +/// and using them to service indexing requests from other apps. This could also be done by a Wasm /// app, but in the future, this process will hopefully expand in scope to perform more complex /// indexing and ETH node responsibilities. pub async fn provider( our: String, - provider_node: ProviderInput, - public: bool, + configs: SavedConfigs, send_to_loop: MessageSender, mut recv_in_client: MessageReceiver, - _print_tx: PrintSender, + print_tx: PrintSender, ) -> Result<()> { let our = Arc::new(our); - // Initialize the provider conditionally based on rpc_url - // Todo: make provider support multiple transports, one direct and another passthrough. - let provider_config = match provider_node { - ProviderInput::Ws(rpc_url) => { - // Validate and parse the WebSocket URL - match Url::parse(&rpc_url)?.scheme() { - "ws" | "wss" => { - let connector = WsConnect { - url: rpc_url, - auth: None, - }; - let client = ClientBuilder::default().ws(connector).await?; - ProviderConfig::Provider(Provider::new_with_client(client)) - } - _ => { - return Err(anyhow::anyhow!( - "Only `ws://` or `wss://` URLs are supported." - )) - } - } - } - ProviderInput::Node(node_id) => { - // Directly use the node ID - ProviderConfig::Node(node_id) - } - }; - - let provider_config = Arc::new(provider_config); - - // handles of longrunning subscriptions. - let connections: DashMap<(ProcessId, u64), JoinHandle>> = DashMap::new(); - let connections = Arc::new(connections); - - // add whitelist, logic in provider middleware? - while let Some(km) = recv_in_client.recv().await { - // clone Arcs - let our = our.clone(); - let send_to_loop = send_to_loop.clone(); - let provider_config = provider_config.clone(); - let connections = connections.clone(); - tokio::spawn(async move { - if let Err(e) = handle_message( - &our, - &km, - &send_to_loop, - provider_config, - connections, - public, - ) - .await - { - let _ = send_to_loop - .send(make_error_message(our.to_string(), km, e)) - .await; - }; - }); - } + // // Initialize the provider conditionally based on rpc_url + // // Todo: make provider support multiple transports, one direct and another passthrough. + // let provider_config = match provider_node { + // ProviderInput::Ws(rpc_url) => { + // // Validate and parse the WebSocket URL + // match Url::parse(&rpc_url)?.scheme() { + // "ws" | "wss" => { + // let connector = WsConnect { + // url: rpc_url, + // auth: None, + // }; + // let client = ClientBuilder::default().ws(connector).await?; + // ProviderConfig::Provider(Provider::new_with_client(client)) + // } + // _ => { + // return Err(anyhow::anyhow!( + // "Only `ws://` or `wss://` URLs are supported." + // )) + // } + // } + // } + // ProviderInput::Node(node_id) => { + // // Directly use the node ID + // ProviderConfig::Node(node_id) + // } + // }; + + // let provider_config = Arc::new(provider_config); + + // // handles of longrunning subscriptions. + // let connections: DashMap<(ProcessId, u64), JoinHandle>> = DashMap::new(); + // let connections = Arc::new(connections); + + // while let Some(km) = recv_in_client.recv().await { + // // clone Arcs + // let our = our.clone(); + // let send_to_loop = send_to_loop.clone(); + // let provider_config = provider_config.clone(); + // let connections = connections.clone(); + // tokio::spawn(async move { + // if let Err(e) = handle_message( + // &our, + // &km, + // &send_to_loop, + // provider_config, + // connections, + // public, + // ) + // .await + // { + // let _ = send_to_loop + // .send(make_error_message(our.to_string(), km, e)) + // .await; + // }; + // }); + // } Err(anyhow::anyhow!("eth: fatal: message receiver closed!")) } -async fn handle_message( - our: &str, - km: &KernelMessage, - send_to_loop: &MessageSender, - provider_config: Arc, - connections: Arc>>>, - public: bool, -) -> Result<(), EthError> { - match &km.message { - Message::Request(req) => { - match &*provider_config { - ProviderConfig::Node(node) => { - if km.source.node == our { - // we have no provider, let's send this request to someone who has one. - let request = KernelMessage { - id: km.id, - source: Address { - node: our.to_string(), - process: ETH_PROCESS_ID.clone(), - }, - target: Address { - node: "jugodenaranja.os".to_string(), - process: ETH_PROCESS_ID.clone(), - }, - rsvp: Some(km.source.clone()), - message: Message::Request(req.clone()), - lazy_load_blob: None, - }; - - let _ = send_to_loop.send(request).await; - } else { - // either someone asking us for rpc, or we are passing through a sub event. - handle_remote_request(our, km, send_to_loop, None, connections, public) - .await? - } - } - ProviderConfig::Provider(provider) => { - if km.source.node == our { - handle_local_request(our, km, send_to_loop, &provider, connections, public) - .await? - } else { - handle_remote_request( - our, - km, - send_to_loop, - Some(provider), - connections, - public, - ) - .await? - } - } - } - } - Message::Response(_) => { - // handle passthrough responses, send to rsvp. - if km.source.process == "eth:distro:sys" { - if let Some(rsvp) = &km.rsvp { - let _ = send_to_loop - .send(KernelMessage { - id: rand::random(), - source: Address { - node: our.to_string(), - process: ETH_PROCESS_ID.clone(), - }, - target: rsvp.clone(), - rsvp: None, - message: km.message.clone(), - lazy_load_blob: None, - }) - .await; - } - } - } - } - Ok(()) -} - -async fn handle_local_request( - our: &str, - km: &KernelMessage, - send_to_loop: &MessageSender, - provider: &Provider, - connections: Arc>>>, - public: bool, -) -> Result<(), EthError> { - let Message::Request(req) = &km.message else { - return Err(EthError::InvalidMethod( - "eth: only accepts requests".to_string(), - )); - }; - let action = serde_json::from_slice::(&req.body).map_err(|e| { - EthError::InvalidMethod(format!("eth: failed to deserialize request: {:?}", e)) - })?; - - // we might want some of these in payloads.. sub items? - let return_body: EthResponse = match action { - EthAction::SubscribeLogs { - sub_id, - kind, - params, - } => { - let sub_id = (km.target.process.clone(), sub_id); - - let kind = serde_json::to_value(&kind).unwrap(); - let params = serde_json::to_value(¶ms).unwrap(); - - let id = provider - .inner() - .prepare("eth_subscribe", [kind, params]) - .await - .map_err(|e| EthError::TransportError(e.to_string()))?; - - let rx = provider.inner().get_raw_subscription(id).await; - let handle = tokio::spawn(handle_subscription_stream( - our.to_string(), - sub_id.1.clone(), - rx, - km.source.clone(), - km.rsvp.clone(), - send_to_loop.clone(), - )); - - connections.insert(sub_id, handle); - EthResponse::Ok - } - EthAction::UnsubscribeLogs(sub_id) => { - let sub_id = (km.target.process.clone(), sub_id); - let handle = connections - .remove(&sub_id) - .ok_or(EthError::SubscriptionNotFound)?; - - handle.1.abort(); - EthResponse::Ok - } - EthAction::Request { method, params } => { - let method = to_static_str(&method).ok_or(EthError::InvalidMethod(method))?; - - let response: serde_json::Value = provider - .inner() - .prepare(method, params) - .await - .map_err(|e| EthError::TransportError(e.to_string()))?; - EthResponse::Response { value: response } - } - }; - if let Some(_) = req.expects_response { - let _ = send_to_loop - .send(KernelMessage { - id: km.id, - source: Address { - node: our.to_string(), - process: ETH_PROCESS_ID.clone(), - }, - target: km.source.clone(), - rsvp: km.rsvp.clone(), - message: Message::Response(( - Response { - inherit: false, - body: serde_json::to_vec(&return_body).unwrap(), - metadata: req.metadata.clone(), - capabilities: vec![], - }, - None, - )), - lazy_load_blob: None, - }) - .await; - } - - Ok(()) -} - -// here we are either processing another nodes request. -// or we are passing through an ethSub Request.. -async fn handle_remote_request( - our: &str, - km: &KernelMessage, - send_to_loop: &MessageSender, - provider: Option<&Provider>, - connections: Arc>>>, - public: bool, -) -> Result<(), EthError> { - let Message::Request(req) = &km.message else { - return Err(EthError::InvalidMethod( - "eth: only accepts requests".to_string(), - )); - }; - - if let Some(provider) = provider { - // we need some sort of agreement perhaps on rpc providing. - // even with an agreement, fake ethsubevents could be sent to us. - // light clients could verify blocks perhaps... - if !public { - return Err(EthError::PermissionDenied("not on the list.".to_string())); - } - - let action = serde_json::from_slice::(&req.body).map_err(|e| { - EthError::InvalidMethod(format!("eth: failed to deserialize request: {:?}", e)) - })?; - - let return_body: EthResponse = match action { - EthAction::SubscribeLogs { - sub_id, - kind, - params, - } => { - let sub_id = (km.target.process.clone(), sub_id); - - let kind = serde_json::to_value(&kind).unwrap(); - let params = serde_json::to_value(¶ms).unwrap(); - - let id = provider - .inner() - .prepare("eth_subscribe", [kind, params]) - .await - .map_err(|e| EthError::TransportError(e.to_string()))?; - - let rx = provider.inner().get_raw_subscription(id).await; - let handle = tokio::spawn(handle_subscription_stream( - our.to_string(), - sub_id.1.clone(), - rx, - km.target.clone(), - km.rsvp.clone(), - send_to_loop.clone(), - )); - - connections.insert(sub_id, handle); - EthResponse::Ok - } - EthAction::UnsubscribeLogs(sub_id) => { - let sub_id = (km.target.process.clone(), sub_id); - let handle = connections - .remove(&sub_id) - .ok_or(EthError::SubscriptionNotFound)?; - - handle.1.abort(); - EthResponse::Ok - } - EthAction::Request { method, params } => { - let method = to_static_str(&method).ok_or(EthError::InvalidMethod(method))?; - - let response: serde_json::Value = provider - .inner() - .prepare(method, params) - .await - .map_err(|e| EthError::TransportError(e.to_string()))?; - - EthResponse::Response { value: response } - } - }; - - let response = KernelMessage { - id: km.id, - source: Address { - node: our.to_string(), - process: ETH_PROCESS_ID.clone(), - }, - target: km.source.clone(), - rsvp: km.rsvp.clone(), - message: Message::Response(( - Response { - inherit: false, - body: serde_json::to_vec(&return_body).unwrap(), - metadata: req.metadata.clone(), - capabilities: vec![], - }, - None, - )), - lazy_load_blob: None, - }; - - let _ = send_to_loop.send(response).await; - } else { - // We do not have a provider, this is a reply for a request made by us. - if let Ok(eth_sub) = serde_json::from_slice::(&req.body) { - // forward... - if let Some(target) = km.rsvp.clone() { - let _ = send_to_loop - .send(KernelMessage { - id: rand::random(), - source: Address { - node: our.to_string(), - process: ETH_PROCESS_ID.clone(), - }, - target: target, - rsvp: None, - message: Message::Request(req.clone()), - lazy_load_blob: None, - }) - .await; - } - } - } - Ok(()) -} +/// Handle an incoming message. +// async fn handle_message( +// our: &str, +// km: &KernelMessage, +// send_to_loop: &MessageSender, +// provider_config: Arc, +// connections: Arc>>>, +// public: bool, +// ) -> Result<(), EthError> { +// match &km.message { +// Message::Request(req) => { +// match &*provider_config { +// ProviderConfig::Node(node) => { +// if km.source.node == our { +// // we have no provider, let's send this request to someone who has one. +// let request = KernelMessage { +// id: km.id, +// source: Address { +// node: our.to_string(), +// process: ETH_PROCESS_ID.clone(), +// }, +// target: Address { +// node: "jugodenaranja.os".to_string(), +// process: ETH_PROCESS_ID.clone(), +// }, +// rsvp: Some(km.source.clone()), +// message: Message::Request(req.clone()), +// lazy_load_blob: None, +// }; + +// let _ = send_to_loop.send(request).await; +// } else { +// // either someone asking us for rpc, or we are passing through a sub event. +// handle_remote_request(our, km, send_to_loop, None, connections, public) +// .await? +// } +// } +// ProviderConfig::Provider(provider) => { +// if km.source.node == our { +// handle_local_request(our, km, send_to_loop, &provider, connections, public) +// .await? +// } else { +// handle_remote_request( +// our, +// km, +// send_to_loop, +// Some(provider), +// connections, +// public, +// ) +// .await? +// } +// } +// } +// } +// Message::Response(_) => { +// // handle passthrough responses, send to rsvp. +// if km.source.process == "eth:distro:sys" { +// if let Some(rsvp) = &km.rsvp { +// let _ = send_to_loop +// .send(KernelMessage { +// id: rand::random(), +// source: Address { +// node: our.to_string(), +// process: ETH_PROCESS_ID.clone(), +// }, +// target: rsvp.clone(), +// rsvp: None, +// message: km.message.clone(), +// lazy_load_blob: None, +// }) +// .await; +// } +// } +// } +// } +// Ok(()) +// } + +/// Handle a local request. +// async fn handle_local_request( +// our: &str, +// km: &KernelMessage, +// send_to_loop: &MessageSender, +// provider: &Provider, +// connections: Arc>>>, +// public: bool, +// ) -> Result<(), EthError> { +// let Message::Request(req) = &km.message else { +// return Err(EthError::InvalidMethod( +// "eth: only accepts requests".to_string(), +// )); +// }; +// let action = serde_json::from_slice::(&req.body).map_err(|e| { +// EthError::InvalidMethod(format!("eth: failed to deserialize request: {:?}", e)) +// })?; + +// // we might want some of these in payloads.. sub items? +// let return_body: EthResponse = match action { +// EthAction::SubscribeLogs { +// sub_id, +// kind, +// params, +// } => { +// let sub_id = (km.target.process.clone(), sub_id); + +// let kind = serde_json::to_value(&kind).unwrap(); +// let params = serde_json::to_value(¶ms).unwrap(); + +// let id = provider +// .inner() +// .prepare("eth_subscribe", [kind, params]) +// .await +// .map_err(|e| EthError::TransportError(e.to_string()))?; + +// let rx = provider.inner().get_raw_subscription(id).await; +// let handle = tokio::spawn(handle_subscription_stream( +// our.to_string(), +// sub_id.1.clone(), +// rx, +// km.source.clone(), +// km.rsvp.clone(), +// send_to_loop.clone(), +// )); + +// connections.insert(sub_id, handle); +// EthResponse::Ok +// } +// EthAction::UnsubscribeLogs(sub_id) => { +// let sub_id = (km.target.process.clone(), sub_id); +// let handle = connections +// .remove(&sub_id) +// .ok_or(EthError::SubscriptionNotFound)?; + +// handle.1.abort(); +// EthResponse::Ok +// } +// EthAction::Request { method, params } => { +// let method = to_static_str(&method).ok_or(EthError::InvalidMethod(method))?; + +// let response: serde_json::Value = provider +// .inner() +// .prepare(method, params) +// .await +// .map_err(|e| EthError::TransportError(e.to_string()))?; +// EthResponse::Response { value: response } +// } +// }; +// if let Some(_) = req.expects_response { +// let _ = send_to_loop +// .send(KernelMessage { +// id: km.id, +// source: Address { +// node: our.to_string(), +// process: ETH_PROCESS_ID.clone(), +// }, +// target: km.source.clone(), +// rsvp: km.rsvp.clone(), +// message: Message::Response(( +// Response { +// inherit: false, +// body: serde_json::to_vec(&return_body).unwrap(), +// metadata: req.metadata.clone(), +// capabilities: vec![], +// }, +// None, +// )), +// lazy_load_blob: None, +// }) +// .await; +// } + +// Ok(()) +// } + +/// here we are either processing another nodes request. +/// or we are passing through an ethSub Request.. +// async fn handle_remote_request( +// our: &str, +// km: &KernelMessage, +// send_to_loop: &MessageSender, +// provider: Option<&Provider>, +// connections: Arc>>>, +// public: bool, +// ) -> Result<(), EthError> { +// let Message::Request(req) = &km.message else { +// return Err(EthError::InvalidMethod( +// "eth: only accepts requests".to_string(), +// )); +// }; + +// if let Some(provider) = provider { +// // we need some sort of agreement perhaps on rpc providing. +// // even with an agreement, fake ethsubevents could be sent to us. +// // light clients could verify blocks perhaps... +// if !public { +// return Err(EthError::PermissionDenied("not on the list.".to_string())); +// } + +// let action = serde_json::from_slice::(&req.body).map_err(|e| { +// EthError::InvalidMethod(format!("eth: failed to deserialize request: {:?}", e)) +// })?; + +// let return_body: EthResponse = match action { +// EthAction::SubscribeLogs { +// sub_id, +// kind, +// params, +// } => { +// let sub_id = (km.target.process.clone(), sub_id); + +// let kind = serde_json::to_value(&kind).unwrap(); +// let params = serde_json::to_value(¶ms).unwrap(); + +// let id = provider +// .inner() +// .prepare("eth_subscribe", [kind, params]) +// .await +// .map_err(|e| EthError::TransportError(e.to_string()))?; + +// let rx = provider.inner().get_raw_subscription(id).await; +// let handle = tokio::spawn(handle_subscription_stream( +// our.to_string(), +// sub_id.1.clone(), +// rx, +// km.target.clone(), +// km.rsvp.clone(), +// send_to_loop.clone(), +// )); + +// connections.insert(sub_id, handle); +// EthResponse::Ok +// } +// EthAction::UnsubscribeLogs(sub_id) => { +// let sub_id = (km.target.process.clone(), sub_id); +// let handle = connections +// .remove(&sub_id) +// .ok_or(EthError::SubscriptionNotFound)?; + +// handle.1.abort(); +// EthResponse::Ok +// } +// EthAction::Request { method, params } => { +// let method = to_static_str(&method).ok_or(EthError::InvalidMethod(method))?; + +// let response: serde_json::Value = provider +// .inner() +// .prepare(method, params) +// .await +// .map_err(|e| EthError::TransportError(e.to_string()))?; + +// EthResponse::Response { value: response } +// } +// }; + +// let response = KernelMessage { +// id: km.id, +// source: Address { +// node: our.to_string(), +// process: ETH_PROCESS_ID.clone(), +// }, +// target: km.source.clone(), +// rsvp: km.rsvp.clone(), +// message: Message::Response(( +// Response { +// inherit: false, +// body: serde_json::to_vec(&return_body).unwrap(), +// metadata: req.metadata.clone(), +// capabilities: vec![], +// }, +// None, +// )), +// lazy_load_blob: None, +// }; + +// let _ = send_to_loop.send(response).await; +// } else { +// // We do not have a provider, this is a reply for a request made by us. +// if let Ok(eth_sub) = serde_json::from_slice::(&req.body) { +// // forward... +// if let Some(target) = km.rsvp.clone() { +// let _ = send_to_loop +// .send(KernelMessage { +// id: rand::random(), +// source: Address { +// node: our.to_string(), +// process: ETH_PROCESS_ID.clone(), +// }, +// target: target, +// rsvp: None, +// message: Message::Request(req.clone()), +// lazy_load_blob: None, +// }) +// .await; +// } +// } +// } +// Ok(()) +// } /// Executed as a long-lived task. The JoinHandle is stored in the `connections` map. /// This task is responsible for connecting to the ETH RPC provider and streaming logs diff --git a/kinode/src/kernel/mod.rs b/kinode/src/kernel/mod.rs index 574afd641..608af0c72 100644 --- a/kinode/src/kernel/mod.rs +++ b/kinode/src/kernel/mod.rs @@ -672,7 +672,7 @@ pub async fn kernel( home_directory_path: String, contract_address: String, runtime_extensions: Vec<(t::ProcessId, t::MessageSender, bool)>, - default_pki_entries: Vec, + default_pki_entries: Vec, ) -> Result<()> { let mut config = Config::new(); config.cache_config_load_default().unwrap(); @@ -844,10 +844,8 @@ pub async fn kernel( message: t::Message::Request(t::Request { inherit: false, expects_response: None, - body: rmp_serde::to_vec(&crate::net::NetActions::KnsBatchUpdate( - default_pki_entries, - )) - .unwrap(), + body: rmp_serde::to_vec(&t::NetActions::KnsBatchUpdate(default_pki_entries)) + .unwrap(), metadata: None, capabilities: vec![], }), diff --git a/kinode/src/main.rs b/kinode/src/main.rs index 1cbc710ff..7c04d97e0 100644 --- a/kinode/src/main.rs +++ b/kinode/src/main.rs @@ -2,17 +2,14 @@ use anyhow::Result; use clap::{arg, value_parser, Command}; -use rand::seq::SliceRandom; +use lib::types::core::*; +#[cfg(feature = "simulation-mode")] +use ring::{rand::SystemRandom, signature, signature::KeyPair}; use std::env; use std::sync::Arc; use tokio::sync::{mpsc, oneshot}; use tokio::{fs, time::timeout}; -use lib::types::core::*; - -#[cfg(feature = "simulation-mode")] -use ring::{rand::SystemRandom, signature, signature::KeyPair}; - mod eth; mod http; mod kernel; @@ -110,14 +107,7 @@ async fn main() { arg!(--testnet "If set, use Sepolia testnet") .default_value("false") .value_parser(value_parser!(bool)), - ) - .arg( - arg!(--public "If set, allow rpc passthrough") - .default_value("false") - .value_parser(value_parser!(bool)), - ) - .arg(arg!(--rpcnode "RPC node provider must be a valid address").required(false)) - .arg(arg!(--rpc "Ethereum RPC endpoint (must be wss://)").required(false)); + ); #[cfg(feature = "simulation-mode")] let app = app @@ -141,9 +131,6 @@ async fn main() { None => (8080, false), }; let on_testnet = *matches.get_one::("testnet").unwrap(); - let public = *matches.get_one::("public").unwrap(); - let rpc_url = matches.get_one::("rpc").cloned(); - let rpc_node = matches.get_one::("rpcnode").cloned(); #[cfg(not(feature = "simulation-mode"))] let is_detached = false; @@ -190,47 +177,24 @@ async fn main() { } } + if let Err(e) = fs::create_dir_all(home_directory_path).await { + panic!("failed to create home directory: {:?}", e); + } + println!("home at {}\r", home_directory_path); + // default eth providers/routers - type KnsUpdate = crate::net::KnsUpdate; - let default_pki_entries: Vec = - match fs::read_to_string(format!("{}/.default_providers", home_directory_path)).await { - Ok(contents) => serde_json::from_str(&contents).unwrap(), + let eth_provider_config: lib::eth::SavedConfigs = + match fs::read_to_string(format!("{}/.saved_providers", home_directory_path)).await { + Ok(contents) => { + println!("loaded saved providers\r"); + serde_json::from_str(&contents).unwrap() + } Err(_) => match on_testnet { true => serde_json::from_str(DEFAULT_PROVIDERS_TESTNET).unwrap(), false => serde_json::from_str(DEFAULT_PROVIDERS_MAINNET).unwrap(), }, }; - type ProviderInput = lib::eth::ProviderInput; - let eth_provider: ProviderInput; - - match (rpc_url.clone(), rpc_node) { - (Some(url), Some(_)) => { - println!("passed both node and url for rpc, using url."); - eth_provider = ProviderInput::Ws(url); - } - (Some(url), None) => { - eth_provider = ProviderInput::Ws(url); - } - (None, Some(ref node)) => { - println!("trying to use remote node for rpc: {}", node); - eth_provider = ProviderInput::Node(node.clone()); - } - (None, None) => { - let random_provider = default_pki_entries.choose(&mut rand::thread_rng()).unwrap(); - let default_provider = random_provider.name.clone(); - - println!("no rpc provided, using a default: {}", default_provider); - - eth_provider = ProviderInput::Node(default_provider); - } - } - - if let Err(e) = fs::create_dir_all(home_directory_path).await { - panic!("failed to create home directory: {:?}", e); - } - println!("home at {}\r", home_directory_path); - // kernel receives system messages via this channel, all other modules send messages let (kernel_message_sender, kernel_message_receiver): (MessageSender, MessageReceiver) = mpsc::channel(EVENT_LOOP_CHANNEL_CAPACITY); @@ -502,7 +466,20 @@ async fn main() { home_directory_path.clone(), contract_address.to_string(), runtime_extensions, - default_pki_entries, + // from saved eth provider config, filter for node identities which will be + // bootstrapped into the networking module, so that this node can start + // getting PKI info ("bootstrap") + eth_provider_config + .clone() + .into_iter() + .filter_map(|config| { + if let lib::eth::NodeOrRpcUrl::Node(kns_update) = config.provider { + Some(kns_update) + } else { + None + } + }) + .collect(), )); #[cfg(not(feature = "simulation-mode"))] tasks.spawn(net::networking( @@ -574,8 +551,7 @@ async fn main() { #[cfg(not(feature = "simulation-mode"))] tasks.spawn(eth::provider::provider( our.name.clone(), - eth_provider, - public, + eth_provider_config, kernel_message_sender.clone(), eth_provider_receiver, print_sender.clone(), diff --git a/kinode/src/net/types.rs b/kinode/src/net/types.rs index fd8f11571..da850cfa0 100644 --- a/kinode/src/net/types.rs +++ b/kinode/src/net/types.rs @@ -1,5 +1,6 @@ use dashmap::DashMap; use futures::stream::{SplitSink, SplitStream}; +use lib::types::core::*; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::sync::Arc; @@ -7,8 +8,6 @@ use tokio::net::TcpStream; use tokio::sync::mpsc::UnboundedSender; use tokio_tungstenite::{tungstenite, MaybeTlsStream, WebSocketStream}; -use lib::types::core::*; - /// Sent to a node when you want to connect directly to them. /// Sent in the 'e, ee, s, es' and 's, se' phases of XX noise protocol pattern. #[derive(Debug, Deserialize, Serialize)] @@ -86,35 +85,3 @@ pub struct Peer { pub routing_for: bool, pub sender: UnboundedSender, } - -/// Must be parsed from message pack vector. -#[derive(Clone, Debug, Serialize, Deserialize)] -pub enum NetActions { - /// Received from a router of ours when they have a new pending passthrough for us. - /// We should respond (if we desire) by using them to initialize a routed connection - /// with the NodeId given. - ConnectionRequest(NodeId), - /// can only receive from trusted source, for now just ourselves locally, - /// in the future could get from remote provider - KnsUpdate(KnsUpdate), - KnsBatchUpdate(Vec), -} - -/// For now, only sent in response to a ConnectionRequest. -/// Must be parsed from message pack vector -#[derive(Clone, Debug, Serialize, Deserialize)] -pub enum NetResponses { - Accepted(NodeId), - Rejected(NodeId), -} - -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct KnsUpdate { - pub name: String, // actual username / domain name - pub owner: String, - pub node: String, // hex namehash of node - pub public_key: String, - pub ip: String, - pub port: u16, - pub routers: Vec, -} diff --git a/lib/src/core.rs b/lib/src/core.rs index bfbd8203a..a3fc37695 100644 --- a/lib/src/core.rs +++ b/lib/src/core.rs @@ -1522,3 +1522,39 @@ pub enum TimerAction { Debug, SetTimer(u64), } + +// +// networking protocol types +// + +/// Must be parsed from message pack vector. +#[derive(Clone, Debug, Serialize, Deserialize)] +pub enum NetActions { + /// Received from a router of ours when they have a new pending passthrough for us. + /// We should respond (if we desire) by using them to initialize a routed connection + /// with the NodeId given. + ConnectionRequest(NodeId), + /// can only receive from trusted source, for now just ourselves locally, + /// in the future could get from remote provider + KnsUpdate(KnsUpdate), + KnsBatchUpdate(Vec), +} + +/// For now, only sent in response to a ConnectionRequest. +/// Must be parsed from message pack vector +#[derive(Clone, Debug, Serialize, Deserialize)] +pub enum NetResponses { + Accepted(NodeId), + Rejected(NodeId), +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct KnsUpdate { + pub name: String, // actual username / domain name + pub owner: String, + pub node: String, // hex namehash of node + pub public_key: String, + pub ip: String, + pub port: u16, + pub routers: Vec, +} diff --git a/lib/src/eth.rs b/lib/src/eth.rs index e36564b96..58a3addc9 100644 --- a/lib/src/eth.rs +++ b/lib/src/eth.rs @@ -103,7 +103,19 @@ pub fn to_static_str(method: &str) -> Option<&'static str> { } } -pub enum ProviderInput { - Ws(String), - Node(String), +pub type SavedConfigs = Vec; + +/// Provider config. Can currently be a node or a ws provider instance. +#[derive(Clone, Debug, Deserialize, Serialize)] +pub struct ProviderConfig { + pub chain_id: u64, + pub usable: bool, + pub trusted: bool, + pub provider: NodeOrRpcUrl, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub enum NodeOrRpcUrl { + Node(crate::core::KnsUpdate), + RpcUrl(String), } diff --git a/lib/src/net.rs b/lib/src/net.rs new file mode 100644 index 000000000..e69de29bb From 75b187787287477fba8638f73edf1a910f37acaa Mon Sep 17 00:00:00 2001 From: OdinsBadEye Date: Mon, 19 Feb 2024 11:04:33 +0000 Subject: [PATCH 096/171] Updated packages with new IncomingHttpRequest (#257) --- Cargo.lock | 4 +- .../app_store/app_store/src/http_api.rs | 107 ++++++++++-------- kinode/packages/chess/chess/Cargo.toml | 2 +- kinode/packages/chess/chess/src/lib.rs | 5 +- 4 files changed, 65 insertions(+), 53 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aaf5b4869..5a80dfed9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -956,7 +956,7 @@ dependencies = [ "anyhow", "base64 0.13.1", "bincode", - "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=12bf9ee)", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?rev=3232423)", "pleco", "serde", "serde_json", @@ -2679,7 +2679,7 @@ dependencies = [ [[package]] name = "kit" version = "0.1.0" -source = "git+https://github.com/kinode-dao/kit?rev=f96cdaa#f96cdaa022ec8d0ff675bce3b92bd436236881ea" +source = "git+https://github.com/kinode-dao/kit?rev=83d1e86#83d1e86203f5a7d239c7d89aa0375167f1af6cdc" dependencies = [ "anyhow", "autocontext", diff --git a/kinode/packages/app_store/app_store/src/http_api.rs b/kinode/packages/app_store/app_store/src/http_api.rs index 65953bf59..c5b607499 100644 --- a/kinode/packages/app_store/app_store/src/http_api.rs +++ b/kinode/packages/app_store/app_store/src/http_api.rs @@ -47,6 +47,15 @@ pub fn handle_http_request( Ok(()) } +fn get_package_id(url_params: &HashMap) -> anyhow::Result { + let Some(package_id) = url_params.get("id") else { + return Err(anyhow::anyhow!("Missing id")); + }; + + let id = package_id.parse::()?; + Ok(id) +} + fn gen_package_info( id: &PackageId, listing: Option<&PackageListing>, @@ -94,23 +103,10 @@ fn serve_paths( requested_packages: &mut HashMap, req: &IncomingHttpRequest, ) -> anyhow::Result<(StatusCode, Option>, Vec)> { - let path = req.path()?; let method = req.method()?; - // TODO get rid of this workaround when we change `IncomingHttpRequest` - let bound_path: &str = if path.ends_with("auto-update") { - "/apps/:id/auto-update" - } else if path.ends_with("mirror") { - "/apps/:id/mirror" - } else if path.ends_with("caps") { - "/apps/:id/caps" - } else if path.starts_with("/apps/listed/") { - "/apps/listed/:id" - } else if &path == "/apps/listed" || &path == "/apps" { - &path - } else { - "/apps/:id" - }; + let bound_path: &str = req.bound_path(Some(&our.process.to_string())); + let url_params = req.url_params(); // print_to_terminal(0, &format!("HTTP {method} {path} {bound_path}")); @@ -121,7 +117,7 @@ fn serve_paths( return Ok(( StatusCode::METHOD_NOT_ALLOWED, None, - format!("Invalid method {method} for {path}").into_bytes(), + format!("Invalid method {method} for {bound_path}").into_bytes(), )); } let all: Vec = state @@ -140,7 +136,7 @@ fn serve_paths( return Ok(( StatusCode::METHOD_NOT_ALLOWED, None, - format!("Invalid method {method} for {path}").into_bytes(), + format!("Invalid method {method} for {bound_path}").into_bytes(), )); } let all: Vec = state @@ -159,11 +155,14 @@ fn serve_paths( // update a downloaded app: PUT // uninstall/delete a downloaded app: DELETE "/apps/:id" => { - let package_id = path - .split("/") - .last() - .unwrap_or_default() - .parse::()?; + let Ok(package_id) = get_package_id(url_params) else { + return Ok(( + StatusCode::BAD_REQUEST, + None, + format!("Missing id").into_bytes(), + )); + }; + match method { Method::GET => { let Some(pkg) = state.downloaded_packages.get(&package_id) else { @@ -234,18 +233,21 @@ fn serve_paths( _ => Ok(( StatusCode::METHOD_NOT_ALLOWED, None, - format!("Invalid method {method} for {path}").into_bytes(), + format!("Invalid method {method} for {bound_path}").into_bytes(), )), } } // GET detail about a specific listed app // download a listed app: POST "/apps/listed/:id" => { - let package_id = path - .split("/") - .last() - .unwrap_or_default() - .parse::()?; + let Ok(package_id) = get_package_id(url_params) else { + return Ok(( + StatusCode::BAD_REQUEST, + None, + format!("Missing id").into_bytes(), + )); + }; + match method { Method::GET => { let Some(listing) = state.get_listing(&package_id) else { @@ -318,18 +320,21 @@ fn serve_paths( _ => Ok(( StatusCode::METHOD_NOT_ALLOWED, None, - format!("Invalid method {method} for {path}").into_bytes(), + format!("Invalid method {method} for {bound_path}").into_bytes(), )), } } // GET caps for a specific downloaded app // approve capabilities for a downloaded app: POST "/apps/:id/caps" => { - let package_id = path - .split("/") - .nth(2) - .unwrap_or_default() - .parse::()?; + let Ok(package_id) = get_package_id(url_params) else { + return Ok(( + StatusCode::BAD_REQUEST, + None, + format!("Missing id").into_bytes(), + )); + }; + match method { // return the capabilities for that app Method::GET => Ok(match crate::fetch_package_manifest(&package_id) { @@ -356,18 +361,21 @@ fn serve_paths( _ => Ok(( StatusCode::METHOD_NOT_ALLOWED, None, - format!("Invalid method {method} for {path}").into_bytes(), + format!("Invalid method {method} for {bound_path}").into_bytes(), )), } } // start mirroring a downloaded app: PUT // stop mirroring a downloaded app: DELETE "/apps/:id/mirror" => { - let package_id = path - .split("/") - .nth(2) - .unwrap_or_default() - .parse::()?; + let Ok(package_id) = get_package_id(url_params) else { + return Ok(( + StatusCode::BAD_REQUEST, + None, + format!("Missing id").into_bytes(), + )); + }; + match method { // start mirroring an app Method::PUT => { @@ -382,18 +390,21 @@ fn serve_paths( _ => Ok(( StatusCode::METHOD_NOT_ALLOWED, None, - format!("Invalid method {method} for {path}").into_bytes(), + format!("Invalid method {method} for {bound_path}").into_bytes(), )), } } // start auto-updating a downloaded app: PUT // stop auto-updating a downloaded app: DELETE "/apps/:id/auto-update" => { - let package_id = path - .split("/") - .nth(2) - .unwrap_or_default() - .parse::()?; + let Ok(package_id) = get_package_id(url_params) else { + return Ok(( + StatusCode::BAD_REQUEST, + None, + format!("Missing id").into_bytes(), + )); + }; + match method { // start auto-updating an app Method::PUT => { @@ -408,14 +419,14 @@ fn serve_paths( _ => Ok(( StatusCode::METHOD_NOT_ALLOWED, None, - format!("Invalid method {method} for {path}").into_bytes(), + format!("Invalid method {method} for {bound_path}").into_bytes(), )), } } _ => Ok(( StatusCode::NOT_FOUND, None, - format!("Path not found: {}", path).into_bytes(), + format!("Path not found: {bound_path}").into_bytes(), )), } } diff --git a/kinode/packages/chess/chess/Cargo.toml b/kinode/packages/chess/chess/Cargo.toml index 7150a9706..385da11d5 100644 --- a/kinode/packages/chess/chess/Cargo.toml +++ b/kinode/packages/chess/chess/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" anyhow = "1.0" base64 = "0.13" bincode = "1.3.3" -kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "12bf9ee" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", rev = "3232423" } pleco = "0.5" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" diff --git a/kinode/packages/chess/chess/src/lib.rs b/kinode/packages/chess/chess/src/lib.rs index 5a02fdfd2..fed53235d 100644 --- a/kinode/packages/chess/chess/src/lib.rs +++ b/kinode/packages/chess/chess/src/lib.rs @@ -193,7 +193,7 @@ fn handle_request(our: &Address, message: &Message, state: &mut ChessState) -> a } } } - http::HttpServerRequest::WebSocketOpen { path, channel_id } => { + http::HttpServerRequest::WebSocketOpen { channel_id, .. } => { // We know this is authenticated and unencrypted because we only // bound one path, the root path. So we know that client // frontend opened a websocket and can send updates @@ -419,7 +419,7 @@ fn handle_http_request( state: &mut ChessState, http_request: &http::IncomingHttpRequest, ) -> anyhow::Result<()> { - if http_request.path()? != "/games" { + if http_request.bound_path(Some(&our.process.to_string())) != "/games" { http::send_response( http::StatusCode::NOT_FOUND, None, @@ -454,6 +454,7 @@ fn handle_http_request( vec![], )); }; + if let Some(game) = state.games.get(game_id) && !game.ended { From 9188fb3beb17c39c7036e187ec31e9fd54e0c1c6 Mon Sep 17 00:00:00 2001 From: OdinsBadEye Date: Mon, 19 Feb 2024 11:15:06 +0000 Subject: [PATCH 097/171] Fix register redirect (#258) --- kinode/packages/homepage/homepage/src/home.html | 5 ++--- kinode/src/register-ui/build/asset-manifest.json | 4 ++-- kinode/src/register-ui/build/index.html | 2 +- .../build/static/js/{main.77d268ea.js => main.084b4a46.js} | 4 ++-- ....77d268ea.js.LICENSE.txt => main.084b4a46.js.LICENSE.txt} | 0 5 files changed, 7 insertions(+), 8 deletions(-) rename kinode/src/register-ui/build/static/js/{main.77d268ea.js => main.084b4a46.js} (98%) rename kinode/src/register-ui/build/static/js/{main.77d268ea.js.LICENSE.txt => main.084b4a46.js.LICENSE.txt} (100%) diff --git a/kinode/packages/homepage/homepage/src/home.html b/kinode/packages/homepage/homepage/src/home.html index 0891248a7..1e28bfcfa 100644 --- a/kinode/packages/homepage/homepage/src/home.html +++ b/kinode/packages/homepage/homepage/src/home.html @@ -178,7 +178,7 @@ a { color: white; - margin-bottom: 2em; + margin-bottom: 1em; } a:visited { @@ -196,9 +196,8 @@

${our} home

Welcome ${our}!

-

Apps:

+

Apps:

App Store -
Chess diff --git a/kinode/src/register-ui/build/asset-manifest.json b/kinode/src/register-ui/build/asset-manifest.json index 04a8b91fe..6f2667c46 100644 --- a/kinode/src/register-ui/build/asset-manifest.json +++ b/kinode/src/register-ui/build/asset-manifest.json @@ -1,12 +1,12 @@ { "files": { "main.css": "/static/css/main.74f501c5.css", - "main.js": "/static/js/main.77d268ea.js", + "main.js": "/static/js/main.084b4a46.js", "static/media/unknown.png": "/static/media/unknown.880d04d4611a45ab1001.png", "index.html": "/index.html" }, "entrypoints": [ "static/css/main.74f501c5.css", - "static/js/main.77d268ea.js" + "static/js/main.084b4a46.js" ] } \ No newline at end of file diff --git a/kinode/src/register-ui/build/index.html b/kinode/src/register-ui/build/index.html index 68242893c..f109445d9 100644 --- a/kinode/src/register-ui/build/index.html +++ b/kinode/src/register-ui/build/index.html @@ -1 +1 @@ -Welcome - Kinode
\ No newline at end of file +Welcome - Kinode
\ No newline at end of file diff --git a/kinode/src/register-ui/build/static/js/main.77d268ea.js b/kinode/src/register-ui/build/static/js/main.084b4a46.js similarity index 98% rename from kinode/src/register-ui/build/static/js/main.77d268ea.js rename to kinode/src/register-ui/build/static/js/main.084b4a46.js index e4ac708fc..f7cdd0330 100644 --- a/kinode/src/register-ui/build/static/js/main.77d268ea.js +++ b/kinode/src/register-ui/build/static/js/main.084b4a46.js @@ -1,2 +1,2 @@ -/*! For license information please see main.77d268ea.js.LICENSE.txt */ -!function(){var e={773:function(e,t,r){"use strict";r.d(t,{i:function(){return n}});var n="abi/5.7.0"},6388:function(e,t,r){"use strict";r.d(t,{R:function(){return B},$:function(){return L}});var n=r(5671),i=r(3144),a=r(2009),o=r(4812),u=r(2735),s=r(773),c=r(62),l=r(136),f=r(9388),h=r(8552),d=function(e){(0,l.Z)(r,e);var t=(0,f.Z)(r);function r(e){return(0,n.Z)(this,r),t.call(this,"address","address",e,!1)}return(0,i.Z)(r,[{key:"defaultValue",value:function(){return"0x0000000000000000000000000000000000000000"}},{key:"encode",value:function(e,t){try{t=(0,h.getAddress)(t)}catch(r){this._throwError(r.message,t)}return e.writeValue(t)}},{key:"decode",value:function(e){return(0,h.getAddress)((0,a.hexZeroPad)(e.readValue().toHexString(),20))}}]),r}(c.XI),p=function(e){(0,l.Z)(r,e);var t=(0,f.Z)(r);function r(e){var i;return(0,n.Z)(this,r),(i=t.call(this,e.name,e.type,void 0,e.dynamic)).coder=e,i}return(0,i.Z)(r,[{key:"defaultValue",value:function(){return this.coder.defaultValue()}},{key:"encode",value:function(e,t){return this.coder.encode(e,t)}},{key:"decode",value:function(e){return this.coder.decode(e)}}]),r}(c.XI),m=new u.Logger(s.i);function v(e,t,r){var n=null;if(Array.isArray(r))n=r;else if(r&&"object"===typeof r){var i={};n=t.map((function(e){var t=e.localName;return t||m.throwError("cannot encode object for signature with missing names",u.Logger.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),i[t]&&m.throwError("cannot encode object for signature with duplicate names",u.Logger.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),i[t]=!0,r[t]}))}else m.throwArgumentError("invalid tuple value","tuple",r);t.length!==n.length&&m.throwArgumentError("types/value length mismatch","tuple",r);var a=new c.QV(e.wordSize),o=new c.QV(e.wordSize),s=[];t.forEach((function(e,t){var r=n[t];if(e.dynamic){var i=o.length;e.encode(o,r);var u=a.writeUpdatableValue();s.push((function(e){u(e+i)}))}else e.encode(a,r)})),s.forEach((function(e){e(a.length)}));var l=e.appendWriter(a);return l+=e.appendWriter(o)}function y(e,t){var r=[],n=e.subReader(0);t.forEach((function(t){var i=null;if(t.dynamic){var a=e.readValue(),o=n.subReader(a.toNumber());try{i=t.decode(o)}catch(s){if(s.code===u.Logger.errors.BUFFER_OVERRUN)throw s;(i=s).baseType=t.name,i.name=t.localName,i.type=t.type}}else try{i=t.decode(e)}catch(s){if(s.code===u.Logger.errors.BUFFER_OVERRUN)throw s;(i=s).baseType=t.name,i.name=t.localName,i.type=t.type}void 0!=i&&r.push(i)}));var i=t.reduce((function(e,t){var r=t.localName;return r&&(e[r]||(e[r]=0),e[r]++),e}),{});t.forEach((function(e,t){var n=e.localName;if(n&&1===i[n]&&("length"===n&&(n="_length"),null==r[n])){var a=r[t];a instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:function(){throw a}}):r[n]=a}}));for(var a=function(){var e=r[o];e instanceof Error&&Object.defineProperty(r,o,{enumerable:!0,get:function(){throw e}})},o=0;o=0?i:"")+"]",s=-1===i||e.dynamic;return(o=t.call(this,"array",u,a,s)).coder=e,o.length=i,o}return(0,i.Z)(r,[{key:"defaultValue",value:function(){for(var e=this.coder.defaultValue(),t=[],r=0;re._data.length&&m.throwError("insufficient data length",u.Logger.errors.BUFFER_OVERRUN,{length:e._data.length,count:t});for(var r=[],n=0;n256||n%8!==0)&&U.throwArgumentError("invalid "+r[1]+" bit length","param",e),new P(n/8,"int"===r[1],e.name)}if(r=e.type.match(R)){var i=parseInt(r[1]);return(0===i||i>32)&&U.throwArgumentError("invalid bytes length","param",e),new E(i,e.name)}return U.throwArgumentError("invalid type","type",e.type)}},{key:"_getWordSize",value:function(){return 32}},{key:"_getReader",value:function(e,t){return new c.Ej(e,this._getWordSize(),this.coerceFunc,t)}},{key:"_getWriter",value:function(){return new c.QV(this._getWordSize())}},{key:"getDefaultValue",value:function(e){var t=this,r=e.map((function(e){return t._getCoder(M._R.from(e))}));return new T(r,"_").defaultValue()}},{key:"encode",value:function(e,t){var r=this;e.length!==t.length&&U.throwError("types/values length mismatch",u.Logger.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});var n=e.map((function(e){return r._getCoder(M._R.from(e))})),i=new T(n,"_"),a=this._getWriter();return i.encode(a,t),a.data}},{key:"decode",value:function(e,t,r){var n=this,i=e.map((function(e){return n._getCoder(M._R.from(e))}));return new T(i,"_").decode(this._getReader((0,a.arrayify)(t),r))}}]),e}(),L=new B},62:function(e,t,r){"use strict";r.d(t,{BR:function(){return f},Ej:function(){return p},QV:function(){return d},XI:function(){return h}});var n=r(5671),i=r(3144),a=r(2009),o=r(9560),u=r(4812),s=r(2735),c=r(773),l=new s.Logger(c.i);function f(e){var t=[];return function e(r,n){if(Array.isArray(n))for(var i in n){var a=r.slice();a.push(i);try{e(a,n[i])}catch(o){t.push({path:a,error:o})}}}([],e),t}var h=function(){function e(t,r,i,a){(0,n.Z)(this,e),this.name=t,this.type=r,this.localName=i,this.dynamic=a}return(0,i.Z)(e,[{key:"_throwError",value:function(e,t){l.throwArgumentError(e,this.localName,t)}}]),e}(),d=function(){function e(t){(0,n.Z)(this,e),(0,u.defineReadOnly)(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}return(0,i.Z)(e,[{key:"data",get:function(){return(0,a.hexConcat)(this._data)}},{key:"length",get:function(){return this._dataLength}},{key:"_writeData",value:function(e){return this._data.push(e),this._dataLength+=e.length,e.length}},{key:"appendWriter",value:function(e){return this._writeData((0,a.concat)(e._data))}},{key:"writeBytes",value:function(e){var t=(0,a.arrayify)(e),r=t.length%this.wordSize;return r&&(t=(0,a.concat)([t,this._padding.slice(r)])),this._writeData(t)}},{key:"_getValue",value:function(e){var t=(0,a.arrayify)(o.O$.from(e));return t.length>this.wordSize&&l.throwError("value out-of-bounds",s.Logger.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=(0,a.concat)([this._padding.slice(t.length%this.wordSize),t])),t}},{key:"writeValue",value:function(e){return this._writeData(this._getValue(e))}},{key:"writeUpdatableValue",value:function(){var e=this,t=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,function(r){e._data[t]=e._getValue(r)}}}]),e}(),p=function(){function e(t,r,i,o){(0,n.Z)(this,e),(0,u.defineReadOnly)(this,"_data",(0,a.arrayify)(t)),(0,u.defineReadOnly)(this,"wordSize",r||32),(0,u.defineReadOnly)(this,"_coerceFunc",i),(0,u.defineReadOnly)(this,"allowLoose",o),this._offset=0}return(0,i.Z)(e,[{key:"data",get:function(){return(0,a.hexlify)(this._data)}},{key:"consumed",get:function(){return this._offset}},{key:"coerce",value:function(t,r){return this._coerceFunc?this._coerceFunc(t,r):e.coerce(t,r)}},{key:"_peekBytes",value:function(e,t,r){var n=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+n>this._data.length&&(this.allowLoose&&r&&this._offset+t<=this._data.length?n=t:l.throwError("data out-of-bounds",s.Logger.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+n})),this._data.slice(this._offset,this._offset+n)}},{key:"subReader",value:function(t){return new e(this._data.slice(this._offset+t),this.wordSize,this._coerceFunc,this.allowLoose)}},{key:"readBytes",value:function(e,t){var r=this._peekBytes(0,e,!!t);return this._offset+=r.length,r.slice(0,e)}},{key:"readValue",value:function(){return o.O$.from(this.readBytes(this.wordSize))}}],[{key:"coerce",value:function(e,t){var r=e.match("^u?int([0-9]+)$");return r&&parseInt(r[1])<=48&&(t=t.toNumber()),t}}]),e}()},7550:function(e,t,r){"use strict";r.d(t,{HY:function(){return k},IC:function(){return O},QV:function(){return x},Xg:function(){return _},YW:function(){return C},_R:function(){return b},pc:function(){return y}});var n=r(136),i=r(9388),a=r(5671),o=r(3144),u=r(9560),s=r(4812),c=r(2735),l=r(773),f=new c.Logger(l.i),h={},d={calldata:!0,memory:!0,storage:!0},p={calldata:!0,memory:!0};function m(e,t){if("bytes"===e||"string"===e){if(d[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&p[t])return!0;return(d[t]||"payable"===t)&&f.throwArgumentError("invalid modifier","name",t),!1}function v(e,t){for(var r in t)(0,s.defineReadOnly)(e,r,t[r])}var y=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),g=new RegExp(/^(.*)\[([0-9]*)\]$/),b=function(){function e(t,r){(0,a.Z)(this,e),t!==h&&f.throwError("use fromString",c.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),v(this,r);var n=this.type.match(g);v(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:e.fromObject({type:n[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}return(0,o.Z)(e,[{key:"format",value:function(e){if(e||(e=y.sighash),y[e]||f.throwArgumentError("invalid format type","format",e),e===y.json){var t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"===typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map((function(t){return JSON.parse(t.format(e))}))),JSON.stringify(t)}var r="";return"array"===this.baseType?(r+=this.arrayChildren.format(e),r+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==y.sighash&&(r+=this.type),r+="("+this.components.map((function(t){return t.format(e)})).join(e===y.full?", ":",")+")"):r+=this.type,e!==y.sighash&&(!0===this.indexed&&(r+=" indexed"),e===y.full&&this.name&&(r+=" "+this.name)),r}}],[{key:"from",value:function(t,r){return"string"===typeof t?e.fromString(t,r):e.fromObject(t)}},{key:"fromObject",value:function(t){return e.isParamType(t)?t:new e(h,{name:t.name||null,type:N(t.type),indexed:null==t.indexed?null:!!t.indexed,components:t.components?t.components.map(e.fromObject):null})}},{key:"fromString",value:function(t,r){return n=function(e,t){var r=e;function n(t){f.throwArgumentError("unexpected character at position ".concat(t),"param",e)}function i(e){var r={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(r.indexed=!1),r}e=e.replace(/\s/g," ");for(var a={type:"",name:"",state:{allowType:!0}},o=a,u=0;u2&&f.throwArgumentError("invalid human-readable ABI signature","value",e),r[1].match(/^[0-9]+$/)||f.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=u.O$.from(r[1]),r[0]):e}function E(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach((function(e){switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+e)}}))}function S(e){var t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&f.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&f.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||f.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&f.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&f.throwArgumentError("unable to determine stateMutability","value",e),t}var _=function(e){(0,n.Z)(r,e);var t=(0,i.Z)(r);function r(){return(0,a.Z)(this,r),t.apply(this,arguments)}return(0,o.Z)(r,[{key:"format",value:function(e){if(e||(e=y.sighash),y[e]||f.throwArgumentError("invalid format type","format",e),e===y.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))}))});e===y.sighash&&f.throwError("cannot format a constructor for sighash",c.Logger.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});var t="constructor("+this.inputs.map((function(t){return t.format(e)})).join(e===y.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}}],[{key:"from",value:function(e){return"string"===typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isConstructorFragment(e))return e;"constructor"!==e.type&&f.throwArgumentError("invalid constructor object","value",e);var t=S(e);t.constant&&f.throwArgumentError("constructor cannot be constant","value",e);var n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(b.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?u.O$.from(e.gas):null};return new r(h,n)}},{key:"fromString",value:function(e){var t={type:"constructor"},n=(e=A(e,t)).match(U);return n&&"constructor"===n[1].trim()||f.throwArgumentError("invalid constructor string","value",e),t.inputs=w(n[2].trim(),!1),E(n[3].trim(),t),r.fromObject(t)}},{key:"isConstructorFragment",value:function(e){return e&&e._isFragment&&"constructor"===e.type}}]),r}(k),C=function(e){(0,n.Z)(r,e);var t=(0,i.Z)(r);function r(){return(0,a.Z)(this,r),t.apply(this,arguments)}return(0,o.Z)(r,[{key:"format",value:function(e){if(e||(e=y.sighash),y[e]||f.throwArgumentError("invalid format type","format",e),e===y.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))})),outputs:this.outputs.map((function(t){return JSON.parse(t.format(e))}))});var t="";return e!==y.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((function(t){return t.format(e)})).join(e===y.full?", ":",")+") ",e!==y.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map((function(t){return t.format(e)})).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}}],[{key:"from",value:function(e){return"string"===typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isFunctionFragment(e))return e;"function"!==e.type&&f.throwArgumentError("invalid function object","value",e);var t=S(e),n={type:e.type,name:M(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(b.fromObject):[],outputs:e.outputs?e.outputs.map(b.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?u.O$.from(e.gas):null};return new r(h,n)}},{key:"fromString",value:function(e){var t={type:"function"},n=(e=A(e,t)).split(" returns ");n.length>2&&f.throwArgumentError("invalid function string","value",e);var i=n[0].match(U);if(i||f.throwArgumentError("invalid function signature","value",e),t.name=i[1].trim(),t.name&&M(t.name),t.inputs=w(i[2],!1),E(i[3].trim(),t),n.length>1){var a=n[1].match(U);""==a[1].trim()&&""==a[3].trim()||f.throwArgumentError("unexpected tokens","value",e),t.outputs=w(a[2],!1)}else t.outputs=[];return r.fromObject(t)}},{key:"isFunctionFragment",value:function(e){return e&&e._isFragment&&"function"===e.type}}]),r}(_);function P(e){var t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||f.throwArgumentError("cannot specify user defined ".concat(t," error"),"fragment",e),e}var O=function(e){(0,n.Z)(r,e);var t=(0,i.Z)(r);function r(){return(0,a.Z)(this,r),t.apply(this,arguments)}return(0,o.Z)(r,[{key:"format",value:function(e){if(e||(e=y.sighash),y[e]||f.throwArgumentError("invalid format type","format",e),e===y.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((function(t){return JSON.parse(t.format(e))}))});var t="";return e!==y.sighash&&(t+="error "),(t+=this.name+"("+this.inputs.map((function(t){return t.format(e)})).join(e===y.full?", ":",")+") ").trim()}}],[{key:"from",value:function(e){return"string"===typeof e?r.fromString(e):r.fromObject(e)}},{key:"fromObject",value:function(e){if(r.isErrorFragment(e))return e;"error"!==e.type&&f.throwArgumentError("invalid error object","value",e);var t={type:e.type,name:M(e.name),inputs:e.inputs?e.inputs.map(b.fromObject):[]};return P(new r(h,t))}},{key:"fromString",value:function(e){var t={type:"error"},n=e.match(U);return n||f.throwArgumentError("invalid error signature","value",e),t.name=n[1].trim(),t.name&&M(t.name),t.inputs=w(n[2],!1),P(r.fromObject(t))}},{key:"isErrorFragment",value:function(e){return e&&e._isFragment&&"error"===e.type}}]),r}(k);function N(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}var T=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function M(e){return e&&e.match(T)||f.throwArgumentError('invalid identifier "'.concat(e,'"'),"value",e),e}var U=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$")},3487:function(e,t,r){"use strict";r.r(t),r.d(t,{AbiCoder:function(){return i.R},ConstructorFragment:function(){return n.Xg},ErrorFragment:function(){return n.IC},EventFragment:function(){return n.QV},FormatTypes:function(){return n.pc},Fragment:function(){return n.HY},FunctionFragment:function(){return n.YW},Indexed:function(){return a.Hk},Interface:function(){return a.vU},LogDescription:function(){return a.CC},ParamType:function(){return n._R},TransactionDescription:function(){return a.vk},checkResultErrors:function(){return o.BR},defaultAbiCoder:function(){return i.$}});var n=r(7550),i=r(6388),a=r(9456),o=r(62)},9456:function(e,t,r){"use strict";r.d(t,{CC:function(){return g},Hk:function(){return k},vU:function(){return E},vk:function(){return b}});var n=r(3144),i=r(5671),a=r(136),o=r(9388),u=r(8552),s=r(9560),c=r(2009),l=r(3358),f=r(1291),h=r(4812),d=r(6388),p=r(7550),m=r(2735),v=r(773),y=new m.Logger(v.i),g=function(e){(0,a.Z)(r,e);var t=(0,o.Z)(r);function r(){return(0,i.Z)(this,r),t.apply(this,arguments)}return(0,n.Z)(r)}(h.Description),b=function(e){(0,a.Z)(r,e);var t=(0,o.Z)(r);function r(){return(0,i.Z)(this,r),t.apply(this,arguments)}return(0,n.Z)(r)}(h.Description),w=function(e){(0,a.Z)(r,e);var t=(0,o.Z)(r);function r(){return(0,i.Z)(this,r),t.apply(this,arguments)}return(0,n.Z)(r)}(h.Description),k=function(e){(0,a.Z)(r,e);var t=(0,o.Z)(r);function r(){return(0,i.Z)(this,r),t.apply(this,arguments)}return(0,n.Z)(r,null,[{key:"isIndexed",value:function(e){return!(!e||!e._isIndexed)}}]),r}(h.Description),x={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function A(e,t){var r=new Error("deferred error during ABI decoding triggered accessing ".concat(e));return r.error=t,r}var E=function(){function e(t){var r=this;(0,i.Z)(this,e);var n=[];n="string"===typeof t?JSON.parse(t):t,(0,h.defineReadOnly)(this,"fragments",n.map((function(e){return p.HY.from(e)})).filter((function(e){return null!=e}))),(0,h.defineReadOnly)(this,"_abiCoder",(0,h.getStatic)(this instanceof e?this.constructor:void 0,"getAbiCoder")()),(0,h.defineReadOnly)(this,"functions",{}),(0,h.defineReadOnly)(this,"errors",{}),(0,h.defineReadOnly)(this,"events",{}),(0,h.defineReadOnly)(this,"structs",{}),this.fragments.forEach((function(e){var t=null;switch(e.type){case"constructor":return r.deploy?void y.warn("duplicate definition - constructor"):void(0,h.defineReadOnly)(r,"deploy",e);case"function":t=r.functions;break;case"event":t=r.events;break;case"error":t=r.errors;break;default:return}var n=e.format();t[n]?y.warn("duplicate definition - "+n):t[n]=e})),this.deploy||(0,h.defineReadOnly)(this,"deploy",p.Xg.from({payable:!1,type:"constructor"})),(0,h.defineReadOnly)(this,"_isInterface",!0)}return(0,n.Z)(e,[{key:"format",value:function(e){e||(e=p.pc.full),e===p.pc.sighash&&y.throwArgumentError("interface does not support formatting sighash","format",e);var t=this.fragments.map((function(t){return t.format(e)}));return e===p.pc.json?JSON.stringify(t.map((function(e){return JSON.parse(e)}))):t}},{key:"getFunction",value:function(e){if((0,c.isHexString)(e)){for(var t in this.functions)if(e===this.getSighash(t))return this.functions[t];y.throwArgumentError("no matching function","sighash",e)}if(-1===e.indexOf("(")){var r=e.trim(),n=Object.keys(this.functions).filter((function(e){return e.split("(")[0]===r}));return 0===n.length?y.throwArgumentError("no matching function","name",r):n.length>1&&y.throwArgumentError("multiple matching functions","name",r),this.functions[n[0]]}var i=this.functions[p.YW.fromString(e).format()];return i||y.throwArgumentError("no matching function","signature",e),i}},{key:"getEvent",value:function(e){if((0,c.isHexString)(e)){var t=e.toLowerCase();for(var r in this.events)if(t===this.getEventTopic(r))return this.events[r];y.throwArgumentError("no matching event","topichash",t)}if(-1===e.indexOf("(")){var n=e.trim(),i=Object.keys(this.events).filter((function(e){return e.split("(")[0]===n}));return 0===i.length?y.throwArgumentError("no matching event","name",n):i.length>1&&y.throwArgumentError("multiple matching events","name",n),this.events[i[0]]}var a=this.events[p.QV.fromString(e).format()];return a||y.throwArgumentError("no matching event","signature",e),a}},{key:"getError",value:function(e){if((0,c.isHexString)(e)){var t=(0,h.getStatic)(this.constructor,"getSighash");for(var r in this.errors){if(e===t(this.errors[r]))return this.errors[r]}y.throwArgumentError("no matching error","sighash",e)}if(-1===e.indexOf("(")){var n=e.trim(),i=Object.keys(this.errors).filter((function(e){return e.split("(")[0]===n}));return 0===i.length?y.throwArgumentError("no matching error","name",n):i.length>1&&y.throwArgumentError("multiple matching errors","name",n),this.errors[i[0]]}var a=this.errors[p.YW.fromString(e).format()];return a||y.throwArgumentError("no matching error","signature",e),a}},{key:"getSighash",value:function(e){if("string"===typeof e)try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch(r){throw t}}return(0,h.getStatic)(this.constructor,"getSighash")(e)}},{key:"getEventTopic",value:function(e){return"string"===typeof e&&(e=this.getEvent(e)),(0,h.getStatic)(this.constructor,"getEventTopic")(e)}},{key:"_decodeParams",value:function(e,t){return this._abiCoder.decode(e,t)}},{key:"_encodeParams",value:function(e,t){return this._abiCoder.encode(e,t)}},{key:"encodeDeploy",value:function(e){return this._encodeParams(this.deploy.inputs,e||[])}},{key:"decodeErrorResult",value:function(e,t){"string"===typeof e&&(e=this.getError(e));var r=(0,c.arrayify)(t);return(0,c.hexlify)(r.slice(0,4))!==this.getSighash(e)&&y.throwArgumentError("data signature does not match error ".concat(e.name,"."),"data",(0,c.hexlify)(r)),this._decodeParams(e.inputs,r.slice(4))}},{key:"encodeErrorResult",value:function(e,t){return"string"===typeof e&&(e=this.getError(e)),(0,c.hexlify)((0,c.concat)([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}},{key:"decodeFunctionData",value:function(e,t){"string"===typeof e&&(e=this.getFunction(e));var r=(0,c.arrayify)(t);return(0,c.hexlify)(r.slice(0,4))!==this.getSighash(e)&&y.throwArgumentError("data signature does not match function ".concat(e.name,"."),"data",(0,c.hexlify)(r)),this._decodeParams(e.inputs,r.slice(4))}},{key:"encodeFunctionData",value:function(e,t){return"string"===typeof e&&(e=this.getFunction(e)),(0,c.hexlify)((0,c.concat)([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}},{key:"decodeFunctionResult",value:function(e,t){"string"===typeof e&&(e=this.getFunction(e));var r=(0,c.arrayify)(t),n=null,i="",a=null,o=null,u=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch(f){}break;case 4:var s=(0,c.hexlify)(r.slice(0,4)),l=x[s];if(l)a=this._abiCoder.decode(l.inputs,r.slice(4)),o=l.name,u=l.signature,l.reason&&(n=a[0]),"Error"===o?i="; VM Exception while processing transaction: reverted with reason string ".concat(JSON.stringify(a[0])):"Panic"===o&&(i="; VM Exception while processing transaction: reverted with panic code ".concat(a[0]));else try{var f=this.getError(s);a=this._abiCoder.decode(f.inputs,r.slice(4)),o=f.name,u=f.format()}catch(f){}}return y.throwError("call revert exception"+i,m.Logger.errors.CALL_EXCEPTION,{method:e.format(),data:(0,c.hexlify)(t),errorArgs:a,errorName:o,errorSignature:u,reason:n})}},{key:"encodeFunctionResult",value:function(e,t){return"string"===typeof e&&(e=this.getFunction(e)),(0,c.hexlify)(this._abiCoder.encode(e.outputs,t||[]))}},{key:"encodeFilterTopics",value:function(e,t){var r=this;"string"===typeof e&&(e=this.getEvent(e)),t.length>e.inputs.length&&y.throwError("too many arguments for "+e.format(),m.Logger.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});var n=[];e.anonymous||n.push(this.getEventTopic(e));var i=function(e,t){return"string"===e.type?(0,l.id)(t):"bytes"===e.type?(0,f.keccak256)((0,c.hexlify)(t)):("bool"===e.type&&"boolean"===typeof t&&(t=t?"0x01":"0x00"),e.type.match(/^u?int/)&&(t=s.O$.from(t).toHexString()),"address"===e.type&&r._abiCoder.encode(["address"],[t]),(0,c.hexZeroPad)((0,c.hexlify)(t),32))};for(t.forEach((function(t,r){var a=e.inputs[r];a.indexed?null==t?n.push(null):"array"===a.baseType||"tuple"===a.baseType?y.throwArgumentError("filtering with tuples or arrays not supported","contract."+a.name,t):Array.isArray(t)?n.push(t.map((function(e){return i(a,e)}))):n.push(i(a,t)):null!=t&&y.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+a.name,t)}));n.length&&null===n[n.length-1];)n.pop();return n}},{key:"encodeEventLog",value:function(e,t){var r=this;"string"===typeof e&&(e=this.getEvent(e));var n=[],i=[],a=[];return e.anonymous||n.push(this.getEventTopic(e)),t.length!==e.inputs.length&&y.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach((function(e,o){var u=t[o];if(e.indexed)if("string"===e.type)n.push((0,l.id)(u));else if("bytes"===e.type)n.push((0,f.keccak256)(u));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");n.push(r._abiCoder.encode([e.type],[u]))}else i.push(e),a.push(u)})),{data:this._abiCoder.encode(i,a),topics:n}}},{key:"decodeEventLog",value:function(e,t,r){if("string"===typeof e&&(e=this.getEvent(e)),null!=r&&!e.anonymous){var n=this.getEventTopic(e);(0,c.isHexString)(r[0],32)&&r[0].toLowerCase()===n||y.throwError("fragment/topic mismatch",m.Logger.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:n,value:r[0]}),r=r.slice(1)}var i=[],a=[],o=[];e.inputs.forEach((function(e,t){e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(i.push(p._R.fromObject({type:"bytes32",name:e.name})),o.push(!0)):(i.push(e),o.push(!1)):(a.push(e),o.push(!1))}));var u=null!=r?this._abiCoder.decode(i,(0,c.concat)(r)):null,s=this._abiCoder.decode(a,t,!0),l=[],f=0,h=0;e.inputs.forEach((function(e,t){if(e.indexed)if(null==u)l[t]=new k({_isIndexed:!0,hash:null});else if(o[t])l[t]=new k({_isIndexed:!0,hash:u[h++]});else try{l[t]=u[h++]}catch(n){l[t]=n}else try{l[t]=s[f++]}catch(n){l[t]=n}if(e.name&&null==l[e.name]){var r=l[t];r instanceof Error?Object.defineProperty(l,e.name,{enumerable:!0,get:function(){throw A("property ".concat(JSON.stringify(e.name)),r)}}):l[e.name]=r}}));for(var d=function(e){var t=l[e];t instanceof Error&&Object.defineProperty(l,e,{enumerable:!0,get:function(){throw A("index ".concat(e),t)}})},v=0;v=0)throw e;return h.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",l.Logger.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,tx:r})}))),null==r.chainId?r.chainId=this.getChainId():r.chainId=Promise.all([Promise.resolve(r.chainId),this.getChainId()]).then((function(t){return 0!==t[1]&&t[0]!==t[1]&&h.throwArgumentError("chainId address mismatch","transaction",e),t[0]})),t.next=23,(0,c.resolveProperties)(r);case 23:return t.abrupt("return",t.sent);case 24:case"end":return t.stop()}}),t,this)})))}},{key:"_checkProvider",value:function(e){this.provider||h.throwError("missing provider",l.Logger.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}}],[{key:"isSigner",value:function(e){return!(!e||!e._isSigner)}}]),e}(),v=function(e){(0,i.Z)(r,e);var t=(0,a.Z)(r);function r(e,i){var a;return(0,u.Z)(this,r),a=t.call(this),(0,c.defineReadOnly)((0,n.Z)(a),"address",e),(0,c.defineReadOnly)((0,n.Z)(a),"provider",i||null),a}return(0,s.Z)(r,[{key:"getAddress",value:function(){return Promise.resolve(this.address)}},{key:"_fail",value:function(e,t){return Promise.resolve().then((function(){h.throwError(e,l.Logger.errors.UNSUPPORTED_OPERATION,{operation:t})}))}},{key:"signMessage",value:function(e){return this._fail("VoidSigner cannot sign messages","signMessage")}},{key:"signTransaction",value:function(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}},{key:"_signTypedData",value:function(e,t,r){return this._fail("VoidSigner cannot sign typed data","signTypedData")}},{key:"connect",value:function(e){return new r(this.address,e)}}]),r}(m)},8552:function(e,t,r){"use strict";r.r(t),r.d(t,{getAddress:function(){return m},getContractAddress:function(){return g},getCreate2Address:function(){return b},getIcapAddress:function(){return y},isAddress:function(){return v}});var n=r(2009),i=r(9560),a=r(1291),o=r(807),u=new(r(2735).Logger)("address/5.7.0");function s(e){(0,n.isHexString)(e,20)||u.throwArgumentError("invalid address","address",e);for(var t=(e=e.toLowerCase()).substring(2).split(""),r=new Uint8Array(40),i=0;i<40;i++)r[i]=t[i].charCodeAt(0);for(var o=(0,n.arrayify)((0,a.keccak256)(r)),s=0;s<40;s+=2)o[s>>1]>>4>=8&&(t[s]=t[s].toUpperCase()),(15&o[s>>1])>=8&&(t[s+1]=t[s+1].toUpperCase());return"0x"+t.join("")}for(var c={},l=0;l<10;l++)c[String(l)]=String(l);for(var f=0;f<26;f++)c[String.fromCharCode(65+f)]=String(10+f);var h,d=Math.floor((h=9007199254740991,Math.log10?Math.log10(h):Math.log(h)/Math.LN10));function p(e){for(var t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((function(e){return c[e]})).join("");t.length>=d;){var r=t.substring(0,d);t=parseInt(r,10)%97+t.substring(r.length)}for(var n=String(98-parseInt(t,10)%97);n.length<2;)n="0"+n;return n}function m(e){var t=null;if("string"!==typeof e&&u.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=s(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&u.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==p(e)&&u.throwArgumentError("bad icap checksum","address",e),t=(0,i.g$)(e.substring(4));t.length<40;)t="0"+t;t=s("0x"+t)}else u.throwArgumentError("invalid address","address",e);return t}function v(e){try{return m(e),!0}catch(t){}return!1}function y(e){for(var t=(0,i.t2)(m(e).substring(2)).toUpperCase();t.length<30;)t="0"+t;return"XE"+p("XE00"+t)+t}function g(e){var t=null;try{t=m(e.from)}catch(s){u.throwArgumentError("missing from address","transaction",e)}var r=(0,n.stripZeros)((0,n.arrayify)(i.O$.from(e.nonce).toHexString()));return m((0,n.hexDataSlice)((0,a.keccak256)((0,o.encode)([t,r])),12))}function b(e,t,r){return 32!==(0,n.hexDataLength)(t)&&u.throwArgumentError("salt must be 32 bytes","salt",t),32!==(0,n.hexDataLength)(r)&&u.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),m((0,n.hexDataSlice)((0,a.keccak256)((0,n.concat)(["0xff",m(e),t,r])),12))}},8853:function(e,t,r){"use strict";r.d(t,{J:function(){return i},c:function(){return a}});var n=r(2009);function i(e){e=atob(e);for(var t=[],r=0;r0;)r.push(i%this.base),i=i/this.base|0}for(var u="",s=0;0===t[s]&&s=0;--c)u+=this.alphabet[r[c]];return u}},{key:"decode",value:function(e){if("string"!==typeof e)throw new TypeError("Expected String");var t=[];if(0===e.length)return new Uint8Array(t);t.push(0);for(var r=0;r>=8;for(;i>0;)t.push(255&i),i>>=8}for(var u=0;e[u]===this._leader&&u0&&(10===arguments[0]?m||(m=!0,f.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?f.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",s.Logger.errors.UNEXPECTED_ARGUMENT,{}):f.throwError("BigNumber.toString does not accept parameters",s.Logger.errors.UNEXPECTED_ARGUMENT,{})),b(this).toString(10)}},{key:"toHexString",value:function(){return this._hex}},{key:"toJSON",value:function(e){return{type:"BigNumber",hex:this.toHexString()}}}],[{key:"from",value:function(t){if(t instanceof e)return t;if("string"===typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new e(h,y(t)):t.match(/^-?[0-9]+$/)?new e(h,y(new l(t))):f.throwArgumentError("invalid BigNumber string","value",t);if("number"===typeof t)return t%1&&w("underflow","BigNumber.from",t),(t>=d||t<=-d)&&w("overflow","BigNumber.from",t),e.from(String(t));var r=t;if("bigint"===typeof r)return e.from(r.toString());if((0,u.isBytes)(r))return e.from((0,u.hexlify)(r));if(r)if(r.toHexString){var n=r.toHexString();if("string"===typeof n)return e.from(n)}else{var i=r._hex;if(null==i&&"BigNumber"===r.type&&(i=r.hex),"string"===typeof i&&((0,u.isHexString)(i)||"-"===i[0]&&(0,u.isHexString)(i.substring(1))))return e.from(i)}return f.throwArgumentError("invalid BigNumber value","value",t)}},{key:"isBigNumber",value:function(e){return!(!e||!e._isBigNumber)}}]),e}();function y(e){if("string"!==typeof e)return y(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&f.throwArgumentError("invalid hex","value",e),"0x00"===(e=y(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function g(e){return v.from(y(e))}function b(e){var t=v.from(e).toHexString();return"-"===t[0]?new l("-"+t.substring(3),16):new l(t.substring(2),16)}function w(e,t,r){var n={fault:e,operation:t};return null!=r&&(n.value=r),f.throwError(e,s.Logger.errors.NUMERIC_FAULT,n)}function k(e){return new l(e,36).toString(16)}function x(e){return new l(e,16).toString(36)}},2009:function(e,t,r){"use strict";r.r(t),r.d(t,{arrayify:function(){return c},concat:function(){return l},hexConcat:function(){return g},hexDataLength:function(){return v},hexDataSlice:function(){return y},hexStripZeros:function(){return w},hexValue:function(){return b},hexZeroPad:function(){return k},hexlify:function(){return m},isBytes:function(){return s},isBytesLike:function(){return o},isHexString:function(){return d},joinSignature:function(){return A},splitSignature:function(){return x},stripZeros:function(){return f},zeroPad:function(){return h}});var n=new(r(2735).Logger)("bytes/5.7.0");function i(e){return!!e.toHexString}function a(e){return e.slice||(e.slice=function(){var t=Array.prototype.slice.call(arguments);return a(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function o(e){return d(e)&&!(e.length%2)||s(e)}function u(e){return"number"===typeof e&&e==e&&e%1===0}function s(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"===typeof e)return!1;if(!u(e.length)||e.length<0)return!1;for(var t=0;t=256)return!1}return!0}function c(e,t){if(t||(t={}),"number"===typeof e){n.checkSafeUint53(e,"invalid arrayify value");for(var r=[];e;)r.unshift(255&e),e=parseInt(String(e/256));return 0===r.length&&r.push(0),a(new Uint8Array(r))}if(t.allowMissingPrefix&&"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),i(e)&&(e=e.toHexString()),d(e)){var o=e.substring(2);o.length%2&&("left"===t.hexPad?o="0"+o:"right"===t.hexPad?o+="0":n.throwArgumentError("hex data is odd-length","value",e));for(var u=[],c=0;ct&&n.throwArgumentError("value out of range","value",arguments[0]);var r=new Uint8Array(t);return r.set(e,t-e.length),a(r)}function d(e,t){return!("string"!==typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}var p="0123456789abcdef";function m(e,t){if(t||(t={}),"number"===typeof e){n.checkSafeUint53(e,"invalid hexlify value");for(var r="";e;)r=p[15&e]+r,e=Math.floor(e/16);return r.length?(r.length%2&&(r="0"+r),"0x"+r):"0x00"}if("bigint"===typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),i(e))return e.toHexString();if(d(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":n.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(s(e)){for(var a="0x",o=0;o>4]+p[15&u]}return a}return n.throwArgumentError("invalid hexlify value","value",e)}function v(e){if("string"!==typeof e)e=m(e);else if(!d(e)||e.length%2)return null;return(e.length-2)/2}function y(e,t,r){return"string"!==typeof e?e=m(e):(!d(e)||e.length%2)&&n.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=r?"0x"+e.substring(t,2+2*r):"0x"+e.substring(t)}function g(e){var t="0x";return e.forEach((function(e){t+=m(e).substring(2)})),t}function b(e){var t=w(m(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function w(e){"string"!==typeof e&&(e=m(e)),d(e)||n.throwArgumentError("invalid hex string","value",e),e=e.substring(2);for(var t=0;t2*t+2&&n.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function x(e){var t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(o(e)){var r=c(e);64===r.length?(t.v=27+(r[32]>>7),r[32]&=127,t.r=m(r.slice(0,32)),t.s=m(r.slice(32,64))):65===r.length?(t.r=m(r.slice(0,32)),t.s=m(r.slice(32,64)),t.v=r[64]):n.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:n.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(r[32]|=128),t._vs=m(r.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){var i=h(c(t._vs),32);t._vs=m(i);var a=i[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=a:t.recoveryParam!==a&&n.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),i[0]&=127;var u=m(i);null==t.s?t.s=u:t.s!==u&&n.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?n.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{var s=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==s&&n.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&d(t.r)?t.r=k(t.r,32):n.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&d(t.s)?t.s=k(t.s,32):n.throwArgumentError("signature missing or invalid s","signature",e);var l=c(t.s);l[0]>=128&&n.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(l[0]|=128);var f=m(l);t._vs&&(d(t._vs)||n.throwArgumentError("signature invalid _vs","signature",e),t._vs=k(t._vs,32)),null==t._vs?t._vs=f:t._vs!==f&&n.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function A(e){return m(l([(e=x(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}},6321:function(e,t,r){"use strict";r.d(t,{Bz:function(){return u},_Y:function(){return a},fh:function(){return o},tL:function(){return i}});var n=r(9560),i=n.O$.from(-1),a=n.O$.from(0),o=n.O$.from(1),u=n.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")},4160:function(e,t,r){"use strict";r.d(t,{R:function(){return n}});var n="0x0000000000000000000000000000000000000000000000000000000000000000"},2069:function(e,t,r){"use strict";r.d(t,{i:function(){return n}});var n="hash/5.7.0"},3358:function(e,t,r){"use strict";r.d(t,{id:function(){return a}});var n=r(1291),i=r(1953);function a(e){return(0,n.keccak256)((0,i.Y0)(e))}},5843:function(e,t,r){"use strict";r.r(t),r.d(t,{_TypedDataEncoder:function(){return o.E},dnsEncode:function(){return i.Kn},ensNormalize:function(){return i.w3},hashMessage:function(){return a.r},id:function(){return n.id},isValidName:function(){return i.r1},messagePrefix:function(){return a.B},namehash:function(){return i.VM}});var n=r(3358),i=r(8565),a=r(8836),o=r(6454)},8836:function(e,t,r){"use strict";r.d(t,{B:function(){return o},r:function(){return u}});var n=r(2009),i=r(1291),a=r(1953),o="\x19Ethereum Signed Message:\n";function u(e){return"string"===typeof e&&(e=(0,a.Y0)(e)),(0,i.keccak256)((0,n.concat)([(0,a.Y0)(o),(0,a.Y0)(String(e.length)),e]))}},8565:function(e,t,r){"use strict";r.d(t,{Kn:function(){return j},w3:function(){return I},r1:function(){return B},VM:function(){return L}});var n=r(2009),i=r(1953),a=r(1291),o=r(2735),u=r(2069),s=r(3433),c=r(7762);function l(e,t){null==t&&(t=1);var r=[],n=r.forEach;return function e(t,i){n.call(t,(function(t){i>0&&Array.isArray(t)?e(t,i-1):r.push(t)}))}(e,t),r}function f(e){return function(e){var t=0;return function(){return e[t++]}}(function(e){var t=0;function r(){return e[t++]<<8|e[t++]}for(var n=r(),i=1,a=[0,1],o=1;o>--c&1}for(var h=Math.pow(2,31),d=h>>>1,p=d>>1,m=h-1,v=0,y=0;y<31;y++)v=v<<1|f();for(var g=[],b=0,w=h;;){for(var k=Math.floor(((v-b+1)*i-1)/w),x=0,A=n;A-x>1;){var E=x+A>>>1;k>>1|f(),S=S<<1^d,_=(_^d)<<1|d|1;b=S,w=1+_-S}var C=n-4;return g.map((function(t){switch(t-C){case 3:return C+65792+(e[s++]<<16|e[s++]<<8|e[s++]);case 2:return C+256+(e[s++]<<8|e[s++]);case 1:return C+e[s++];default:return t-1}}))}(e))}function h(e){return 1&e?~e>>1:e>>1}function d(e,t){for(var r=Array(e),n=0,i=-1;n>=1),check:2==a}}()}(b),E=45,S=95;function _(e){return(0,i.XL)(e)}function C(e){return e.filter((function(e){return 65039!=e}))}function P(e){var t,r=(0,c.Z)(e.split("."));try{for(r.s();!(t=r.n()).done;){var n=t.value,i=_(n);try{for(var a=i.lastIndexOf(S)-1;a>=0;a--)if(i[a]!==S)throw new Error("underscore only allowed at start");if(i.length>=4&&i.every((function(e){return e<128}))&&i[2]===E&&i[3]===E)throw new Error("invalid label extension")}catch(o){throw new Error('Invalid label "'.concat(n,'": ').concat(o.message))}}}catch(o){r.e(o)}finally{r.f()}return e}function O(e){return P(function(e,t){var r=_(e).reverse(),n=[];for(;r.length;){var i=N(r);if(i)n.push.apply(n,(0,s.Z)(t(i)));else{var a=r.pop();if(w.has(a))n.push(a);else if(!k.has(a)){var o=x[a];if(!o)throw new Error("Disallowed codepoint: 0x".concat(a.toString(16).toUpperCase()));n.push.apply(n,(0,s.Z)(o))}}}return P((u=String.fromCodePoint.apply(String,n),u.normalize("NFC")));var u}(e,C))}function N(e,t){var r,n,i,a=A,o=[],u=e.length;t&&(t.length=0);for(var c=function(){var c=e[--u];if(!(a=null===(r=a.branches.find((function(e){return e.set.has(c)})))||void 0===r?void 0:r.node))return 0;if(a.save)i=c;else if(a.check&&c===i)return 0;o.push(c),a.fe0f&&(o.push(65039),u>0&&65039==e[u-1]&&u--),a.valid&&(n=o.slice(),2==a.valid&&n.splice(1,1),t&&t.push.apply(t,(0,s.Z)(e.slice(u).reverse())),e.length=u)};u&&0!==c(););return n}var T=new o.Logger(u.i),M=new Uint8Array(32);function U(e){if(0===e.length)throw new Error("invalid ENS name; empty component");return e}function R(e){var t=(0,i.Y0)(O(e)),r=[];if(0===e.length)return r;for(var n=0,a=0;a=t.length)throw new Error("invalid ENS name; empty component");return r.push(U(t.slice(n))),r}function I(e){return R(e).map((function(e){return(0,i.ZN)(e)})).join(".")}function B(e){try{return 0!==R(e).length}catch(t){}return!1}function L(e){"string"!==typeof e&&T.throwArgumentError("invalid ENS name; not a string","name",e);for(var t=M,r=R(e);r.length;)t=(0,a.keccak256)((0,n.concat)([t,(0,a.keccak256)(r.pop())]));return(0,n.hexlify)(t)}function j(e){return(0,n.hexlify)((0,n.concat)(R(e).map((function(e){if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");var t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t}))))+"00"}M.fill(0)},6454:function(e,t,r){"use strict";r.d(t,{E:function(){return O}});var n=r(4165),i=r(5671),a=r(3144),o=r(8552),u=r(9560),s=r(2009),c=r(1291),l=r(4812),f=r(2735),h=r(2069),d=r(3358),p=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{s(n.next(e))}catch(t){a(t)}}function u(e){try{s(n.throw(e))}catch(t){a(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,u)}s((n=n.apply(e,t||[])).next())}))},m=new f.Logger(h.i),v=new Uint8Array(32);v.fill(0);var y=u.O$.from(-1),g=u.O$.from(0),b=u.O$.from(1),w=u.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var k=(0,s.hexZeroPad)(b.toHexString(),32),x=(0,s.hexZeroPad)(g.toHexString(),32),A={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},E=["name","version","chainId","verifyingContract","salt"];function S(e){return function(t){return"string"!==typeof t&&m.throwArgumentError("invalid domain value for ".concat(JSON.stringify(e)),"domain.".concat(e),t),t}}var _={name:S("name"),version:S("version"),chainId:function(e){try{return u.O$.from(e).toString()}catch(t){}return m.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return(0,o.getAddress)(e).toLowerCase()}catch(t){}return m.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{var t=(0,s.arrayify)(e);if(32!==t.length)throw new Error("bad length");return(0,s.hexlify)(t)}catch(r){}return m.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function C(e){var t=e.match(/^(u?)int(\d*)$/);if(t){var r=""===t[1],n=parseInt(t[2]||"256");(n%8!==0||n>256||t[2]&&t[2]!==String(n))&&m.throwArgumentError("invalid numeric width","type",e);var i=w.mask(r?n-1:n),a=r?i.add(b).mul(y):g;return function(t){var r=u.O$.from(t);return(r.lt(a)||r.gt(i))&&m.throwArgumentError("value out-of-bounds for ".concat(e),"value",t),(0,s.hexZeroPad)(r.toTwos(256).toHexString(),32)}}var l=e.match(/^bytes(\d+)$/);if(l){var f=parseInt(l[1]);return(0===f||f>32||l[1]!==String(f))&&m.throwArgumentError("invalid bytes width","type",e),function(t){return(0,s.arrayify)(t).length!==f&&m.throwArgumentError("invalid length for ".concat(e),"value",t),function(e){var t=(0,s.arrayify)(e),r=t.length%32;return r?(0,s.hexConcat)([t,v.slice(r)]):(0,s.hexlify)(t)}(t)}}switch(e){case"address":return function(e){return(0,s.hexZeroPad)((0,o.getAddress)(e),32)};case"bool":return function(e){return e?k:x};case"bytes":return function(e){return(0,c.keccak256)(e)};case"string":return function(e){return(0,d.id)(e)}}return null}function P(e,t){return"".concat(e,"(").concat(t.map((function(e){var t=e.name;return e.type+" "+t})).join(","),")")}var O=function(){function e(t){(0,i.Z)(this,e),(0,l.defineReadOnly)(this,"types",Object.freeze((0,l.deepCopy)(t))),(0,l.defineReadOnly)(this,"_encoderCache",{}),(0,l.defineReadOnly)(this,"_types",{});var r={},n={},a={};Object.keys(t).forEach((function(e){r[e]={},n[e]=[],a[e]={}}));var o=function(e){var i={};t[e].forEach((function(a){i[a.name]&&m.throwArgumentError("duplicate variable name ".concat(JSON.stringify(a.name)," in ").concat(JSON.stringify(e)),"types",t),i[a.name]=!0;var o=a.type.match(/^([^\x5b]*)(\x5b|$)/)[1];o===e&&m.throwArgumentError("circular type reference to ".concat(JSON.stringify(o)),"types",t),C(o)||(n[o]||m.throwArgumentError("unknown type ".concat(JSON.stringify(o)),"types",t),n[o].push(e),r[e][o]=!0)}))};for(var u in t)o(u);var s=Object.keys(n).filter((function(e){return 0===n[e].length}));for(var c in 0===s.length?m.throwArgumentError("missing primary type","types",t):s.length>1&&m.throwArgumentError("ambiguous primary types or unused types: ".concat(s.map((function(e){return JSON.stringify(e)})).join(", ")),"types",t),(0,l.defineReadOnly)(this,"primaryType",s[0]),function e(i,o){o[i]&&m.throwArgumentError("circular type reference to ".concat(JSON.stringify(i)),"types",t),o[i]=!0,Object.keys(r[i]).forEach((function(t){n[t]&&(e(t,o),Object.keys(o).forEach((function(e){a[e][t]=!0})))})),delete o[i]}(this.primaryType,{}),a){var f=Object.keys(a[c]);f.sort(),this._types[c]=P(c,t[c])+f.map((function(e){return P(e,t[e])})).join("")}}return(0,a.Z)(e,[{key:"getEncoder",value:function(e){var t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}},{key:"_getEncoder",value:function(e){var t=this,r=C(e);if(r)return r;var n=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(n){var i=n[1],a=this.getEncoder(i),o=parseInt(n[3]);return function(e){o>=0&&e.length!==o&&m.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);var r=e.map(a);return t._types[i]&&(r=r.map(c.keccak256)),(0,c.keccak256)((0,s.hexConcat)(r))}}var u=this.types[e];if(u){var l=(0,d.id)(this._types[e]);return function(e){var r=u.map((function(r){var n=r.name,i=r.type,a=t.getEncoder(i)(e[n]);return t._types[i]?(0,c.keccak256)(a):a}));return r.unshift(l),(0,s.hexConcat)(r)}}return m.throwArgumentError("unknown type: ".concat(e),"type",e)}},{key:"encodeType",value:function(e){var t=this._types[e];return t||m.throwArgumentError("unknown type: ".concat(JSON.stringify(e)),"name",e),t}},{key:"encodeData",value:function(e,t){return this.getEncoder(e)(t)}},{key:"hashStruct",value:function(e,t){return(0,c.keccak256)(this.encodeData(e,t))}},{key:"encode",value:function(e){return this.encodeData(this.primaryType,e)}},{key:"hash",value:function(e){return this.hashStruct(this.primaryType,e)}},{key:"_visit",value:function(e,t,r){var n=this;if(C(e))return r(e,t);var i=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(i){var a=i[1],o=parseInt(i[3]);return o>=0&&t.length!==o&&m.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map((function(e){return n._visit(a,e,r)}))}var u=this.types[e];return u?u.reduce((function(e,i){var a=i.name,o=i.type;return e[a]=n._visit(o,t[a],r),e}),{}):m.throwArgumentError("unknown type: ".concat(e),"type",e)}},{key:"visit",value:function(e,t){return this._visit(this.primaryType,e,t)}}],[{key:"from",value:function(t){return new e(t)}},{key:"getPrimaryType",value:function(t){return e.from(t).primaryType}},{key:"hashStruct",value:function(t,r,n){return e.from(r).hashStruct(t,n)}},{key:"hashDomain",value:function(t){var r=[];for(var n in t){var i=A[n];i||m.throwArgumentError("invalid typed-data domain key: ".concat(JSON.stringify(n)),"domain",t),r.push({name:n,type:i})}return r.sort((function(e,t){return E.indexOf(e.name)-E.indexOf(t.name)})),e.hashStruct("EIP712Domain",{EIP712Domain:r},t)}},{key:"encode",value:function(t,r,n){return(0,s.hexConcat)(["0x1901",e.hashDomain(t),e.from(r).hash(n)])}},{key:"hash",value:function(t,r,n){return(0,c.keccak256)(e.encode(t,r,n))}},{key:"resolveNames",value:function(t,r,i,a){return p(this,void 0,void 0,(0,n.Z)().mark((function o(){var u,c,f;return(0,n.Z)().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:t=(0,l.shallowCopy)(t),u={},t.verifyingContract&&!(0,s.isHexString)(t.verifyingContract,20)&&(u[t.verifyingContract]="0x"),(c=e.from(r)).visit(i,(function(e,t){return"address"!==e||(0,s.isHexString)(t,20)||(u[t]="0x"),t})),o.t0=(0,n.Z)().keys(u);case 6:if((o.t1=o.t0()).done){o.next=13;break}return f=o.t1.value,o.next=10,a(f);case 10:u[f]=o.sent,o.next=6;break;case 13:return t.verifyingContract&&u[t.verifyingContract]&&(t.verifyingContract=u[t.verifyingContract]),i=c.visit(i,(function(e,t){return"address"===e&&u[t]?u[t]:t})),o.abrupt("return",{domain:t,value:i});case 16:case"end":return o.stop()}}),o)})))}},{key:"getPayload",value:function(t,r,n){e.hashDomain(t);var i={},a=[];E.forEach((function(e){var r=t[e];null!=r&&(i[e]=_[e](r),a.push({name:e,type:A[e]}))}));var o=e.from(r),c=(0,l.shallowCopy)(r);return c.EIP712Domain?m.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):c.EIP712Domain=a,o.encode(n),{types:c,domain:i,primaryType:o.primaryType,message:o.visit(n,(function(e,t){if(e.match(/^bytes(\d*)/))return(0,s.hexlify)((0,s.arrayify)(t));if(e.match(/^u?int/))return u.O$.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!==typeof t&&m.throwArgumentError("invalid string","value",t),t}return m.throwArgumentError("unsupported type","type",e)}))}}}]),e}()},9590:function(e,t,r){"use strict";r.r(t),r.d(t,{HDNode:function(){return I},defaultPath:function(){return R},entropyToMnemonic:function(){return j},getAccountPath:function(){return D},isValidMnemonic:function(){return F},mnemonicToEntropy:function(){return L},mnemonicToSeed:function(){return B}});var n=r(5671),i=r(3144),a=r(4247),o=r(2009),u=r(9560),s=r(1953),c=r(9716),l=r(4812),f=r(4760),h=r(3984),d=r(8427),p=r(5958),m=r(136),v=r(9388),y=r(3358),g=r(2735),b=new g.Logger("wordlists/5.7.0"),w=function(){function e(t){(0,n.Z)(this,e),b.checkAbstract(this instanceof e?this.constructor:void 0,e),(0,l.defineReadOnly)(this,"locale",t)}return(0,i.Z)(e,[{key:"split",value:function(e){return e.toLowerCase().split(/ +/g)}},{key:"join",value:function(e){return e.join(" ")}}],[{key:"check",value:function(e){for(var t=[],r=0;r<2048;r++){var n=e.getWord(r);if(r!==e.getWordIndex(n))return"0x";t.push(n)}return(0,y.id)(t.join("\n")+"\n")}},{key:"register",value:function(e,t){t||(t=e.locale)}}]),e}(),k=null;function x(e){if(null==k&&(k="AbandonAbilityAbleAboutAboveAbsentAbsorbAbstractAbsurdAbuseAccessAccidentAccountAccuseAchieveAcidAcousticAcquireAcrossActActionActorActressActualAdaptAddAddictAddressAdjustAdmitAdultAdvanceAdviceAerobicAffairAffordAfraidAgainAgeAgentAgreeAheadAimAirAirportAisleAlarmAlbumAlcoholAlertAlienAllAlleyAllowAlmostAloneAlphaAlreadyAlsoAlterAlwaysAmateurAmazingAmongAmountAmusedAnalystAnchorAncientAngerAngleAngryAnimalAnkleAnnounceAnnualAnotherAnswerAntennaAntiqueAnxietyAnyApartApologyAppearAppleApproveAprilArchArcticAreaArenaArgueArmArmedArmorArmyAroundArrangeArrestArriveArrowArtArtefactArtistArtworkAskAspectAssaultAssetAssistAssumeAsthmaAthleteAtomAttackAttendAttitudeAttractAuctionAuditAugustAuntAuthorAutoAutumnAverageAvocadoAvoidAwakeAwareAwayAwesomeAwfulAwkwardAxisBabyBachelorBaconBadgeBagBalanceBalconyBallBambooBananaBannerBarBarelyBargainBarrelBaseBasicBasketBattleBeachBeanBeautyBecauseBecomeBeefBeforeBeginBehaveBehindBelieveBelowBeltBenchBenefitBestBetrayBetterBetweenBeyondBicycleBidBikeBindBiologyBirdBirthBitterBlackBladeBlameBlanketBlastBleakBlessBlindBloodBlossomBlouseBlueBlurBlushBoardBoatBodyBoilBombBoneBonusBookBoostBorderBoringBorrowBossBottomBounceBoxBoyBracketBrainBrandBrassBraveBreadBreezeBrickBridgeBriefBrightBringBriskBroccoliBrokenBronzeBroomBrotherBrownBrushBubbleBuddyBudgetBuffaloBuildBulbBulkBulletBundleBunkerBurdenBurgerBurstBusBusinessBusyButterBuyerBuzzCabbageCabinCableCactusCageCakeCallCalmCameraCampCanCanalCancelCandyCannonCanoeCanvasCanyonCapableCapitalCaptainCarCarbonCardCargoCarpetCarryCartCaseCashCasinoCastleCasualCatCatalogCatchCategoryCattleCaughtCauseCautionCaveCeilingCeleryCementCensusCenturyCerealCertainChairChalkChampionChangeChaosChapterChargeChaseChatCheapCheckCheeseChefCherryChestChickenChiefChildChimneyChoiceChooseChronicChuckleChunkChurnCigarCinnamonCircleCitizenCityCivilClaimClapClarifyClawClayCleanClerkCleverClickClientCliffClimbClinicClipClockClogCloseClothCloudClownClubClumpClusterClutchCoachCoastCoconutCodeCoffeeCoilCoinCollectColorColumnCombineComeComfortComicCommonCompanyConcertConductConfirmCongressConnectConsiderControlConvinceCookCoolCopperCopyCoralCoreCornCorrectCostCottonCouchCountryCoupleCourseCousinCoverCoyoteCrackCradleCraftCramCraneCrashCraterCrawlCrazyCreamCreditCreekCrewCricketCrimeCrispCriticCropCrossCrouchCrowdCrucialCruelCruiseCrumbleCrunchCrushCryCrystalCubeCultureCupCupboardCuriousCurrentCurtainCurveCushionCustomCuteCycleDadDamageDampDanceDangerDaringDashDaughterDawnDayDealDebateDebrisDecadeDecemberDecideDeclineDecorateDecreaseDeerDefenseDefineDefyDegreeDelayDeliverDemandDemiseDenialDentistDenyDepartDependDepositDepthDeputyDeriveDescribeDesertDesignDeskDespairDestroyDetailDetectDevelopDeviceDevoteDiagramDialDiamondDiaryDiceDieselDietDifferDigitalDignityDilemmaDinnerDinosaurDirectDirtDisagreeDiscoverDiseaseDishDismissDisorderDisplayDistanceDivertDivideDivorceDizzyDoctorDocumentDogDollDolphinDomainDonateDonkeyDonorDoorDoseDoubleDoveDraftDragonDramaDrasticDrawDreamDressDriftDrillDrinkDripDriveDropDrumDryDuckDumbDuneDuringDustDutchDutyDwarfDynamicEagerEagleEarlyEarnEarthEasilyEastEasyEchoEcologyEconomyEdgeEditEducateEffortEggEightEitherElbowElderElectricElegantElementElephantElevatorEliteElseEmbarkEmbodyEmbraceEmergeEmotionEmployEmpowerEmptyEnableEnactEndEndlessEndorseEnemyEnergyEnforceEngageEngineEnhanceEnjoyEnlistEnoughEnrichEnrollEnsureEnterEntireEntryEnvelopeEpisodeEqualEquipEraEraseErodeErosionErrorEruptEscapeEssayEssenceEstateEternalEthicsEvidenceEvilEvokeEvolveExactExampleExcessExchangeExciteExcludeExcuseExecuteExerciseExhaustExhibitExileExistExitExoticExpandExpectExpireExplainExposeExpressExtendExtraEyeEyebrowFabricFaceFacultyFadeFaintFaithFallFalseFameFamilyFamousFanFancyFantasyFarmFashionFatFatalFatherFatigueFaultFavoriteFeatureFebruaryFederalFeeFeedFeelFemaleFenceFestivalFetchFeverFewFiberFictionFieldFigureFileFilmFilterFinalFindFineFingerFinishFireFirmFirstFiscalFishFitFitnessFixFlagFlameFlashFlatFlavorFleeFlightFlipFloatFlockFloorFlowerFluidFlushFlyFoamFocusFogFoilFoldFollowFoodFootForceForestForgetForkFortuneForumForwardFossilFosterFoundFoxFragileFrameFrequentFreshFriendFringeFrogFrontFrostFrownFrozenFruitFuelFunFunnyFurnaceFuryFutureGadgetGainGalaxyGalleryGameGapGarageGarbageGardenGarlicGarmentGasGaspGateGatherGaugeGazeGeneralGeniusGenreGentleGenuineGestureGhostGiantGiftGiggleGingerGiraffeGirlGiveGladGlanceGlareGlassGlideGlimpseGlobeGloomGloryGloveGlowGlueGoatGoddessGoldGoodGooseGorillaGospelGossipGovernGownGrabGraceGrainGrantGrapeGrassGravityGreatGreenGridGriefGritGroceryGroupGrowGruntGuardGuessGuideGuiltGuitarGunGymHabitHairHalfHammerHamsterHandHappyHarborHardHarshHarvestHatHaveHawkHazardHeadHealthHeartHeavyHedgehogHeightHelloHelmetHelpHenHeroHiddenHighHillHintHipHireHistoryHobbyHockeyHoldHoleHolidayHollowHomeHoneyHoodHopeHornHorrorHorseHospitalHostHotelHourHoverHubHugeHumanHumbleHumorHundredHungryHuntHurdleHurryHurtHusbandHybridIceIconIdeaIdentifyIdleIgnoreIllIllegalIllnessImageImitateImmenseImmuneImpactImposeImproveImpulseInchIncludeIncomeIncreaseIndexIndicateIndoorIndustryInfantInflictInformInhaleInheritInitialInjectInjuryInmateInnerInnocentInputInquiryInsaneInsectInsideInspireInstallIntactInterestIntoInvestInviteInvolveIronIslandIsolateIssueItemIvoryJacketJaguarJarJazzJealousJeansJellyJewelJobJoinJokeJourneyJoyJudgeJuiceJumpJungleJuniorJunkJustKangarooKeenKeepKetchupKeyKickKidKidneyKindKingdomKissKitKitchenKiteKittenKiwiKneeKnifeKnockKnowLabLabelLaborLadderLadyLakeLampLanguageLaptopLargeLaterLatinLaughLaundryLavaLawLawnLawsuitLayerLazyLeaderLeafLearnLeaveLectureLeftLegLegalLegendLeisureLemonLendLengthLensLeopardLessonLetterLevelLiarLibertyLibraryLicenseLifeLiftLightLikeLimbLimitLinkLionLiquidListLittleLiveLizardLoadLoanLobsterLocalLockLogicLonelyLongLoopLotteryLoudLoungeLoveLoyalLuckyLuggageLumberLunarLunchLuxuryLyricsMachineMadMagicMagnetMaidMailMainMajorMakeMammalManManageMandateMangoMansionManualMapleMarbleMarchMarginMarineMarketMarriageMaskMassMasterMatchMaterialMathMatrixMatterMaximumMazeMeadowMeanMeasureMeatMechanicMedalMediaMelodyMeltMemberMemoryMentionMenuMercyMergeMeritMerryMeshMessageMetalMethodMiddleMidnightMilkMillionMimicMindMinimumMinorMinuteMiracleMirrorMiseryMissMistakeMixMixedMixtureMobileModelModifyMomMomentMonitorMonkeyMonsterMonthMoonMoralMoreMorningMosquitoMotherMotionMotorMountainMouseMoveMovieMuchMuffinMuleMultiplyMuscleMuseumMushroomMusicMustMutualMyselfMysteryMythNaiveNameNapkinNarrowNastyNationNatureNearNeckNeedNegativeNeglectNeitherNephewNerveNestNetNetworkNeutralNeverNewsNextNiceNightNobleNoiseNomineeNoodleNormalNorthNoseNotableNoteNothingNoticeNovelNowNuclearNumberNurseNutOakObeyObjectObligeObscureObserveObtainObviousOccurOceanOctoberOdorOffOfferOfficeOftenOilOkayOldOliveOlympicOmitOnceOneOnionOnlineOnlyOpenOperaOpinionOpposeOptionOrangeOrbitOrchardOrderOrdinaryOrganOrientOriginalOrphanOstrichOtherOutdoorOuterOutputOutsideOvalOvenOverOwnOwnerOxygenOysterOzonePactPaddlePagePairPalacePalmPandaPanelPanicPantherPaperParadeParentParkParrotPartyPassPatchPathPatientPatrolPatternPausePavePaymentPeacePeanutPearPeasantPelicanPenPenaltyPencilPeoplePepperPerfectPermitPersonPetPhonePhotoPhrasePhysicalPianoPicnicPicturePiecePigPigeonPillPilotPinkPioneerPipePistolPitchPizzaPlacePlanetPlasticPlatePlayPleasePledgePluckPlugPlungePoemPoetPointPolarPolePolicePondPonyPoolPopularPortionPositionPossiblePostPotatoPotteryPovertyPowderPowerPracticePraisePredictPreferPreparePresentPrettyPreventPricePridePrimaryPrintPriorityPrisonPrivatePrizeProblemProcessProduceProfitProgramProjectPromoteProofPropertyProsperProtectProudProvidePublicPuddingPullPulpPulsePumpkinPunchPupilPuppyPurchasePurityPurposePursePushPutPuzzlePyramidQualityQuantumQuarterQuestionQuickQuitQuizQuoteRabbitRaccoonRaceRackRadarRadioRailRainRaiseRallyRampRanchRandomRangeRapidRareRateRatherRavenRawRazorReadyRealReasonRebelRebuildRecallReceiveRecipeRecordRecycleReduceReflectReformRefuseRegionRegretRegularRejectRelaxReleaseReliefRelyRemainRememberRemindRemoveRenderRenewRentReopenRepairRepeatReplaceReportRequireRescueResembleResistResourceResponseResultRetireRetreatReturnReunionRevealReviewRewardRhythmRibRibbonRiceRichRideRidgeRifleRightRigidRingRiotRippleRiskRitualRivalRiverRoadRoastRobotRobustRocketRomanceRoofRookieRoomRoseRotateRoughRoundRouteRoyalRubberRudeRugRuleRunRunwayRuralSadSaddleSadnessSafeSailSaladSalmonSalonSaltSaluteSameSampleSandSatisfySatoshiSauceSausageSaveSayScaleScanScareScatterSceneSchemeSchoolScienceScissorsScorpionScoutScrapScreenScriptScrubSeaSearchSeasonSeatSecondSecretSectionSecuritySeedSeekSegmentSelectSellSeminarSeniorSenseSentenceSeriesServiceSessionSettleSetupSevenShadowShaftShallowShareShedShellSheriffShieldShiftShineShipShiverShockShoeShootShopShortShoulderShoveShrimpShrugShuffleShySiblingSickSideSiegeSightSignSilentSilkSillySilverSimilarSimpleSinceSingSirenSisterSituateSixSizeSkateSketchSkiSkillSkinSkirtSkullSlabSlamSleepSlenderSliceSlideSlightSlimSloganSlotSlowSlushSmallSmartSmileSmokeSmoothSnackSnakeSnapSniffSnowSoapSoccerSocialSockSodaSoftSolarSoldierSolidSolutionSolveSomeoneSongSoonSorrySortSoulSoundSoupSourceSouthSpaceSpareSpatialSpawnSpeakSpecialSpeedSpellSpendSphereSpiceSpiderSpikeSpinSpiritSplitSpoilSponsorSpoonSportSpotSpraySpreadSpringSpySquareSqueezeSquirrelStableStadiumStaffStageStairsStampStandStartStateStaySteakSteelStemStepStereoStickStillStingStockStomachStoneStoolStoryStoveStrategyStreetStrikeStrongStruggleStudentStuffStumbleStyleSubjectSubmitSubwaySuccessSuchSuddenSufferSugarSuggestSuitSummerSunSunnySunsetSuperSupplySupremeSureSurfaceSurgeSurpriseSurroundSurveySuspectSustainSwallowSwampSwapSwarmSwearSweetSwiftSwimSwingSwitchSwordSymbolSymptomSyrupSystemTableTackleTagTailTalentTalkTankTapeTargetTaskTasteTattooTaxiTeachTeamTellTenTenantTennisTentTermTestTextThankThatThemeThenTheoryThereTheyThingThisThoughtThreeThriveThrowThumbThunderTicketTideTigerTiltTimberTimeTinyTipTiredTissueTitleToastTobaccoTodayToddlerToeTogetherToiletTokenTomatoTomorrowToneTongueTonightToolToothTopTopicToppleTorchTornadoTortoiseTossTotalTouristTowardTowerTownToyTrackTradeTrafficTragicTrainTransferTrapTrashTravelTrayTreatTreeTrendTrialTribeTrickTriggerTrimTripTrophyTroubleTruckTrueTrulyTrumpetTrustTruthTryTubeTuitionTumbleTunaTunnelTurkeyTurnTurtleTwelveTwentyTwiceTwinTwistTwoTypeTypicalUglyUmbrellaUnableUnawareUncleUncoverUnderUndoUnfairUnfoldUnhappyUniformUniqueUnitUniverseUnknownUnlockUntilUnusualUnveilUpdateUpgradeUpholdUponUpperUpsetUrbanUrgeUsageUseUsedUsefulUselessUsualUtilityVacantVacuumVagueValidValleyValveVanVanishVaporVariousVastVaultVehicleVelvetVendorVentureVenueVerbVerifyVersionVeryVesselVeteranViableVibrantViciousVictoryVideoViewVillageVintageViolinVirtualVirusVisaVisitVisualVitalVividVocalVoiceVoidVolcanoVolumeVoteVoyageWageWagonWaitWalkWallWalnutWantWarfareWarmWarriorWashWaspWasteWaterWaveWayWealthWeaponWearWeaselWeatherWebWeddingWeekendWeirdWelcomeWestWetWhaleWhatWheatWheelWhenWhereWhipWhisperWideWidthWifeWildWillWinWindowWineWingWinkWinnerWinterWireWisdomWiseWishWitnessWolfWomanWonderWoodWoolWordWorkWorldWorryWorthWrapWreckWrestleWristWriteWrongYardYearYellowYouYoungYouthZebraZeroZoneZoo".replace(/([A-Z])/g," $1").toLowerCase().substring(1).split(" "),"0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"!==w.check(e)))throw k=null,new Error("BIP39 Wordlist for en (English) FAILED")}var A=new(function(e){(0,m.Z)(r,e);var t=(0,v.Z)(r);function r(){return(0,n.Z)(this,r),t.call(this,"en")}return(0,i.Z)(r,[{key:"getWord",value:function(e){return x(this),k[e]}},{key:"getWordIndex",value:function(e){return x(this),k.indexOf(e)}}]),r}(w));w.register(A);var E={en:A},S=new g.Logger("hdnode/5.7.0"),_=u.O$.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),C=(0,s.Y0)("Bitcoin seed"),P=2147483648;function O(e){return(1<=256)throw new Error("Depth too large!");return T((0,o.concat)([null!=this.privateKey?"0x0488ADE4":"0x0488B21E",(0,o.hexlify)(this.depth),this.parentFingerprint,(0,o.hexZeroPad)((0,o.hexlify)(this.index),4),this.chainCode,null!=this.privateKey?(0,o.concat)(["0x00",this.privateKey]):this.publicKey]))}},{key:"neuter",value:function(){return new e(U,null,this.publicKey,this.parentFingerprint,this.chainCode,this.index,this.depth,this.path)}},{key:"_derive",value:function(t){if(t>4294967295)throw new Error("invalid index - "+String(t));var r=this.path;r&&(r+="/"+(t&~P));var n=new Uint8Array(37);if(t&P){if(!this.privateKey)throw new Error("cannot derive child of neutered node");n.set((0,o.arrayify)(this.privateKey),1),r&&(r+="'")}else n.set((0,o.arrayify)(this.publicKey));for(var i=24;i>=0;i-=8)n[33+(i>>3)]=t>>24-i&255;var a=(0,o.arrayify)((0,h.Gy)(d.p.sha512,this.chainCode,n)),s=a.slice(0,32),c=a.slice(32),l=null,p=null;this.privateKey?l=N(u.O$.from(s).add(this.privateKey).mod(_)):p=new f.SigningKey((0,o.hexlify)(s))._addPoint(this.publicKey);var m=r,v=this.mnemonic;return v&&(m=Object.freeze({phrase:v.phrase,path:r,locale:v.locale||"en"})),new e(U,l,p,this.fingerprint,N(c),t,this.depth+1,m)}},{key:"derivePath",value:function(e){var t=e.split("/");if(0===t.length||"m"===t[0]&&0!==this.depth)throw new Error("invalid path - "+e);"m"===t[0]&&t.shift();for(var r=this,n=0;n=P)throw new Error("invalid path index - "+i);r=r._derive(P+a)}else{if(!i.match(/^[0-9]+$/))throw new Error("invalid path component - "+i);var o=parseInt(i);if(o>=P)throw new Error("invalid path index - "+i);r=r._derive(o)}}return r}}],[{key:"_fromSeed",value:function(t,r){var n=(0,o.arrayify)(t);if(n.length<16||n.length>64)throw new Error("invalid seed");var i=(0,o.arrayify)((0,h.Gy)(d.p.sha512,C,n));return new e(U,N(i.slice(0,32)),null,"0x00000000",N(i.slice(32)),0,0,r)}},{key:"fromMnemonic",value:function(t,r,n){return t=j(L(t,n=M(n)),n),e._fromSeed(B(t,r),{phrase:t,path:"m",locale:n.locale})}},{key:"fromSeed",value:function(t){return e._fromSeed(t,null)}},{key:"fromExtendedKey",value:function(t){var r=a.Base58.decode(t);82===r.length&&T(r.slice(0,78))===t||S.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");var n=r[4],i=(0,o.hexlify)(r.slice(5,9)),u=parseInt((0,o.hexlify)(r.slice(9,13)).substring(2),16),s=(0,o.hexlify)(r.slice(13,45)),c=r.slice(45,78);switch((0,o.hexlify)(r.slice(0,4))){case"0x0488b21e":case"0x043587cf":return new e(U,null,(0,o.hexlify)(c),i,s,u,n,null);case"0x0488ade4":case"0x04358394 ":if(0!==c[0])break;return new e(U,(0,o.hexlify)(c.slice(1)),null,i,s,u,n,null)}return S.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}]),e}();function B(e,t){t||(t="");var r=(0,s.Y0)("mnemonic"+t,s.Uj.NFKD);return(0,c.n)((0,s.Y0)(e,s.Uj.NFKD),r,2048,64,"sha512")}function L(e,t){t=M(t),S.checkNormalize();var r=t.split(e);if(r.length%3!==0)throw new Error("invalid mnemonic");for(var n=(0,o.arrayify)(new Uint8Array(Math.ceil(11*r.length/8))),i=0,a=0;a>3]|=1<<7-i%8),i++}var c=32*r.length/3,l=O(r.length/3);if(((0,o.arrayify)((0,h.JQ)(n.slice(0,c/8)))[0]&l)!==(n[n.length-1]&l))throw new Error("invalid checksum");return(0,o.hexlify)(n.slice(0,c/8))}function j(e,t){if(t=M(t),(e=(0,o.arrayify)(e)).length%4!==0||e.length<16||e.length>32)throw new Error("invalid entropy");for(var r=[0],n=11,i=0;i8?(r[r.length-1]<<=8,r[r.length-1]|=e[i],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=e[i]>>8-n,r.push(e[i]&(1<<8-n)-1),n+=3);var a=e.length/4,u=(0,o.arrayify)((0,h.JQ)(e))[0]&O(a);return r[r.length-1]<<=a,r[r.length-1]|=u>>8-a,t.join(r.map((function(e){return t.getWord(e)})))}function F(e,t){try{return L(e,t),!0}catch(r){}return!1}function D(e){return("number"!==typeof e||e<0||e>=P||e%1)&&S.throwArgumentError("invalid account index","index",e),"m/44'/60'/".concat(e,"'/0/0")}},5779:function(e,t,r){"use strict";r.d(t,{i:function(){return n}});var n="json-wallets/5.7.0"},5054:function(e,t,r){"use strict";r.r(t),r.d(t,{decryptCrowdsale:function(){return w},decryptJsonWallet:function(){return S},decryptJsonWalletSync:function(){return _},decryptKeystore:function(){return E.pe},decryptKeystoreSync:function(){return E.hb},encryptKeystore:function(){return E.HI},getJsonWalletAddress:function(){return A},isCrowdsaleWallet:function(){return k},isKeystoreWallet:function(){return x}});var n=r(5671),i=r(3144),a=r(136),o=r(9388),u=r(2959),s=r.n(u),c=r(8552),l=r(2009),f=r(1291),h=r(9716),d=r(1953),p=r(4812),m=r(2735),v=r(5779),y=r(7211),g=new m.Logger(v.i),b=function(e){(0,a.Z)(r,e);var t=(0,o.Z)(r);function r(){return(0,n.Z)(this,r),t.apply(this,arguments)}return(0,i.Z)(r,[{key:"isCrowdsaleAccount",value:function(e){return!(!e||!e._isCrowdsaleAccount)}}]),r}(p.Description);function w(e,t){var r=JSON.parse(e);t=(0,y.Ij)(t);var n=(0,c.getAddress)((0,y.gx)(r,"ethaddr")),i=(0,y.p3)((0,y.gx)(r,"encseed"));i&&i.length%16===0||g.throwArgumentError("invalid encseed","json",e);for(var a=(0,l.arrayify)((0,h.n)(t,t,2e3,32,"sha256")).slice(0,16),o=i.slice(0,16),u=i.slice(16),p=new(s().ModeOfOperation.cbc)(a,o),m=s().padding.pkcs7.strip((0,l.arrayify)(p.decrypt(u))),v="",w=0;w255)return!1;return!0}function i(e,t){if(e.buffer&&ArrayBuffer.isView(e)&&"Uint8Array"===e.name)return t&&(e=e.slice?e.slice():Array.prototype.slice.call(e)),e;if(Array.isArray(e)){if(!n(e))throw new Error("Array contains invalid value: "+e);return new Uint8Array(e)}if(r(e.length)&&n(e))return new Uint8Array(e);throw new Error("unsupported array-like object")}function a(e){return new Uint8Array(e)}function o(e,t,r,n,i){null==n&&null==i||(e=e.slice?e.slice(n,i):Array.prototype.slice.call(e,n,i)),t.set(e,r)}var u={toBytes:function(e){var t=[],r=0;for(e=encodeURI(e);r191&&n<224?(t.push(String.fromCharCode((31&n)<<6|63&e[r+1])),r+=2):(t.push(String.fromCharCode((15&n)<<12|(63&e[r+1])<<6|63&e[r+2])),r+=3)}return t.join("")}},s=function(){var e="0123456789abcdef";return{toBytes:function(e){for(var t=[],r=0;r>4]+e[15&i])}return r.join("")}}}(),c={16:10,24:12,32:14},l=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],f=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],h=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],d=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],p=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],m=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],v=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],y=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],g=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],b=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],w=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],k=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],x=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],A=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],E=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function S(e){for(var t=[],r=0;r>2,this._Ke[r][t%4]=a[t],this._Kd[e-r][t%4]=a[t];for(var o,u=0,s=i;s>16&255]<<24^f[o>>8&255]<<16^f[255&o]<<8^f[o>>24&255]^l[u]<<24,u+=1,8!=i)for(t=1;t>8&255]<<8^f[o>>16&255]<<16^f[o>>24&255]<<24;for(t=i/2+1;t>2,d=s%4,this._Ke[h][d]=a[t],this._Kd[e-h][d]=a[t++],s++}for(var h=1;h>24&255]^x[o>>16&255]^A[o>>8&255]^E[255&o]},_.prototype.encrypt=function(e){if(16!=e.length)throw new Error("invalid plaintext size (must be 16 bytes)");for(var t=this._Ke.length-1,r=[0,0,0,0],n=S(e),i=0;i<4;i++)n[i]^=this._Ke[0][i];for(var o=1;o>24&255]^p[n[(i+1)%4]>>16&255]^m[n[(i+2)%4]>>8&255]^v[255&n[(i+3)%4]]^this._Ke[o][i];n=r.slice()}var u,s=a(16);for(i=0;i<4;i++)u=this._Ke[t][i],s[4*i]=255&(f[n[i]>>24&255]^u>>24),s[4*i+1]=255&(f[n[(i+1)%4]>>16&255]^u>>16),s[4*i+2]=255&(f[n[(i+2)%4]>>8&255]^u>>8),s[4*i+3]=255&(f[255&n[(i+3)%4]]^u);return s},_.prototype.decrypt=function(e){if(16!=e.length)throw new Error("invalid ciphertext size (must be 16 bytes)");for(var t=this._Kd.length-1,r=[0,0,0,0],n=S(e),i=0;i<4;i++)n[i]^=this._Kd[0][i];for(var o=1;o>24&255]^g[n[(i+3)%4]>>16&255]^b[n[(i+2)%4]>>8&255]^w[255&n[(i+1)%4]]^this._Kd[o][i];n=r.slice()}var u,s=a(16);for(i=0;i<4;i++)u=this._Kd[t][i],s[4*i]=255&(h[n[i]>>24&255]^u>>24),s[4*i+1]=255&(h[n[(i+3)%4]>>16&255]^u>>16),s[4*i+2]=255&(h[n[(i+2)%4]>>8&255]^u>>8),s[4*i+3]=255&(h[255&n[(i+1)%4]]^u);return s};var C=function e(t){if(!(this instanceof e))throw Error("AES must be instanitated with `new`");this.description="Electronic Code Block",this.name="ecb",this._aes=new _(t)};C.prototype.encrypt=function(e){if((e=i(e)).length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=a(e.length),r=a(16),n=0;n=0;--t)this._counter[t]=e%256,e>>=8},T.prototype.setBytes=function(e){if(16!=(e=i(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},T.prototype.increment=function(){for(var e=15;e>=0;e--){if(255!==this._counter[e]){this._counter[e]++;break}this._counter[e]=0}};var M=function e(t,r){if(!(this instanceof e))throw Error("AES must be instanitated with `new`");this.description="Counter",this.name="ctr",r instanceof T||(r=new T(r)),this._counter=r,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new _(t)};M.prototype.encrypt=function(e){for(var t=i(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,n=0;nu[r]||console.log.apply(console,t)}},{key:"debug",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n>4],r+=d[15&t[a]];i.push(e+"=Uint8Array(0x"+r+")")}else i.push(e+"="+JSON.stringify(t))}catch(c){i.push(e+"="+JSON.stringify(n[e].toString()))}})),i.push("code=".concat(r)),i.push("version=".concat(this.version));var a=t,u="";switch(r){case f.NUMERIC_FAULT:u="NUMERIC_FAULT";var s=t;switch(s){case"overflow":case"underflow":case"division-by-zero":u+="-"+s;break;case"negative-power":case"negative-width":u+="-unsupported";break;case"unbound-bitwise-result":u+="-unbound-result"}break;case f.CALL_EXCEPTION:case f.INSUFFICIENT_FUNDS:case f.MISSING_NEW:case f.NONCE_EXPIRED:case f.REPLACEMENT_UNDERPRICED:case f.TRANSACTION_REPLACED:case f.UNPREDICTABLE_GAS_LIMIT:u=r}u&&(t+=" [ See: https://links.ethers.org/v5-errors-"+u+" ]"),i.length&&(t+=" ("+i.join(", ")+")");var c=new Error(t);return c.reason=a,c.code=r,Object.keys(n).forEach((function(e){c[e]=n[e]})),c}},{key:"throwError",value:function(e,t,r){throw this.makeError(e,t,r)}},{key:"throwArgumentError",value:function(t,r,n){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:r,value:n})}},{key:"assert",value:function(e,t,r,n){e||this.throwError(t,r,n)}},{key:"assertArgument",value:function(e,t,r,n){e||this.throwArgumentError(t,r,n)}},{key:"checkNormalize",value:function(t){null==t&&(t="platform missing String.prototype.normalize"),h&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:h})}},{key:"checkSafeUint53",value:function(t,r){"number"===typeof t&&(null==r&&(r="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(r,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}},{key:"checkArgumentCount",value:function(t,r,n){n=n?": "+n:"",tr&&this.throwError("too many arguments"+n,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:r})}},{key:"checkNew",value:function(t,r){t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}},{key:"checkAbstract",value:function(t,r){t===r?this.throwError("cannot instantiate abstract class "+JSON.stringify(r.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&null!=t||this.throwError("missing new",e.errors.MISSING_NEW,{name:r.name})}}],[{key:"globalLogger",value:function(){return c||(c=new e("logger/5.7.0")),c}},{key:"setCensorship",value:function(t,r){if(!t&&r&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),a){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}o=!!t,a=!!r}},{key:"setLogLevel",value:function(t){var r=u[t.toLowerCase()];null!=r?s=r:e.globalLogger().warn("invalid log level - "+t)}},{key:"from",value:function(t){return new e(t)}}]),e}();p.errors=f,p.levels=l},8133:function(e,t,r){"use strict";r.d(t,{H:function(){return l}});var n=new(r(2735).Logger)("networks/5.7.1");function i(e){var t=function(t,r){null==r&&(r={});var n=[];if(t.InfuraProvider&&"-"!==r.infura)try{n.push(new t.InfuraProvider(e,r.infura))}catch(u){}if(t.EtherscanProvider&&"-"!==r.etherscan)try{n.push(new t.EtherscanProvider(e,r.etherscan))}catch(u){}if(t.AlchemyProvider&&"-"!==r.alchemy)try{n.push(new t.AlchemyProvider(e,r.alchemy))}catch(u){}if(t.PocketProvider&&"-"!==r.pocket){try{var i=new t.PocketProvider(e,r.pocket);i.network&&-1===["goerli","ropsten","rinkeby","sepolia"].indexOf(i.network.name)&&n.push(i)}catch(u){}}if(t.CloudflareProvider&&"-"!==r.cloudflare)try{n.push(new t.CloudflareProvider(e))}catch(u){}if(t.AnkrProvider&&"-"!==r.ankr)try{var a=new t.AnkrProvider(e,r.ankr);a.network&&-1===["ropsten"].indexOf(a.network.name)&&n.push(a)}catch(u){}if(0===n.length)return null;if(t.FallbackProvider){var o=1;return null!=r.quorum?o=r.quorum:"homestead"===e&&(o=2),new t.FallbackProvider(n,o)}return n[0]};return t.renetwork=function(e){return i(e)},t}function a(e,t){var r=function(r,n){return r.JsonRpcProvider?new r.JsonRpcProvider(e,t):null};return r.renetwork=function(t){return a(e,t)},r}var o={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:i("homestead")},u={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:i("ropsten")},s={chainId:63,name:"classicMordor",_defaultProvider:a("https://www.ethercluster.com/mordor","classicMordor")},c={unspecified:{chainId:0,name:"unspecified"},homestead:o,mainnet:o,morden:{chainId:2,name:"morden"},ropsten:u,testnet:u,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:i("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:i("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:i("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:i("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:a("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:s,classicTestnet:s,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:a("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:i("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:i("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};function l(e){if(null==e)return null;if("number"===typeof e){for(var t in c){var r=c[t];if(r.chainId===e)return{name:r.name,chainId:r.chainId,ensAddress:r.ensAddress||null,_defaultProvider:r._defaultProvider||null}}return{chainId:e,name:"unknown"}}if("string"===typeof e){var i=c[e];return null==i?null:{name:i.name,chainId:i.chainId,ensAddress:i.ensAddress,_defaultProvider:i._defaultProvider||null}}var a=c[e.name];if(!a)return"number"!==typeof e.chainId&&n.throwArgumentError("invalid network chainId","network",e),e;0!==e.chainId&&e.chainId!==a.chainId&&n.throwArgumentError("network chainId mismatch","network",e);var o,u=e._defaultProvider||null;return null==u&&a._defaultProvider&&(u=(o=a._defaultProvider)&&"function"===typeof o.renetwork?a._defaultProvider.renetwork(e):a._defaultProvider),{name:e.name,chainId:a.chainId,ensAddress:e.ensAddress||a.ensAddress||null,_defaultProvider:u}}},9716:function(e,t,r){"use strict";r.d(t,{n:function(){return a}});var n=r(2009),i=r(3984);function a(e,t,r,a,o){var u;e=(0,n.arrayify)(e),t=(0,n.arrayify)(t);var s,c,l=1,f=new Uint8Array(a),h=new Uint8Array(t.length+4);h.set(t);for(var d=1;d<=l;d++){h[t.length]=d>>24&255,h[t.length+1]=d>>16&255,h[t.length+2]=d>>8&255,h[t.length+3]=255&d;var p=(0,n.arrayify)((0,i.Gy)(o,e,h));u||(u=p.length,c=new Uint8Array(u),s=a-((l=Math.ceil(a/u))-1)*u),c.set(p);for(var m=1;m0&&null==e[e.length-1];)e.pop();return e.map((function(e){if(Array.isArray(e)){var t={};e.forEach((function(e){t[P(e)]=!0}));var r=Object.keys(t);return r.sort(),r.join("|")}return P(e)})).join("&")}function N(e){if("string"===typeof e){if(e=e.toLowerCase(),32===(0,d.hexDataLength)(e))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter:*:"+O(e);if(c.Sg.isForkEvent(e))throw C.warn("not implemented"),new Error("not implemented");if(e&&"object"===typeof e)return"filter:"+(e.address||"*")+":"+O(e.topics||[])}throw new Error("invalid event - "+e)}function T(){return(new Date).getTime()}function M(e){return new Promise((function(t){setTimeout(t,e)}))}var U=["block","network","pending","poll"],R=function(){function e(t,r,n){(0,u.Z)(this,e),(0,y.defineReadOnly)(this,"tag",t),(0,y.defineReadOnly)(this,"listener",r),(0,y.defineReadOnly)(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}return(0,s.Z)(e,[{key:"event",get:function(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}},{key:"type",get:function(){return this.tag.split(":")[0]}},{key:"hash",get:function(){var e=this.tag.split(":");return"tx"!==e[0]?null:e[1]}},{key:"filter",get:function(){var e=this.tag.split(":");if("filter"!==e[0])return null;var t,r=e[1],n=""===(t=e[2])?[]:t.split(/&/g).map((function(e){if(""===e)return[];var t=e.split("|").map((function(e){return"null"===e?null:e}));return 1===t.length?t[0]:t})),i={};return n.length>0&&(i.topics=n),r&&"*"!==r&&(i.address=r),i}},{key:"pollable",value:function(){return this.tag.indexOf(":")>=0||U.indexOf(this.tag)>=0}}]),e}(),I={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function B(e){return(0,d.hexZeroPad)(h.O$.from(e).toHexString(),32)}function L(e){return f.Base58.encode((0,d.concat)([e,(0,d.hexDataSlice)((0,g.JQ)((0,g.JQ)(e)),0,4)]))}var j=new RegExp("^(ipfs)://(.*)$","i"),F=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),j,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function D(e,t){try{return(0,b.ZN)(z(e,t))}catch(r){}return null}function z(e,t){if("0x"===e)return null;var r=h.O$.from((0,d.hexDataSlice)(e,t,t+32)).toNumber(),n=h.O$.from((0,d.hexDataSlice)(e,r,r+32)).toNumber();return(0,d.hexDataSlice)(e,r+32,r+32+n)}function Z(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):C.throwArgumentError("unsupported IPFS format","link",e),"https://gateway.ipfs.io/ipfs/".concat(e)}function q(e){var t=(0,d.arrayify)(e);if(t.length>32)throw new Error("internal; should not happen");var r=new Uint8Array(32);return r.set(t,32-t.length),r}function H(e){if(e.length%32===0)return e;var t=new Uint8Array(32*Math.ceil(e.length/32));return t.set(e),t}function G(e){for(var t=[],r=0,n=0;n=1&&a<=75)return L((0,d.concat)([[r.p2pkh],"0x"+i[2]]))}}if(null!=r.p2sh){var o=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(o){var u=parseInt(o[1],16);if(o[2].length===2*u&&u>=1&&u<=75)return L((0,d.concat)([[r.p2sh],"0x"+o[2]]))}}if(null!=r.prefix){var s=n[1],c=n[0];if(0===c?20!==s&&32!==s&&(c=-1):c=-1,c>=0&&n.length===2+s&&s>=1&&s<=75){var l=x().toWords(n.slice(2));return l.unshift(c),x().encode(r.prefix,l)}}return null}},{key:"getAddress",value:function(e){return _(this,void 0,void 0,(0,o.Z)().mark((function t(){var r,n,i;return(0,o.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null==e&&(e=60),60!==e){t.next=16;break}return t.prev=2,t.next=5,this._fetch("0x3b3b57de");case 5:if("0x"!==(r=t.sent)&&r!==p.R){t.next=8;break}return t.abrupt("return",null);case 8:return t.abrupt("return",this.provider.formatter.callAddress(r));case 11:if(t.prev=11,t.t0=t.catch(2),t.t0.code!==A.Logger.errors.CALL_EXCEPTION){t.next=15;break}return t.abrupt("return",null);case 15:throw t.t0;case 16:return t.next=18,this._fetchBytes("0xf1cb7e06",B(e));case 18:if(null!=(n=t.sent)&&"0x"!==n){t.next=21;break}return t.abrupt("return",null);case 21:return null==(i=this._getAddress(e,n))&&C.throwError("invalid or unsupported coin data",A.Logger.errors.UNSUPPORTED_OPERATION,{operation:"getAddress(".concat(e,")"),coinType:e,data:n}),t.abrupt("return",i);case 24:case"end":return t.stop()}}),t,this,[[2,11]])})))}},{key:"getAvatar",value:function(){return _(this,void 0,void 0,(0,o.Z)().mark((function e(){var t,r,n,i,a,u,s,c,l,f,p,m,v,y,g,b;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[{type:"name",content:this.name}],e.prev=1,e.next=4,this.getText("avatar");case 4:if(null!=(r=e.sent)){e.next=7;break}return e.abrupt("return",null);case 7:n=0;case 8:if(!(n=0?null:JSON.stringify({data:a,sender:i}),n.next=12,(0,w.fetchJson)({url:l,errorPassThrough:!0},f,(function(e,t){return e.status=t.statusCode,e}));case 12:if(!(h=n.sent).data){n.next=15;break}return n.abrupt("return",h.data);case 15:if(d=h.message||"unknown error",!(h.status>=400&&h.status<500)){n.next=18;break}return n.abrupt("return",C.throwError("response not found during CCIP fetch: ".concat(d),A.Logger.errors.SERVER_ERROR,{url:c,errorMessage:d}));case 18:u.push(d);case 19:s++,n.next=6;break;case 22:return n.abrupt("return",C.throwError("error encountered during CCIP fetch: ".concat(u.map((function(e){return JSON.stringify(e)})).join(", ")),A.Logger.errors.SERVER_ERROR,{urls:r,errorMessages:u}));case 23:case"end":return n.stop()}}),n,this)})))}},{key:"_getInternalBlockNumber",value:function(e){return _(this,void 0,void 0,(0,o.Z)().mark((function t(){var r,n,i,a,u=this;return(0,o.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._ready();case 2:if(!(e>0)){t.next=20;break}case 3:if(!this._internalBlockNumber){t.next=20;break}return r=this._internalBlockNumber,t.prev=5,t.next=8,r;case 8:if(n=t.sent,!(T()-n.respTime<=e)){t.next=11;break}return t.abrupt("return",n.blockNumber);case 11:return t.abrupt("break",20);case 14:if(t.prev=14,t.t0=t.catch(5),this._internalBlockNumber!==r){t.next=18;break}return t.abrupt("break",20);case 18:t.next=3;break;case 20:return i=T(),a=(0,y.resolveProperties)({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((function(e){return null}),(function(e){return e}))}).then((function(e){var t=e.blockNumber,r=e.networkError;if(r)throw u._internalBlockNumber===a&&(u._internalBlockNumber=null),r;var n=T();return(t=h.O$.from(t).toNumber())1e3)C.warn("network block skew detected; skipping block events (emitted=".concat(this._emitted.block," blockNumber").concat(n,")")),this.emit("error",C.makeError("network block skew detected",A.Logger.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(i=this._emitted.block+1;i<=n;i++)this.emit("block",i);return this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach((function(e){if("block"!==e){var t=a._emitted[e];"pending"!==t&&n-t>12&&delete a._emitted[e]}}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=n-1),this._events.forEach((function(e){switch(e.type){case"tx":var t=e.hash,i=a.getTransactionReceipt(t).then((function(e){return e&&null!=e.blockNumber?(a._emitted["t:"+t]=e.blockNumber,a.emit(t,e),null):null})).catch((function(e){a.emit("error",e)}));r.push(i);break;case"filter":if(!e._inflight){e._inflight=!0,-2===e._lastBlockNumber&&(e._lastBlockNumber=n-1);var o=e.filter;o.fromBlock=e._lastBlockNumber+1,o.toBlock=n;var u=o.toBlock-a._maxFilterBlockRange;u>o.fromBlock&&(o.fromBlock=u),o.fromBlock<0&&(o.fromBlock=0);var s=a.getLogs(o).then((function(t){e._inflight=!1,0!==t.length&&t.forEach((function(t){t.blockNumber>e._lastBlockNumber&&(e._lastBlockNumber=t.blockNumber),a._emitted["b:"+t.blockHash]=t.blockNumber,a._emitted["t:"+t.transactionHash]=t.blockNumber,a.emit(o,t)}))})).catch((function(t){a.emit("error",t),e._inflight=!1}));r.push(s)}}})),this._lastBlockNumber=n,Promise.all(r).then((function(){a.emit("didPoll",t)})).catch((function(e){a.emit("error",e)})),e.abrupt("return");case 26:case"end":return e.stop()}}),e,this,[[3,9]])})))}},{key:"resetEventsBlock",value:function(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}},{key:"network",get:function(){return this._network}},{key:"detectNetwork",value:function(){return _(this,void 0,void 0,(0,o.Z)().mark((function e(){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",C.throwError("provider does not support network detection",A.Logger.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"}));case 1:case"end":return e.stop()}}),e)})))}},{key:"getNetwork",value:function(){return _(this,void 0,void 0,(0,o.Z)().mark((function e(){var t,r,n;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._ready();case 2:return t=e.sent,e.next=5,this.detectNetwork();case 5:if(r=e.sent,t.chainId===r.chainId){e.next=23;break}if(!this.anyNetwork){e.next=20;break}return this._network=r,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",r,t),e.next=19,M(0);case 19:return e.abrupt("return",this._network);case 20:throw n=C.makeError("underlying network changed",A.Logger.errors.NETWORK_ERROR,{event:"changed",network:t,detectedNetwork:r}),this.emit("error",n),n;case 23:return e.abrupt("return",t);case 24:case"end":return e.stop()}}),e,this)})))}},{key:"blockNumber",get:function(){var e=this;return this._getInternalBlockNumber(100+this.pollingInterval/2).then((function(t){e._setFastBlockNumber(t)}),(function(e){})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}},{key:"polling",get:function(){return null!=this._poller},set:function(e){var t=this;e&&!this._poller?(this._poller=setInterval((function(){t.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((function(){t.poll(),t._bootstrapPoll=setTimeout((function(){t._poller||t.poll(),t._bootstrapPoll=null}),t.pollingInterval)}),0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}},{key:"pollingInterval",get:function(){return this._pollingInterval},set:function(e){var t=this;if("number"!==typeof e||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval((function(){t.poll()}),this._pollingInterval))}},{key:"_getFastBlockNumber",value:function(){var e=this,t=T();return t-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=t,this._fastBlockNumberPromise=this.getBlockNumber().then((function(t){return(null==e._fastBlockNumber||t>e._fastBlockNumber)&&(e._fastBlockNumber=t),e._fastBlockNumber}))),this._fastBlockNumberPromise}},{key:"_setFastBlockNumber",value:function(e){null!=this._fastBlockNumber&&ethis._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}},{key:"waitForTransaction",value:function(e,t,r){return _(this,void 0,void 0,(0,o.Z)().mark((function n(){return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",this._waitForTransaction(e,null==t?1:t,r||0,null));case 1:case"end":return n.stop()}}),n,this)})))}},{key:"_waitForTransaction",value:function(e,t,r,n){return _(this,void 0,void 0,(0,o.Z)().mark((function i(){var a,u=this;return(0,o.Z)().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,this.getTransactionReceipt(e);case 2:if(!(((a=i.sent)?a.confirmations:0)>=t)){i.next=5;break}return i.abrupt("return",a);case 5:return i.abrupt("return",new Promise((function(i,a){var s=[],c=!1,l=function(){return!!c||(c=!0,s.forEach((function(e){e()})),!1)},f=function(e){e.confirmations0){var m=setTimeout((function(){l()||a(C.makeError("timeout exceeded",A.Logger.errors.TIMEOUT,{timeout:r}))}),r);m.unref&&m.unref(),s.push((function(){clearTimeout(m)}))}})));case 6:case"end":return i.stop()}}),i,this)})))}},{key:"getBlockNumber",value:function(){return _(this,void 0,void 0,(0,o.Z)().mark((function e(){return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._getInternalBlockNumber(0));case 1:case"end":return e.stop()}}),e,this)})))}},{key:"getGasPrice",value:function(){return _(this,void 0,void 0,(0,o.Z)().mark((function e(){var t;return(0,o.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getNetwork();case 2:return e.next=4,this.perform("getGasPrice",{});case 4:return t=e.sent,e.prev=5,e.abrupt("return",h.O$.from(t));case 9:return e.prev=9,e.t0=e.catch(5),e.abrupt("return",C.throwError("bad result from backend",A.Logger.errors.SERVER_ERROR,{method:"getGasPrice",result:t,error:e.t0}));case 12:case"end":return e.stop()}}),e,this,[[5,9]])})))}},{key:"getBalance",value:function(e,t){return _(this,void 0,void 0,(0,o.Z)().mark((function r(){var n,i;return(0,o.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.getNetwork();case 2:return r.next=4,(0,y.resolveProperties)({address:this._getAddress(e),blockTag:this._getBlockTag(t)});case 4:return n=r.sent,r.next=7,this.perform("getBalance",n);case 7:return i=r.sent,r.prev=8,r.abrupt("return",h.O$.from(i));case 12:return r.prev=12,r.t0=r.catch(8),r.abrupt("return",C.throwError("bad result from backend",A.Logger.errors.SERVER_ERROR,{method:"getBalance",params:n,result:i,error:r.t0}));case 15:case"end":return r.stop()}}),r,this,[[8,12]])})))}},{key:"getTransactionCount",value:function(e,t){return _(this,void 0,void 0,(0,o.Z)().mark((function r(){var n,i;return(0,o.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.getNetwork();case 2:return r.next=4,(0,y.resolveProperties)({address:this._getAddress(e),blockTag:this._getBlockTag(t)});case 4:return n=r.sent,r.next=7,this.perform("getTransactionCount",n);case 7:return i=r.sent,r.prev=8,r.abrupt("return",h.O$.from(i).toNumber());case 12:return r.prev=12,r.t0=r.catch(8),r.abrupt("return",C.throwError("bad result from backend",A.Logger.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:i,error:r.t0}));case 15:case"end":return r.stop()}}),r,this,[[8,12]])})))}},{key:"getCode",value:function(e,t){return _(this,void 0,void 0,(0,o.Z)().mark((function r(){var n,i;return(0,o.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.getNetwork();case 2:return r.next=4,(0,y.resolveProperties)({address:this._getAddress(e),blockTag:this._getBlockTag(t)});case 4:return n=r.sent,r.next=7,this.perform("getCode",n);case 7:return i=r.sent,r.prev=8,r.abrupt("return",(0,d.hexlify)(i));case 12:return r.prev=12,r.t0=r.catch(8),r.abrupt("return",C.throwError("bad result from backend",A.Logger.errors.SERVER_ERROR,{method:"getCode",params:n,result:i,error:r.t0}));case 15:case"end":return r.stop()}}),r,this,[[8,12]])})))}},{key:"getStorageAt",value:function(e,t,r){return _(this,void 0,void 0,(0,o.Z)().mark((function n(){var i,a;return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.getNetwork();case 2:return n.next=4,(0,y.resolveProperties)({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then((function(e){return(0,d.hexValue)(e)}))});case 4:return i=n.sent,n.next=7,this.perform("getStorageAt",i);case 7:return a=n.sent,n.prev=8,n.abrupt("return",(0,d.hexlify)(a));case 12:return n.prev=12,n.t0=n.catch(8),n.abrupt("return",C.throwError("bad result from backend",A.Logger.errors.SERVER_ERROR,{method:"getStorageAt",params:i,result:a,error:n.t0}));case 15:case"end":return n.stop()}}),n,this,[[8,12]])})))}},{key:"_wrapTransaction",value:function(e,t,r){var n=this;if(null!=t&&32!==(0,d.hexDataLength)(t))throw new Error("invalid response - sendTransaction");var i=e;return null!=t&&e.hash!==t&&C.throwError("Transaction hash mismatch from Provider.sendTransaction.",A.Logger.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),i.wait=function(t,i){return _(n,void 0,void 0,(0,o.Z)().mark((function n(){var a,u;return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return null==t&&(t=1),null==i&&(i=0),a=void 0,0!==t&&null!=r&&(a={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:r}),n.next=6,this._waitForTransaction(e.hash,t,i,a);case 6:if(null!=(u=n.sent)||0!==t){n.next=9;break}return n.abrupt("return",null);case 9:return this._emitted["t:"+e.hash]=u.blockNumber,0===u.status&&C.throwError("transaction failed",A.Logger.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:u}),n.abrupt("return",u);case 12:case"end":return n.stop()}}),n,this)})))},i}},{key:"sendTransaction",value:function(e){return _(this,void 0,void 0,(0,o.Z)().mark((function t(){var r,n,i,a;return(0,o.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getNetwork();case 2:return t.next=4,Promise.resolve(e).then((function(e){return(0,d.hexlify)(e)}));case 4:return r=t.sent,null==(n=this.formatter.transaction(e)).confirmations&&(n.confirmations=0),t.next=9,this._getInternalBlockNumber(100+2*this.pollingInterval);case 9:return i=t.sent,t.prev=10,t.next=13,this.perform("sendTransaction",{signedTransaction:r});case 13:return a=t.sent,t.abrupt("return",this._wrapTransaction(n,a,i));case 17:throw t.prev=17,t.t0=t.catch(10),t.t0.transaction=n,t.t0.transactionHash=n.hash,t.t0;case 22:case"end":return t.stop()}}),t,this,[[10,17]])})))}},{key:"_getTransactionRequest",value:function(e){return _(this,void 0,void 0,(0,o.Z)().mark((function t(){var r,n,i=this;return(0,o.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e;case 2:return r=t.sent,n={},["from","to"].forEach((function(e){null!=r[e]&&(n[e]=Promise.resolve(r[e]).then((function(e){return e?i._getAddress(e):null})))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((function(e){null!=r[e]&&(n[e]=Promise.resolve(r[e]).then((function(e){return e?h.O$.from(e):null})))})),["type"].forEach((function(e){null!=r[e]&&(n[e]=Promise.resolve(r[e]).then((function(e){return null!=e?e:null})))})),r.accessList&&(n.accessList=this.formatter.accessList(r.accessList)),["data"].forEach((function(e){null!=r[e]&&(n[e]=Promise.resolve(r[e]).then((function(e){return e?(0,d.hexlify)(e):null})))})),t.t0=this.formatter,t.next=12,(0,y.resolveProperties)(n);case 12:return t.t1=t.sent,t.abrupt("return",t.t0.transactionRequest.call(t.t0,t.t1));case 14:case"end":return t.stop()}}),t,this)})))}},{key:"_getFilter",value:function(e){return _(this,void 0,void 0,(0,o.Z)().mark((function t(){var r,n=this;return(0,o.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e;case 2:return e=t.sent,r={},null!=e.address&&(r.address=this._getAddress(e.address)),["blockHash","topics"].forEach((function(t){null!=e[t]&&(r[t]=e[t])})),["fromBlock","toBlock"].forEach((function(t){null!=e[t]&&(r[t]=n._getBlockTag(e[t]))})),t.t0=this.formatter,t.next=10,(0,y.resolveProperties)(r);case 10:return t.t1=t.sent,t.abrupt("return",t.t0.filter.call(t.t0,t.t1));case 12:case"end":return t.stop()}}),t,this)})))}},{key:"_call",value:function(e,t,r){return _(this,void 0,void 0,(0,o.Z)().mark((function n(){var i,a,u,s,c,l,f,p,m,v,y,g,b,w,k;return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r>=10&&C.throwError("CCIP read exceeded maximum redirections",A.Logger.errors.SERVER_ERROR,{redirects:r,transaction:e}),i=e.to,n.next=4,this.perform("call",{transaction:e,blockTag:t});case 4:if(a=n.sent,!(r>=0&&"latest"===t&&null!=i&&"0x556f1830"===a.substring(0,10)&&(0,d.hexDataLength)(a)%32===4)){n.next=31;break}for(n.prev=6,u=(0,d.hexDataSlice)(a,4),s=(0,d.hexDataSlice)(u,0,32),h.O$.from(s).eq(i)||C.throwError("CCIP Read sender did not match",A.Logger.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:a}),c=[],l=h.O$.from((0,d.hexDataSlice)(u,32,64)).toNumber(),f=h.O$.from((0,d.hexDataSlice)(u,l,l+32)).toNumber(),p=(0,d.hexDataSlice)(u,l+32),m=0;mthis._emitted.block)){e.next=10;break}return e.abrupt("return",null);case 10:return e.abrupt("return",void 0);case 11:if(!t){e.next=34;break}a=null,u=0;case 14:if(!(u0}},{key:"_stopEvent",value:function(e){this.polling=this._events.filter((function(e){return e.pollable()})).length>0}},{key:"_addEventListener",value:function(e,t,r){var n=new R(N(e),t,r);return this._events.push(n),this._startEvent(n),this}},{key:"on",value:function(e,t){return this._addEventListener(e,t,!1)}},{key:"once",value:function(e,t){return this._addEventListener(e,t,!0)}},{key:"emit",value:function(e){for(var t=this,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i=0&&(t.throttleRetry=!0),t}return e.result}function J(e){if(e&&0==e.status&&"NOTOK"==e.message&&(e.result||"").toLowerCase().indexOf("rate limit")>=0){var t=new Error("throttled response");throw t.result=JSON.stringify(e),t.throttleRetry=!0,t}if("2.0"!=e.jsonrpc){var r=new Error("invalid response");throw r.result=JSON.stringify(e),r}if(e.error){var n=new Error(e.error.message||"unknown error");throw e.error.code&&(n.code=e.error.code),e.error.data&&(n.data=e.error.data),n}return e.result}function Q(e){if("pending"===e)throw new Error("pending not supported");return"latest"===e?e:parseInt(e.substring(2),16)}function Y(e,t,r){if("call"===e&&t.code===b.Logger.errors.SERVER_ERROR){var n=t.error;if(n&&(n.message.match(/reverted/i)||n.message.match(/VM execution error/i))){var i=n.data;if(i&&(i="0x"+i.replace(/^.*0x/i,"")),(0,Z.isHexString)(i))return i;K.throwError("missing revert data in call exception",b.Logger.errors.CALL_EXCEPTION,{error:t,data:"0x"})}}var a=t.message;throw t.code===b.Logger.errors.SERVER_ERROR&&(t.error&&"string"===typeof t.error.message?a=t.error.message:"string"===typeof t.body?a=t.body:"string"===typeof t.responseText&&(a=t.responseText)),(a=(a||"").toLowerCase()).match(/insufficient funds/)&&K.throwError("insufficient funds for intrinsic transaction cost",b.Logger.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:r}),a.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&K.throwError("nonce has already been used",b.Logger.errors.NONCE_EXPIRED,{error:t,method:e,transaction:r}),a.match(/another transaction with same nonce/)&&K.throwError("replacement fee too low",b.Logger.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:r}),a.match(/execution failed due to an exception|execution reverted/)&&K.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",b.Logger.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:r}),t}var X=function(e){(0,c.Z)(r,e);var t=(0,l.Z)(r);function r(e,n){var i;return(0,o.Z)(this,r),i=t.call(this,e),(0,f.defineReadOnly)((0,s.Z)(i),"baseUrl",i.getBaseUrl()),(0,f.defineReadOnly)((0,s.Z)(i),"apiKey",n||null),i}return(0,u.Z)(r,[{key:"getBaseUrl",value:function(){switch(this.network?this.network.name:"invalid"){case"homestead":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"matic":return"https://api.polygonscan.com";case"maticmum":return"https://api-testnet.polygonscan.com";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}return K.throwArgumentError("unsupported network","network",this.network.name)}},{key:"getUrl",value:function(e,t){var r=Object.keys(t).reduce((function(e,r){var n=t[r];return null!=n&&(e+="&".concat(r,"=").concat(n)),e}),""),n=this.apiKey?"&apikey=".concat(this.apiKey):"";return"".concat(this.baseUrl,"/api?module=").concat(e).concat(r).concat(n)}},{key:"getPostUrl",value:function(){return"".concat(this.baseUrl,"/api")}},{key:"getPostData",value:function(e,t){return t.module=e,t.apikey=this.apiKey,t}},{key:"fetch",value:function(e,t,r){return G(this,void 0,void 0,(0,d.Z)().mark((function n(){var i,a,o,u,s,c,l=this;return(0,d.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return i=r?this.getPostUrl():this.getUrl(e,t),a=r?this.getPostData(e,t):null,o="proxy"===e?J:W,this.emit("debug",{action:"request",request:i,provider:this}),u={url:i,throttleSlotInterval:1e3,throttleCallback:function(e,t){return l.isCommunityResource()&&(0,h.vh)(),Promise.resolve(!0)}},s=null,a&&(u.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},s=Object.keys(a).map((function(e){return"".concat(e,"=").concat(a[e])})).join("&")),n.next=9,(0,H.fetchJson)(u,s,o||J);case 9:return c=n.sent,this.emit("debug",{action:"response",request:i,response:(0,f.deepCopy)(c),provider:this}),n.abrupt("return",c);case 12:case"end":return n.stop()}}),n,this)})))}},{key:"detectNetwork",value:function(){return G(this,void 0,void 0,(0,d.Z)().mark((function e(){return(0,d.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.network);case 1:case"end":return e.stop()}}),e,this)})))}},{key:"perform",value:function(e,t){var n=this,i=Object.create(null,{perform:{get:function(){return(0,m.Z)((0,v.Z)(r.prototype),"perform",n)}}});return G(this,void 0,void 0,(0,d.Z)().mark((function r(){var n,a,o,u,s,c,l,f,h;return(0,d.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:r.t0=e,r.next="getBlockNumber"===r.t0?3:"getGasPrice"===r.t0?4:"getBalance"===r.t0?5:"getTransactionCount"===r.t0?6:"getCode"===r.t0?7:"getStorageAt"===r.t0?8:"sendTransaction"===r.t0?9:"getBlock"===r.t0?10:"getTransaction"===r.t0?13:"getTransactionReceipt"===r.t0?14:"call"===r.t0?15:"estimateGas"===r.t0?29:"getLogs"===r.t0?41:"getEtherPrice"===r.t0?65:72;break;case 3:return r.abrupt("return",this.fetch("proxy",{action:"eth_blockNumber"}));case 4:return r.abrupt("return",this.fetch("proxy",{action:"eth_gasPrice"}));case 5:return r.abrupt("return",this.fetch("account",{action:"balance",address:t.address,tag:t.blockTag}));case 6:return r.abrupt("return",this.fetch("proxy",{action:"eth_getTransactionCount",address:t.address,tag:t.blockTag}));case 7:return r.abrupt("return",this.fetch("proxy",{action:"eth_getCode",address:t.address,tag:t.blockTag}));case 8:return r.abrupt("return",this.fetch("proxy",{action:"eth_getStorageAt",address:t.address,position:t.position,tag:t.blockTag}));case 9:return r.abrupt("return",this.fetch("proxy",{action:"eth_sendRawTransaction",hex:t.signedTransaction},!0).catch((function(e){return Y("sendTransaction",e,t.signedTransaction)})));case 10:if(!t.blockTag){r.next=12;break}return r.abrupt("return",this.fetch("proxy",{action:"eth_getBlockByNumber",tag:t.blockTag,boolean:t.includeTransactions?"true":"false"}));case 12:throw new Error("getBlock by blockHash not implemented");case 13:return r.abrupt("return",this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:t.transactionHash}));case 14:return r.abrupt("return",this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:t.transactionHash}));case 15:if("latest"===t.blockTag){r.next=17;break}throw new Error("EtherscanProvider does not support blockTag for call");case 17:return(n=V(t.transaction)).module="proxy",n.action="eth_call",r.prev=20,r.next=23,this.fetch("proxy",n,!0);case 23:return r.abrupt("return",r.sent);case 26:return r.prev=26,r.t1=r.catch(20),r.abrupt("return",Y("call",r.t1,t.transaction));case 29:return(a=V(t.transaction)).module="proxy",a.action="eth_estimateGas",r.prev=32,r.next=35,this.fetch("proxy",a,!0);case 35:return r.abrupt("return",r.sent);case 38:return r.prev=38,r.t2=r.catch(32),r.abrupt("return",Y("estimateGas",r.t2,t.transaction));case 41:return o={action:"getLogs"},t.filter.fromBlock&&(o.fromBlock=Q(t.filter.fromBlock)),t.filter.toBlock&&(o.toBlock=Q(t.filter.toBlock)),t.filter.address&&(o.address=t.filter.address),t.filter.topics&&t.filter.topics.length>0&&(t.filter.topics.length>1&&K.throwError("unsupported topic count",b.Logger.errors.UNSUPPORTED_OPERATION,{topics:t.filter.topics}),1===t.filter.topics.length&&("string"===typeof(u=t.filter.topics[0])&&66===u.length||K.throwError("unsupported topic format",b.Logger.errors.UNSUPPORTED_OPERATION,{topic0:u}),o.topic0=u)),r.next=48,this.fetch("logs",o);case 48:s=r.sent,c={},l=0;case 51:if(!(lt?null:(n+i)/2}function ae(e){if(null===e)return"null";if("number"===typeof e||"boolean"===typeof e)return JSON.stringify(e);if("string"===typeof e)return e;if(y.O$.isBigNumber(e))return e.toString();if(Array.isArray(e))return JSON.stringify(e.map((function(e){return ae(e)})));if("object"===typeof e){var t=Object.keys(e);return t.sort(),"{"+t.map((function(t){var r=e[t];return r="function"===typeof r?"[function]":ae(r),JSON.stringify(t)+":"+r})).join(",")+"}"}throw new Error("unknown value type: "+typeof e)}var oe=1;function ue(e){var t=null,r=null,n=new Promise((function(n){t=function(){r&&(clearTimeout(r),r=null),n()},r=setTimeout(t,e)}));return{cancel:t,getPromise:function(){return n},wait:function(e){return n=n.then(e)}}}var se=[b.Logger.errors.CALL_EXCEPTION,b.Logger.errors.INSUFFICIENT_FUNDS,b.Logger.errors.NONCE_EXPIRED,b.Logger.errors.REPLACEMENT_UNDERPRICED,b.Logger.errors.UNPREDICTABLE_GAS_LIMIT],ce=["address","args","errorArgs","errorSignature","method","transaction"];function le(e,t){var r={weight:e.weight};return Object.defineProperty(r,"provider",{get:function(){return e.provider}}),e.start&&(r.start=e.start),t&&(r.duration=t-e.start),e.done&&(e.error?r.error=e.error:r.result=e.result||null),r}function fe(e,t,r){var n=ae;switch(t){case"getBlockNumber":return function(t){var r=t.map((function(e){return e.result})),n=ie(t.map((function(e){return e.result})),2);if(null!=n)return n=Math.ceil(n),r.indexOf(n+1)>=0&&n++,n>=e._highestBlockNumber&&(e._highestBlockNumber=n),e._highestBlockNumber};case"getGasPrice":return function(e){var t=e.map((function(e){return e.result}));return t.sort(),t[Math.floor(t.length/2)]};case"getEtherPrice":return function(e){return ie(e.map((function(e){return e.result})))};case"getBalance":case"getTransactionCount":case"getCode":case"getStorageAt":case"call":case"estimateGas":case"getLogs":break;case"getTransaction":case"getTransactionReceipt":n=function(e){return null==e?null:((e=(0,f.shallowCopy)(e)).confirmations=-1,ae(e))};break;case"getBlock":n=r.includeTransactions?function(e){return null==e?null:((e=(0,f.shallowCopy)(e)).transactions=e.transactions.map((function(e){return(e=(0,f.shallowCopy)(e)).confirmations=-1,e})),ae(e))}:function(e){return null==e?null:ae(e)};break;default:throw new Error("unknown method: "+t)}return function(e,t){return function(r){var n={};r.forEach((function(t){var r=e(t.result);n[r]||(n[r]={count:0,result:t.result}),n[r].count++}));for(var i=Object.keys(n),a=0;a=t)return o.result}}}(n,e.quorum)}function he(e,t){return ee(this,void 0,void 0,(0,d.Z)().mark((function r(){var n;return(0,d.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!(null!=(n=e.provider).blockNumber&&n.blockNumber>=t||-1===t)){r.next=3;break}return r.abrupt("return",n);case 3:return r.abrupt("return",(0,H.poll)((function(){return new Promise((function(r,i){setTimeout((function(){return n.blockNumber>=t?r(n):e.cancelled?r(null):r(void 0)}),0)}))}),{oncePoll:n}));case 4:case"end":return r.stop()}}),r)})))}function de(e,t,r,n){return ee(this,void 0,void 0,(0,d.Z)().mark((function i(){var a,o;return(0,d.Z)().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:a=e.provider,i.t0=r,i.next="getBlockNumber"===i.t0||"getGasPrice"===i.t0?4:"getEtherPrice"===i.t0?5:"getBalance"===i.t0||"getTransactionCount"===i.t0||"getCode"===i.t0?8:"getStorageAt"===i.t0?13:"getBlock"===i.t0?18:"call"===i.t0||"estimateGas"===i.t0?23:"getTransaction"===i.t0||"getTransactionReceipt"===i.t0?30:"getLogs"===i.t0?31:37;break;case 4:return i.abrupt("return",a[r]());case 5:if(!a.getEtherPrice){i.next=7;break}return i.abrupt("return",a.getEtherPrice());case 7:return i.abrupt("break",37);case 8:if(!n.blockTag||!(0,Z.isHexString)(n.blockTag)){i.next=12;break}return i.next=11,he(e,t);case 11:a=i.sent;case 12:return i.abrupt("return",a[r](n.address,n.blockTag||"latest"));case 13:if(!n.blockTag||!(0,Z.isHexString)(n.blockTag)){i.next=17;break}return i.next=16,he(e,t);case 16:a=i.sent;case 17:return i.abrupt("return",a.getStorageAt(n.address,n.position,n.blockTag||"latest"));case 18:if(!n.blockTag||!(0,Z.isHexString)(n.blockTag)){i.next=22;break}return i.next=21,he(e,t);case 21:a=i.sent;case 22:return i.abrupt("return",a[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash));case 23:if(!n.blockTag||!(0,Z.isHexString)(n.blockTag)){i.next=27;break}return i.next=26,he(e,t);case 26:a=i.sent;case 27:if("call"!==r||!n.blockTag){i.next=29;break}return i.abrupt("return",a[r](n.transaction,n.blockTag));case 29:return i.abrupt("return",a[r](n.transaction));case 30:return i.abrupt("return",a[r](n.transactionHash));case 31:if(!((o=n.filter).fromBlock&&(0,Z.isHexString)(o.fromBlock)||o.toBlock&&(0,Z.isHexString)(o.toBlock))){i.next=36;break}return i.next=35,he(e,t);case 35:a=i.sent;case 36:return i.abrupt("return",a.getLogs(o));case 37:return i.abrupt("return",te.throwError("unknown method error",b.Logger.errors.UNKNOWN_ERROR,{method:r,params:n}));case 38:case"end":return i.stop()}}),i)})))}var pe=function(e){(0,c.Z)(r,e);var t=(0,l.Z)(r);function r(e,i){var a;(0,o.Z)(this,r),0===e.length&&te.throwArgumentError("missing providers","providers",e);var u=e.map((function(e,t){if(n.zt.isProvider(e)){var r=(0,h.Gp)(e)?2e3:750;return Object.freeze({provider:e,weight:1,stallTimeout:r,priority:1})}var i=(0,f.shallowCopy)(e);null==i.priority&&(i.priority=1),null==i.stallTimeout&&(i.stallTimeout=(0,h.Gp)(e)?2e3:750),null==i.weight&&(i.weight=1);var a=i.weight;return(a%1||a>512||a<1)&&te.throwArgumentError("invalid weight; must be integer in [1, 512]","providers[".concat(t,"].weight"),a),Object.freeze(i)})),c=u.reduce((function(e,t){return e+t.weight}),0);null==i?i=c/2:i>c&&te.throwArgumentError("quorum will always fail; larger than total weight","quorum",i);var l=ne(u.map((function(e){return e.provider.network})));return null==l&&(l=new Promise((function(e,t){setTimeout((function(){a.detectNetwork().then(e,t)}),0)}))),a=t.call(this,l),(0,f.defineReadOnly)((0,s.Z)(a),"providerConfigs",Object.freeze(u)),(0,f.defineReadOnly)((0,s.Z)(a),"quorum",i),a._highestBlockNumber=-1,a}return(0,u.Z)(r,[{key:"detectNetwork",value:function(){return ee(this,void 0,void 0,(0,d.Z)().mark((function e(){var t;return(0,d.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Promise.all(this.providerConfigs.map((function(e){return e.provider.getNetwork()})));case 2:return t=e.sent,e.abrupt("return",ne(t));case 4:case"end":return e.stop()}}),e,this)})))}},{key:"perform",value:function(e,t){return ee(this,void 0,void 0,(0,d.Z)().mark((function r(){var n,i,a,o,u,s,c,l,h,p,m=this;return(0,d.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if("sendTransaction"!==e){r.next=13;break}return r.next=3,Promise.all(this.providerConfigs.map((function(e){return e.provider.sendTransaction(t.signedTransaction).then((function(e){return e.hash}),(function(e){return e}))})));case 3:n=r.sent,i=0;case 5:if(!(i=m.quorum)){r.next=22;break}if(void 0===(v=o(p))){r.next=18;break}return u.forEach((function(e){e.staller&&e.staller.cancel(),e.cancelled=!0})),r.abrupt("return",{v:v});case 18:if(l){r.next=21;break}return r.next=21,ue(100).getPromise();case 21:l=!1;case 22:if(y=u.reduce((function(e,t){if(!t.done||null==t.error)return e;var r=t.error.code;return se.indexOf(r)>=0&&(e[r]||(e[r]={error:t.error,weight:0}),e[r].weight+=t.weight),e}),{}),Object.keys(y).forEach((function(e){var t=y[e];if(!(t.weight=0&&o.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&A.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",b.Logger.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:n}),t}function C(e){return new Promise((function(t){setTimeout(t,e)}))}function P(e){if(e.error){var t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function O(e){return e?e.toLowerCase():e}var N={},T=function(e){(0,c.Z)(r,e);var t=(0,l.Z)(r);function r(e,n,i){var a;if((0,o.Z)(this,r),a=t.call(this),e!==N)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");return(0,m.defineReadOnly)((0,s.Z)(a),"provider",n),null==i&&(i=0),"string"===typeof i?((0,m.defineReadOnly)((0,s.Z)(a),"_address",a.provider.formatter.address(i)),(0,m.defineReadOnly)((0,s.Z)(a),"_index",null)):"number"===typeof i?((0,m.defineReadOnly)((0,s.Z)(a),"_index",i),(0,m.defineReadOnly)((0,s.Z)(a),"_address",null)):A.throwArgumentError("invalid address or index","addressOrIndex",i),a}return(0,u.Z)(r,[{key:"connect",value:function(e){return A.throwError("cannot alter JSON-RPC Signer connection",b.Logger.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}},{key:"connectUnchecked",value:function(){return new M(N,this.provider,this._address||this._index)}},{key:"getAddress",value:function(){var e=this;return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((function(t){return t.length<=e._index&&A.throwError("unknown account #"+e._index,b.Logger.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),e.provider.formatter.address(t[e._index])}))}},{key:"sendUncheckedTransaction",value:function(e){var t=this;e=(0,m.shallowCopy)(e);var r=this.getAddress().then((function(e){return e&&(e=e.toLowerCase()),e}));if(null==e.gasLimit){var n=(0,m.shallowCopy)(e);n.from=r,e.gasLimit=this.provider.estimateGas(n)}return null!=e.to&&(e.to=Promise.resolve(e.to).then((function(e){return x(t,void 0,void 0,(0,a.Z)().mark((function t(){var r;return(0,a.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null!=e){t.next=2;break}return t.abrupt("return",null);case 2:return t.next=4,this.provider.resolveName(e);case 4:return null==(r=t.sent)&&A.throwArgumentError("provided ENS name resolves to null","tx.to",e),t.abrupt("return",r);case 7:case"end":return t.stop()}}),t,this)})))}))),(0,m.resolveProperties)({tx:(0,m.resolveProperties)(e),sender:r}).then((function(r){var n=r.tx,i=r.sender;null!=n.from?n.from.toLowerCase()!==i&&A.throwArgumentError("from address mismatch","transaction",e):n.from=i;var a=t.provider.constructor.hexlifyTransaction(n,{from:!0});return t.provider.send("eth_sendTransaction",[a]).then((function(e){return e}),(function(e){return"string"===typeof e.message&&e.message.match(/user denied/i)&&A.throwError("user rejected transaction",b.Logger.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:n}),_("sendTransaction",e,a)}))}))}},{key:"signTransaction",value:function(e){return A.throwError("signing transactions is unsupported",b.Logger.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}},{key:"sendTransaction",value:function(e){return x(this,void 0,void 0,(0,a.Z)().mark((function t(){var r,n,i=this;return(0,a.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval);case 2:return r=t.sent,t.next=5,this.sendUncheckedTransaction(e);case 5:return n=t.sent,t.prev=6,t.next=9,(0,g.poll)((function(){return x(i,void 0,void 0,(0,a.Z)().mark((function e(){var t;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.provider.getTransaction(n);case 2:if(null!==(t=e.sent)){e.next=5;break}return e.abrupt("return",void 0);case 5:return e.abrupt("return",this.provider._wrapTransaction(t,n,r));case 6:case"end":return e.stop()}}),e,this)})))}),{oncePoll:this.provider});case 9:return t.abrupt("return",t.sent);case 12:throw t.prev=12,t.t0=t.catch(6),t.t0.transactionHash=n,t.t0;case 16:case"end":return t.stop()}}),t,this,[[6,12]])})))}},{key:"signMessage",value:function(e){return x(this,void 0,void 0,(0,a.Z)().mark((function t(){var r,n;return(0,a.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="string"===typeof e?(0,v.Y0)(e):e,t.next=3,this.getAddress();case 3:return n=t.sent,t.prev=4,t.next=7,this.provider.send("personal_sign",[(0,d.hexlify)(r),n.toLowerCase()]);case 7:return t.abrupt("return",t.sent);case 10:throw t.prev=10,t.t0=t.catch(4),"string"===typeof t.t0.message&&t.t0.message.match(/user denied/i)&&A.throwError("user rejected signing",b.Logger.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),t.t0;case 14:case"end":return t.stop()}}),t,this,[[4,10]])})))}},{key:"_legacySignMessage",value:function(e){return x(this,void 0,void 0,(0,a.Z)().mark((function t(){var r,n;return(0,a.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="string"===typeof e?(0,v.Y0)(e):e,t.next=3,this.getAddress();case 3:return n=t.sent,t.prev=4,t.next=7,this.provider.send("eth_sign",[n.toLowerCase(),(0,d.hexlify)(r)]);case 7:return t.abrupt("return",t.sent);case 10:throw t.prev=10,t.t0=t.catch(4),"string"===typeof t.t0.message&&t.t0.message.match(/user denied/i)&&A.throwError("user rejected signing",b.Logger.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),t.t0;case 14:case"end":return t.stop()}}),t,this,[[4,10]])})))}},{key:"_signTypedData",value:function(e,t,r){return x(this,void 0,void 0,(0,a.Z)().mark((function n(){var i,o,u=this;return(0,a.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,p.E.resolveNames(e,t,r,(function(e){return u.provider.resolveName(e)}));case 2:return i=n.sent,n.next=5,this.getAddress();case 5:return o=n.sent,n.prev=6,n.next=9,this.provider.send("eth_signTypedData_v4",[o.toLowerCase(),JSON.stringify(p.E.getPayload(i.domain,t,i.value))]);case 9:return n.abrupt("return",n.sent);case 12:throw n.prev=12,n.t0=n.catch(6),"string"===typeof n.t0.message&&n.t0.message.match(/user denied/i)&&A.throwError("user rejected signing",b.Logger.errors.ACTION_REJECTED,{action:"_signTypedData",from:o,messageData:{domain:i.domain,types:t,value:i.value}}),n.t0;case 16:case"end":return n.stop()}}),n,this,[[6,12]])})))}},{key:"unlock",value:function(e){return x(this,void 0,void 0,(0,a.Z)().mark((function t(){var r,n;return(0,a.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=this.provider,t.next=3,this.getAddress();case 3:return n=t.sent,t.abrupt("return",r.send("personal_unlockAccount",[n.toLowerCase(),e,null]));case 5:case"end":return t.stop()}}),t,this)})))}}]),r}(f.E),M=function(e){(0,c.Z)(r,e);var t=(0,l.Z)(r);function r(){return(0,o.Z)(this,r),t.apply(this,arguments)}return(0,u.Z)(r,[{key:"sendTransaction",value:function(e){var t=this;return this.sendUncheckedTransaction(e).then((function(e){return{hash:e,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:function(r){return t.provider.waitForTransaction(e,r)}}}))}}]),r}(T),U={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0},R=function(e){(0,c.Z)(r,e);var t=(0,l.Z)(r);function r(e,n){var i;(0,o.Z)(this,r);var a=n;return null==a&&(a=new Promise((function(e,t){setTimeout((function(){i.detectNetwork().then((function(t){e(t)}),(function(e){t(e)}))}),0)}))),i=t.call(this,a),e||(e=(0,m.getStatic)(i.constructor,"defaultUrl")()),"string"===typeof e?(0,m.defineReadOnly)((0,s.Z)(i),"connection",Object.freeze({url:e})):(0,m.defineReadOnly)((0,s.Z)(i),"connection",Object.freeze((0,m.shallowCopy)(e))),i._nextId=42,i}return(0,u.Z)(r,[{key:"_cache",get:function(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}},{key:"detectNetwork",value:function(){var e=this;return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((function(){e._cache.detectNetwork=null}),0)),this._cache.detectNetwork}},{key:"_uncachedDetectNetwork",value:function(){return x(this,void 0,void 0,(0,a.Z)().mark((function e(){var t,r;return(0,a.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,C(0);case 2:return t=null,e.prev=3,e.next=6,this.send("eth_chainId",[]);case 6:t=e.sent,e.next=19;break;case 9:return e.prev=9,e.t0=e.catch(3),e.prev=11,e.next=14,this.send("net_version",[]);case 14:t=e.sent,e.next=19;break;case 17:e.prev=17,e.t1=e.catch(11);case 19:if(null==t){e.next=28;break}return r=(0,m.getStatic)(this.constructor,"getNetwork"),e.prev=21,e.abrupt("return",r(h.O$.from(t).toNumber()));case 25:return e.prev=25,e.t2=e.catch(21),e.abrupt("return",A.throwError("could not detect network",b.Logger.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:e.t2}));case 28:return e.abrupt("return",A.throwError("could not detect network",b.Logger.errors.NETWORK_ERROR,{event:"noNetwork"}));case 29:case"end":return e.stop()}}),e,this,[[3,9],[11,17],[21,25]])})))}},{key:"getSigner",value:function(e){return new T(N,this,e)}},{key:"getUncheckedSigner",value:function(e){return this.getSigner(e).connectUnchecked()}},{key:"listAccounts",value:function(){var e=this;return this.send("eth_accounts",[]).then((function(t){return t.map((function(t){return e.formatter.address(t)}))}))}},{key:"send",value:function(e,t){var r=this,n={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:(0,m.deepCopy)(n),provider:this});var i=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(i&&this._cache[e])return this._cache[e];var a=(0,g.fetchJson)(this.connection,JSON.stringify(n),P).then((function(e){return r.emit("debug",{action:"response",request:n,response:e,provider:r}),e}),(function(e){throw r.emit("debug",{action:"response",error:e,request:n,provider:r}),e}));return i&&(this._cache[e]=a,setTimeout((function(){r._cache[e]=null}),0)),a}},{key:"prepareRequest",value:function(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[O(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[O(t.address),t.blockTag]];case"getCode":return["eth_getCode",[O(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[O(t.address),(0,d.hexZeroPad)(t.position,32),t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[(0,m.getStatic)(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[(0,m.getStatic)(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=O(t.filter.address)),["eth_getLogs",[t.filter]]}return null}},{key:"perform",value:function(e,t){return x(this,void 0,void 0,(0,a.Z)().mark((function r(){var n,i,o;return(0,a.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if("call"!==e&&"estimateGas"!==e){r.next=8;break}if(!(n=t.transaction)||null==n.type||!h.O$.from(n.type).isZero()){r.next=8;break}if(null!=n.maxFeePerGas||null!=n.maxPriorityFeePerGas){r.next=8;break}return r.next=6,this.getFeeData();case 6:null==(i=r.sent).maxFeePerGas&&null==i.maxPriorityFeePerGas&&((t=(0,m.shallowCopy)(t)).transaction=(0,m.shallowCopy)(n),delete t.transaction.type);case 8:return null==(o=this.prepareRequest(e,t))&&A.throwError(e+" not implemented",b.Logger.errors.NOT_IMPLEMENTED,{operation:e}),r.prev=10,r.next=13,this.send(o[0],o[1]);case 13:return r.abrupt("return",r.sent);case 16:return r.prev=16,r.t0=r.catch(10),r.abrupt("return",_(e,r.t0,t));case 19:case"end":return r.stop()}}),r,this,[[10,16]])})))}},{key:"_startEvent",value:function(e){"pending"===e.tag&&this._startPending(),(0,n.Z)((0,i.Z)(r.prototype),"_startEvent",this).call(this,e)}},{key:"_startPending",value:function(){if(null==this._pendingFilter){var e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then((function(r){return function n(){e.send("eth_getFilterChanges",[r]).then((function(r){if(e._pendingFilter!=t)return null;var n=Promise.resolve();return r.forEach((function(t){e._emitted["t:"+t.toLowerCase()]="pending",n=n.then((function(){return e.getTransaction(t).then((function(t){return e.emit("pending",t),null}))}))})),n.then((function(){return C(1e3)}))})).then((function(){if(e._pendingFilter==t)return setTimeout((function(){n()}),0),null;e.send("eth_uninstallFilter",[r])})).catch((function(e){}))}(),r})).catch((function(e){}))}}},{key:"_stopEvent",value:function(e){"pending"===e.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),(0,n.Z)((0,i.Z)(r.prototype),"_stopEvent",this).call(this,e)}}],[{key:"defaultUrl",value:function(){return"http://localhost:8545"}},{key:"hexlifyTransaction",value:function(e,t){var r=(0,m.shallowCopy)(U);if(t)for(var n in t)t[n]&&(r[n]=!0);(0,m.checkProperties)(e,r);var i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(t){if(null!=e[t]){var r=(0,d.hexValue)(h.O$.from(e[t]));"gasLimit"===t&&(t="gas"),i[t]=r}})),["from","to","data"].forEach((function(t){null!=e[t]&&(i[t]=(0,d.hexlify)(e[t]))})),e.accessList&&(i.accessList=(0,y.accessListify)(e.accessList)),i}}]),r}(k.Zk)},5683:function(e,t,r){"use strict";r.r(t),r.d(t,{randomBytes:function(){return n.O},shuffled:function(){return i.y}});var n=r(5722),i=r(4327)},5722:function(e,t,r){"use strict";r.d(t,{O:function(){return s}});var n=r(2009),i=r(2735),a=new i.Logger("random/5.7.0");var o=function(){if("undefined"!==typeof self)return self;if("undefined"!==typeof window)return window;if("undefined"!==typeof r.g)return r.g;throw new Error("unable to locate global object")}(),u=o.crypto||o.msCrypto;function s(e){(e<=0||e>1024||e%1||e!=e)&&a.throwArgumentError("invalid length","length",e);var t=new Uint8Array(e);return u.getRandomValues(t),(0,n.arrayify)(t)}u&&u.getRandomValues||(a.warn("WARNING: Missing strong random number source"),u={getRandomValues:function(e){return a.throwError("no secure random source avaialble",i.Logger.errors.UNSUPPORTED_OPERATION,{operation:"crypto.getRandomValues"})}})},4327:function(e,t,r){"use strict";function n(e){for(var t=(e=e.slice()).length-1;t>0;t--){var r=Math.floor(Math.random()*(t+1)),n=e[t];e[t]=e[r],e[r]=n}return e}r.d(t,{y:function(){return n}})},807:function(e,t,r){"use strict";r.r(t),r.d(t,{decode:function(){return h},encode:function(){return c}});var n=r(2009),i=r(2735),a=new i.Logger("rlp/5.7.0");function o(e){for(var t=[];e;)t.unshift(255&e),e>>=8;return t}function u(e,t,r){for(var n=0,i=0;it+1+n&&a.throwError("child data too short",i.Logger.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:o}}function f(e,t){if(0===e.length&&a.throwError("data too short",i.Logger.errors.BUFFER_OVERRUN,{}),e[t]>=248){var r=e[t]-247;t+1+r>e.length&&a.throwError("data short segment too short",i.Logger.errors.BUFFER_OVERRUN,{});var o=u(e,t+1,r);return t+1+r+o>e.length&&a.throwError("data long segment too short",i.Logger.errors.BUFFER_OVERRUN,{}),l(e,t,t+1+r,r+o)}if(e[t]>=192){var s=e[t]-192;return t+1+s>e.length&&a.throwError("data array too short",i.Logger.errors.BUFFER_OVERRUN,{}),l(e,t,t+1,s)}if(e[t]>=184){var c=e[t]-183;t+1+c>e.length&&a.throwError("data array too short",i.Logger.errors.BUFFER_OVERRUN,{});var f=u(e,t+1,c);return t+1+c+f>e.length&&a.throwError("data array too short",i.Logger.errors.BUFFER_OVERRUN,{}),{consumed:1+c+f,result:(0,n.hexlify)(e.slice(t+1+c,t+1+c+f))}}if(e[t]>=128){var h=e[t]-128;return t+1+h>e.length&&a.throwError("data too short",i.Logger.errors.BUFFER_OVERRUN,{}),{consumed:1+h,result:(0,n.hexlify)(e.slice(t+1,t+1+h))}}return{consumed:1,result:(0,n.hexlify)(e[t])}}function h(e){var t=(0,n.arrayify)(e),r=f(t,0);return r.consumed!==t.length&&a.throwArgumentError("invalid rlp data","data",e),r.result}},4517:function(e,t,r){"use strict";r.r(t),r.d(t,{SupportedAlgorithm:function(){return i.p},computeHmac:function(){return n.Gy},ripemd160:function(){return n.bP},sha256:function(){return n.JQ},sha512:function(){return n.o}});var n=r(3984),i=r(8427)},3984:function(e,t,r){"use strict";r.d(t,{Gy:function(){return h},bP:function(){return c},JQ:function(){return l},o:function(){return f}});var n=r(7553),i=r.n(n),a=r(2009),o=r(8427),u=r(2735),s=new u.Logger("sha2/5.7.0");function c(e){return"0x"+i().ripemd160().update((0,a.arrayify)(e)).digest("hex")}function l(e){return"0x"+i().sha256().update((0,a.arrayify)(e)).digest("hex")}function f(e){return"0x"+i().sha512().update((0,a.arrayify)(e)).digest("hex")}function h(e,t,r){return o.p[e]||s.throwError("unsupported algorithm "+e,u.Logger.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:e}),"0x"+i().hmac(i()[e],(0,a.arrayify)(t)).update((0,a.arrayify)(r)).digest("hex")}},8427:function(e,t,r){"use strict";var n;r.d(t,{p:function(){return n}}),function(e){e.sha256="sha256",e.sha512="sha512"}(n||(n={}))},4760:function(e,t,r){"use strict";r.r(t),r.d(t,{SigningKey:function(){return Q},computePublicKey:function(){return X},recoverPublicKey:function(){return Y}});var n=r(5671),i=r(3144),a=r(4166),o=r.n(a),u=r(7553),s=r.n(u);"undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof r.g?r.g:"undefined"!==typeof self&&self;function c(e,t,r){return r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}((void 0===t||null===t)&&r.path)}},e(r,r.exports),r.exports}var l=f;function f(e,t){if(!e)throw new Error(t||"Assertion failed")}f.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)};var h=c((function(e,t){var r=t;function n(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",r=0;r>8,o=255&i;a?r.push(a,o):r.push(o)}return r},r.zero2=n,r.toHex=i,r.encode=function(e,t){return"hex"===t?i(e):e}})),d=c((function(e,t){var r=t;r.assert=l,r.toArray=h.toArray,r.zero2=h.zero2,r.toHex=h.toHex,r.encode=h.encode,r.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var i=1<(i>>1)-1?(i>>1)-s:s,a.isubn(u)):u=0,n[o]=u,a.iushrn(1)}return n},r.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,i=0,a=0;e.cmpn(-i)>0||t.cmpn(-a)>0;){var o,u,s=e.andln(3)+i&3,c=t.andln(3)+a&3;3===s&&(s=-1),3===c&&(c=-1),o=0===(1&s)?0:3!==(n=e.andln(7)+i&7)&&5!==n||2!==c?s:-s,r[0].push(o),u=0===(1&c)?0:3!==(n=t.andln(7)+a&7)&&5!==n||2!==s?c:-c,r[1].push(u),2*i===o+1&&(i=1-i),2*a===u+1&&(a=1-a),e.iushrn(1),t.iushrn(1)}return r},r.cachedProperty=function(e,t,r){var n="_"+t;e.prototype[t]=function(){return void 0!==this[n]?this[n]:this[n]=r.call(this)}},r.parseBytes=function(e){return"string"===typeof e?r.toArray(e,"hex"):e},r.intFromLE=function(e){return new(o())(e,"hex","le")}})),p=d.getNAF,m=d.getJSF,v=d.assert;function y(e,t){this.type=e,this.p=new(o())(t.p,16),this.red=t.prime?o().red(t.prime):o().mont(this.p),this.zero=new(o())(0).toRed(this.red),this.one=new(o())(1).toRed(this.red),this.two=new(o())(2).toRed(this.red),this.n=t.n&&new(o())(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var g=y;function b(e,t){this.curve=e,this.type=t,this.precomputed=null}y.prototype.point=function(){throw new Error("Not implemented")},y.prototype.validate=function(){throw new Error("Not implemented")},y.prototype._fixedNafMul=function(e,t){v(e.precomputed);var r=e._getDoubles(),n=p(t,1,this._bitLength),i=(1<=a;s--)o=(o<<1)+n[s];u.push(o)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),f=i;f>0;f--){for(a=0;a=0;u--){for(var s=0;u>=0&&0===a[u];u--)s++;if(u>=0&&s++,o=o.dblp(s),u<0)break;var c=a[u];v(0!==c),o="affine"===e.type?c>0?o.mixedAdd(i[c-1>>1]):o.mixedAdd(i[-c-1>>1].neg()):c>0?o.add(i[c-1>>1]):o.add(i[-c-1>>1].neg())}return"affine"===e.type?o.toP():o},y.prototype._wnafMulAdd=function(e,t,r,n,i){var a,o,u,s=this._wnafT1,c=this._wnafT2,l=this._wnafT3,f=0;for(a=0;a=1;a-=2){var d=a-1,v=a;if(1===s[d]&&1===s[v]){var y=[t[d],null,null,t[v]];0===t[d].y.cmp(t[v].y)?(y[1]=t[d].add(t[v]),y[2]=t[d].toJ().mixedAdd(t[v].neg())):0===t[d].y.cmp(t[v].y.redNeg())?(y[1]=t[d].toJ().mixedAdd(t[v]),y[2]=t[d].add(t[v].neg())):(y[1]=t[d].toJ().mixedAdd(t[v]),y[2]=t[d].toJ().mixedAdd(t[v].neg()));var g=[-3,-1,-5,-7,0,7,5,1,3],b=m(r[d],r[v]);for(f=Math.max(b[0].length,f),l[d]=new Array(f),l[v]=new Array(f),o=0;o=0;a--){for(var E=0;a>=0;){var S=!0;for(o=0;o=0&&E++,x=x.dblp(E),a<0)break;for(o=0;o0?u=c[o][_-1>>1]:_<0&&(u=c[o][-_-1>>1].neg()),x="affine"===u.type?x.mixedAdd(u):x.add(u))}}for(a=0;a=Math.ceil((e.bitLength()+1)/t.step)},b.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,i=0;i=0&&(a=t,u=r),n.negative&&(n=n.neg(),i=i.neg()),a.negative&&(a=a.neg(),u=u.neg()),[{a:n,b:i},{a:a,b:u}]},x.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],i=n.b.mul(e).divRound(this.n),a=r.b.neg().mul(e).divRound(this.n),o=i.mul(r.a),u=a.mul(n.a),s=i.mul(r.b),c=a.mul(n.b);return{k1:e.sub(o).sub(u),k2:s.add(c).neg()}},x.prototype.pointFromX=function(e,t){(e=new(o())(e,16)).red||(e=e.toRed(this.red));var r=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),n=r.redSqrt();if(0!==n.redSqr().redSub(r).cmp(this.zero))throw new Error("invalid point");var i=n.fromRed().isOdd();return(t&&!i||!t&&i)&&(n=n.redNeg()),this.point(e,n)},x.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,r=e.y,n=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(i).cmpn(0)},x.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,i=this._endoWnafT2,a=0;a":""},E.prototype.isInfinity=function(){return this.inf},E.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var r=t.redSqr().redISub(this.x).redISub(e.x),n=t.redMul(this.x.redSub(r)).redISub(this.y);return this.curve.point(r,n)},E.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,r=this.x.redSqr(),n=e.redInvm(),i=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),a=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,o)},E.prototype.getX=function(){return this.x.fromRed()},E.prototype.getY=function(){return this.y.fromRed()},E.prototype.mul=function(e){return e=new(o())(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},E.prototype.mulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i):this.curve._wnafMulAdd(1,n,i,2)},E.prototype.jmulAdd=function(e,t,r){var n=[this,t],i=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,i,!0):this.curve._wnafMulAdd(1,n,i,2,!0)},E.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},E.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var r=this.precomputed,n=function(e){return e.neg()};t.precomputed={naf:r.naf&&{wnd:r.naf.wnd,points:r.naf.points.map(n)},doubles:r.doubles&&{step:r.doubles.step,points:r.doubles.points.map(n)}}}return t},E.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},w(S,g.BasePoint),x.prototype.jpoint=function(e,t,r){return new S(this,e,t,r)},S.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),r=this.x.redMul(t),n=this.y.redMul(t).redMul(e);return this.curve.point(r,n)},S.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},S.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),r=this.z.redSqr(),n=this.x.redMul(t),i=e.x.redMul(r),a=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),u=n.redSub(i),s=a.redSub(o);if(0===u.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=u.redSqr(),l=c.redMul(u),f=n.redMul(c),h=s.redSqr().redIAdd(l).redISub(f).redISub(f),d=s.redMul(f.redISub(h)).redISub(a.redMul(l)),p=this.z.redMul(e.z).redMul(u);return this.curve.jpoint(h,d,p)},S.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),r=this.x,n=e.x.redMul(t),i=this.y,a=e.y.redMul(t).redMul(this.z),o=r.redSub(n),u=i.redSub(a);if(0===o.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var s=o.redSqr(),c=s.redMul(o),l=r.redMul(s),f=u.redSqr().redIAdd(c).redISub(l).redISub(l),h=u.redMul(l.redISub(f)).redISub(i.redMul(c)),d=this.z.redMul(o);return this.curve.jpoint(f,h,d)},S.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var r=this;for(t=0;t=0)return!1;if(r.redIAdd(i),0===this.x.cmp(r))return!0}},S.prototype.inspect=function(){return this.isInfinity()?"":""},S.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var _=c((function(e,t){var r=t;r.base=g,r.short=A,r.mont=null,r.edwards=null})),C=c((function(e,t){var r,n=t,i=d.assert;function a(e){"short"===e.type?this.curve=new _.short(e):"edwards"===e.type?this.curve=new _.edwards(e):this.curve=new _.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function o(e,t){Object.defineProperty(n,e,{configurable:!0,enumerable:!0,get:function(){var r=new a(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=a,o("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:s().sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),o("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:s().sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),o("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:s().sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),o("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:s().sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),o("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:s().sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),o("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s().sha256,gRed:!1,g:["9"]}),o("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:s().sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(u){r=void 0}o("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:s().sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function P(e){if(!(this instanceof P))return new P(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=h.toArray(e.entropy,e.entropyEnc||"hex"),r=h.toArray(e.nonce,e.nonceEnc||"hex"),n=h.toArray(e.pers,e.persEnc||"hex");l(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}var O=P;P.prototype._init=function(e,t,r){var n=e.concat(t).concat(r);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},P.prototype.generate=function(e,t,r,n){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!==typeof t&&(n=r,r=t,t=null),r&&(r=h.toArray(r,n||"hex"),this._update(r));for(var i=[];i.length"};var U=d.assert;function R(e,t){if(e instanceof R)return e;this._importDER(e,t)||(U(e.r&&e.s,"Signature without r or s"),this.r=new(o())(e.r,16),this.s=new(o())(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var I=R;function B(){this.place=0}function L(e,t){var r=e[t.place++];if(!(128&r))return r;var n=15&r;if(0===n||n>4)return!1;for(var i=0,a=0,o=t.place;a>>=0;return!(i<=127)&&(t.place=o,i)}function j(e){for(var t=0,r=e.length-1;!e[t]&&!(128&e[t+1])&&t>>3);for(e.push(128|r);--r;)e.push(t>>>(r<<3)&255);e.push(t)}}R.prototype._importDER=function(e,t){e=d.toArray(e,t);var r=new B;if(48!==e[r.place++])return!1;var n=L(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var i=L(e,r);if(!1===i)return!1;var a=e.slice(r.place,i+r.place);if(r.place+=i,2!==e[r.place++])return!1;var u=L(e,r);if(!1===u)return!1;if(e.length!==u+r.place)return!1;var s=e.slice(r.place,u+r.place);if(0===a[0]){if(!(128&a[1]))return!1;a=a.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new(o())(a),this.s=new(o())(s),this.recoveryParam=null,!0},R.prototype.toDER=function(e){var t=this.r.toArray(),r=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&r[0]&&(r=[0].concat(r)),t=j(t),r=j(r);!r[0]&&!(128&r[1]);)r=r.slice(1);var n=[2];F(n,t.length),(n=n.concat(t)).push(2),F(n,r.length);var i=n.concat(r),a=[48];return F(a,i.length),a=a.concat(i),d.encode(a,e)};var D=function(){throw new Error("unsupported")},z=d.assert;function Z(e){if(!(this instanceof Z))return new Z(e);"string"===typeof e&&(z(Object.prototype.hasOwnProperty.call(C,e),"Unknown curve "+e),e=C[e]),e instanceof C.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var q=Z;Z.prototype.keyPair=function(e){return new M(this,e)},Z.prototype.keyFromPrivate=function(e,t){return M.fromPrivate(this,e,t)},Z.prototype.keyFromPublic=function(e,t){return M.fromPublic(this,e,t)},Z.prototype.genKeyPair=function(e){e||(e={});for(var t=new O({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||D(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),r=this.n.byteLength(),n=this.n.sub(new(o())(2));;){var i=new(o())(t.generate(r));if(!(i.cmp(n)>0))return i.iaddn(1),this.keyFromPrivate(i)}},Z.prototype._truncateToN=function(e,t){var r=8*e.byteLength()-this.n.bitLength();return r>0&&(e=e.ushrn(r)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},Z.prototype.sign=function(e,t,r,n){"object"===typeof r&&(n=r,r=null),n||(n={}),t=this.keyFromPrivate(t,r),e=this._truncateToN(new(o())(e,16));for(var i=this.n.byteLength(),a=t.getPrivate().toArray("be",i),u=e.toArray("be",i),s=new O({hash:this.hash,entropy:a,nonce:u,pers:n.pers,persEnc:n.persEnc||"utf8"}),c=this.n.sub(new(o())(1)),l=0;;l++){var f=n.k?n.k(l):new(o())(s.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(c)>=0)){var h=this.g.mul(f);if(!h.isInfinity()){var d=h.getX(),p=d.umod(this.n);if(0!==p.cmpn(0)){var m=f.invm(this.n).mul(p.mul(t.getPrivate()).iadd(e));if(0!==(m=m.umod(this.n)).cmpn(0)){var v=(h.getY().isOdd()?1:0)|(0!==d.cmp(p)?2:0);return n.canonical&&m.cmp(this.nh)>0&&(m=this.n.sub(m),v^=1),new I({r:p,s:m,recoveryParam:v})}}}}}},Z.prototype.verify=function(e,t,r,n){e=this._truncateToN(new(o())(e,16)),r=this.keyFromPublic(r,n);var i=(t=new I(t,"hex")).r,a=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;var u,s=a.invm(this.n),c=s.mul(e).umod(this.n),l=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(u=this.g.jmulAdd(c,r.getPublic(),l)).isInfinity()&&u.eqXToP(i):!(u=this.g.mulAdd(c,r.getPublic(),l)).isInfinity()&&0===u.getX().umod(this.n).cmp(i)},Z.prototype.recoverPubKey=function(e,t,r,n){z((3&r)===r,"The recovery param is more than two bits"),t=new I(t,n);var i=this.n,a=new(o())(e),u=t.r,s=t.s,c=1&r,l=r>>1;if(u.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");u=l?this.curve.pointFromX(u.add(this.curve.n),c):this.curve.pointFromX(u,c);var f=t.r.invm(i),h=i.sub(a).mul(f).umod(i),d=s.mul(f).umod(i);return this.g.mulAdd(h,u,d)},Z.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new I(t,n)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var a;try{a=this.recoverPubKey(e,t,i)}catch(e){continue}if(a.eq(r))return i}throw new Error("Unable to find valid recovery factor")};var H=c((function(e,t){var r=t;r.version="6.5.4",r.utils=d,r.rand=function(){throw new Error("unsupported")},r.curve=_,r.curves=C,r.ec=q,r.eddsa=null})).ec,G=r(2009),K=r(4812),V=new(r(2735).Logger)("signing-key/5.7.0"),W=null;function J(){return W||(W=new H("secp256k1")),W}var Q=function(){function e(t){(0,n.Z)(this,e),(0,K.defineReadOnly)(this,"curve","secp256k1"),(0,K.defineReadOnly)(this,"privateKey",(0,G.hexlify)(t)),32!==(0,G.hexDataLength)(this.privateKey)&&V.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");var r=J().keyFromPrivate((0,G.arrayify)(this.privateKey));(0,K.defineReadOnly)(this,"publicKey","0x"+r.getPublic(!1,"hex")),(0,K.defineReadOnly)(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),(0,K.defineReadOnly)(this,"_isSigningKey",!0)}return(0,i.Z)(e,[{key:"_addPoint",value:function(e){var t=J().keyFromPublic((0,G.arrayify)(this.publicKey)),r=J().keyFromPublic((0,G.arrayify)(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}},{key:"signDigest",value:function(e){var t=J().keyFromPrivate((0,G.arrayify)(this.privateKey)),r=(0,G.arrayify)(e);32!==r.length&&V.throwArgumentError("bad digest length","digest",e);var n=t.sign(r,{canonical:!0});return(0,G.splitSignature)({recoveryParam:n.recoveryParam,r:(0,G.hexZeroPad)("0x"+n.r.toString(16),32),s:(0,G.hexZeroPad)("0x"+n.s.toString(16),32)})}},{key:"computeSharedSecret",value:function(e){var t=J().keyFromPrivate((0,G.arrayify)(this.privateKey)),r=J().keyFromPublic((0,G.arrayify)(X(e)));return(0,G.hexZeroPad)("0x"+t.derive(r.getPublic()).toString(16),32)}}],[{key:"isSigningKey",value:function(e){return!(!e||!e._isSigningKey)}}]),e}();function Y(e,t){var r=(0,G.splitSignature)(t),n={r:(0,G.arrayify)(r.r),s:(0,G.arrayify)(r.s)};return"0x"+J().recoverPubKey((0,G.arrayify)(e),n,r.recoveryParam).encode("hex",!1)}function X(e,t){var r=(0,G.arrayify)(e);if(32===r.length){var n=new Q(r);return t?"0x"+J().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}return 33===r.length?t?(0,G.hexlify)(r):"0x"+J().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?t?"0x"+J().keyFromPublic(r).getPublic(!0,"hex"):(0,G.hexlify)(r):V.throwArgumentError("invalid public or private key","key","[REDACTED]")}},6684:function(e,t,r){"use strict";r.r(t),r.d(t,{keccak256:function(){return v},pack:function(){return m},sha256:function(){return y}});var n=r(9560),i=r(2009),a=r(1291),o=r(3984),u=r(1953),s=r(2735),c=new RegExp("^bytes([0-9]+)$"),l=new RegExp("^(u?int)([0-9]*)$"),f=new RegExp("^(.*)\\[([0-9]*)\\]$"),h="0000000000000000000000000000000000000000000000000000000000000000",d=new s.Logger("solidity/5.7.0");function p(e,t,r){switch(e){case"address":return r?(0,i.zeroPad)(t,32):(0,i.arrayify)(t);case"string":return(0,u.Y0)(t);case"bytes":return(0,i.arrayify)(t);case"bool":return t=t?"0x01":"0x00",r?(0,i.zeroPad)(t,32):(0,i.arrayify)(t)}var a=e.match(l);if(a){var o=parseInt(a[2]||"256");return(a[2]&&String(o)!==a[2]||o%8!==0||0===o||o>256)&&d.throwArgumentError("invalid number type","type",e),r&&(o=256),t=n.O$.from(t).toTwos(o),(0,i.zeroPad)(t,o/8)}if(a=e.match(c)){var s=parseInt(a[1]);return(String(s)!==a[1]||0===s||s>32)&&d.throwArgumentError("invalid bytes type","type",e),(0,i.arrayify)(t).byteLength!==s&&d.throwArgumentError("invalid value for ".concat(e),"value",t),r?(0,i.arrayify)((t+h).substring(0,66)):t}if((a=e.match(f))&&Array.isArray(t)){var m=a[1];parseInt(a[2]||String(t.length))!=t.length&&d.throwArgumentError("invalid array length for ".concat(e),"value",t);var v=[];return t.forEach((function(e){v.push(p(m,e,!0))})),(0,i.concat)(v)}return d.throwArgumentError("invalid type","type",e)}function m(e,t){e.length!=t.length&&d.throwArgumentError("wrong number of values; expected ${ types.length }","values",t);var r=[];return e.forEach((function(e,n){r.push(p(e,t[n]))})),(0,i.hexlify)((0,i.concat)(r))}function v(e,t){return(0,a.keccak256)(m(e,t))}function y(e,t){return(0,o.JQ)(m(e,t))}},4965:function(e,t,r){"use strict";r.r(t),r.d(t,{UnicodeNormalizationForm:function(){return a.Uj},Utf8ErrorFuncs:function(){return a.te},Utf8ErrorReason:function(){return a.Uw},_toEscapedUtf8String:function(){return a.U$},formatBytes32String:function(){return o},nameprep:function(){return g},parseBytes32String:function(){return u},toUtf8Bytes:function(){return a.Y0},toUtf8CodePoints:function(){return a.XL},toUtf8String:function(){return a.ZN}});var n=r(4160),i=r(2009),a=r(1953);function o(e){var t=(0,a.Y0)(e);if(t.length>31)throw new Error("bytes32 string must be less than 32 bytes");return(0,i.hexlify)((0,i.concat)([t,n.R]).slice(0,32))}function u(e){var t=(0,i.arrayify)(e);if(32!==t.length)throw new Error("invalid bytes32 - not 32 bytes long");if(0!==t[31])throw new Error("invalid bytes32 string - no null terminator");for(var r=31;0===t[r-1];)r--;return(0,a.ZN)(t.slice(0,r))}function s(e,t){t||(t=function(e){return[parseInt(e,16)]});var r=0,n={};return e.split(",").forEach((function(e){var i=e.split(":");r+=parseInt(i[0],16),n[r]=t(i[1])})),n}function c(e){var t=0;return e.split(",").map((function(e){var r=e.split("-");return 1===r.length?r[1]="0":""===r[1]&&(r[1]="1"),{l:t+parseInt(r[0],16),h:t=parseInt(r[1],16)}}))}function l(e,t){for(var r=0,n=0;n=(r+=i.l)&&e<=r+i.h&&(e-r)%(i.d||1)===0){if(i.e&&-1!==i.e.indexOf(e-r))continue;return i}}return null}var f=c("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),h="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((function(e){return parseInt(e,16)})),d=[{h:25,s:32,l:65},{h:30,s:32,e:[23],l:127},{h:54,s:1,e:[48],l:64,d:2},{h:14,s:1,l:57,d:2},{h:44,s:1,l:17,d:2},{h:10,s:1,e:[2,6,8],l:61,d:2},{h:16,s:1,l:68,d:2},{h:84,s:1,e:[18,24,66],l:19,d:2},{h:26,s:32,e:[17],l:435},{h:22,s:1,l:71,d:2},{h:15,s:80,l:40},{h:31,s:32,l:16},{h:32,s:1,l:80,d:2},{h:52,s:1,l:42,d:2},{h:12,s:1,l:55,d:2},{h:40,s:1,e:[38],l:15,d:2},{h:14,s:1,l:48,d:2},{h:37,s:48,l:49},{h:148,s:1,l:6351,d:2},{h:88,s:1,l:160,d:2},{h:15,s:16,l:704},{h:25,s:26,l:854},{h:25,s:32,l:55915},{h:37,s:40,l:1247},{h:25,s:-119711,l:53248},{h:25,s:-119763,l:52},{h:25,s:-119815,l:52},{h:25,s:-119867,e:[1,4,5,7,8,11,12,17],l:52},{h:25,s:-119919,l:52},{h:24,s:-119971,e:[2,7,8,17],l:52},{h:24,s:-120023,e:[2,7,13,15,16,17],l:52},{h:25,s:-120075,l:52},{h:25,s:-120127,l:52},{h:25,s:-120179,l:52},{h:25,s:-120231,l:52},{h:25,s:-120283,l:52},{h:25,s:-120335,l:52},{h:24,s:-119543,e:[17],l:56},{h:24,s:-119601,e:[17],l:58},{h:24,s:-119659,e:[17],l:58},{h:24,s:-119717,e:[17],l:58},{h:24,s:-119775,e:[17],l:58}],p=s("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),m=s("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),v=s("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(e){if(e.length%4!==0)throw new Error("bad data");for(var t=[],r=0;r=0)return[];if(e>=65024&&e<=65039)return[];var t=function(e){var t=l(e,d);if(t)return[e+t.s];var r=p[e];if(r)return r;var n=m[e];return n?[e+n[0]]:v[e]||null}(e);return t||[e]})),r=t.reduce((function(e,t){return t.forEach((function(t){e.push(t)})),e}),[]),(r=(0,a.XL)((0,a.uu)(r),a.Uj.NFKC)).forEach((function(e){if(l(e,y))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")})),r.forEach((function(e){if(l(e,f))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}));var n=(0,a.uu)(r);if("-"===n.substring(0,1)||"--"===n.substring(2,4)||"-"===n.substring(n.length-1))throw new Error("invalid hyphen");return n}},1953:function(e,t,r){"use strict";r.d(t,{Uj:function(){return n},te:function(){return s},Uw:function(){return i},U$:function(){return h},uu:function(){return d},Y0:function(){return l},XL:function(){return m},ZN:function(){return p}});var n,i,a=r(2009),o=new(r(2735).Logger)("strings/5.7.0");function u(e,t,r,n,a){if(e===i.BAD_PREFIX||e===i.UNEXPECTED_CONTINUE){for(var o=0,u=t+1;u>6===2;u++)o++;return o}return e===i.OVERRUN?r.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(n||(n={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(i||(i={}));var s=Object.freeze({error:function(e,t,r,n,i){return o.throwArgumentError("invalid codepoint at offset ".concat(t,"; ").concat(e),"bytes",r)},ignore:u,replace:function(e,t,r,n,a){return e===i.OVERLONG?(n.push(a),0):(n.push(65533),u(e,t,r))}});function c(e,t){null==t&&(t=s.error),e=(0,a.arrayify)(e);for(var r=[],n=0;n>7!==0){var u=null,c=null;if(192===(224&o))u=1,c=127;else if(224===(240&o))u=2,c=2047;else{if(240!==(248&o)){n+=t(128===(192&o)?i.UNEXPECTED_CONTINUE:i.BAD_PREFIX,n-1,e,r);continue}u=3,c=65535}if(n-1+u>=e.length)n+=t(i.OVERRUN,n-1,e,r);else{for(var l=o&(1<<8-u-1)-1,f=0;f1114111?n+=t(i.OUT_OF_RANGE,n-1-u,e,r,l):l>=55296&&l<=57343?n+=t(i.UTF16_SURROGATE,n-1-u,e,r,l):l<=c?n+=t(i.OVERLONG,n-1-u,e,r,l):r.push(l))}}else r.push(o)}return r}function l(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.current;t!=n.current&&(o.checkNormalize(),e=e.normalize(t));for(var r=[],i=0;i>6|192),r.push(63&u|128);else if(55296==(64512&u)){i++;var s=e.charCodeAt(i);if(i>=e.length||56320!==(64512&s))throw new Error("invalid utf-8 string");var c=65536+((1023&u)<<10)+(1023&s);r.push(c>>18|240),r.push(c>>12&63|128),r.push(c>>6&63|128),r.push(63&c|128)}else r.push(u>>12|224),r.push(u>>6&63|128),r.push(63&u|128)}return(0,a.arrayify)(r)}function f(e){var t="0000"+e.toString(16);return"\\u"+t.substring(t.length-4)}function h(e,t){return'"'+c(e,t).map((function(e){if(e<256){switch(e){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 13:return"\\r";case 34:return'\\"';case 92:return"\\\\"}if(e>=32&&e<127)return String.fromCharCode(e)}return e<=65535?f(e):f(55296+((e-=65536)>>10&1023))+f(56320+(1023&e))})).join("")+'"'}function d(e){return e.map((function(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e)))})).join("")}function p(e,t){return d(c(e,t))}function m(e){return c(l(e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:n.current))}},5958:function(e,t,r){"use strict";r.r(t),r.d(t,{TransactionTypes:function(){return n},accessListify:function(){return x},computeAddress:function(){return g},parse:function(){return P},recoverAddress:function(){return b},serialize:function(){return _}});var n,i=r(8552),a=r(9560),o=r(2009),u=r(6321),s=r(1291),c=r(4812),l=r(807),f=r(4760),h=r(2735),d=new h.Logger("transactions/5.7.0");function p(e){return"0x"===e?null:(0,i.getAddress)(e)}function m(e){return"0x"===e?u._Y:a.O$.from(e)}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(n||(n={}));var v=[{name:"nonce",maxLength:32,numeric:!0},{name:"gasPrice",maxLength:32,numeric:!0},{name:"gasLimit",maxLength:32,numeric:!0},{name:"to",length:20},{name:"value",maxLength:32,numeric:!0},{name:"data"}],y={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function g(e){var t=(0,f.computePublicKey)(e);return(0,i.getAddress)((0,o.hexDataSlice)((0,s.keccak256)((0,o.hexDataSlice)(t,1)),12))}function b(e,t){return g((0,f.recoverPublicKey)((0,o.arrayify)(e),t))}function w(e,t){var r=(0,o.stripZeros)(a.O$.from(e).toHexString());return r.length>32&&d.throwArgumentError("invalid length for "+t,"transaction:"+t,e),r}function k(e,t){return{address:(0,i.getAddress)(e),storageKeys:(t||[]).map((function(t,r){return 32!==(0,o.hexDataLength)(t)&&d.throwArgumentError("invalid access list storageKey","accessList[".concat(e,":").concat(r,"]"),t),t.toLowerCase()}))}}function x(e){if(Array.isArray(e))return e.map((function(e,t){return Array.isArray(e)?(e.length>2&&d.throwArgumentError("access list expected to be [ address, storageKeys[] ]","value[".concat(t,"]"),e),k(e[0],e[1])):k(e.address,e.storageKeys)}));var t=Object.keys(e).map((function(t){var r=e[t].reduce((function(e,t){return e[t]=!0,e}),{});return k(t,Object.keys(r).sort())}));return t.sort((function(e,t){return e.address.localeCompare(t.address)})),t}function A(e){return x(e).map((function(e){return[e.address,e.storageKeys]}))}function E(e,t){if(null!=e.gasPrice){var r=a.O$.from(e.gasPrice),n=a.O$.from(e.maxFeePerGas||0);r.eq(n)||d.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:r,maxFeePerGas:n})}var u=[w(e.chainId||0,"chainId"),w(e.nonce||0,"nonce"),w(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),w(e.maxFeePerGas||0,"maxFeePerGas"),w(e.gasLimit||0,"gasLimit"),null!=e.to?(0,i.getAddress)(e.to):"0x",w(e.value||0,"value"),e.data||"0x",A(e.accessList||[])];if(t){var s=(0,o.splitSignature)(t);u.push(w(s.recoveryParam,"recoveryParam")),u.push((0,o.stripZeros)(s.r)),u.push((0,o.stripZeros)(s.s))}return(0,o.hexConcat)(["0x02",l.encode(u)])}function S(e,t){var r=[w(e.chainId||0,"chainId"),w(e.nonce||0,"nonce"),w(e.gasPrice||0,"gasPrice"),w(e.gasLimit||0,"gasLimit"),null!=e.to?(0,i.getAddress)(e.to):"0x",w(e.value||0,"value"),e.data||"0x",A(e.accessList||[])];if(t){var n=(0,o.splitSignature)(t);r.push(w(n.recoveryParam,"recoveryParam")),r.push((0,o.stripZeros)(n.r)),r.push((0,o.stripZeros)(n.s))}return(0,o.hexConcat)(["0x01",l.encode(r)])}function _(e,t){if(null==e.type||0===e.type)return null!=e.accessList&&d.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",e),function(e,t){(0,c.checkProperties)(e,y);var r=[];v.forEach((function(t){var n=e[t.name]||[],i={};t.numeric&&(i.hexPad="left"),n=(0,o.arrayify)((0,o.hexlify)(n,i)),t.length&&n.length!==t.length&&n.length>0&&d.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,n),t.maxLength&&(n=(0,o.stripZeros)(n)).length>t.maxLength&&d.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,n),r.push((0,o.hexlify)(n))}));var n=0;if(null!=e.chainId?"number"!==typeof(n=e.chainId)&&d.throwArgumentError("invalid transaction.chainId","transaction",e):t&&!(0,o.isBytesLike)(t)&&t.v>28&&(n=Math.floor((t.v-35)/2)),0!==n&&(r.push((0,o.hexlify)(n)),r.push("0x"),r.push("0x")),!t)return l.encode(r);var i=(0,o.splitSignature)(t),a=27+i.recoveryParam;return 0!==n?(r.pop(),r.pop(),r.pop(),a+=2*n+8,i.v>28&&i.v!==a&&d.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t)):i.v!==a&&d.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t),r.push((0,o.hexlify)(a)),r.push((0,o.stripZeros)((0,o.arrayify)(i.r))),r.push((0,o.stripZeros)((0,o.arrayify)(i.s))),l.encode(r)}(e,t);switch(e.type){case 1:return S(e,t);case 2:return E(e,t)}return d.throwError("unsupported transaction type: ".concat(e.type),h.Logger.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:e.type})}function C(e,t,r){try{var n=m(t[0]).toNumber();if(0!==n&&1!==n)throw new Error("bad recid");e.v=n}catch(a){d.throwArgumentError("invalid v for transaction type: 1","v",t[0])}e.r=(0,o.hexZeroPad)(t[1],32),e.s=(0,o.hexZeroPad)(t[2],32);try{var i=(0,s.keccak256)(r(e));e.from=b(i,{r:e.r,s:e.s,recoveryParam:e.v})}catch(a){}}function P(e){var t=(0,o.arrayify)(e);if(t[0]>127)return function(e){var t=l.decode(e);9!==t.length&&6!==t.length&&d.throwArgumentError("invalid raw transaction","rawTransaction",e);var r={nonce:m(t[0]).toNumber(),gasPrice:m(t[1]),gasLimit:m(t[2]),to:p(t[3]),value:m(t[4]),data:t[5],chainId:0};if(6===t.length)return r;try{r.v=a.O$.from(t[6]).toNumber()}catch(c){return r}if(r.r=(0,o.hexZeroPad)(t[7],32),r.s=(0,o.hexZeroPad)(t[8],32),a.O$.from(r.r).isZero()&&a.O$.from(r.s).isZero())r.chainId=r.v,r.v=0;else{r.chainId=Math.floor((r.v-35)/2),r.chainId<0&&(r.chainId=0);var n=r.v-27,i=t.slice(0,6);0!==r.chainId&&(i.push((0,o.hexlify)(r.chainId)),i.push("0x"),i.push("0x"),n-=2*r.chainId+8);var u=(0,s.keccak256)(l.encode(i));try{r.from=b(u,{r:(0,o.hexlify)(r.r),s:(0,o.hexlify)(r.s),recoveryParam:n})}catch(c){}r.hash=(0,s.keccak256)(e)}return r.type=null,r}(t);switch(t[0]){case 1:return function(e){var t=l.decode(e.slice(1));8!==t.length&&11!==t.length&&d.throwArgumentError("invalid component count for transaction type: 1","payload",(0,o.hexlify)(e));var r={type:1,chainId:m(t[0]).toNumber(),nonce:m(t[1]).toNumber(),gasPrice:m(t[2]),gasLimit:m(t[3]),to:p(t[4]),value:m(t[5]),data:t[6],accessList:x(t[7])};return 8===t.length||(r.hash=(0,s.keccak256)(e),C(r,t.slice(8),S)),r}(t);case 2:return function(e){var t=l.decode(e.slice(1));9!==t.length&&12!==t.length&&d.throwArgumentError("invalid component count for transaction type: 2","payload",(0,o.hexlify)(e));var r=m(t[2]),n=m(t[3]),i={type:2,chainId:m(t[0]).toNumber(),nonce:m(t[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:m(t[4]),to:p(t[5]),value:m(t[6]),data:t[7],accessList:x(t[8])};return 9===t.length||(i.hash=(0,s.keccak256)(e),C(i,t.slice(9),E)),i}(t)}return d.throwError("unsupported transaction type: ".concat(t[0]),h.Logger.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:t[0]})}},6955:function(e,t,r){"use strict";r.r(t),r.d(t,{commify:function(){return E},formatEther:function(){return C},formatUnits:function(){return S},parseEther:function(){return P},parseUnits:function(){return _}});var n=r(5671),i=r(3144),a=r(2009),o=r(2735),u=r(4227),s=r(9560),c=new o.Logger(u.i),l={},f=s.O$.from(0),h=s.O$.from(-1);function d(e,t,r,n){var i={fault:t,operation:r};return void 0!==n&&(i.value=n),c.throwError(e,o.Logger.errors.NUMERIC_FAULT,i)}for(var p="0";p.length<256;)p+=p;function m(e){if("number"!==typeof e)try{e=s.O$.from(e).toNumber()}catch(t){}return"number"===typeof e&&e>=0&&e<=256&&!(e%1)?"1"+p.substring(0,e):c.throwArgumentError("invalid decimal size","decimals",e)}function v(e,t){null==t&&(t=0);var r=m(t),n=(e=s.O$.from(e)).lt(f);n&&(e=e.mul(h));for(var i=e.mod(r).toString();i.length2&&c.throwArgumentError("too many decimal points","value",e);var a=i[0],o=i[1];for(a||(a="0"),o||(o="0");"0"===o[o.length-1];)o=o.substring(0,o.length-1);for(o.length>r.length-1&&d("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length80&&c.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new e(l,r,n,i)}}]),e}(),b=function(){function e(t,r,i,a){(0,n.Z)(this,e),t!==l&&c.throwError("cannot use FixedNumber constructor; use FixedNumber.from",o.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=a,this._hex=r,this._value=i,this._isFixedNumber=!0,Object.freeze(this)}return(0,i.Z)(e,[{key:"_checkFormat",value:function(e){this.format.name!==e.format.name&&c.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}},{key:"addUnsafe",value:function(t){this._checkFormat(t);var r=y(this._value,this.format.decimals),n=y(t._value,t.format.decimals);return e.fromValue(r.add(n),this.format.decimals,this.format)}},{key:"subUnsafe",value:function(t){this._checkFormat(t);var r=y(this._value,this.format.decimals),n=y(t._value,t.format.decimals);return e.fromValue(r.sub(n),this.format.decimals,this.format)}},{key:"mulUnsafe",value:function(t){this._checkFormat(t);var r=y(this._value,this.format.decimals),n=y(t._value,t.format.decimals);return e.fromValue(r.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}},{key:"divUnsafe",value:function(t){this._checkFormat(t);var r=y(this._value,this.format.decimals),n=y(t._value,t.format.decimals);return e.fromValue(r.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}},{key:"floor",value:function(){var t=this.toString().split(".");1===t.length&&t.push("0");var r=e.from(t[0],this.format),n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(r=r.subUnsafe(w.toFormat(r.format))),r}},{key:"ceiling",value:function(){var t=this.toString().split(".");1===t.length&&t.push("0");var r=e.from(t[0],this.format),n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(r=r.addUnsafe(w.toFormat(r.format))),r}},{key:"round",value:function(t){null==t&&(t=0);var r=this.toString().split(".");if(1===r.length&&r.push("0"),(t<0||t>80||t%1)&&c.throwArgumentError("invalid decimal count","decimals",t),r[1].length<=t)return this;var n=e.from("1"+p.substring(0,t),this.format),i=k.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(i).floor().divUnsafe(n)}},{key:"isZero",value:function(){return"0.0"===this._value||"0"===this._value}},{key:"isNegative",value:function(){return"-"===this._value[0]}},{key:"toString",value:function(){return this._value}},{key:"toHexString",value:function(e){if(null==e)return this._hex;e%8&&c.throwArgumentError("invalid byte width","width",e);var t=s.O$.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return(0,a.hexZeroPad)(t,e/8)}},{key:"toUnsafeFloat",value:function(){return parseFloat(this.toString())}},{key:"toFormat",value:function(t){return e.fromString(this._value,t)}}],[{key:"fromValue",value:function(t,r,n){return null!=n||null==r||(0,s.Zm)(r)||(n=r,r=null),null==r&&(r=0),null==n&&(n="fixed"),e.fromString(v(t,r),g.from(n))}},{key:"fromString",value:function(t,r){null==r&&(r="fixed");var n=g.from(r),i=y(t,n.decimals);!n.signed&&i.lt(f)&&d("unsigned value cannot be negative","overflow","value",t);var o=null;n.signed?o=i.toTwos(n.width).toHexString():(o=i.toHexString(),o=(0,a.hexZeroPad)(o,n.width/8));var u=v(i,n.decimals);return new e(l,o,u,n)}},{key:"fromBytes",value:function(t,r){null==r&&(r="fixed");var n=g.from(r);if((0,a.arrayify)(t).length>n.width/8)throw new Error("overflow");var i=s.O$.from(t);n.signed&&(i=i.fromTwos(n.width));var o=i.toTwos((n.signed?0:1)+n.width).toHexString(),u=v(i,n.decimals);return new e(l,o,u,n)}},{key:"from",value:function(t,r){if("string"===typeof t)return e.fromString(t,r);if((0,a.isBytes)(t))return e.fromBytes(t,r);try{return e.fromValue(t,0,r)}catch(n){if(n.code!==o.Logger.errors.INVALID_ARGUMENT)throw n}return c.throwArgumentError("invalid FixedNumber value","value",t)}},{key:"isFixedNumber",value:function(e){return!(!e||!e._isFixedNumber)}}]),e}(),w=b.from(1),k=b.from("0.5"),x=new o.Logger("units/5.7.0"),A=["wei","kwei","mwei","gwei","szabo","finney","ether"];function E(e){var t=String(e).split(".");(t.length>2||!t[0].match(/^-?[0-9]*$/)||t[1]&&!t[1].match(/^[0-9]*$/)||"."===e||"-."===e)&&x.throwArgumentError("invalid value","value",e);var r=t[0],n="";for("-"===r.substring(0,1)&&(n="-",r=r.substring(1));"0"===r.substring(0,1);)r=r.substring(1);""===r&&(r="0");var i="";for(2===t.length&&(i="."+(t[1]||"0"));i.length>2&&"0"===i[i.length-1];)i=i.substring(0,i.length-1);for(var a=[];r.length;){if(r.length<=3){a.unshift(r);break}var o=r.length-3;a.unshift(r.substring(o)),r=r.substring(0,o)}return n+a.join(",")+i}function S(e,t){if("string"===typeof t){var r=A.indexOf(t);-1!==r&&(t=3*r)}return v(e,null!=t?t:18)}function _(e,t){if("string"!==typeof e&&x.throwArgumentError("value must be a string","value",e),"string"===typeof t){var r=A.indexOf(t);-1!==r&&(t=3*r)}return y(e,null!=t?t:18)}function C(e){return S(e,18)}function P(e){return _(e,18)}},6204:function(e,t,r){"use strict";r.r(t),r.d(t,{Wallet:function(){return _},verifyMessage:function(){return C},verifyTypedData:function(){return P}});var n=r(4165),i=r(5671),a=r(3144),o=r(7326),u=r(136),s=r(9388),c=r(8552),l=r(5157),f=r(2388),h=r(2009),d=r(8836),p=r(6454),m=r(9590),v=r(1291),y=r(4812),g=r(5722),b=r(4760),w=r(2691),k=r(5054),x=r(5958),A=r(2735),E=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{s(n.next(e))}catch(t){a(t)}}function u(e){try{s(n.throw(e))}catch(t){a(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,u)}s((n=n.apply(e,t||[])).next())}))},S=new A.Logger("wallet/5.7.0");var _=function(e){(0,u.Z)(r,e);var t=(0,s.Z)(r);function r(e,n){var a,u;if((0,i.Z)(this,r),a=t.call(this),null!=(u=e)&&(0,h.isHexString)(u.privateKey,32)&&null!=u.address){var s=new b.SigningKey(e.privateKey);if((0,y.defineReadOnly)((0,o.Z)(a),"_signingKey",(function(){return s})),(0,y.defineReadOnly)((0,o.Z)(a),"address",(0,x.computeAddress)(a.publicKey)),a.address!==(0,c.getAddress)(e.address)&&S.throwArgumentError("privateKey/address mismatch","privateKey","[REDACTED]"),function(e){var t=e.mnemonic;return t&&t.phrase}(e)){var f=e.mnemonic;(0,y.defineReadOnly)((0,o.Z)(a),"_mnemonic",(function(){return{phrase:f.phrase,path:f.path||m.defaultPath,locale:f.locale||"en"}}));var d=a.mnemonic,p=m.HDNode.fromMnemonic(d.phrase,null,d.locale).derivePath(d.path);(0,x.computeAddress)(p.privateKey)!==a.address&&S.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else(0,y.defineReadOnly)((0,o.Z)(a),"_mnemonic",(function(){return null}))}else{if(b.SigningKey.isSigningKey(e))"secp256k1"!==e.curve&&S.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),(0,y.defineReadOnly)((0,o.Z)(a),"_signingKey",(function(){return e}));else{"string"===typeof e&&e.match(/^[0-9a-f]*$/i)&&64===e.length&&(e="0x"+e);var v=new b.SigningKey(e);(0,y.defineReadOnly)((0,o.Z)(a),"_signingKey",(function(){return v}))}(0,y.defineReadOnly)((0,o.Z)(a),"_mnemonic",(function(){return null})),(0,y.defineReadOnly)((0,o.Z)(a),"address",(0,x.computeAddress)(a.publicKey))}return n&&!l.zt.isProvider(n)&&S.throwArgumentError("invalid provider","provider",n),(0,y.defineReadOnly)((0,o.Z)(a),"provider",n||null),a}return(0,a.Z)(r,[{key:"mnemonic",get:function(){return this._mnemonic()}},{key:"privateKey",get:function(){return this._signingKey().privateKey}},{key:"publicKey",get:function(){return this._signingKey().publicKey}},{key:"getAddress",value:function(){return Promise.resolve(this.address)}},{key:"connect",value:function(e){return new r(this,e)}},{key:"signTransaction",value:function(e){var t=this;return(0,y.resolveProperties)(e).then((function(r){null!=r.from&&((0,c.getAddress)(r.from)!==t.address&&S.throwArgumentError("transaction from address mismatch","transaction.from",e.from),delete r.from);var n=t._signingKey().signDigest((0,v.keccak256)((0,x.serialize)(r)));return(0,x.serialize)(r,n)}))}},{key:"signMessage",value:function(e){return E(this,void 0,void 0,(0,n.Z)().mark((function t(){return(0,n.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",(0,h.joinSignature)(this._signingKey().signDigest((0,d.r)(e))));case 1:case"end":return t.stop()}}),t,this)})))}},{key:"_signTypedData",value:function(e,t,r){return E(this,void 0,void 0,(0,n.Z)().mark((function i(){var a,o=this;return(0,n.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,p.E.resolveNames(e,t,r,(function(e){return null==o.provider&&S.throwError("cannot resolve ENS names without a provider",A.Logger.errors.UNSUPPORTED_OPERATION,{operation:"resolveName",value:e}),o.provider.resolveName(e)}));case 2:return a=n.sent,n.abrupt("return",(0,h.joinSignature)(this._signingKey().signDigest(p.E.hash(a.domain,t,a.value))));case 4:case"end":return n.stop()}}),i,this)})))}},{key:"encrypt",value:function(e,t,r){if("function"!==typeof t||r||(r=t,t={}),r&&"function"!==typeof r)throw new Error("invalid callback");return t||(t={}),(0,w.HI)(this,e,t,r)}}],[{key:"createRandom",value:function(e){var t=(0,g.O)(16);e||(e={}),e.extraEntropy&&(t=(0,h.arrayify)((0,h.hexDataSlice)((0,v.keccak256)((0,h.concat)([t,e.extraEntropy])),0,16)));var n=(0,m.entropyToMnemonic)(t,e.locale);return r.fromMnemonic(n,e.path,e.locale)}},{key:"fromEncryptedJson",value:function(e,t,n){return(0,k.decryptJsonWallet)(e,t,n).then((function(e){return new r(e)}))}},{key:"fromEncryptedJsonSync",value:function(e,t){return new r((0,k.decryptJsonWalletSync)(e,t))}},{key:"fromMnemonic",value:function(e,t,n){return t||(t=m.defaultPath),new r(m.HDNode.fromMnemonic(e,null,n).derivePath(t))}}]),r}(f.E);function C(e,t){return(0,x.recoverAddress)((0,d.r)(e),t)}function P(e,t,r,n){return(0,x.recoverAddress)(p.E.hash(e,t,r),n)}},8786:function(e,t,r){"use strict";r.r(t),r.d(t,{_fetchData:function(){return m},fetchJson:function(){return v},poll:function(){return y}});var n=r(4165),i=r(8853),a=r(2009),o=r(4812),u=r(1953),s=r(2735),c=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{s(n.next(e))}catch(t){a(t)}}function u(e){try{s(n.throw(e))}catch(t){a(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,u)}s((n=n.apply(e,t||[])).next())}))};function l(e,t){return c(this,void 0,void 0,(0,n.Z)().mark((function r(){var i,o,u,s,c;return(0,n.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return null==t&&(t={}),i={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0},!0!==t.skipFetchSetup&&(i.mode="cors",i.cache="no-cache",i.credentials="same-origin",i.redirect="follow",i.referrer="client"),null!=t.fetchOptions&&((o=t.fetchOptions).mode&&(i.mode=o.mode),o.cache&&(i.cache=o.cache),o.credentials&&(i.credentials=o.credentials),o.redirect&&(i.redirect=o.redirect),o.referrer&&(i.referrer=o.referrer)),r.next=7,fetch(e,i);case 7:return u=r.sent,r.next=10,u.arrayBuffer();case 10:return s=r.sent,c={},u.headers.forEach?u.headers.forEach((function(e,t){c[t.toLowerCase()]=e})):u.headers.keys().forEach((function(e){c[e.toLowerCase()]=u.headers.get(e)})),r.abrupt("return",{headers:c,statusCode:u.status,statusMessage:u.statusText,body:(0,a.arrayify)(new Uint8Array(s))});case 14:case"end":return r.stop()}}),r)})))}var f=function(e,t,r,n){return new(r||(r=Promise))((function(i,a){function o(e){try{s(n.next(e))}catch(t){a(t)}}function u(e){try{s(n.throw(e))}catch(t){a(t)}}function s(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,u)}s((n=n.apply(e,t||[])).next())}))},h=new s.Logger("web/5.7.1");function d(e){return new Promise((function(t){setTimeout(t,e)}))}function p(e,t){if(null==e)return null;if("string"===typeof e)return e;if((0,a.isBytesLike)(e)){if(t&&("text"===t.split("/")[0]||"application/json"===t.split(";")[0].trim()))try{return(0,u.ZN)(e)}catch(r){}return(0,a.hexlify)(e)}return e}function m(e,t,r){var a="object"===typeof e&&null!=e.throttleLimit?e.throttleLimit:12;h.assertArgument(a>0&&a%1===0,"invalid connection throttle limit","connection.throttleLimit",a);var c="object"===typeof e?e.throttleCallback:null,m="object"===typeof e&&"number"===typeof e.throttleSlotInterval?e.throttleSlotInterval:100;h.assertArgument(m>0&&m%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",m);var v="object"===typeof e&&!!e.errorPassThrough,y={},g=null,b={method:"GET"},w=!1,k=12e4;if("string"===typeof e)g=e;else if("object"===typeof e){if(null!=e&&null!=e.url||h.throwArgumentError("missing URL","connection.url",e),g=e.url,"number"===typeof e.timeout&&e.timeout>0&&(k=e.timeout),e.headers)for(var x in e.headers)y[x.toLowerCase()]={key:x,value:String(e.headers[x])},["if-none-match","if-modified-since"].indexOf(x.toLowerCase())>=0&&(w=!0);if(b.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==g.substring(0,6)&&!0!==e.allowInsecureAuthentication&&h.throwError("basic authentication requires a secure https url",s.Logger.errors.INVALID_ARGUMENT,{argument:"url",url:g,user:e.user,password:"[REDACTED]"});var A=e.user+":"+e.password;y.authorization={key:"Authorization",value:"Basic "+(0,i.c)((0,u.Y0)(A))}}null!=e.skipFetchSetup&&(b.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(b.fetchOptions=(0,o.shallowCopy)(e.fetchOptions))}var E,S=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),_=g?g.match(S):null;if(_)try{var C={statusCode:200,statusMessage:"OK",headers:{"content-type":_[1]||"text/plain"},body:_[2]?(0,i.J)(_[3]):(E=_[3],(0,u.Y0)(E.replace(/%([0-9a-f][0-9a-f])/gi,(function(e,t){return String.fromCharCode(parseInt(t,16))}))))},P=C.body;return r&&(P=r(C.body,C)),Promise.resolve(P)}catch(M){h.throwError("processing response error",s.Logger.errors.SERVER_ERROR,{body:p(_[1],_[2]),error:M,requestBody:null,requestMethod:"GET",url:g})}t&&(b.method="POST",b.body=t,null==y["content-type"]&&(y["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==y["content-length"]&&(y["content-length"]={key:"Content-Length",value:String(t.length)}));var O={};Object.keys(y).forEach((function(e){var t=y[e];O[t.key]=t.value})),b.headers=O;var N=function(){var e=null;return{promise:new Promise((function(t,r){k&&(e=setTimeout((function(){null!=e&&(e=null,r(h.makeError("timeout",s.Logger.errors.TIMEOUT,{requestBody:p(b.body,O["content-type"]),requestMethod:b.method,timeout:k,url:g})))}),k))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),T=function(){return f(this,void 0,void 0,(0,n.Z)().mark((function e(){var t,i,o,u,f,y,k,x,A,E;return(0,n.Z)().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=0;case 1:if(!(t=300)&&(N.cancel(),h.throwError("bad response",s.Logger.errors.SERVER_ERROR,{status:i.statusCode,headers:i.headers,body:p(k,i.headers?i.headers["content-type"]:null),requestBody:p(b.body,O["content-type"]),requestMethod:b.method,url:g})),!r){e.next=60;break}return e.prev=37,e.next=40,r(k,i);case 40:return x=e.sent,N.cancel(),e.abrupt("return",x);case 45:if(e.prev=45,e.t1=e.catch(37),!(e.t1.throttleRetry&&tu)return void(o()&&n(new Error("retry limit reached")));var c=t.interval*parseInt(String(Math.random()*Math.pow(2,s)));ct.ceiling&&(c=t.ceiling),setTimeout(i,c)}return null}),(function(e){o()&&n(e)}))}()}))}},3811:function(e){"use strict";e.exports=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.mustBeMetaMask,r=void 0!==t&&t,n=e.silent,i=void 0!==n&&n,a=e.timeout,o=void 0===a?3e3:a;!function(){if("boolean"!==typeof r)throw new Error("@metamask/detect-provider: Expected option 'mustBeMetaMask' to be a boolean.");if("boolean"!==typeof i)throw new Error("@metamask/detect-provider: Expected option 'silent' to be a boolean.");if("number"!==typeof o)throw new Error("@metamask/detect-provider: Expected option 'timeout' to be a number.")}();var u=!1;return new Promise((function(e){function t(){if(!u){u=!0,window.removeEventListener("ethereum#initialized",t);var n=window.ethereum;if(!n||r&&!n.isMetaMask){var a=r&&n?"Non-MetaMask window.ethereum detected.":"Unable to detect window.ethereum.";!i&&console.error("@metamask/detect-provider:",a),e(null)}else e(n)}}window.ethereum?t():(window.addEventListener("ethereum#initialized",t,{once:!0}),setTimeout((function(){t()}),o))}))}},2470:function(e,t){"use strict";t.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,a=u(e),o=a[0],s=a[1],c=new i(function(e,t,r){return 3*(t+r)/4-r}(0,o,s)),l=0,f=s>0?o-4:o;for(r=0;r>16&255,c[l++]=t>>8&255,c[l++]=255&t;2===s&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[l++]=255&t);1===s&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t);return c},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,a=[],o=16383,u=0,c=n-i;uc?c:u+o));1===i?(t=e[n-1],a.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],a.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return a.join("")};for(var r=[],n=[],i="undefined"!==typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)r[o]=a[o],n[a.charCodeAt(o)]=o;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function s(e,t,n){for(var i,a,o=[],u=t;u>18&63]+r[a>>12&63]+r[a>>6&63]+r[63&a]);return o.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},5109:function(e){"use strict";for(var t="qpzry9x8gf2tvdw0s3jn54khce6mua7l",r={},n=0;n<32;n++){var i=t.charAt(n);if(void 0!==r[i])throw new TypeError(i+" is ambiguous");r[i]=n}function a(e){var t=e>>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function o(e){for(var t=1,r=0;r126)return"Invalid prefix ("+e+")";t=a(t)^n>>5}for(t=a(t),r=0;rt)return"Exceeds length limit";var n=e.toLowerCase(),i=e.toUpperCase();if(e!==n&&e!==i)return"Mixed-case string "+e;var u=(e=n).lastIndexOf("1");if(-1===u)return"No separator character for "+e;if(0===u)return"Missing prefix for "+e;var s=e.slice(0,u),c=e.slice(u+1);if(c.length<6)return"Data too short";var l=o(s);if("string"===typeof l)return l;for(var f=[],h=0;h=c.length||f.push(p)}return 1!==l?"Invalid checksum for "+e:{prefix:s,words:f}}function s(e,t,r,n){for(var i=0,a=0,o=(1<=r;)a-=r,u.push(i>>a&o);if(n)a>0&&u.push(i<=t)return"Excess padding";if(i<n)throw new TypeError("Exceeds length limit");var i=o(e=e.toLowerCase());if("string"===typeof i)throw new Error(i);for(var u=e+"1",s=0;s>5!==0)throw new Error("Non 5-bit word");i=a(i)^c,u+=t.charAt(c)}for(s=0;s<6;++s)i=a(i);for(i^=1,s=0;s<6;++s){u+=t.charAt(i>>5*(5-s)&31)}return u},toWordsUnsafe:function(e){var t=s(e,8,5,!0);if(Array.isArray(t))return t},toWords:function(e){var t=s(e,8,5,!0);if(Array.isArray(t))return t;throw new Error(t)},fromWordsUnsafe:function(e){var t=s(e,5,8,!1);if(Array.isArray(t))return t},fromWords:function(e){var t=s(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}}},4166:function(e,t,r){!function(e,t){"use strict";function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function a(e,t,r){if(a.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(r=t,t=10),this._init(e||0,t||10,r||"be"))}var o;"object"===typeof e?e.exports=a:t.BN=a,a.BN=a,a.wordSize=26;try{o="undefined"!==typeof window&&"undefined"!==typeof window.Buffer?window.Buffer:r(6601).Buffer}catch(P){}function u(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function s(e,t,r){var n=u(e,r);return r-1>=t&&(n|=u(e,r-1)<<4),n}function c(e,t,r,i){for(var a=0,o=0,u=Math.min(e.length,r),s=t;s=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&o0?e:t},a.min=function(e,t){return e.cmp(t)<0?e:t},a.prototype._init=function(e,t,r){if("number"===typeof e)return this._initNumber(e,t,r);if("object"===typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i=0;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=o<>>26-u&67108863,(u+=24)>=26&&(u-=26,a++);else if("le"===r)for(i=0,a=0;i>>26-u&67108863,(u+=24)>=26&&(u-=26,a++);return this._strip()},a.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var n=0;n=t;n-=2)i=s(e,t,n)<=18?(a-=18,o+=1,this.words[o]|=i>>>26):a+=8;else for(n=(e.length-t)%2===0?t+1:t;n=18?(a-=18,o+=1,this.words[o]|=i>>>26):a+=8;this._strip()},a.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var a=e.length-r,o=a%n,u=Math.min(a,a-o)+r,s=0,l=r;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!==typeof Symbol&&"function"===typeof Symbol.for)try{a.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch(P){a.prototype.inspect=f}else a.prototype.inspect=f;function f(){return(this.red?""}var h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];a.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,a=0,o=0;o>>24-i&16777215,(i+=2)>=26&&(i-=26,o--),r=0!==a||o!==this.length-1?h[6-s.length]+s+r:s+r}for(0!==a&&(r=a.toString(16)+r);r.length%t!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=d[e],l=p[e];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var m=f.modrn(l).toString(e);r=(f=f.idivn(l)).isZero()?m+r:h[c-m.length]+m+r}for(this.isZero()&&(r="0"+r);r.length%t!==0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},a.prototype.toJSON=function(){return this.toString(16,2)},o&&(a.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),a.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function m(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],a=0|t.words[0],o=i*a,u=67108863&o,s=o/67108864|0;r.words[0]=u;for(var c=1;c>>26,f=67108863&s,h=Math.min(c,t.length-1),d=Math.max(0,c-e.length+1);d<=h;d++){var p=c-d|0;l+=(o=(i=0|e.words[p])*(a=0|t.words[d])+f)/67108864|0,f=67108863&o}r.words[c]=0|f,s=0|l}return 0!==s?r.words[c]=0|s:r.length--,r._strip()}a.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,"byte array longer than desired length"),n(a>0,"Requested array length <= 0");var o=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,a);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,i),o},a.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,i=0,a=0;i>8&255),r>16&255),6===a?(r>24&255),n=0,a=0):(n=o>>>24,a+=2)}if(r=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===a?(r>=0&&(e[r--]=o>>24&255),n=0,a=0):(n=o>>>24,a+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?a.prototype._countBits=function(e){return 32-Math.clz32(e)}:a.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},a.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return 0===(8191&t)&&(r+=13,t>>>=13),0===(127&t)&&(r+=7,t>>>=7),0===(15&t)&&(r+=4,t>>>=4),0===(3&t)&&(r+=2,t>>>=2),0===(1&t)&&r++,r},a.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},a.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},a.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;re.length?this.clone().iand(e):e.clone().iand(this)},a.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},a.prototype.iuxor=function(e){var t,r;this.length>e.length?(t=this,r=e):(t=e,r=this);for(var n=0;ne.length?this.clone().ixor(e):e.clone().ixor(this)},a.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},a.prototype.inotn=function(e){n("number"===typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},a.prototype.notn=function(e){return this.clone().inotn(e)},a.prototype.setn=function(e,t){n("number"===typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<e.length?(r=this,n=e):(r=e,n=this);for(var i=0,a=0;a>>26;for(;0!==i&&a>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;ae.length?this.clone().iadd(e):e.clone().iadd(this)},a.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var r,n,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=e):(r=e,n=this);for(var a=0,o=0;o>26,this.words[o]=67108863&t;for(;0!==a&&o>26,this.words[o]=67108863&t;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,v=0|o[2],y=8191&v,g=v>>>13,b=0|o[3],w=8191&b,k=b>>>13,x=0|o[4],A=8191&x,E=x>>>13,S=0|o[5],_=8191&S,C=S>>>13,P=0|o[6],O=8191&P,N=P>>>13,T=0|o[7],M=8191&T,U=T>>>13,R=0|o[8],I=8191&R,B=R>>>13,L=0|o[9],j=8191&L,F=L>>>13,D=0|u[0],z=8191&D,Z=D>>>13,q=0|u[1],H=8191&q,G=q>>>13,K=0|u[2],V=8191&K,W=K>>>13,J=0|u[3],Q=8191&J,Y=J>>>13,X=0|u[4],$=8191&X,ee=X>>>13,te=0|u[5],re=8191&te,ne=te>>>13,ie=0|u[6],ae=8191&ie,oe=ie>>>13,ue=0|u[7],se=8191&ue,ce=ue>>>13,le=0|u[8],fe=8191&le,he=le>>>13,de=0|u[9],pe=8191&de,me=de>>>13;r.negative=e.negative^t.negative,r.length=19;var ve=(c+(n=Math.imul(f,z))|0)+((8191&(i=(i=Math.imul(f,Z))+Math.imul(h,z)|0))<<13)|0;c=((a=Math.imul(h,Z))+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,Z))+Math.imul(m,z)|0,a=Math.imul(m,Z);var ye=(c+(n=n+Math.imul(f,H)|0)|0)+((8191&(i=(i=i+Math.imul(f,G)|0)+Math.imul(h,H)|0))<<13)|0;c=((a=a+Math.imul(h,G)|0)+(i>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(y,z),i=(i=Math.imul(y,Z))+Math.imul(g,z)|0,a=Math.imul(g,Z),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,H)|0,a=a+Math.imul(m,G)|0;var ge=(c+(n=n+Math.imul(f,V)|0)|0)+((8191&(i=(i=i+Math.imul(f,W)|0)+Math.imul(h,V)|0))<<13)|0;c=((a=a+Math.imul(h,W)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(w,z),i=(i=Math.imul(w,Z))+Math.imul(k,z)|0,a=Math.imul(k,Z),n=n+Math.imul(y,H)|0,i=(i=i+Math.imul(y,G)|0)+Math.imul(g,H)|0,a=a+Math.imul(g,G)|0,n=n+Math.imul(p,V)|0,i=(i=i+Math.imul(p,W)|0)+Math.imul(m,V)|0,a=a+Math.imul(m,W)|0;var be=(c+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,Y)|0)+Math.imul(h,Q)|0))<<13)|0;c=((a=a+Math.imul(h,Y)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,n=Math.imul(A,z),i=(i=Math.imul(A,Z))+Math.imul(E,z)|0,a=Math.imul(E,Z),n=n+Math.imul(w,H)|0,i=(i=i+Math.imul(w,G)|0)+Math.imul(k,H)|0,a=a+Math.imul(k,G)|0,n=n+Math.imul(y,V)|0,i=(i=i+Math.imul(y,W)|0)+Math.imul(g,V)|0,a=a+Math.imul(g,W)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(m,Q)|0,a=a+Math.imul(m,Y)|0;var we=(c+(n=n+Math.imul(f,$)|0)|0)+((8191&(i=(i=i+Math.imul(f,ee)|0)+Math.imul(h,$)|0))<<13)|0;c=((a=a+Math.imul(h,ee)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(_,z),i=(i=Math.imul(_,Z))+Math.imul(C,z)|0,a=Math.imul(C,Z),n=n+Math.imul(A,H)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(E,H)|0,a=a+Math.imul(E,G)|0,n=n+Math.imul(w,V)|0,i=(i=i+Math.imul(w,W)|0)+Math.imul(k,V)|0,a=a+Math.imul(k,W)|0,n=n+Math.imul(y,Q)|0,i=(i=i+Math.imul(y,Y)|0)+Math.imul(g,Q)|0,a=a+Math.imul(g,Y)|0,n=n+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(m,$)|0,a=a+Math.imul(m,ee)|0;var ke=(c+(n=n+Math.imul(f,re)|0)|0)+((8191&(i=(i=i+Math.imul(f,ne)|0)+Math.imul(h,re)|0))<<13)|0;c=((a=a+Math.imul(h,ne)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(O,z),i=(i=Math.imul(O,Z))+Math.imul(N,z)|0,a=Math.imul(N,Z),n=n+Math.imul(_,H)|0,i=(i=i+Math.imul(_,G)|0)+Math.imul(C,H)|0,a=a+Math.imul(C,G)|0,n=n+Math.imul(A,V)|0,i=(i=i+Math.imul(A,W)|0)+Math.imul(E,V)|0,a=a+Math.imul(E,W)|0,n=n+Math.imul(w,Q)|0,i=(i=i+Math.imul(w,Y)|0)+Math.imul(k,Q)|0,a=a+Math.imul(k,Y)|0,n=n+Math.imul(y,$)|0,i=(i=i+Math.imul(y,ee)|0)+Math.imul(g,$)|0,a=a+Math.imul(g,ee)|0,n=n+Math.imul(p,re)|0,i=(i=i+Math.imul(p,ne)|0)+Math.imul(m,re)|0,a=a+Math.imul(m,ne)|0;var xe=(c+(n=n+Math.imul(f,ae)|0)|0)+((8191&(i=(i=i+Math.imul(f,oe)|0)+Math.imul(h,ae)|0))<<13)|0;c=((a=a+Math.imul(h,oe)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(M,z),i=(i=Math.imul(M,Z))+Math.imul(U,z)|0,a=Math.imul(U,Z),n=n+Math.imul(O,H)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(N,H)|0,a=a+Math.imul(N,G)|0,n=n+Math.imul(_,V)|0,i=(i=i+Math.imul(_,W)|0)+Math.imul(C,V)|0,a=a+Math.imul(C,W)|0,n=n+Math.imul(A,Q)|0,i=(i=i+Math.imul(A,Y)|0)+Math.imul(E,Q)|0,a=a+Math.imul(E,Y)|0,n=n+Math.imul(w,$)|0,i=(i=i+Math.imul(w,ee)|0)+Math.imul(k,$)|0,a=a+Math.imul(k,ee)|0,n=n+Math.imul(y,re)|0,i=(i=i+Math.imul(y,ne)|0)+Math.imul(g,re)|0,a=a+Math.imul(g,ne)|0,n=n+Math.imul(p,ae)|0,i=(i=i+Math.imul(p,oe)|0)+Math.imul(m,ae)|0,a=a+Math.imul(m,oe)|0;var Ae=(c+(n=n+Math.imul(f,se)|0)|0)+((8191&(i=(i=i+Math.imul(f,ce)|0)+Math.imul(h,se)|0))<<13)|0;c=((a=a+Math.imul(h,ce)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(I,z),i=(i=Math.imul(I,Z))+Math.imul(B,z)|0,a=Math.imul(B,Z),n=n+Math.imul(M,H)|0,i=(i=i+Math.imul(M,G)|0)+Math.imul(U,H)|0,a=a+Math.imul(U,G)|0,n=n+Math.imul(O,V)|0,i=(i=i+Math.imul(O,W)|0)+Math.imul(N,V)|0,a=a+Math.imul(N,W)|0,n=n+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,Y)|0)+Math.imul(C,Q)|0,a=a+Math.imul(C,Y)|0,n=n+Math.imul(A,$)|0,i=(i=i+Math.imul(A,ee)|0)+Math.imul(E,$)|0,a=a+Math.imul(E,ee)|0,n=n+Math.imul(w,re)|0,i=(i=i+Math.imul(w,ne)|0)+Math.imul(k,re)|0,a=a+Math.imul(k,ne)|0,n=n+Math.imul(y,ae)|0,i=(i=i+Math.imul(y,oe)|0)+Math.imul(g,ae)|0,a=a+Math.imul(g,oe)|0,n=n+Math.imul(p,se)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(m,se)|0,a=a+Math.imul(m,ce)|0;var Ee=(c+(n=n+Math.imul(f,fe)|0)|0)+((8191&(i=(i=i+Math.imul(f,he)|0)+Math.imul(h,fe)|0))<<13)|0;c=((a=a+Math.imul(h,he)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(j,z),i=(i=Math.imul(j,Z))+Math.imul(F,z)|0,a=Math.imul(F,Z),n=n+Math.imul(I,H)|0,i=(i=i+Math.imul(I,G)|0)+Math.imul(B,H)|0,a=a+Math.imul(B,G)|0,n=n+Math.imul(M,V)|0,i=(i=i+Math.imul(M,W)|0)+Math.imul(U,V)|0,a=a+Math.imul(U,W)|0,n=n+Math.imul(O,Q)|0,i=(i=i+Math.imul(O,Y)|0)+Math.imul(N,Q)|0,a=a+Math.imul(N,Y)|0,n=n+Math.imul(_,$)|0,i=(i=i+Math.imul(_,ee)|0)+Math.imul(C,$)|0,a=a+Math.imul(C,ee)|0,n=n+Math.imul(A,re)|0,i=(i=i+Math.imul(A,ne)|0)+Math.imul(E,re)|0,a=a+Math.imul(E,ne)|0,n=n+Math.imul(w,ae)|0,i=(i=i+Math.imul(w,oe)|0)+Math.imul(k,ae)|0,a=a+Math.imul(k,oe)|0,n=n+Math.imul(y,se)|0,i=(i=i+Math.imul(y,ce)|0)+Math.imul(g,se)|0,a=a+Math.imul(g,ce)|0,n=n+Math.imul(p,fe)|0,i=(i=i+Math.imul(p,he)|0)+Math.imul(m,fe)|0,a=a+Math.imul(m,he)|0;var Se=(c+(n=n+Math.imul(f,pe)|0)|0)+((8191&(i=(i=i+Math.imul(f,me)|0)+Math.imul(h,pe)|0))<<13)|0;c=((a=a+Math.imul(h,me)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(j,H),i=(i=Math.imul(j,G))+Math.imul(F,H)|0,a=Math.imul(F,G),n=n+Math.imul(I,V)|0,i=(i=i+Math.imul(I,W)|0)+Math.imul(B,V)|0,a=a+Math.imul(B,W)|0,n=n+Math.imul(M,Q)|0,i=(i=i+Math.imul(M,Y)|0)+Math.imul(U,Q)|0,a=a+Math.imul(U,Y)|0,n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,ee)|0)+Math.imul(N,$)|0,a=a+Math.imul(N,ee)|0,n=n+Math.imul(_,re)|0,i=(i=i+Math.imul(_,ne)|0)+Math.imul(C,re)|0,a=a+Math.imul(C,ne)|0,n=n+Math.imul(A,ae)|0,i=(i=i+Math.imul(A,oe)|0)+Math.imul(E,ae)|0,a=a+Math.imul(E,oe)|0,n=n+Math.imul(w,se)|0,i=(i=i+Math.imul(w,ce)|0)+Math.imul(k,se)|0,a=a+Math.imul(k,ce)|0,n=n+Math.imul(y,fe)|0,i=(i=i+Math.imul(y,he)|0)+Math.imul(g,fe)|0,a=a+Math.imul(g,he)|0;var _e=(c+(n=n+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,me)|0)+Math.imul(m,pe)|0))<<13)|0;c=((a=a+Math.imul(m,me)|0)+(i>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(j,V),i=(i=Math.imul(j,W))+Math.imul(F,V)|0,a=Math.imul(F,W),n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(B,Q)|0,a=a+Math.imul(B,Y)|0,n=n+Math.imul(M,$)|0,i=(i=i+Math.imul(M,ee)|0)+Math.imul(U,$)|0,a=a+Math.imul(U,ee)|0,n=n+Math.imul(O,re)|0,i=(i=i+Math.imul(O,ne)|0)+Math.imul(N,re)|0,a=a+Math.imul(N,ne)|0,n=n+Math.imul(_,ae)|0,i=(i=i+Math.imul(_,oe)|0)+Math.imul(C,ae)|0,a=a+Math.imul(C,oe)|0,n=n+Math.imul(A,se)|0,i=(i=i+Math.imul(A,ce)|0)+Math.imul(E,se)|0,a=a+Math.imul(E,ce)|0,n=n+Math.imul(w,fe)|0,i=(i=i+Math.imul(w,he)|0)+Math.imul(k,fe)|0,a=a+Math.imul(k,he)|0;var Ce=(c+(n=n+Math.imul(y,pe)|0)|0)+((8191&(i=(i=i+Math.imul(y,me)|0)+Math.imul(g,pe)|0))<<13)|0;c=((a=a+Math.imul(g,me)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(j,Q),i=(i=Math.imul(j,Y))+Math.imul(F,Q)|0,a=Math.imul(F,Y),n=n+Math.imul(I,$)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(B,$)|0,a=a+Math.imul(B,ee)|0,n=n+Math.imul(M,re)|0,i=(i=i+Math.imul(M,ne)|0)+Math.imul(U,re)|0,a=a+Math.imul(U,ne)|0,n=n+Math.imul(O,ae)|0,i=(i=i+Math.imul(O,oe)|0)+Math.imul(N,ae)|0,a=a+Math.imul(N,oe)|0,n=n+Math.imul(_,se)|0,i=(i=i+Math.imul(_,ce)|0)+Math.imul(C,se)|0,a=a+Math.imul(C,ce)|0,n=n+Math.imul(A,fe)|0,i=(i=i+Math.imul(A,he)|0)+Math.imul(E,fe)|0,a=a+Math.imul(E,he)|0;var Pe=(c+(n=n+Math.imul(w,pe)|0)|0)+((8191&(i=(i=i+Math.imul(w,me)|0)+Math.imul(k,pe)|0))<<13)|0;c=((a=a+Math.imul(k,me)|0)+(i>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(j,$),i=(i=Math.imul(j,ee))+Math.imul(F,$)|0,a=Math.imul(F,ee),n=n+Math.imul(I,re)|0,i=(i=i+Math.imul(I,ne)|0)+Math.imul(B,re)|0,a=a+Math.imul(B,ne)|0,n=n+Math.imul(M,ae)|0,i=(i=i+Math.imul(M,oe)|0)+Math.imul(U,ae)|0,a=a+Math.imul(U,oe)|0,n=n+Math.imul(O,se)|0,i=(i=i+Math.imul(O,ce)|0)+Math.imul(N,se)|0,a=a+Math.imul(N,ce)|0,n=n+Math.imul(_,fe)|0,i=(i=i+Math.imul(_,he)|0)+Math.imul(C,fe)|0,a=a+Math.imul(C,he)|0;var Oe=(c+(n=n+Math.imul(A,pe)|0)|0)+((8191&(i=(i=i+Math.imul(A,me)|0)+Math.imul(E,pe)|0))<<13)|0;c=((a=a+Math.imul(E,me)|0)+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(j,re),i=(i=Math.imul(j,ne))+Math.imul(F,re)|0,a=Math.imul(F,ne),n=n+Math.imul(I,ae)|0,i=(i=i+Math.imul(I,oe)|0)+Math.imul(B,ae)|0,a=a+Math.imul(B,oe)|0,n=n+Math.imul(M,se)|0,i=(i=i+Math.imul(M,ce)|0)+Math.imul(U,se)|0,a=a+Math.imul(U,ce)|0,n=n+Math.imul(O,fe)|0,i=(i=i+Math.imul(O,he)|0)+Math.imul(N,fe)|0,a=a+Math.imul(N,he)|0;var Ne=(c+(n=n+Math.imul(_,pe)|0)|0)+((8191&(i=(i=i+Math.imul(_,me)|0)+Math.imul(C,pe)|0))<<13)|0;c=((a=a+Math.imul(C,me)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,n=Math.imul(j,ae),i=(i=Math.imul(j,oe))+Math.imul(F,ae)|0,a=Math.imul(F,oe),n=n+Math.imul(I,se)|0,i=(i=i+Math.imul(I,ce)|0)+Math.imul(B,se)|0,a=a+Math.imul(B,ce)|0,n=n+Math.imul(M,fe)|0,i=(i=i+Math.imul(M,he)|0)+Math.imul(U,fe)|0,a=a+Math.imul(U,he)|0;var Te=(c+(n=n+Math.imul(O,pe)|0)|0)+((8191&(i=(i=i+Math.imul(O,me)|0)+Math.imul(N,pe)|0))<<13)|0;c=((a=a+Math.imul(N,me)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(j,se),i=(i=Math.imul(j,ce))+Math.imul(F,se)|0,a=Math.imul(F,ce),n=n+Math.imul(I,fe)|0,i=(i=i+Math.imul(I,he)|0)+Math.imul(B,fe)|0,a=a+Math.imul(B,he)|0;var Me=(c+(n=n+Math.imul(M,pe)|0)|0)+((8191&(i=(i=i+Math.imul(M,me)|0)+Math.imul(U,pe)|0))<<13)|0;c=((a=a+Math.imul(U,me)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(j,fe),i=(i=Math.imul(j,he))+Math.imul(F,fe)|0,a=Math.imul(F,he);var Ue=(c+(n=n+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,me)|0)+Math.imul(B,pe)|0))<<13)|0;c=((a=a+Math.imul(B,me)|0)+(i>>>13)|0)+(Ue>>>26)|0,Ue&=67108863;var Re=(c+(n=Math.imul(j,pe))|0)+((8191&(i=(i=Math.imul(j,me))+Math.imul(F,pe)|0))<<13)|0;return c=((a=Math.imul(F,me))+(i>>>13)|0)+(Re>>>26)|0,Re&=67108863,s[0]=ve,s[1]=ye,s[2]=ge,s[3]=be,s[4]=we,s[5]=ke,s[6]=xe,s[7]=Ae,s[8]=Ee,s[9]=Se,s[10]=_e,s[11]=Ce,s[12]=Pe,s[13]=Oe,s[14]=Ne,s[15]=Te,s[16]=Me,s[17]=Ue,s[18]=Re,0!==c&&(s[19]=c,r.length++),r};function y(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=u,n=o,o=i}return 0!==n?r.words[a]=n:r.length--,r._strip()}function g(e,t,r){return y(e,t,r)}function b(e,t){this.x=e,this.y=t}Math.imul||(v=m),a.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?v(this,e,t):r<63?m(this,e,t):r<1024?y(this,e,t):g(this,e,t)},b.prototype.makeRBT=function(e){for(var t=new Array(e),r=a.prototype._countBits(e)-1,n=0;n>=1;return n},b.prototype.permute=function(e,t,r,n,i,a){for(var o=0;o>>=1)i++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*t;o>=26,r+=a/67108864|0,r+=o>>>26,this.words[i]=67108863&o}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},a.prototype.muln=function(e){return this.clone().imuln(e)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>i&1}return t}(e);if(0===t.length)return new a(1);for(var r=this,n=0;n=0);var t,r=e%26,i=(e-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t=0),i=t?(t-t%26)/26:0;var a=e%26,o=Math.min((e-a)/26,this.length),u=67108863^67108863>>>a<o)for(this.length-=o,c=0;c=0&&(0!==l||c>=i);c--){var f=0|this.words[c];this.words[c]=l<<26-a|f>>>a,l=f&u}return s&&0!==l&&(s.words[s.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},a.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},a.prototype.shln=function(e){return this.clone().ishln(e)},a.prototype.ushln=function(e){return this.clone().iushln(e)},a.prototype.shrn=function(e){return this.clone().ishrn(e)},a.prototype.ushrn=function(e){return this.clone().iushrn(e)},a.prototype.testn=function(e){n("number"===typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},a.prototype.isubn=function(e){if(n("number"===typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t>26)-(s/67108864|0),this.words[i+r]=67108863&a}for(;i>26,this.words[i+r]=67108863&a;if(0===u)return this._strip();for(n(-1===u),u=0,i=0;i>26,this.words[i]=67108863&a;return this.negative=1,this._strip()},a.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),i=e,o=0|i.words[i.length-1];0!==(r=26-this._countBits(o))&&(i=i.ushln(r),n.iushln(r),o=0|i.words[i.length-1]);var u,s=n.length-i.length;if("mod"!==t){(u=new a(null)).length=s+1,u.words=new Array(u.length);for(var c=0;c=0;f--){var h=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(h=Math.min(h/o|0,67108863),n._ishlnsubmul(i,h,f);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);u&&(u.words[f]=h)}return u&&u._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:u||null,mod:n}},a.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new a(0),mod:new a(0)}:0!==this.negative&&0===e.negative?(u=this.neg().divmod(e,t),"mod"!==t&&(i=u.div.neg()),"div"!==t&&(o=u.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:i,mod:o}):0===this.negative&&0!==e.negative?(u=this.divmod(e.neg(),t),"mod"!==t&&(i=u.div.neg()),{div:i,mod:u.mod}):0!==(this.negative&e.negative)?(u=this.neg().divmod(e.neg(),t),"div"!==t&&(o=u.mod.neg(),r&&0!==o.negative&&o.isub(e)),{div:u.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new a(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new a(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new a(this.modrn(e.words[0]))}:this._wordDiv(e,t);var i,o,u},a.prototype.div=function(e){return this.divmod(e,"div",!1).div},a.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},a.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},a.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),a=r.cmp(n);return a<0||1===i&&0===a?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},a.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,a=this.length-1;a>=0;a--)i=(r*i+(0|this.words[a]))%e;return t?-i:i},a.prototype.modn=function(e){return this.modrn(e)},a.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var a=(0|this.words[i])+67108864*r;this.words[i]=a/e|0,r=a%e}return this._strip(),t?this.ineg():this},a.prototype.divn=function(e){return this.clone().idivn(e)},a.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new a(1),o=new a(0),u=new a(0),s=new a(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),f=t.clone();!t.isZero();){for(var h=0,d=1;0===(t.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(l),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var p=0,m=1;0===(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(u.isOdd()||s.isOdd())&&(u.iadd(l),s.isub(f)),u.iushrn(1),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(u),o.isub(s)):(r.isub(t),u.isub(i),s.isub(o))}return{a:u,b:s,gcd:r.iushln(c)}},a.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i,o=new a(1),u=new a(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0===(t.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);for(var f=0,h=1;0===(r.words[0]&h)&&f<26;++f,h<<=1);if(f>0)for(r.iushrn(f);f-- >0;)u.isOdd()&&u.iadd(s),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(u)):(r.isub(t),u.isub(o))}return(i=0===t.cmpn(1)?o:u).cmpn(0)<0&&i.iadd(e),i},a.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var a=t;t=r,r=a}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},a.prototype.invm=function(e){return this.egcd(e).a.umod(e)},a.prototype.isEven=function(){return 0===(1&this.words[0])},a.prototype.isOdd=function(){return 1===(1&this.words[0])},a.prototype.andln=function(e){return this.words[0]&e},a.prototype.bincn=function(e){n("number"===typeof e);var t=e%26,r=(e-t)/26,i=1<>>26,u&=67108863,this.words[o]=u}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:ie.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){ni&&(t=1);break}}return t},a.prototype.gtn=function(e){return 1===this.cmpn(e)},a.prototype.gt=function(e){return 1===this.cmp(e)},a.prototype.gten=function(e){return this.cmpn(e)>=0},a.prototype.gte=function(e){return this.cmp(e)>=0},a.prototype.ltn=function(e){return-1===this.cmpn(e)},a.prototype.lt=function(e){return-1===this.cmp(e)},a.prototype.lten=function(e){return this.cmpn(e)<=0},a.prototype.lte=function(e){return this.cmp(e)<=0},a.prototype.eqn=function(e){return 0===this.cmpn(e)},a.prototype.eq=function(e){return 0===this.cmp(e)},a.red=function(e){return new _(e)},a.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},a.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},a.prototype._forceRed=function(e){return this.red=e,this},a.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},a.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},a.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},a.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},a.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},a.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},a.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},a.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},a.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},a.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},a.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},a.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},a.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},a.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function k(e,t){this.name=e,this.p=new a(t,16),this.n=this.p.bitLength(),this.k=new a(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function x(){k.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function A(){k.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function E(){k.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function S(){k.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(e){if("string"===typeof e){var t=a._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function C(e){_.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new a(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}k.prototype._tmp=function(){var e=new a(null);return e.words=new Array(Math.ceil(this.n/13)),e},k.prototype.ireduce=function(e){var t,r=e;do{this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(t>this.n);var n=t0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},k.prototype.split=function(e,t){e.iushrn(this.n,0,t)},k.prototype.imulK=function(e){return e.imul(this.k)},i(x,k),x.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),i=0;i>>22,a=o}a>>>=22,e.words[i-10]=a,0===a&&e.length>10?e.length-=10:e.length-=9},x.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},a._prime=function(e){if(w[e])return w[e];var t;if("k256"===e)t=new x;else if("p224"===e)t=new A;else if("p192"===e)t=new E;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new S}return w[e]=t,t},_.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},_.prototype._verify2=function(e,t){n(0===(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},_.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},_.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},_.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},_.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},_.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return r.cmpn(0)<0&&r.iadd(this.m),r._forceRed(this)},_.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return r.cmpn(0)<0&&r.iadd(this.m),r},_.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},_.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},_.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},_.prototype.isqr=function(e){return this.imul(e,e.clone())},_.prototype.sqr=function(e){return this.mul(e,e)},_.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2===1),3===t){var r=this.m.add(new a(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var u=new a(1).toRed(this),s=u.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new a(2*l*l).toRed(this);0!==this.pow(l,c).cmp(s);)l.redIAdd(s);for(var f=this.pow(l,i),h=this.pow(e,i.addn(1).iushrn(1)),d=this.pow(e,i),p=o;0!==d.cmp(u);){for(var m=d,v=0;0!==m.cmp(u);v++)m=m.redSqr();n(v=0;n--){for(var c=t.words[n],l=s-1;l>=0;l--){var f=c>>l&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==o?(o<<=1,o|=f,(4===++u||0===n&&0===l)&&(i=this.mul(i,r[o]),u=0,o=0)):u=0}s=26}return i},_.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},_.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},a.mont=function(e){return new C(e)},i(C,_),C.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},C.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},C.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},C.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new a(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},C.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},918:function(e,t,r){"use strict";var n=r(6690).default,i=r(9728).default,a=r(6115).default,o=r(1655).default,u=r(6389).default,s=r(2470),c=r(545),l="function"===typeof Symbol&&"function"===typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.lW=d,t.h2=50;var f=2147483647;function h(e){if(e>f)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,d.prototype),t}function d(e,t,r){if("number"===typeof e){if("string"===typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return v(e)}return p(e,t,r)}function p(e,t,r){if("string"===typeof e)return function(e,t){"string"===typeof t&&""!==t||(t="utf8");if(!d.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|w(e,t),n=h(r),i=n.write(e,t);i!==r&&(n=n.slice(0,i));return n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(ee(e,Uint8Array)){var t=new Uint8Array(e);return g(t.buffer,t.byteOffset,t.byteLength)}return y(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(ee(e,ArrayBuffer)||e&&ee(e.buffer,ArrayBuffer))return g(e,t,r);if("undefined"!==typeof SharedArrayBuffer&&(ee(e,SharedArrayBuffer)||e&&ee(e.buffer,SharedArrayBuffer)))return g(e,t,r);if("number"===typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return d.from(n,t,r);var i=function(e){if(d.isBuffer(e)){var t=0|b(e.length),r=h(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!==typeof e.length||te(e.length)?h(0):y(e);if("Buffer"===e.type&&Array.isArray(e.data))return y(e.data)}(e);if(i)return i;if("undefined"!==typeof Symbol&&null!=Symbol.toPrimitive&&"function"===typeof e[Symbol.toPrimitive])return d.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function m(e){if("number"!==typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function v(e){return m(e),h(e<0?0:0|b(e))}function y(e){for(var t=e.length<0?0:0|b(e.length),r=h(t),n=0;n=f)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+f.toString(16)+" bytes");return 0|e}function w(e,t){if(d.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||ee(e,ArrayBuffer))return e.byteLength;if("string"!==typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return Y(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(e).length;default:if(i)return n?-1:Y(e).length;t=(""+t).toLowerCase(),i=!0}}function k(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,r);case"utf8":case"utf-8":return T(this,t,r);case"ascii":return U(this,t,r);case"latin1":case"binary":return R(this,t,r);case"base64":return N(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function x(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function A(e,t,r,n,i){if(0===e.length)return-1;if("string"===typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),te(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"===typeof t&&(t=d.from(t,n)),d.isBuffer(t))return 0===t.length?-1:E(e,t,r,n,i);if("number"===typeof t)return t&=255,"function"===typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):E(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function E(e,t,r,n,i){var a,o=1,u=e.length,s=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;o=2,u/=2,s/=2,r/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var l=-1;for(a=r;au&&(r=u-s),a=r;a>=0;a--){for(var f=!0,h=0;hi&&(n=i):n=i;var a,o=t.length;for(n>o/2&&(n=o/2),a=0;a>8,i=r%256,a.push(i),a.push(n);return a}(t,e.length-r),e,r,n)}function N(e,t,r){return 0===t&&r===e.length?s.fromByteArray(e):s.fromByteArray(e.slice(t,r))}function T(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:a>223?3:a>191?2:1;if(i+u<=r){var s=void 0,c=void 0,l=void 0,f=void 0;switch(u){case 1:a<128&&(o=a);break;case 2:128===(192&(s=e[i+1]))&&(f=(31&a)<<6|63&s)>127&&(o=f);break;case 3:s=e[i+1],c=e[i+2],128===(192&s)&&128===(192&c)&&(f=(15&a)<<12|(63&s)<<6|63&c)>2047&&(f<55296||f>57343)&&(o=f);break;case 4:s=e[i+1],c=e[i+2],l=e[i+3],128===(192&s)&&128===(192&c)&&128===(192&l)&&(f=(15&a)<<18|(63&s)<<12|(63&c)<<6|63&l)>65535&&f<1114112&&(o=f)}}null===o?(o=65533,u=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=u}return function(e){var t=e.length;if(t<=M)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nn.length?(d.isBuffer(a)||(a=d.from(a)),a.copy(n,i)):Uint8Array.prototype.set.call(n,a,i);else{if(!d.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,i)}i+=a.length}return n},d.byteLength=w,d.prototype._isBuffer=!0,d.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;tr&&(e+=" ... "),""},l&&(d.prototype[l]=d.prototype.inspect),d.prototype.compare=function(e,t,r,n,i){if(ee(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),!d.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;for(var a=(i>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),u=Math.min(a,o),s=this.slice(n,i),c=e.slice(t,r),l=0;l>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return S(this,e,t,r);case"utf8":case"utf-8":return _(this,e,t,r);case"ascii":case"latin1":case"binary":return C(this,e,t,r);case"base64":return P(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,t,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var M=4096;function U(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;in)&&(r=n);for(var i="",a=t;ar)throw new RangeError("Trying to access beyond buffer length")}function j(e,t,r,n,i,a){if(!d.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function F(e,t,r,n,i){V(t,n,i,e,r,7);var a=Number(t&BigInt(4294967295));e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a;var o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,r}function D(e,t,r,n,i){V(t,n,i,e,r,7);var a=Number(t&BigInt(4294967295));e[r+7]=a,a>>=8,e[r+6]=a,a>>=8,e[r+5]=a,a>>=8,e[r+4]=a;var o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=o,o>>=8,e[r+2]=o,o>>=8,e[r+1]=o,o>>=8,e[r]=o,r+8}function z(e,t,r,n,i,a){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Z(e,t,r,n,i){return t=+t,r>>>=0,i||z(e,0,r,4),c.write(e,t,r,n,23,4),r+4}function q(e,t,r,n,i){return t=+t,r>>>=0,i||z(e,0,r,8),c.write(e,t,r,n,52,8),r+8}d.prototype.slice=function(e,t){var r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t>>=0,t>>>=0,r||L(e,t,this.length);for(var n=this[e],i=1,a=0;++a>>=0,t>>>=0,r||L(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},d.prototype.readUint8=d.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},d.prototype.readBigUInt64LE=ne((function(e){W(e>>>=0,"offset");var t=this[e],r=this[e+7];void 0!==t&&void 0!==r||J(e,this.length-8);var n=t+this[++e]*Math.pow(2,8)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,24),i=this[++e]+this[++e]*Math.pow(2,8)+this[++e]*Math.pow(2,16)+r*Math.pow(2,24);return BigInt(n)+(BigInt(i)<>>=0,"offset");var t=this[e],r=this[e+7];void 0!==t&&void 0!==r||J(e,this.length-8);var n=t*Math.pow(2,24)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,8)+this[++e],i=this[++e]*Math.pow(2,24)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,8)+r;return(BigInt(n)<>>=0,t>>>=0,r||L(e,t,this.length);for(var n=this[e],i=1,a=0;++a=(i*=128)&&(n-=Math.pow(2,8*t)),n},d.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||L(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*t)),a},d.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},d.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},d.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},d.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},d.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},d.prototype.readBigInt64LE=ne((function(e){W(e>>>=0,"offset");var t=this[e],r=this[e+7];void 0!==t&&void 0!==r||J(e,this.length-8);var n=this[e+4]+this[e+5]*Math.pow(2,8)+this[e+6]*Math.pow(2,16)+(r<<24);return(BigInt(n)<>>=0,"offset");var t=this[e],r=this[e+7];void 0!==t&&void 0!==r||J(e,this.length-8);var n=(t<<24)+this[++e]*Math.pow(2,16)+this[++e]*Math.pow(2,8)+this[++e];return(BigInt(n)<>>=0,t||L(e,4,this.length),c.read(this,e,!0,23,4)},d.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),c.read(this,e,!1,23,4)},d.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),c.read(this,e,!0,52,8)},d.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),c.read(this,e,!1,52,8)},d.prototype.writeUintLE=d.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t>>>=0,r>>>=0,n)||j(this,e,t,r,Math.pow(2,8*r)-1,0);var i=1,a=0;for(this[t]=255&e;++a>>=0,r>>>=0,n)||j(this,e,t,r,Math.pow(2,8*r)-1,0);var i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},d.prototype.writeUint8=d.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,1,255,0),this[t]=255&e,t+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},d.prototype.writeBigUInt64LE=ne((function(e){return F(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),d.prototype.writeBigUInt64BE=ne((function(e){return D(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),d.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);j(this,e,t,r,i-1,-i)}var a=0,o=1,u=0;for(this[t]=255&e;++a>0)-u&255;return t+r},d.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var i=Math.pow(2,8*r-1);j(this,e,t,r,i-1,-i)}var a=r-1,o=1,u=0;for(this[t+a]=255&e;--a>=0&&(o*=256);)e<0&&0===u&&0!==this[t+a+1]&&(u=1),this[t+a]=(e/o>>0)-u&255;return t+r},d.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},d.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},d.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},d.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},d.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||j(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},d.prototype.writeBigInt64LE=ne((function(e){return F(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),d.prototype.writeBigInt64BE=ne((function(e){return D(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),d.prototype.writeFloatLE=function(e,t,r){return Z(this,e,t,!0,r)},d.prototype.writeFloatBE=function(e,t,r){return Z(this,e,t,!1,r)},d.prototype.writeDoubleLE=function(e,t,r){return q(this,e,t,!0,r)},d.prototype.writeDoubleBE=function(e,t,r){return q(this,e,t,!1,r)},d.prototype.copy=function(e,t,r,n){if(!d.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"===typeof e)for(a=t;a=n+4;r-=3)t="_".concat(e.slice(r-3,r)).concat(t);return"".concat(e.slice(0,r)).concat(t)}function V(e,t,r,n,i,a){if(e>r||e3?0===t||t===BigInt(0)?">= 0".concat(u," and < 2").concat(u," ** ").concat(8*(a+1)).concat(u):">= -(2".concat(u," ** ").concat(8*(a+1)-1).concat(u,") and < 2 ** ")+"".concat(8*(a+1)-1).concat(u):">= ".concat(t).concat(u," and <= ").concat(r).concat(u),new H.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,r){W(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||J(t,e.length-(r+1))}(n,i,a)}function W(e,t){if("number"!==typeof e)throw new H.ERR_INVALID_ARG_TYPE(t,"number",e)}function J(e,t,r){if(Math.floor(e)!==e)throw W(e,r),new H.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new H.ERR_BUFFER_OUT_OF_BOUNDS;throw new H.ERR_OUT_OF_RANGE(r||"offset",">= ".concat(r?1:0," and <= ").concat(t),e)}G("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?"".concat(e," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"}),RangeError),G("ERR_INVALID_ARG_TYPE",(function(e,t){return'The "'.concat(e,'" argument must be of type number. Received type ').concat(typeof t)}),TypeError),G("ERR_OUT_OF_RANGE",(function(e,t,r){var n='The value of "'.concat(e,'" is out of range.'),i=r;return Number.isInteger(r)&&Math.abs(r)>Math.pow(2,32)?i=K(String(r)):"bigint"===typeof r&&(i=String(r),(r>Math.pow(BigInt(2),BigInt(32))||r<-Math.pow(BigInt(2),BigInt(32)))&&(i=K(i)),i+="n"),n+=" It must be ".concat(t,". Received ").concat(i)}),RangeError);var Q=/[^+/0-9A-Za-z-_]/g;function Y(e,t){var r;t=t||1/0;for(var n=e.length,i=null,a=[],o=0;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function X(e){return s.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(Q,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function $(e,t,r,n){var i;for(i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function ee(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function te(e){return e!==e}var re=function(){for(var e="0123456789abcdef",t=new Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}();function ne(e){return"undefined"===typeof BigInt?ie:e}function ie(){throw new Error("BigInt not supported")}},7438:function(e){var t=function(){"use strict";function e(t,n,i,a){"object"===typeof n&&(i=n.depth,a=n.prototype,n.filter,n=n.circular);var o=[],u=[],s="undefined"!=typeof Buffer;return"undefined"==typeof n&&(n=!0),"undefined"==typeof i&&(i=1/0),function t(i,c){if(null===i)return null;if(0==c)return i;var l,f;if("object"!=typeof i)return i;if(e.__isArray(i))l=[];else if(e.__isRegExp(i))l=new RegExp(i.source,r(i)),i.lastIndex&&(l.lastIndex=i.lastIndex);else if(e.__isDate(i))l=new Date(i.getTime());else{if(s&&Buffer.isBuffer(i))return l=Buffer.allocUnsafe?Buffer.allocUnsafe(i.length):new Buffer(i.length),i.copy(l),l;"undefined"==typeof a?(f=Object.getPrototypeOf(i),l=Object.create(f)):(l=Object.create(a),f=a)}if(n){var h=o.indexOf(i);if(-1!=h)return u[h];o.push(i),u.push(l)}for(var d in i){var p;f&&(p=Object.getOwnPropertyDescriptor(f,d)),p&&null==p.set||(l[d]=t(i[d],c-1))}return l}(t,i)}function t(e){return Object.prototype.toString.call(e)}function r(e){var t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),t}return e.clonePrototype=function(e){if(null===e)return null;var t=function(){};return t.prototype=e,new t},e.__objToStr=t,e.__isDate=function(e){return"object"===typeof e&&"[object Date]"===t(e)},e.__isArray=function(e){return"object"===typeof e&&"[object Array]"===t(e)},e.__isRegExp=function(e){return"object"===typeof e&&"[object RegExp]"===t(e)},e.__getRegExpFlags=r,e}();e.exports&&(e.exports=t)},1238:function(e){"use strict";e.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},2116:function(e,t,r){var n=r(1238);function i(e){if(e){var t=[0,0,0],r=1,i=e.match(/^#([a-fA-F0-9]{3})$/);if(i){i=i[1];for(var a=0;ar?(t+.05)/(r+.05):(r+.05)/(t+.05)},level:function(e){var t=this.contrast(e);return t>=7.1?"AAA":t>=4.5?"AA":""},dark:function(){var e=this.values.rgb;return(299*e[0]+587*e[1]+114*e[2])/1e3<128},light:function(){return!this.dark()},negate:function(){for(var e=[],t=0;t<3;t++)e[t]=255-this.values.rgb[t];return this.setValues("rgb",e),this},lighten:function(e){return this.values.hsl[2]+=this.values.hsl[2]*e,this.setValues("hsl",this.values.hsl),this},darken:function(e){return this.values.hsl[2]-=this.values.hsl[2]*e,this.setValues("hsl",this.values.hsl),this},saturate:function(e){return this.values.hsl[1]+=this.values.hsl[1]*e,this.setValues("hsl",this.values.hsl),this},desaturate:function(e){return this.values.hsl[1]-=this.values.hsl[1]*e,this.setValues("hsl",this.values.hsl),this},whiten:function(e){return this.values.hwb[1]+=this.values.hwb[1]*e,this.setValues("hwb",this.values.hwb),this},blacken:function(e){return this.values.hwb[2]+=this.values.hwb[2]*e,this.setValues("hwb",this.values.hwb),this},greyscale:function(){var e=this.values.rgb,t=.3*e[0]+.59*e[1]+.11*e[2];return this.setValues("rgb",[t,t,t]),this},clearer:function(e){return this.setValues("alpha",this.values.alpha-this.values.alpha*e),this},opaquer:function(e){return this.setValues("alpha",this.values.alpha+this.values.alpha*e),this},rotate:function(e){var t=this.values.hsl[0];return t=(t=(t+e)%360)<0?360+t:t,this.values.hsl[0]=t,this.setValues("hsl",this.values.hsl),this},mix:function(e,t){var r=this,n=e,i=void 0===t?.5:t,a=2*i-1,o=r.alpha()-n.alpha(),u=((a*o===-1?a:(a+o)/(1+a*o))+1)/2,s=1-u;return this.rgb(u*r.red()+s*n.red(),u*r.green()+s*n.green(),u*r.blue()+s*n.blue()).alpha(r.alpha()*i+n.alpha()*(1-i))},toJSON:function(){return this.rgb()},clone:function(){var e=new o;return e.values=n(this.values),e}},o.prototype.getValues=function(e){for(var t={},r=0;r1&&(i-=1)),[360*i,100*a,100*c]},o.rgb.hwb=function(e){var t=e[0],r=e[1],n=e[2];return[o.rgb.hsl(e)[0],100*(1/255*Math.min(t,Math.min(r,n))),100*(n=1-1/255*Math.max(t,Math.max(r,n)))]},o.rgb.cmyk=function(e){var t,r=e[0]/255,n=e[1]/255,i=e[2]/255;return[100*((1-r-(t=Math.min(1-r,1-n,1-i)))/(1-t)||0),100*((1-n-t)/(1-t)||0),100*((1-i-t)/(1-t)||0),100*t]},o.rgb.keyword=function(e){var t=i[e];if(t)return t;var r,a,o,u=1/0;for(var s in n)if(n.hasOwnProperty(s)){var c=n[s],l=(a=e,o=c,Math.pow(a[0]-o[0],2)+Math.pow(a[1]-o[1],2)+Math.pow(a[2]-o[2],2));l.04045?Math.pow((t+.055)/1.055,2.4):t/12.92)+.3576*(r=r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92)+.1805*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)),100*(.2126*t+.7152*r+.0722*n),100*(.0193*t+.1192*r+.9505*n)]},o.rgb.lab=function(e){var t=o.rgb.xyz(e),r=t[0],n=t[1],i=t[2];return n/=100,i/=108.883,r=(r/=95.047)>.008856?Math.pow(r,1/3):7.787*r+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(r-n),200*(n-(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116))]},o.hsl.rgb=function(e){var t,r,n,i,a,o=e[0]/360,u=e[1]/100,s=e[2]/100;if(0===u)return[a=255*s,a,a];t=2*s-(r=s<.5?s*(1+u):s+u-s*u),i=[0,0,0];for(var c=0;c<3;c++)(n=o+1/3*-(c-1))<0&&n++,n>1&&n--,a=6*n<1?t+6*(r-t)*n:2*n<1?r:3*n<2?t+(r-t)*(2/3-n)*6:t,i[c]=255*a;return i},o.hsl.hsv=function(e){var t=e[0],r=e[1]/100,n=e[2]/100,i=r,a=Math.max(n,.01);return r*=(n*=2)<=1?n:2-n,i*=a<=1?a:2-a,[t,100*(0===n?2*i/(a+i):2*r/(n+r)),100*((n+r)/2)]},o.hsv.rgb=function(e){var t=e[0]/60,r=e[1]/100,n=e[2]/100,i=Math.floor(t)%6,a=t-Math.floor(t),o=255*n*(1-r),u=255*n*(1-r*a),s=255*n*(1-r*(1-a));switch(n*=255,i){case 0:return[n,s,o];case 1:return[u,n,o];case 2:return[o,n,s];case 3:return[o,u,n];case 4:return[s,o,n];case 5:return[n,o,u]}},o.hsv.hsl=function(e){var t,r,n,i=e[0],a=e[1]/100,o=e[2]/100,u=Math.max(o,.01);return n=(2-a)*o,r=a*u,[i,100*(r=(r/=(t=(2-a)*u)<=1?t:2-t)||0),100*(n/=2)]},o.hwb.rgb=function(e){var t,r,n,i,a,o,u,s=e[0]/360,c=e[1]/100,l=e[2]/100,f=c+l;switch(f>1&&(c/=f,l/=f),n=6*s-(t=Math.floor(6*s)),0!==(1&t)&&(n=1-n),i=c+n*((r=1-l)-c),t){default:case 6:case 0:a=r,o=i,u=c;break;case 1:a=i,o=r,u=c;break;case 2:a=c,o=r,u=i;break;case 3:a=c,o=i,u=r;break;case 4:a=i,o=c,u=r;break;case 5:a=r,o=c,u=i}return[255*a,255*o,255*u]},o.cmyk.rgb=function(e){var t=e[0]/100,r=e[1]/100,n=e[2]/100,i=e[3]/100;return[255*(1-Math.min(1,t*(1-i)+i)),255*(1-Math.min(1,r*(1-i)+i)),255*(1-Math.min(1,n*(1-i)+i))]},o.xyz.rgb=function(e){var t,r,n,i=e[0]/100,a=e[1]/100,o=e[2]/100;return r=-.9689*i+1.8758*a+.0415*o,n=.0557*i+-.204*a+1.057*o,t=(t=3.2406*i+-1.5372*a+-.4986*o)>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t,r=r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:12.92*n,[255*(t=Math.min(Math.max(0,t),1)),255*(r=Math.min(Math.max(0,r),1)),255*(n=Math.min(Math.max(0,n),1))]},o.xyz.lab=function(e){var t=e[0],r=e[1],n=e[2];return r/=100,n/=108.883,t=(t/=95.047)>.008856?Math.pow(t,1/3):7.787*t+16/116,[116*(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116)-16,500*(t-r),200*(r-(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116))]},o.lab.xyz=function(e){var t,r,n,i=e[0];t=e[1]/500+(r=(i+16)/116),n=r-e[2]/200;var a=Math.pow(r,3),o=Math.pow(t,3),u=Math.pow(n,3);return r=a>.008856?a:(r-16/116)/7.787,t=o>.008856?o:(t-16/116)/7.787,n=u>.008856?u:(n-16/116)/7.787,[t*=95.047,r*=100,n*=108.883]},o.lab.lch=function(e){var t,r=e[0],n=e[1],i=e[2];return(t=360*Math.atan2(i,n)/2/Math.PI)<0&&(t+=360),[r,Math.sqrt(n*n+i*i),t]},o.lch.lab=function(e){var t,r=e[0],n=e[1];return t=e[2]/360*2*Math.PI,[r,n*Math.cos(t),n*Math.sin(t)]},o.rgb.ansi16=function(e){var t=e[0],r=e[1],n=e[2],i=1 in arguments?arguments[1]:o.rgb.hsv(e)[2];if(0===(i=Math.round(i/50)))return 30;var a=30+(Math.round(n/255)<<2|Math.round(r/255)<<1|Math.round(t/255));return 2===i&&(a+=60),a},o.hsv.ansi16=function(e){return o.rgb.ansi16(o.hsv.rgb(e),e[2])},o.rgb.ansi256=function(e){var t=e[0],r=e[1],n=e[2];return t===r&&r===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},o.ansi16.rgb=function(e){var t=e%10;if(0===t||7===t)return e>50&&(t+=3.5),[t=t/10.5*255,t,t];var r=.5*(1+~~(e>50));return[(1&t)*r*255,(t>>1&1)*r*255,(t>>2&1)*r*255]},o.ansi256.rgb=function(e){if(e>=232){var t=10*(e-232)+8;return[t,t,t]}var r;return e-=16,[Math.floor(e/36)/5*255,Math.floor((r=e%36)/6)/5*255,r%6/5*255]},o.rgb.hex=function(e){var t=(((255&Math.round(e[0]))<<16)+((255&Math.round(e[1]))<<8)+(255&Math.round(e[2]))).toString(16).toUpperCase();return"000000".substring(t.length)+t},o.hex.rgb=function(e){var t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];var r=t[0];3===t[0].length&&(r=r.split("").map((function(e){return e+e})).join(""));var n=parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},o.rgb.hcg=function(e){var t,r=e[0]/255,n=e[1]/255,i=e[2]/255,a=Math.max(Math.max(r,n),i),o=Math.min(Math.min(r,n),i),u=a-o;return t=u<=0?0:a===r?(n-i)/u%6:a===n?2+(i-r)/u:4+(r-n)/u+4,t/=6,[360*(t%=1),100*u,100*(u<1?o/(1-u):0)]},o.hsl.hcg=function(e){var t=e[1]/100,r=e[2]/100,n=1,i=0;return(n=r<.5?2*t*r:2*t*(1-r))<1&&(i=(r-.5*n)/(1-n)),[e[0],100*n,100*i]},o.hsv.hcg=function(e){var t=e[1]/100,r=e[2]/100,n=t*r,i=0;return n<1&&(i=(r-n)/(1-n)),[e[0],100*n,100*i]},o.hcg.rgb=function(e){var t=e[0]/360,r=e[1]/100,n=e[2]/100;if(0===r)return[255*n,255*n,255*n];var i,a=[0,0,0],o=t%1*6,u=o%1,s=1-u;switch(Math.floor(o)){case 0:a[0]=1,a[1]=u,a[2]=0;break;case 1:a[0]=s,a[1]=1,a[2]=0;break;case 2:a[0]=0,a[1]=1,a[2]=u;break;case 3:a[0]=0,a[1]=s,a[2]=1;break;case 4:a[0]=u,a[1]=0,a[2]=1;break;default:a[0]=1,a[1]=0,a[2]=s}return i=(1-r)*n,[255*(r*a[0]+i),255*(r*a[1]+i),255*(r*a[2]+i)]},o.hcg.hsv=function(e){var t=e[1]/100,r=t+e[2]/100*(1-t),n=0;return r>0&&(n=t/r),[e[0],100*n,100*r]},o.hcg.hsl=function(e){var t=e[1]/100,r=e[2]/100*(1-t)+.5*t,n=0;return r>0&&r<.5?n=t/(2*r):r>=.5&&r<1&&(n=t/(2*(1-r))),[e[0],100*n,100*r]},o.hcg.hwb=function(e){var t=e[1]/100,r=t+e[2]/100*(1-t);return[e[0],100*(r-t),100*(1-r)]},o.hwb.hcg=function(e){var t=e[1]/100,r=1-e[2]/100,n=r-t,i=0;return n<1&&(i=(r-n)/(1-n)),[e[0],100*n,100*i]},o.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},o.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},o.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},o.gray.hsl=o.gray.hsv=function(e){return[0,0,e[0]]},o.gray.hwb=function(e){return[0,100,e[0]]},o.gray.cmyk=function(e){return[0,0,0,e[0]]},o.gray.lab=function(e){return[e[0],0,0]},o.gray.hex=function(e){var t=255&Math.round(e[0]/100*255),r=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(r.length)+r},o.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}},3143:function(e,t,r){var n=r(198),i=r(3150),a={};Object.keys(n).forEach((function(e){a[e]={},Object.defineProperty(a[e],"channels",{value:n[e].channels}),Object.defineProperty(a[e],"labels",{value:n[e].labels});var t=i(e);Object.keys(t).forEach((function(r){var n=t[r];a[e][r]=function(e){var t=function(t){if(void 0===t||null===t)return t;arguments.length>1&&(t=Array.prototype.slice.call(arguments));var r=e(t);if("object"===typeof r)for(var n=r.length,i=0;i1&&(t=Array.prototype.slice.call(arguments)),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(n)}))})),e.exports=a},3150:function(e,t,r){var n=r(198);function i(e){var t=function(){for(var e={},t=Object.keys(n),r=t.length,i=0;i=0;r--){var o=n(i[r]);t=n(new Buffer(t+o,"hex"))}}return"0x"+t}},4756:function(e,t,r){!function(){"use strict";var t="object"===typeof window?window:{};!t.JS_SHA3_NO_NODE_JS&&"object"===typeof process&&process.versions&&process.versions.node&&(t=r.g);for(var n=!t.JS_SHA3_NO_COMMON_JS&&e.exports,i="0123456789abcdef".split(""),a=[0,8,16,24],o=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],u=[224,256,384,512],s=["hex","buffer","arrayBuffer","array"],c=function(e,t,r){return function(n){return new w(e,t,e).update(n)[r]()}},l=function(e,t,r){return function(n,i){return new w(e,t,i).update(n)[r]()}},f=function(e,t){var r=c(e,t,"hex");r.create=function(){return new w(e,t,e)},r.update=function(e){return r.create().update(e)};for(var n=0;n>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}w.prototype.update=function(e){var t="string"!==typeof e;t&&e.constructor===ArrayBuffer&&(e=new Uint8Array(e));for(var r,n,i=e.length,o=this.blocks,u=this.byteCount,s=this.blockCount,c=0,l=this.s;c>2]|=e[c]<>2]|=n<>2]|=(192|n>>6)<>2]|=(128|63&n)<=57344?(o[r>>2]|=(224|n>>12)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<>2]|=(240|n>>18)<>2]|=(128|n>>12&63)<>2]|=(128|n>>6&63)<>2]|=(128|63&n)<=u){for(this.start=r-u,this.block=o[s],r=0;r>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4&15]+i[15&e]+i[e>>12&15]+i[e>>8&15]+i[e>>20&15]+i[e>>16&15]+i[e>>28&15]+i[e>>24&15];u%t===0&&(k(r),o=0)}return a&&(e=r[o],a>0&&(s+=i[e>>4&15]+i[15&e]),a>1&&(s+=i[e>>12&15]+i[e>>8&15]),a>2&&(s+=i[e>>20&15]+i[e>>16&15])),s},w.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,a=0,o=0,u=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(u);for(var s=new Uint32Array(e);o>8&255,s[e+2]=t>>16&255,s[e+3]=t>>24&255;u%r===0&&k(n)}return a&&(e=u<<2,t=n[o],a>0&&(s[e]=255&t),a>1&&(s[e+1]=t>>8&255),a>2&&(s[e+2]=t>>16&255)),s};var k=function(e){var t,r,n,i,a,u,s,c,l,f,h,d,p,m,v,y,g,b,w,k,x,A,E,S,_,C,P,O,N,T,M,U,R,I,B,L,j,F,D,z,Z,q,H,G,K,V,W,J,Q,Y,X,$,ee,te,re,ne,ie,ae,oe,ue,se,ce,le;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],a=e[1]^e[11]^e[21]^e[31]^e[41],u=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],c=e[4]^e[14]^e[24]^e[34]^e[44],l=e[5]^e[15]^e[25]^e[35]^e[45],f=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],t=(d=e[8]^e[18]^e[28]^e[38]^e[48])^(u<<1|s>>>31),r=(p=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|u>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(c<<1|l>>>31),r=a^(l<<1|c>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=u^(f<<1|h>>>31),r=s^(h<<1|f>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=c^(d<<1|p>>>31),r=l^(p<<1|d>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=f^(i<<1|a>>>31),r=h^(a<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,m=e[0],v=e[1],V=e[11]<<4|e[10]>>>28,W=e[10]<<4|e[11]>>>28,O=e[20]<<3|e[21]>>>29,N=e[21]<<3|e[20]>>>29,ue=e[31]<<9|e[30]>>>23,se=e[30]<<9|e[31]>>>23,q=e[40]<<18|e[41]>>>14,H=e[41]<<18|e[40]>>>14,I=e[2]<<1|e[3]>>>31,B=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,g=e[12]<<12|e[13]>>>20,J=e[22]<<10|e[23]>>>22,Q=e[23]<<10|e[22]>>>22,T=e[33]<<13|e[32]>>>19,M=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,le=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,L=e[14]<<6|e[15]>>>26,j=e[15]<<6|e[14]>>>26,b=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,Y=e[34]<<15|e[35]>>>17,X=e[35]<<15|e[34]>>>17,U=e[45]<<29|e[44]>>>3,R=e[44]<<29|e[45]>>>3,S=e[6]<<28|e[7]>>>4,_=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,F=e[26]<<25|e[27]>>>7,D=e[27]<<25|e[26]>>>7,k=e[36]<<21|e[37]>>>11,x=e[37]<<21|e[36]>>>11,$=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,G=e[8]<<27|e[9]>>>5,K=e[9]<<27|e[8]>>>5,C=e[18]<<20|e[19]>>>12,P=e[19]<<20|e[18]>>>12,ae=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,z=e[38]<<8|e[39]>>>24,Z=e[39]<<8|e[38]>>>24,A=e[48]<<14|e[49]>>>18,E=e[49]<<14|e[48]>>>18,e[0]=m^~y&b,e[1]=v^~g&w,e[10]=S^~C&O,e[11]=_^~P&N,e[20]=I^~L&F,e[21]=B^~j&D,e[30]=G^~V&J,e[31]=K^~W&Q,e[40]=te^~ne&ae,e[41]=re^~ie&oe,e[2]=y^~b&k,e[3]=g^~w&x,e[12]=C^~O&T,e[13]=P^~N&M,e[22]=L^~F&z,e[23]=j^~D&Z,e[32]=V^~J&Y,e[33]=W^~Q&X,e[42]=ne^~ae&ue,e[43]=ie^~oe&se,e[4]=b^~k&A,e[5]=w^~x&E,e[14]=O^~T&U,e[15]=N^~M&R,e[24]=F^~z&q,e[25]=D^~Z&H,e[34]=J^~Y&$,e[35]=Q^~X&ee,e[44]=ae^~ue&ce,e[45]=oe^~se&le,e[6]=k^~A&m,e[7]=x^~E&v,e[16]=T^~U&S,e[17]=M^~R&_,e[26]=z^~q&I,e[27]=Z^~H&B,e[36]=Y^~$&G,e[37]=X^~ee&K,e[46]=ue^~ce&te,e[47]=se^~le&re,e[8]=A^~m&y,e[9]=E^~v&g,e[18]=U^~S&C,e[19]=R^~_&P,e[28]=q^~I&L,e[29]=H^~B&j,e[38]=$^~G&V,e[39]=ee^~K&W,e[48]=ce^~te&ne,e[49]=le^~re&ie,e[0]^=o[n],e[1]^=o[n+1]};if(n)e.exports=d;else for(m=0;m=this._delta8){var r=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-r,e.length),0===this.pending.length&&(this.pending=null),e=n.join32(e,0,e.length-r,this.endian);for(var i=0;i>>24&255,n[i++]=e>>>16&255,n[i++]=e>>>8&255,n[i++]=255&e}else for(n[i++]=255&e,n[i++]=e>>>8&255,n[i++]=e>>>16&255,n[i++]=e>>>24&255,n[i++]=0,n[i++]=0,n[i++]=0,n[i++]=0,a=8;athis.blockSize&&(e=(new this.Hash).update(e).digest()),i(e.length<=this.blockSize);for(var t=e.length;t>>3},t.g1_256=function(e){return n(e,17)^n(e,19)^e>>>10}},7657:function(e,t,r){"use strict";var n=r(5701),i=r(273);function a(e,t){return 55296===(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320===(64512&e.charCodeAt(t+1)))}function o(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function u(e){return 1===e.length?"0"+e:e}function s(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}t.inherits=i,t.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if("string"===typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!==0&&(e="0"+e),i=0;i>6|192,r[n++]=63&o|128):a(e,i)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++i)),r[n++]=o>>18|240,r[n++]=o>>12&63|128,r[n++]=o>>6&63|128,r[n++]=63&o|128):(r[n++]=o>>12|224,r[n++]=o>>6&63|128,r[n++]=63&o|128)}else for(i=0;i>>0}return o},t.split32=function(e,t){for(var r=new Array(4*e.length),n=0,i=0;n>>24,r[i+1]=a>>>16&255,r[i+2]=a>>>8&255,r[i+3]=255&a):(r[i+3]=a>>>24,r[i+2]=a>>>16&255,r[i+1]=a>>>8&255,r[i]=255&a)}return r},t.rotr32=function(e,t){return e>>>t|e<<32-t},t.rotl32=function(e,t){return e<>>32-t},t.sum32=function(e,t){return e+t>>>0},t.sum32_3=function(e,t,r){return e+t+r>>>0},t.sum32_4=function(e,t,r,n){return e+t+r+n>>>0},t.sum32_5=function(e,t,r,n,i){return e+t+r+n+i>>>0},t.sum64=function(e,t,r,n){var i=e[t],a=n+e[t+1]>>>0,o=(a>>0,e[t+1]=a},t.sum64_hi=function(e,t,r,n){return(t+n>>>0>>0},t.sum64_lo=function(e,t,r,n){return t+n>>>0},t.sum64_4_hi=function(e,t,r,n,i,a,o,u){var s=0,c=t;return s+=(c=c+n>>>0)>>0)>>0)>>0},t.sum64_4_lo=function(e,t,r,n,i,a,o,u){return t+n+a+u>>>0},t.sum64_5_hi=function(e,t,r,n,i,a,o,u,s,c){var l=0,f=t;return l+=(f=f+n>>>0)>>0)>>0)>>0)>>0},t.sum64_5_lo=function(e,t,r,n,i,a,o,u,s,c){return t+n+a+u+c>>>0},t.rotr64_hi=function(e,t,r){return(t<<32-r|e>>>r)>>>0},t.rotr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0},t.shr64_hi=function(e,t,r){return e>>>r},t.shr64_lo=function(e,t,r){return(e<<32-r|t>>>r)>>>0}},5025:function(e,t){var r;void 0===(r=function(){return function(){var e=[new Uint32Array([2157250,2157314,2157378,2157442,2157506,2157570,2157634,0,2157698,2157762,2157826,2157890,2157954,0,2158018,0]),new Uint32Array([2179041,6291456,2179073,6291456,2179105,6291456,2179137,6291456,2179169,6291456,2179201,6291456,2179233,6291456,2179265,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,14680064,14680064,14680064,14680064,14680064]),new Uint32Array([0,2113729,2197345,2197377,2113825,2197409,2197441,2113921,2197473,2114017,2197505,2197537,2197569,2197601,2197633,2197665]),new Uint32Array([6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,23068672,23068672,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,0,0,0,0,23068672,23068672,23068672,0,0,0,0,23068672]),new Uint32Array([14680064,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,14680064,14680064]),new Uint32Array([2196001,2196033,2196065,2196097,2196129,2196161,2196193,2196225,2196257,2196289,2196321,2196353,2196385,2196417,2196449,2196481]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,6291456,0,0,0,0,0]),new Uint32Array([2097281,2105921,2097729,2106081,0,2097601,2162337,2106017,2133281,2097505,2105889,2097185,2097697,2135777,2097633,2097441]),new Uint32Array([2177025,6291456,2177057,6291456,2177089,6291456,2177121,6291456,2177153,6291456,2177185,6291456,2177217,6291456,2177249,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,0,6291456,6291456,0,0,0,0,0,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,6291456]),new Uint32Array([0,23068672,23068672,23068672,0,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,6291456]),new Uint32Array([2134435,2134531,2134627,2134723,2134723,2134819,2134819,2134915,2134915,2135011,2105987,2135107,2135203,2135299,2131587,2135395]),new Uint32Array([0,0,0,0,0,0,0,6291456,2168673,2169249,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2147906,2147970,2148034,2148098,2148162,2148226,2148290,2148354,2147906,2147970,2148034,2148098,2148162,2148226,2148290,2148354]),new Uint32Array([2125219,2125315,2152834,2152898,2125411,2152962,2153026,2125506,2125507,2125603,2153090,2153154,2153218,2153282,2153346,2105348]),new Uint32Array([2203393,6291456,2203425,6291456,2203457,6291456,2203489,6291456,6291456,6291456,6291456,2203521,6291456,2181281,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,23068672,6291456,2145538,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,0,0,6291456]),new Uint32Array([2139426,2160834,2160898,2160962,2134242,2161026,2161090,2161154,2161218,2161282,2161346,2161410,2138658,2161474,2161538,2134722]),new Uint32Array([2119939,2124930,2125026,2106658,2125218,2128962,2129058,2129154,2129250,2129346,2129442,2108866,2108770,2150466,2150530,2150594]),new Uint32Array([2201601,6291456,2201633,6291456,2201665,6291456,2201697,6291456,2201729,6291456,2201761,6291456,2201793,6291456,2201825,6291456]),new Uint32Array([2193537,2193569,2193601,2193633,2193665,2193697,2193729,2193761,2193793,2193825,2193857,2193889,2193921,2193953,2193985,2194017]),new Uint32Array([6291456,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([0,6291456,6291456,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2190561,6291456,2190593,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2190625,6291456,2190657,6291456,23068672]),new Uint32Array([2215905,2215937,2215969,2216001,2216033,2216065,2216097,2216129,2216161,2216193,2216225,2216257,2105441,2216289,2216321,2216353]),new Uint32Array([23068672,18884130,23068672,23068672,23068672,6291456,23068672,23068672,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672]),new Uint32Array([23068672,23068672,0,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,6291456,23068672,23068672,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2191233,2191265,2191297,2191329,2191361,2191393,2191425,2117377,2191457,2191489,2191521,2191553,2191585,2191617,2191649,2117953]),new Uint32Array([2132227,2132323,2132419,2132419,2132515,2132515,2132611,2132707,2132707,2132803,2132899,2132899,2132995,2132995,2133091,2133187]),new Uint32Array([0,0,0,0,0,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,6291456,0,0]),new Uint32Array([2112481,2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,10609889,10610785,10609921,10610817,2222241]),new Uint32Array([6291456,6291456,6291456,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,0,0]),new Uint32Array([2219969,2157121,2157441,2157505,2157889,2157953,2220001,2158465,2158529,10575617,2156994,2157058,2129923,2130019,2157122,2157186]),new Uint32Array([6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,0,0,0]),new Uint32Array([2185249,6291456,2185281,6291456,2185313,6291456,2185345,6291456,2185377,6291456,2185409,6291456,2185441,6291456,2185473,6291456]),new Uint32Array([0,0,0,0,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,0,0,23068672,23068672,0,0,23068672,23068672,23068672,6291456,0]),new Uint32Array([2183361,6291456,2183393,6291456,2183425,6291456,2183457,6291456,2183489,6291456,2183521,6291456,2183553,6291456,2183585,6291456]),new Uint32Array([2192161,2192193,2192225,2192257,2192289,2192321,2192353,2192385,2192417,2192449,2192481,2192513,2192545,2192577,2192609,2192641]),new Uint32Array([2212001,2212033,2212065,2212097,2212129,2212161,2212193,2212225,2212257,2212289,2212321,2212353,2212385,2212417,2212449,2207265]),new Uint32Array([2249825,2249857,2249889,2249921,2249954,2250018,2250082,2250145,2250177,2250209,2250241,2250274,2250337,2250370,2250433,2250465]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2147905,2147969,2148033,2148097,2148161,2148225,2148289,2148353]),new Uint32Array([10485857,6291456,2197217,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,23068672,23068672]),new Uint32Array([0,23068672,23068672,23068672,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456]),new Uint32Array([2180353,2180385,2144033,2180417,2180449,2180481,2180513,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2112481,2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,10610209,10610465,10610241,10610753,10609857]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,0,0]),new Uint32Array([2223842,2223906,2223970,2224034,2224098,2224162,2224226,2224290,2224354,2224418,2224482,2224546,2224610,2224674,2224738,2224802]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,6291456,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456]),new Uint32Array([23068672,23068672,23068672,18923650,23068672,23068672,23068672,23068672,0,23068672,23068672,23068672,23068672,18923714,23068672,23068672]),new Uint32Array([2126179,2125538,2126275,2126371,2126467,2125634,2126563,2105603,2105604,2125346,2126659,2126755,2126851,2098179,2098181,2098182]),new Uint32Array([2227426,2227490,2227554,2227618,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2192353,2240642,2240642,2240705,2240737,2240737,2240769,2240802,2240866,2240929,2240961,2240993,2241025,2241057,2241089,2241121]),new Uint32Array([6291456,2170881,2170913,2170945,6291456,2170977,6291456,2171009,2171041,6291456,6291456,6291456,2171073,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2132226,2132514,2163586,2132610,2160386,2133090,2133186,2160450,2160514,2160578,2133570,2106178,2160642,2133858,2160706,2160770]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,10532162,10532226,10532290,10532354,10532418,10532482,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,23068672]),new Uint32Array([2098209,2108353,2108193,2108481,2170241,2111713,2105473,2105569,2105601,2112289,2112481,2098305,2108321,0,0,0]),new Uint32Array([2209121,2209153,2209185,2209217,2209249,2209281,2209313,2209345,2209377,2209409,2209441,2209473,2207265,2209505,2209537,2209569]),new Uint32Array([2189025,6291456,2189057,6291456,2189089,6291456,2189121,6291456,2189153,6291456,2189185,6291456,2189217,6291456,2189249,6291456]),new Uint32Array([2173825,2153473,2173857,2173889,2173921,2173953,2173985,2173761,2174017,2174049,2174081,2174113,2174145,2174177,2149057,2233057]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2165764,2140004]),new Uint32Array([2215105,6291456,2215137,6291456,6291456,2215169,2215201,6291456,6291456,6291456,2215233,2215265,2215297,2215329,2215361,2215393]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,0,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,6291456,6291456,6291456,23068672,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([10505091,10505187,10505283,10505379,10505475,10505571,10505667,10505763,10505859,10505955,10506051,10506147,10506243,10506339,10506435,10506531]),new Uint32Array([2229730,2229794,2229858,2229922,2229986,2230050,2230114,2230178,2230242,2230306,2230370,2230434,2230498,2230562,2230626,2230690]),new Uint32Array([2105505,2098241,2108353,2108417,2105825,0,2100897,2111905,2105473,2105569,2105601,2112289,2108193,2112481,2112577,2098177]),new Uint32Array([6291456,6291456,6291456,6291456,10502115,10502178,10502211,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([0,23068672,23068672,23068672,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,6291456]),new Uint32Array([2190305,6291456,2190337,6291456,2190369,6291456,2190401,6291456,2190433,6291456,2190465,6291456,2190497,6291456,2190529,6291456]),new Uint32Array([2173793,2173985,2174017,6291456,2173761,2173697,6291456,2174689,6291456,2174017,2174721,6291456,6291456,2174753,2174785,2174817]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2099521,2099105,2120705,2098369,2120801,2103361,2097985,2098433,2121377,2121473,2099169,2099873,2098401,2099393,2152609,2100033]),new Uint32Array([2132898,2163842,2163906,2133282,2132034,2131938,2137410,2132802,2132706,2164866,2133282,2160578,2165186,2165186,6291456,6291456]),new Uint32Array([10500003,10500099,10500195,10500291,10500387,10500483,10500579,10500675,10500771,10500867,10500963,10501059,10501155,10501251,10501347,10501443]),new Uint32Array([2163458,2130978,2131074,2131266,2131362,2163522,2160130,2132066,2131010,2131106,2106018,2131618,2131298,2132034,2131938,2137410]),new Uint32Array([2212961,2116993,2212993,2213025,2213057,2213089,2213121,2213153,2213185,2213217,2213249,2209633,2213281,2213313,2213345,2213377]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,23068672,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456]),new Uint32Array([2113729,2113825,2113921,2114017,2114113,2114209,2114305,2114401,2114497,2114593,2114689,2114785,2114881,2114977,2115073,2115169]),new Uint32Array([2238177,2238209,2238241,2238273,2238305,2238337,2238337,2217537,2238369,2238401,2238433,2238465,2215649,2238497,2238529,2238561]),new Uint32Array([2108289,2100865,2113153,2108481,2113345,2113441,2098209,2111137,2105505,2098241,2108353,2108417,2105825,2111713,2100897,2111905]),new Uint32Array([6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,0,0]),new Uint32Array([6291456,0,6291456,2145026,0,6291456,2145090,0,6291456,6291456,0,0,23068672,0,23068672,23068672]),new Uint32Array([2099233,2122017,2200673,2098113,2121537,2103201,2200705,2104033,2121857,2121953,2122401,2099649,2099969,2123009,2100129,2100289]),new Uint32Array([6291456,23068672,6291456,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,23068672,23068672,0,0,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,0]),new Uint32Array([2187681,2187713,2187745,2187777,2187809,2187841,2187873,2187905,2187937,2187969,2188001,2188033,2188065,2188097,2188129,2188161]),new Uint32Array([0,10554498,10554562,10554626,10554690,10554754,10554818,10554882,10554946,10555010,10555074,6291456,6291456,0,0,0]),new Uint32Array([2235170,2235234,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,0,0]),new Uint32Array([2181153,6291456,2188897,6291456,6291456,2188929,6291456,6291456,6291456,6291456,6291456,6291456,2111905,2100865,2188961,2188993]),new Uint32Array([2100833,2100897,0,0,2101569,2101697,2101825,2101953,2102081,2102209,10575617,2187041,10502177,10489601,10489697,2112289]),new Uint32Array([6291456,2172833,6291456,2172865,2172897,2172929,2172961,6291456,2172993,6291456,2173025,6291456,2173057,6291456,2173089,6291456]),new Uint32Array([6291456,0,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,0,0,23068672,6291456,23068672,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,2190721]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,23068672,6291456,6291456]),new Uint32Array([2184993,6291456,2185025,6291456,2185057,6291456,2185089,6291456,2185121,6291456,2185153,6291456,2185185,6291456,2185217,6291456]),new Uint32Array([2115265,2115361,2115457,2115553,2115649,2115745,2115841,2115937,2116033,2116129,2116225,2116321,2150658,2150722,2200225,6291456]),new Uint32Array([2168321,6291456,2168353,6291456,2168385,6291456,2168417,6291456,2168449,6291456,2168481,6291456,2168513,6291456,2168545,6291456]),new Uint32Array([23068672,23068672,23068672,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,0,6291456,6291456,6291456,6291456,0,0,0,6291456,6291456,0,6291456,0,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,2186625,0,0,6291456,6291456,2186657,2186689,2186721,2173505,0,10496067,10496163,10496259]),new Uint32Array([2178785,6291456,2178817,6291456,2178849,6291456,2178881,6291456,2178913,6291456,2178945,6291456,2178977,6291456,2179009,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0]),new Uint32Array([2097152,0,0,0,2097152,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456]),new Uint32Array([6291456,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([0,0,2197857,2197889,2197921,2197953,2197985,2198017,0,0,2198049,2198081,2198113,2198145,2198177,2198209]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2098209,2167297,2111137,6291456]),new Uint32Array([2171393,6291456,2171425,6291456,2171457,6291456,2171489,6291456,2171521,6291456,2171553,6291456,2171585,6291456,2171617,6291456]),new Uint32Array([2206753,2206785,2195457,2206817,2206849,2206881,2206913,2197153,2197153,2206945,2117857,2206977,2207009,2207041,2207073,2207105]),new Uint32Array([0,0,0,0,0,0,0,23068672,0,0,0,0,2144834,2144898,0,2144962]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,23068672]),new Uint32Array([2108193,2112481,2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,2098209,0,2105505,2098241]),new Uint32Array([6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,2202049,6291456,2202081,6291456,2202113,6291456,2202145,6291456,2202177,6291456,2202209,6291456,2202241,6291456]),new Uint32Array([10501155,10501251,10501347,10501443,10501539,10501635,10501731,10501827,10501923,10502019,2141731,2105505,2098177,2155586,2166530,0]),new Uint32Array([2102081,2102209,2100833,2100737,2098337,2101441,2101569,2101697,2101825,2101953,2102081,2102209,2100833,2100737,2098337,2101441]),new Uint32Array([2146882,2146946,2147010,2147074,2147138,2147202,2147266,2147330,2146882,2146946,2147010,2147074,2147138,2147202,2147266,2147330]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0]),new Uint32Array([10502307,10502403,10502499,10502595,10502691,10502787,10502883,10502979,10503075,10503171,10503267,10503363,10503459,10503555,10503651,10503747]),new Uint32Array([2179937,2179969,2180001,2180033,2156545,2180065,2156577,2180097,2180129,2180161,2180193,2180225,2180257,2180289,2156737,2180321]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,0,0,0,6291456,0,0,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0]),new Uint32Array([2227682,2227746,2227810,2227874,2227938,2228002,2228066,2228130,2228194,2228258,2228322,2228386,2228450,2228514,2228578,2228642]),new Uint32Array([2105601,2169121,2108193,2170049,2181025,2181057,2112481,2108321,2108289,2181089,2170497,2100865,2181121,2173601,2173633,2173665]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2180641,6291456,6291456,6291456]),new Uint32Array([0,6291456,6291456,6291456,0,6291456,0,6291456,0,0,6291456,6291456,0,6291456,6291456,6291456]),new Uint32Array([2178273,6291456,2178305,6291456,2178337,6291456,2178369,6291456,2178401,6291456,2178433,6291456,2178465,6291456,2178497,6291456]),new Uint32Array([6291456,6291456,23068672,23068672,23068672,6291456,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,14680064,14680064,14680064,14680064,14680064,14680064]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456]),new Uint32Array([2237377,2237409,2236225,2237441,2237473,2217441,2215521,2215553,2217473,2237505,2237537,2209697,2237569,2215585,2237601,2237633]),new Uint32Array([2221985,2165601,2165601,2165665,2165665,2222017,2222017,2165729,2165729,2158913,2158913,2158913,2158913,2097281,2097281,2105921]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,0,23068672,23068672,23068672,0,23068672,23068672,23068672,23068672,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2149634,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2176897,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,2176929,6291456,2176961,6291456,2176993,6291456]),new Uint32Array([2172641,6291456,2172673,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2172705,2172737,6291456,2172769,2172801,6291456]),new Uint32Array([2099173,2104196,2121667,2099395,2121763,2152258,2152322,2098946,2152386,2121859,2121955,2099333,2122051,2104324,2099493,2122147]),new Uint32Array([6291456,6291456,6291456,2145794,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,2145858,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,0,0,6291456,0]),new Uint32Array([0,2105921,2097729,0,2097377,0,0,2106017,0,2097505,2105889,2097185,2097697,2135777,2097633,2097441]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2239074,2239138,2239201,2239233,2239265,2239297,2239329,2239361,0,2239393,2239425,2239425,2239458,2239521,2239553,2209569]),new Uint32Array([14680064,2098209,2111137,2105505,2098241,2108353,2108417,2105825,2111713,2100897,2111905,2105473,2105569,2105601,2112289,2108193]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,6291456,23068672]),new Uint32Array([2108321,2108289,2113153,2098209,2180897,2180929,2180961,2111137,2098241,2108353,2170241,2170273,2180993,2105825,6291456,2105473]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2146114,6291456,6291456,6291456,0,0,0]),new Uint32Array([2105921,2105921,2105921,2222049,2222049,2130977,2130977,2130977,2130977,2160065,2160065,2160065,2160065,2097729,2097729,2097729]),new Uint32Array([2218145,2214785,2207937,2218177,2218209,2192993,2210113,2212769,2218241,2218273,2216129,2218305,2216161,2218337,2218369,2218401]),new Uint32Array([0,0,0,2156546,2156610,2156674,2156738,2156802,0,0,0,0,0,2156866,23068672,2156930]),new Uint32Array([23068672,23068672,23068672,0,0,0,0,23068672,23068672,0,0,23068672,23068672,23068672,0,0]),new Uint32Array([2213409,2213441,2213473,2213505,2213537,2213569,2213601,2213633,2213665,2195681,2213697,2213729,2213761,2213793,2213825,2213857]),new Uint32Array([2100033,2099233,2122017,2200673,2098113,2121537,2103201,2200705,2104033,2121857,2121953,2122401,2099649,2099969,2123009,2100129]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,0,0]),new Uint32Array([2201857,6291456,2201889,6291456,2201921,6291456,2201953,6291456,2201985,6291456,2202017,6291456,2176193,2176257,23068672,23068672]),new Uint32Array([6291456,6291456,23068672,23068672,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2188193,2188225,2188257,2188289,2188321,2188353,2188385,2188417,2188449,2188481,2188513,2188545,2188577,2188609,2188641,0]),new Uint32Array([10554529,2221089,0,10502113,10562017,10537921,10538049,2221121,2221153,0,0,0,0,0,0,0]),new Uint32Array([2213889,2213921,2213953,2213985,2214017,2214049,2214081,2194177,2214113,2214145,2214177,2214209,2214241,2214273,2214305,2214337]),new Uint32Array([2166978,2167042,2099169,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2180545,6291456,6291456,6291456]),new Uint32Array([10518915,10519011,10519107,10519203,2162242,2162306,2159554,2162370,2159362,2159618,2105922,2162434,2159746,2162498,2159810,2159874]),new Uint32Array([2161730,2161794,2135586,2161858,2161922,2137186,2131810,2160290,2135170,2161986,2137954,2162050,2162114,2162178,10518723,10518819]),new Uint32Array([10506627,10506723,10506819,10506915,10507011,10507107,10507203,10507299,10507395,10507491,10507587,10507683,10507779,10507875,10507971,10508067]),new Uint32Array([6291456,23068672,23068672,23068672,0,23068672,23068672,0,0,0,0,0,23068672,23068672,23068672,23068672]),new Uint32Array([23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0]),new Uint32Array([2175873,2175905,2175937,2175969,2176001,2176033,2176065,2176097,2176129,2176161,2176193,2176225,2176257,2176289,2176321,2176353]),new Uint32Array([2140006,2140198,2140390,2140582,2140774,23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456,23068672,23068672,23068672]),new Uint32Array([2108193,2112481,2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,2098209,2111137,2105505,2098241]),new Uint32Array([0,23068672,0,0,0,0,0,0,0,2145154,2145218,2145282,6291456,0,2145346,0]),new Uint32Array([0,0,0,0,10531458,10495395,2148545,2143201,2173473,2148865,2173505,0,2173537,0,2173569,2149121]),new Uint32Array([10537282,10495683,2148738,2148802,2148866,0,6291456,2148930,2186593,2173473,2148737,2148865,2148802,10495779,10495875,10495971]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2215425,2215457,2215489,2215521,2215553,2215585,2215617,2215649,2215681,2215713,2215745,2215777,2192033,2215809,2215841,2215873]),new Uint32Array([2242049,2242081,2242113,2242145,2242177,2242209,2242241,2242273,2215937,2242305,2242338,2242401,2242433,2242465,2242497,2216001]),new Uint32Array([10554529,2221089,0,0,10562017,10502113,10538049,10537921,2221185,10489601,10489697,10609889,10609921,2141729,2141793,10610273]),new Uint32Array([2141923,2142019,2142115,2142211,2142307,2142403,2142499,2142595,2142691,0,0,0,0,0,0,0]),new Uint32Array([0,2221185,2221217,10609857,10609857,10489601,10489697,10609889,10609921,2141729,2141793,2221345,2221377,2221409,2221441,2187105]),new Uint32Array([6291456,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,18923970,23068672,23068672,23068672,0,6291456,6291456]),new Uint32Array([2183105,6291456,2183137,6291456,2183169,6291456,2183201,6291456,2183233,6291456,2183265,6291456,2183297,6291456,2183329,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0]),new Uint32Array([23068672,23068672,23068672,23068672,0,0,0,0,0,0,0,0,6291456,6291456,6291456,6291456]),new Uint32Array([2134434,2134818,2097666,2097186,2097474,2097698,2105986,2131586,2132450,2131874,2131778,2135970,2135778,2161602,2136162,2161666]),new Uint32Array([2236865,2236897,2236930,2236993,2237025,2235681,2237058,2237121,2237153,2237185,2237217,2217281,2237250,2191233,2237313,2237345]),new Uint32Array([2190049,6291456,2190081,6291456,2190113,6291456,2190145,6291456,2190177,6291456,2190209,6291456,2190241,6291456,2190273,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2101922,2102050,2102178,2102306,10498755,10498851,10498947,10499043,10499139,10499235,10499331,10499427,10499523,10489604,10489732,10489860]),new Uint32Array([2166914,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,0,0,0]),new Uint32Array([2181601,2170561,2181633,2181665,2170753,2181697,2172897,2170881,2181729,2170913,2172929,2113441,2181761,2181793,2171009,2173761]),new Uint32Array([0,2105921,2097729,2106081,0,2097601,2162337,2106017,2133281,2097505,0,2097185,2097697,2135777,2097633,2097441]),new Uint32Array([6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,0,0,0,0]),new Uint32Array([2248001,2248033,2248066,2248130,2248193,2248226,2248289,2248322,2248385,2248417,2216673,2248450,2248514,2248577,2248610,2248673]),new Uint32Array([6291456,6291456,0,0,0,0,0,0,0,6291456,6291456,6291456,6291456,0,0,0]),new Uint32Array([2169729,6291456,2169761,6291456,2169793,6291456,2169825,6291456,2169857,2169889,6291456,2169921,6291456,2143329,6291456,2098305]),new Uint32Array([2162178,2163202,2163266,2135170,2136226,2161986,2137954,2159426,2159490,2163330,2159554,2163394,2159682,2139522,2136450,2159746]),new Uint32Array([2173953,2173985,0,2174017,2174049,2174081,2174113,2174145,2174177,2149057,2174209,2174241,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,4271169,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2174273]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,6291456,0,0,0,0,0,0,0,6291456,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,2190785,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2189793,6291456,2189825,6291456,2189857,6291456,2189889,6291456,2189921,6291456,2189953,6291456,2189985,6291456,2190017,6291456]),new Uint32Array([2105601,2112289,2108193,2112481,2112577,0,2098305,2108321,2108289,2100865,2113153,2108481,2113345,0,2098209,2111137]),new Uint32Array([2172129,6291456,2172161,6291456,2172193,6291456,2172225,6291456,2172257,6291456,2172289,6291456,2172321,6291456,2172353,6291456]),new Uint32Array([2214753,6291456,2214785,6291456,6291456,2214817,2214849,2214881,2214913,2214945,2214977,2215009,2215041,2215073,2194401,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,6291456,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([0,0,0,0,6291456,6291456,6291456,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([10610305,10610337,10575617,2221761,10610401,10610433,10502177,0,10610465,10610497,10610529,10610561,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,23068672,0,0,0,0,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2187105,2187137,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2199393,2199425,2199457,2199489,2199521,2199553,2199585,2199617,2199649,2199681,2199713,2199745,2199777,2199809,2199841,0]),new Uint32Array([2217249,2217281,2217313,2217345,2217377,2217409,2217441,2217473,2215617,2217505,2217537,2217569,2214753,2217601,2217633,2217665]),new Uint32Array([2170273,2170305,6291456,2170337,2170369,6291456,2170401,2170433,2170465,6291456,6291456,6291456,2170497,2170529,6291456,2170561]),new Uint32Array([2188673,6291456,2188705,2188737,2188769,6291456,6291456,2188801,6291456,2188833,6291456,2188865,6291456,2180929,2181505,2180897]),new Uint32Array([10489988,10490116,10490244,10490372,10490500,10490628,10490756,10490884,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2147393,2147457,2147521,2147585,2147649,2147713,2147777,2147841]),new Uint32Array([23068672,23068672,0,23068672,23068672,0,23068672,23068672,23068672,23068672,23068672,0,0,0,0,0]),new Uint32Array([2241153,2241185,2241217,2215809,2241250,2241313,2241345,2241377,2217921,2241377,2241409,2215873,2241441,2241473,2241505,2241537]),new Uint32Array([23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2220417,2220417,2220449,2220449,2220481,2220481,2220513,2220513,2220545,2220545,2220577,2220577,2220609,2220609,2220641,2220641]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,2144002,0,6291456,6291456,0,0,6291456,6291456,6291456]),new Uint32Array([2167105,2167137,2167169,2167201,2167233,2167265,2167297,2167329,2167361,2167393,2167425,2167457,2167489,2167521,2167553,2167585]),new Uint32Array([10575521,2098209,2111137,2105505,2098241,2108353,2108417,2105825,2111713,2100897,2111905,2105473,2105569,2105601,2112289,2108193]),new Uint32Array([2234146,2234210,2234274,2234338,2234402,2234466,2234530,2234594,2234658,2234722,2234786,2234850,2234914,2234978,2235042,2235106]),new Uint32Array([0,0,0,0,0,0,0,2180577,0,0,0,0,0,2180609,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,0,0,6291456,6291456]),new Uint32Array([2098209,2111137,2105505,2098241,2108353,2108417,2105825,2111713,2100897,2111905,2105473,2105569,2105601,2112289,2108193,2112481]),new Uint32Array([23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2242529,2242561,2242593,2242625,2242657,2242689,2242721,2242753,2207937,2218177,2242785,2242817,2242849,2242882,2242945,2242977]),new Uint32Array([2118049,2105345,2118241,2105441,2118433,2118529,2118625,2118721,2118817,2200257,2200289,2191809,2200321,2200353,2200385,2200417]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0]),new Uint32Array([2185505,6291456,2185537,6291456,2185569,6291456,2185601,6291456,2185633,6291456,2185665,6291456,2185697,6291456,2185729,6291456]),new Uint32Array([2231970,2232034,2232098,2232162,2232226,2232290,2232354,2232418,2232482,2232546,2232610,2232674,2232738,2232802,2232866,2232930]),new Uint32Array([2218625,2246402,2246466,2246530,2246594,2246657,2246689,2246689,2218657,2219681,2246721,2246753,2246785,2246818,2246881,2208481]),new Uint32Array([2197025,2197057,2197089,2197121,2197153,2197185,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2219137,2216961,2219169,2219201,2219233,2219265,2219297,2217025,2215041,2219329,2217057,2219361,2217089,2219393,2197153,2219426]),new Uint32Array([23068672,23068672,23068672,0,0,0,23068672,23068672,23068672,0,23068672,23068672,23068672,23068672,0,0]),new Uint32Array([2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,2098209,2111137,2105505,2098241,2108353,2108417,2105825,2111713]),new Uint32Array([2243522,2243585,2243617,2243649,2243681,2210113,2243713,2243746,2243810,2243874,2243937,2243970,2244033,2244065,2244097,2244129]),new Uint32Array([2178017,6291456,2178049,6291456,2178081,6291456,2178113,6291456,2178145,6291456,2178177,6291456,2178209,6291456,2178241,6291456]),new Uint32Array([10553858,2165314,10518722,6291456,10518818,0,10518914,2130690,10519010,2130786,10519106,2130882,10519202,2165378,10554050,2165506]),new Uint32Array([0,0,2135491,2135587,2135683,2135779,2135875,2135971,2135971,2136067,2136163,2136259,2136355,2136355,2136451,2136547]),new Uint32Array([23068672,23068672,23068672,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456]),new Uint32Array([0,0,0,0,0,0,0,0,0,0,0,0,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2220033,2220033,2220065,2220065,2220065,2220065,2220097,2220097,2220097,2220097,2220129,2220129,2220129,2220129,2220161,2220161]),new Uint32Array([6291456,6291456,6291456,0,0,0,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,0,23068672,0,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2100897,2100898,2100899,2150018,2100865,2100866,2100867,2100868,2150082,2108481,2109858,2109859,2105569,2105505,2098241,2105601]),new Uint32Array([2097217,2097505,2097505,2097505,2097505,2165570,2165570,2165634,2165634,2165698,2165698,2097858,2097858,0,0,2097152]),new Uint32Array([23068672,6291456,23068672,23068672,23068672,6291456,6291456,23068672,23068672,6291456,6291456,6291456,6291456,6291456,23068672,23068672]),new Uint32Array([23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0]),new Uint32Array([10503843,10503939,10504035,10504131,10504227,10504323,10504419,10504515,10504611,10504707,10504803,10504899,10504995,10491140,10491268,0]),new Uint32Array([2173697,2173729,2148801,2173761,2143969,2173793,2173825,2153473,2173857,2173889,2173921,2173953,2173985,2173761,2174017,2174049]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2134145,2097153,2134241,2105953,2132705,2130977,2160065,2131297,2162049,2133089,2160577,2133857,2235297,2220769,2235329,2235361]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2222401,2222433,2222465,10531394,2222497,2222529,2222561,0,2222593,2222625,2222657,2222689,2222721,2222753,2222785,0]),new Uint32Array([2184481,6291456,2184513,6291456,2184545,6291456,2184577,6291456,2184609,6291456,2184641,6291456,2184673,6291456,2184705,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,23068672,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,23068672,23068672,0,0,0,0,0,0,0,0,0]),new Uint32Array([2105570,2156034,2126947,2156098,2153666,2127043,2127139,2156162,0,2127235,2156226,2156290,2156354,2156418,2127331,2127427]),new Uint32Array([2215905,2207041,2153185,2241569,2241601,2241633,2241665,2241697,2241730,2241793,2241825,2241857,2241889,2241921,2241954,2242017]),new Uint32Array([2203777,6291456,2203809,6291456,2203841,6291456,2203873,6291456,2203905,6291456,2173121,2180993,2181249,2203937,2181313,0]),new Uint32Array([2168577,6291456,2168609,6291456,2168641,6291456,2168673,6291456,2168705,6291456,2168737,6291456,2168769,6291456,2168801,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,6291456,23068672,23068672,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,0,23068672,23068672,23068672,0,23068672,23068672,23068672,0,0]),new Uint32Array([2210113,2195521,2210145,2210177,2210209,2210241,2210273,2210305,2210337,2210369,2210401,2210433,2210465,2210497,2210529,2210561]),new Uint32Array([6291456,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0]),new Uint32Array([2228706,2228770,2228834,2228898,2228962,2229026,2229090,2229154,2229218,2229282,2229346,2229410,2229474,2229538,2229602,2229666]),new Uint32Array([23068672,6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,0,0,0,0,0,0,0,0,0,0,0,0,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,18874368,18874368,18874368,0,0]),new Uint32Array([2133089,2133281,2133281,2133281,2133281,2160577,2160577,2160577,2160577,2097441,2097441,2097441,2097441,2133857,2133857,2133857]),new Uint32Array([6291456,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2173825,2153473,2173857,2173889,2173921,2173953,2173985,2174017,2174017,2174049,2174081,2174113,2174145,2174177,2149057,2233089]),new Uint32Array([2178529,6291456,2178561,6291456,2178593,6291456,2178625,6291456,2178657,6291456,2178689,6291456,2178721,6291456,2178753,6291456]),new Uint32Array([2221025,2221025,2221057,2221057,2159329,2159329,2159329,2159329,2097217,2097217,2158914,2158914,2158978,2158978,2159042,2159042]),new Uint32Array([2208161,2208193,2208225,2208257,2194433,2208289,2208321,2208353,2208385,2208417,2208449,2208481,2208513,2208545,2208577,2208609]),new Uint32Array([2169217,6291456,2169249,6291456,2169281,6291456,2169313,6291456,2169345,6291456,2169377,6291456,2169409,6291456,2169441,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,6291456,6291456,6291456,6291456]),new Uint32Array([2133187,2133283,2133283,2133379,2133475,2133571,2133667,2133667,2133763,2133859,2133955,2134051,2134147,2134147,2134243,2134339]),new Uint32Array([2197697,2114113,2114209,2197729,2197761,2114305,2197793,2114401,2114497,2197825,2114593,2114689,2114785,2114881,2114977,0]),new Uint32Array([2193089,2193121,2193153,2193185,2117665,2117569,2193217,2193249,2193281,2193313,2193345,2193377,2193409,2193441,2193473,2193505]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0]),new Uint32Array([6291456,6291456,6291456,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2184225,6291456,2184257,6291456,2184289,6291456,2184321,6291456,2184353,6291456,2184385,6291456,2184417,6291456,2184449,6291456]),new Uint32Array([2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,2100833,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2098657,2098049,2200737,2123489,2123681,2200769,2098625,2100321,2098145,2100449,2098017,2098753,2200801,2200833,2200865,0]),new Uint32Array([23068672,23068672,23068672,0,0,0,0,0,0,0,0,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,0,0,0,0,0]),new Uint32Array([2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,2098209,2111137,0,2098241,2108353,2108417,2105825,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2181153,2105505,2181185,2167617,2180993]),new Uint32Array([2160002,2160066,2160130,2160194,2160258,2132066,2131010,2131106,2106018,2131618,2160322,2131298,2132034,2131938,2137410,2132226]),new Uint32Array([6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,0,0,0,0,6291456]),new Uint32Array([2183617,6291456,2183649,6291456,2183681,6291456,2183713,6291456,2183745,6291456,2183777,6291456,2183809,6291456,2183841,6291456]),new Uint32Array([0,6291456,6291456,0,6291456,0,0,6291456,6291456,0,6291456,0,0,6291456,0,0]),new Uint32Array([2250977,2251009,2251041,2251073,2195009,2251106,2251169,2251201,2251233,2251265,2251297,2251330,2251394,2251457,2251489,2251521]),new Uint32Array([2205729,2205761,2205793,2205825,2205857,2205889,2205921,2205953,2205985,2206017,2206049,2206081,2206113,2206145,2206177,2206209]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2143170,2168993,6291456,2169025,6291456,2169057,6291456,2169089,6291456,2143234,2169121,6291456,2169153,6291456,2169185,6291456]),new Uint32Array([23068672,23068672,2190689,6291456,0,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2248706,2248769,2248801,2248833,2248865,2248897,2248929,2248962,2249026,2249090,2249154,2240705,2249217,2249249,2249281,2249313]),new Uint32Array([10485857,6291456,6291456,6291456,6291456,6291456,6291456,6291456,10495394,6291456,2098209,6291456,6291456,2097152,6291456,10531394]),new Uint32Array([0,6291456,6291456,6291456,6291456,6291456,6291456,0,0,6291456,6291456,6291456,6291456,6291456,6291456,0]),new Uint32Array([14680064,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2173985,2173953,2148481,2173601,2173633,2173665,2173697,2173729,2148801,2173761,2143969,2173793,2173825,2153473,2173857,2173889]),new Uint32Array([6291456,2186977,6291456,6291456,6291456,6291456,6291456,10537858,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2209601,2209633,2209665,2209697,2209729,2209761,2209793,2209825,2209857,2209889,2209921,2209953,2209985,2210017,2210049,2210081]),new Uint32Array([10501539,10501635,10501731,10501827,10501923,10502019,2098209,2111137,2105505,2098241,2108353,2108417,2105825,2111713,2100897,2111905]),new Uint32Array([2173697,2173729,2148801,2173761,2143969,2173793,2173825,2153473,2173857,2173889,2173921,2173953,2173985,2174017,2174017,2174049]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,0,0]),new Uint32Array([6291456,6291456,23068672,23068672,23068672,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2194561,2194593,2194625,2119777,2119873,2194657,2194689,2194721,2194753,2194785,2194817,2194849,2194881,2194913,2194945,2194977]),new Uint32Array([2113153,2108481,2113345,2113441,2098209,2111137,2105505,2098241,2108353,2108417,2105825,2111713,2100897,2111905,2105473,2105569]),new Uint32Array([2222818,2222882,2222946,2223010,2223074,2223138,2223202,2223266,2223330,2223394,2223458,2223522,2223586,2223650,2223714,2223778]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672]),new Uint32Array([0,2179553,2179585,2179617,2179649,2144001,2179681,2179713,2179745,2179777,2179809,2156705,2179841,2156833,2179873,2179905]),new Uint32Array([6291456,23068672,6291456,2145602,23068672,23068672,23068672,23068672,23068672,23068672,0,23068672,23068672,6291456,0,0]),new Uint32Array([2196513,2196545,2196577,2196609,2196641,2196673,2196705,2196737,2196769,2196801,2196833,2196865,2196897,2196929,2196961,2196993]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2177281,6291456,2177313,6291456,2177345,6291456,2177377,6291456,2177409,6291456,2177441,6291456,2177473,6291456,2177505,6291456]),new Uint32Array([2187137,2221473,2221505,2221537,2221569,6291456,6291456,10610209,10610241,10537986,10537986,10537986,10537986,10609857,10609857,10609857]),new Uint32Array([2243009,2243041,2216033,2243074,2243137,2243169,2243201,2219617,2243233,2243265,2243297,2243329,2243362,2243425,2243457,2243489]),new Uint32Array([10485857,10485857,10485857,10485857,10485857,10485857,10485857,10485857,10485857,10485857,10485857,2097152,4194304,4194304,0,0]),new Uint32Array([2143042,6291456,2143106,2143106,2168833,6291456,2168865,6291456,6291456,2168897,6291456,2168929,6291456,2168961,6291456,2143170]),new Uint32Array([6291456,6291456,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2204193,2204225,2204257,2204289,2204321,2204353,2204385,2204417,2204449,2204481,2204513,2204545,2204577,2204609,2204641,2204673]),new Uint32Array([2202753,6291456,2202785,6291456,2202817,6291456,2202849,6291456,2202881,6291456,2202913,6291456,2202945,6291456,2202977,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2108353,2108417,2105825,2111713,2100897,2111905,2105473,2105569,2105601,2112289,2108193,2112481,2112577,2098177,2098305,2108321]),new Uint32Array([2147394,2147458,2147522,2147586,2147650,2147714,2147778,2147842,2147394,2147458,2147522,2147586,2147650,2147714,2147778,2147842]),new Uint32Array([2253313,2253346,2253409,2253441,2253473,2253505,2253537,2253569,2253601,2253634,2219393,2253697,2253729,2253761,2253793,2253825]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,6291456,6291456]),new Uint32Array([2162562,2162626,2131362,2162690,2159938,2160002,2162754,2162818,2160130,2162882,2160194,2160258,2160834,2160898,2161026,2161090]),new Uint32Array([2175361,2175393,2175425,2175457,2175489,2175521,2175553,2175585,2175617,2175649,2175681,2175713,2175745,2175777,2175809,2175841]),new Uint32Array([2253858,2253921,2253954,2254018,2254082,2196737,2254145,2196865,2254177,2254209,2254241,2254273,2197025,2254306,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2202113,2204129,2188705,2204161]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,0,6291456,6291456,6291456,6291456,0,0]),new Uint32Array([2173985,2174017,2174017,2174049,2174081,2174113,2174145,2174177,2149057,2233089,2173697,2173761,2173793,2174113,2173985,2173953]),new Uint32Array([2101569,2101697,2101825,2101953,2102081,2102209,2100833,2100737,2098337,2101441,2101569,2101697,2101825,2101953,2102081,2102209]),new Uint32Array([2108289,2100865,2113153,2108481,2113345,2113441,2098209,2111137,2105505,2098241,0,2108417,0,2111713,2100897,2111905]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,0,0,0,0,0,0]),new Uint32Array([2175425,2175489,2175809,2175905,2175937,2175937,2176193,2176417,2180865,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,2143298,2143298,2143298,2143362,2143362,2143362,2143426,2143426,2143426,2171105,6291456,2171137]),new Uint32Array([2120162,2120258,2151618,2151682,2151746,2151810,2151874,2151938,2152002,2120035,2120131,2120227,2152066,2120323,2152130,2120419]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,0,0,0,0,0,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2195361,2142433,2236065,2236097,2236129,2236161,2118241,2117473,2236193,2236225,2236257,2236289,0,0,0,0]),new Uint32Array([2189281,6291456,2189313,6291456,2189345,6291456,2189377,6291456,2189409,6291456,2189441,6291456,2189473,6291456,2189505,6291456]),new Uint32Array([6291456,6291456,2145922,6291456,6291456,6291456,6291456,2145986,6291456,6291456,6291456,6291456,2146050,6291456,6291456,6291456]),new Uint32Array([2100833,2100737,2098337,2101441,2101569,2101697,2101825,2101953,2102081,2102209,10502113,10562017,10610401,10502177,10610433,10538049]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,2186401,0,2186433,0,2186465,0,2186497]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,23068672,23068672,23068672]),new Uint32Array([0,0,2198241,2198273,2198305,2198337,2198369,2198401,0,0,2198433,2198465,2198497,0,0,0]),new Uint32Array([6291456,0,6291456,6291456,6291456,6291456,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,0,6291456,0,23068672,23068672,23068672,23068672,23068672,23068672,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,0,0,23068672,6291456,23068672,23068672]),new Uint32Array([0,2105921,2097729,0,2097377,0,0,2106017,2133281,2097505,2105889,0,2097697,2135777,2097633,2097441]),new Uint32Array([2197889,2197921,2197953,2197985,2198017,2198049,2198081,2198113,2198145,2198177,2198209,2198241,2198273,2198305,2198337,2198369]),new Uint32Array([2132514,2132610,2160386,2133090,2133186,2160450,2160514,2133282,2160578,2133570,2106178,2160642,2133858,2160706,2160770,2134146]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,23068672,23068672,0,0,0,0,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,23068672,23068672,6291456,23068672,23068672,6291456,23068672,0,0,0,0,0,0,0,0]),new Uint32Array([2184737,6291456,2184769,6291456,2184801,6291456,2184833,6291456,2184865,6291456,2184897,6291456,2184929,6291456,2184961,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,0,6291456,6291456,6291456,6291456,0,6291456]),new Uint32Array([6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,6291456,23068672,23068672,23068672,6291456,23068672,23068672,23068672,23068672,23068672,0,0]),new Uint32Array([6291456,6291456,6291456,2186753,6291456,6291456,6291456,6291456,2186785,2186817,2186849,2173569,2186881,10496355,10495395,10575521]),new Uint32Array([0,0,2097729,0,0,0,0,2106017,0,2097505,0,2097185,0,2135777,2097633,2097441]),new Uint32Array([2189537,6291456,2189569,6291456,2189601,6291456,2189633,6291456,2189665,6291456,2189697,6291456,2189729,6291456,2189761,6291456]),new Uint32Array([2202497,6291456,2202529,6291456,2202561,6291456,2202593,6291456,2202625,6291456,2202657,6291456,2202689,6291456,2202721,6291456]),new Uint32Array([2245217,2218369,2245249,2245282,2245345,2245377,2245410,2245474,2245537,2245569,2245601,2245633,2245665,2245665,2245697,2245729]),new Uint32Array([6291456,0,23068672,23068672,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,0,0,0,0,0,0,23068672,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,23068672,6291456,23068672,6291456,23068672,6291456,6291456,6291456,6291456,23068672,23068672]),new Uint32Array([0,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,0,0]),new Uint32Array([2097281,2105921,2097729,2106081,2097377,2097601,2162337,2106017,2133281,2097505,0,2097185,2097697,2135777,2097633,2097441]),new Uint32Array([2176641,6291456,2176673,6291456,2176705,6291456,2176737,6291456,2176769,6291456,2176801,6291456,2176833,6291456,2176865,6291456]),new Uint32Array([2174145,2174177,2149057,2233089,2173697,2173761,2173793,2174113,2173985,2173953,2174369,2174369,0,0,2100833,2100737]),new Uint32Array([2116513,2190817,2190849,2190881,2190913,2190945,2116609,2190977,2191009,2191041,2191073,2117185,2191105,2191137,2191169,2191201]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,6291456,6291456,6291456]),new Uint32Array([0,0,0,0,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456]),new Uint32Array([2167617,2167649,2167681,2167713,2167745,2167777,2167809,6291456,2167841,2167873,2167905,2167937,2167969,2168001,2168033,4240130]),new Uint32Array([2165122,2163970,2164034,2164098,2164162,2164226,2164290,2164354,2164418,2164482,2164546,2133122,2134562,2132162,2132834,2136866]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,0,2186209,2186241,2186273,2186305,2186337,2186369,0,0]),new Uint32Array([2112481,2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,14680064,14680064,14680064,14680064,14680064]),new Uint32Array([0,0,23068672,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,6291456,6291456]),new Uint32Array([0,10537921,10610689,10610273,10610497,10610529,10610305,10610721,10489601,10489697,10610337,10575617,10554529,2221761,2197217,10496577]),new Uint32Array([2105473,2105569,2105601,2112289,0,2112481,2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441]),new Uint32Array([2100897,2111905,2105473,2105569,2105601,2112289,2108193,2112481,2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481]),new Uint32Array([2125346,2153410,2153474,2127394,2153538,2153602,2153666,2153730,2105507,2105476,2153794,2153858,2153922,2153986,2154050,2105794]),new Uint32Array([2200449,2119681,2200481,2153313,2199873,2199905,2199937,2200513,2200545,2200577,2200609,2119105,2119201,2119297,2119393,2119489]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2175777,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2222273,2197217,2221473,2221505,2221089,2222305,2200865,2099681,2104481,2222337,2099905,2120737,2222369,2103713,2100225,2098785]),new Uint32Array([2201377,6291456,2201409,6291456,2201441,6291456,2201473,6291456,2201505,6291456,2201537,6291456,2201569,6291456,6291456,23068672]),new Uint32Array([2174081,2174113,2174145,2174177,2149057,2233057,2148481,2173601,2173633,2173665,2173697,2173729,2148801,2173761,2143969,2173793]),new Uint32Array([2200897,6291456,2200929,6291456,2200961,6291456,2200993,6291456,2201025,6291456,2180865,6291456,2201057,6291456,2201089,6291456]),new Uint32Array([0,0,0,0,0,23068672,23068672,0,6291456,6291456,6291456,0,0,0,0,0]),new Uint32Array([2161154,2161410,2138658,2161474,2161538,2097666,2097186,2097474,2162946,2132450,2163010,2163074,2136162,2163138,2161666,2161730]),new Uint32Array([2148481,2173601,2173633,2173665,2173697,2173729,2148801,2173761,2143969,2173793,2173825,2153473,2173857,2173889,2173921,2173953]),new Uint32Array([0,0,0,0,0,0,23068672,23068672,0,0,0,0,2145410,2145474,0,6291456]),new Uint32Array([2244161,2216065,2212769,2244193,2244225,2244257,2244290,2244353,2244385,2244417,2244449,2218273,2244481,2244514,2244577,2244609]),new Uint32Array([2125730,2125699,2125795,2125891,2125987,2154114,2154178,2154242,2154306,2154370,2154434,2154498,2126082,2126178,2126274,2126083]),new Uint32Array([2237665,2237697,2237697,2237697,2237730,2237793,2237825,2237857,2237890,2237953,2237985,2238017,2238049,2238081,2238113,2238145]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2150146,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,0,0,23068672,23068672,0,0,23068672,23068672,23068672,0,0]),new Uint32Array([2214369,2238593,2238625,2238657,2238689,2238721,2238753,2238785,2238817,2238850,2238913,2238945,2238977,2235457,2239009,2239041]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0]),new Uint32Array([2252066,2252130,2252193,2252225,2252257,2252290,2252353,2252385,2252417,2252449,2252481,2252513,2252545,2252578,2252641,2252673]),new Uint32Array([2197697,2114113,2114209,2197729,2197761,2114305,2197793,2114401,2114497,2197825,2114593,2114689,2114785,2114881,2114977,2197857]),new Uint32Array([2224866,2224930,2224994,2225058,2225122,2225186,2225250,2225314,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2219490,2219554,2219617,2219649,2219681,2219714,2219778,2219842,2219905,2219937,0,0,0,0,0,0]),new Uint32Array([6291456,23068672,23068672,23068672,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,6291456]),new Uint32Array([2113345,2113441,2098209,2111137,2105505,2098241,2108353,2108417,2105825,2111713,2100897,2111905,2105473,2105569,2105601,2112289]),new Uint32Array([2174081,2174113,2174145,2174177,2149057,2233089,2173697,2173761,2173793,2174113,2173985,2173953,2148481,2173601,2173633,2173665]),new Uint32Array([2220161,2220161,2220193,2220193,2220193,2220193,2220225,2220225,2220225,2220225,2220257,2220257,2220257,2220257,2220289,2220289]),new Uint32Array([2192673,2192705,2192737,2192769,2192801,2192833,2192865,2118049,2192897,2117473,2117761,2192929,2192961,2192993,2193025,2193057]),new Uint32Array([2179297,6291456,2179329,6291456,2179361,6291456,2179393,6291456,2179425,6291456,2179457,6291456,2179489,6291456,2179521,6291456]),new Uint32Array([6291456,6291456,6291456,23068672,6291456,6291456,6291456,0,0,0,0,0,0,0,0,0]),new Uint32Array([2235745,2235777,2193633,2235809,2235841,2235873,2235905,2235937,2235969,2116513,2116705,2236001,2200513,2199905,2200545,2236033]),new Uint32Array([2113153,2108481,2113345,2113441,2232993,2233025,0,0,2148481,2173601,2173633,2173665,2173697,2173729,2148801,2173761]),new Uint32Array([2170593,6291456,2170625,6291456,2170657,6291456,2170689,2170721,6291456,2170753,6291456,6291456,2170785,6291456,2170817,2170849]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2166786,2166850,0,0,0,0]),new Uint32Array([23068672,6291456,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456]),new Uint32Array([2100833,2100737,2098337,2101441,2101569,2101697,2101825,2101953,2102081,2102209,10575617,2187041,10502177,10489601,10489697,0]),new Uint32Array([0,0,0,0,0,0,0,0,0,0,0,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2134562,2132162,2132834,2136866,2136482,2164610,2164674,2164738,2164802,2132802,2132706,2164866,2132898,2164930,2164994,2165058]),new Uint32Array([6291456,6291456,2098337,2101441,10531458,2153473,6291456,6291456,10531522,2100737,2108193,6291456,2106499,2106595,2106691,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,0,0,0,0,0,0,0]),new Uint32Array([2233122,2233186,2233250,2233314,2233378,2233442,2233506,2233570,2233634,2233698,2233762,2233826,2233890,2233954,2234018,2234082]),new Uint32Array([23068672,6291456,23068672,23068672,23068672,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2205217,2205249,2205281,2205313,2205345,2205377,2205409,2205441,2205473,2205505,2205537,2205569,2205601,2205633,2205665,2205697]),new Uint32Array([6291456,0,6291456,0,0,0,6291456,6291456,6291456,6291456,0,0,23068672,6291456,23068672,23068672]),new Uint32Array([2173601,2173761,2174081,2173569,2174241,2174113,2173953,6291456,2174305,6291456,2174337,6291456,2174369,6291456,2174401,6291456]),new Uint32Array([6291456,23068672,23068672,23068672,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456]),new Uint32Array([2152450,2152514,2099653,2104452,2099813,2122243,2099973,2152578,2122339,2122435,2122531,2122627,2122723,2104580,2122819,2152642]),new Uint32Array([2236385,2236417,2236449,2236482,2236545,2215425,2236577,2236609,2236641,2236673,2215457,2236705,2236737,2236770,2215489,2236833]),new Uint32Array([2163394,2159746,2163458,2131362,2163522,2160130,2163778,2132226,2163842,2132898,2163906,2161410,2138658,2097666,2136162,2163650]),new Uint32Array([2218721,2246913,2246946,2216385,2247010,2247074,2215009,2247137,2247169,2216481,2247201,2247233,2247266,2247330,2247330,0]),new Uint32Array([2129730,2129762,2129858,2129731,2129827,2156482,2156482,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,0,0,0,0,0,6291456,0,0]),new Uint32Array([2203969,2204001,2181377,2204033,2204065,6291456,2204097,6291456,0,0,0,0,0,0,0,0]),new Uint32Array([2169473,6291456,2169505,6291456,2169537,6291456,2169569,6291456,2169601,6291456,2169633,6291456,2169665,6291456,2169697,6291456]),new Uint32Array([2141542,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2220801,2220801,2220801,2220801,2220833,2220833,2220865,2220865,2220865,2220865,2220897,2220897,2220897,2220897,2139873,2139873]),new Uint32Array([0,0,0,0,0,23068672,23068672,0,0,0,0,0,0,0,6291456,0]),new Uint32Array([2214849,2218433,2218465,2218497,2218529,2218561,2214881,2218593,2218625,2218657,2218689,2218721,2218753,2216545,2218785,2218817]),new Uint32Array([23068672,23068672,23068672,23068672,0,0,0,0,0,0,0,0,0,0,0,6291456]),new Uint32Array([2136482,2164610,2164674,2164738,2164802,2132802,2132706,2164866,2132898,2164930,2164994,2165058,2165122,2132802,2132706,2164866]),new Uint32Array([2207649,2207681,2207713,2207745,2207777,2207809,2207841,2207873,2207905,2207937,2207969,2208001,2208033,2208065,2208097,2208129]),new Uint32Array([2123683,2105092,2152706,2123779,2105220,2152770,2100453,2098755,2123906,2124002,2124098,2124194,2124290,2124386,2124482,2124578]),new Uint32Array([6291456,6291456,6291456,6291456,0,0,0,6291456,0,0,0,0,0,0,0,10485857]),new Uint32Array([6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([10508163,10508259,10508355,10508451,2200129,2200161,2192737,2200193,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2203553,6291456,2203585,6291456,6291456,6291456,2203617,6291456,2203649,6291456,2203681,6291456,2203713,6291456,2203745,6291456]),new Uint32Array([18884449,18884065,23068672,18884417,18884034,18921185,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,18874368]),new Uint32Array([2247393,2247426,2247489,2247521,2247553,2247586,2247649,2247681,2247713,2247745,2247777,2247810,2247873,2247905,2247937,2247969]),new Uint32Array([6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,23068672]),new Uint32Array([2134145,2097153,2134241,0,2132705,2130977,2160065,2131297,0,2133089,2160577,2133857,2235297,0,2235329,0]),new Uint32Array([2182593,6291456,2182625,6291456,2182657,6291456,2182689,6291456,2182721,6291456,2182753,6291456,2182785,6291456,2182817,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2102402,2102403,6291456,2110050]),new Uint32Array([2149890,2108323,2149954,6291456,2113441,6291456,2149057,6291456,2113441,6291456,2105473,2167265,2111137,2105505,6291456,2108353]),new Uint32Array([2219105,2219137,2195233,2251554,2251617,2251649,2251681,2251713,2251746,2251810,2251873,2251905,2251937,2251970,2252033,2219169]),new Uint32Array([2203009,6291456,2203041,6291456,2203073,6291456,2203105,6291456,2203137,6291456,2203169,6291456,2203201,6291456,2203233,6291456]),new Uint32Array([2128195,2128291,2128387,2128483,2128579,2128675,2128771,2128867,2128963,2129059,2129155,2129251,2129347,2129443,2129539,2129635]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2140964,2141156,2140966,2141158,2141350]),new Uint32Array([0,0,0,0,0,0,0,0,0,0,0,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2225378,2225442,2225506,2225570,2225634,2225698,2225762,2225826,2225890,2225954,2226018,2226082,2226146,2226210,2226274,2226338]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,2098209,2111137,2105505,2098241,2108353,2108417]),new Uint32Array([2108353,2108417,0,2105601,2108193,2157121,2157313,2157377,2157441,2100897,6291456,2108419,2173953,2173633,2173633,2173953]),new Uint32Array([2111713,2173121,2111905,2098177,2173153,2173185,2173217,2113153,2113345,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,2190753]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,2197249,6291456,2117377,2197281,2197313,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,0,0,0,0,0,0,23068672,0,0,0,0,0,6291456,6291456,6291456]),new Uint32Array([2098337,2101441,2101569,2101697,2101825,2101953,2102081,2102209,2100833,2100737,2098337,2101441,2101569,2101697,2101825,2101953]),new Uint32Array([23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0]),new Uint32Array([0,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,23068672,23068672,23068672]),new Uint32Array([2173281,6291456,2173313,6291456,2173345,6291456,2173377,6291456,0,0,10532546,6291456,6291456,6291456,10562017,2173441]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,0,0]),new Uint32Array([23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2159426,2159490,2159554,2159362,2159618,2159682,2139522,2136450,2159746,2159810,2159874,2130978,2131074,2131266,2131362,2159938]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2203233,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2203265,6291456,2203297,6291456,2203329,2203361,6291456]),new Uint32Array([6291456,6291456,2148418,2148482,2148546,0,6291456,2148610,2186529,2186561,2148417,2148545,2148482,10495778,2143969,10495778]),new Uint32Array([2134146,2139426,2160962,2134242,2161218,2161282,2161346,2161410,2138658,2134722,2134434,2134818,2097666,2097346,2097698,2105986]),new Uint32Array([2198881,2198913,2198945,2198977,2199009,2199041,2199073,2199105,2199137,2199169,2199201,2199233,2199265,2199297,2199329,2199361]),new Uint32Array([0,23068672,23068672,23068672,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456]),new Uint32Array([10610561,2098209,2111137,2105505,2098241,2108353,2108417,2105825,2111713,2100897,2111905,2105473,2105569,2105601,2112289,2108193]),new Uint32Array([2183873,6291456,2183905,6291456,2183937,6291456,2183969,6291456,2184001,6291456,2184033,6291456,2184065,6291456,2184097,6291456]),new Uint32Array([2244642,2244706,2244769,2244801,2218305,2244833,2244865,2244897,2244929,2244961,2244993,2245026,2245089,2245122,2245185,0]),new Uint32Array([6291456,6291456,2116513,2116609,2116705,2116801,2199873,2199905,2199937,2199969,2190913,2200001,2200033,2200065,2200097,2191009]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,0,2180673,2180705,2180737,2180769,2180801,2180833,0,0]),new Uint32Array([2098081,2099521,2099105,2120705,2098369,2120801,2103361,2097985,2098433,2121377,2121473,2099169,2099873,2098401,2099393,2152609]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2150402]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,2145666,2145730,6291456,6291456]),new Uint32Array([2173921,2173953,2173985,2173761,2174017,2174049,2174081,2174113,2174145,2174177,2149057,2233057,2148481,2173601,2173633,2173665]),new Uint32Array([2187073,6291456,6291456,6291456,6291456,2098241,2098241,2108353,2100897,2111905,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2102404,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,2100612,6291456,6291456,6291456,6291456,6291456,6291456,6291456,10485857]),new Uint32Array([2149057,2233057,2148481,2173601,2173633,2173665,2173697,2173729,2148801,2173761,2143969,2173793,2173825,2153473,2173857,2173889]),new Uint32Array([2217697,2217729,2217761,2217793,2217825,2217857,2217889,2217921,2217953,2215873,2217985,2215905,2218017,2218049,2218081,2218113]),new Uint32Array([2211233,2218849,2216673,2218881,2218913,2218945,2218977,2219009,2216833,2219041,2215137,2219073,2216865,2209505,2219105,2216897]),new Uint32Array([2240097,2240129,2240161,2240193,2240225,2240257,2240289,2240321,2240353,2240386,2240449,2240481,2240513,2240545,2207905,2240578]),new Uint32Array([6291456,6291456,2202273,6291456,2202305,6291456,2202337,6291456,2202369,6291456,2202401,6291456,2202433,6291456,2202465,6291456]),new Uint32Array([0,23068672,23068672,18923394,23068672,18923458,18923522,18884099,18923586,18884195,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2201121,6291456,2201153,6291456,2201185,6291456,2201217,6291456,2201249,6291456,2201281,6291456,2201313,6291456,2201345,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,6291456,6291456]),new Uint32Array([2211041,2211073,2211105,2211137,2211169,2211201,2211233,2211265,2211297,2211329,2211361,2211393,2211425,2211457,2211489,2211521]),new Uint32Array([2181825,6291456,2181857,6291456,2181889,6291456,2181921,6291456,2181953,6291456,2181985,6291456,2182017,6291456,2182049,6291456]),new Uint32Array([2162337,2097633,2097633,2097633,2097633,2132705,2132705,2132705,2132705,2097153,2097153,2097153,2097153,2133089,2133089,2133089]),new Uint32Array([6291456,6291456,6291456,6291456,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,2148545,6291456,2173473,6291456,2148865,6291456,2173505,6291456,2173537,6291456,2173569,6291456,2149121,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456,0,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0]),new Uint32Array([2148801,2173761,2143969,2173793,2173825,2153473,2173857,2173889,2173921,2173953,2173985,2174017,2174017,2174049,2174081,2174113]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2207137,2207169,2207201,2207233,2207265,2207297,2207329,2207361,2207393,2207425,2207457,2207489,2207521,2207553,2207585,2207617]),new Uint32Array([6291456,6291456,23068672,23068672,23068672,6291456,6291456,0,23068672,23068672,0,0,0,0,0,0]),new Uint32Array([2198401,2198433,2198465,2198497,0,2198529,2198561,2198593,2198625,2198657,2198689,2198721,2198753,2198785,2198817,2198849]),new Uint32Array([2105505,2098241,2108353,2108417,2105825,2111713,2100897,2111905,2105473,2105569,2105601,2112289,2108193,2112481,2112577,2098177]),new Uint32Array([23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,0,0]),new Uint32Array([2216385,2118721,2216417,2216449,2216481,2216513,2216545,2211233,2216577,2216609,2216641,2216673,2216705,2216737,2216737,2216769]),new Uint32Array([2216801,2216833,2216865,2216897,2216929,2216961,2216993,2215169,2217025,2217057,2217089,2217121,2217154,2217217,0,0]),new Uint32Array([2210593,2191809,2210625,2210657,2210689,2210721,2210753,2210785,2210817,2210849,2191297,2210881,2210913,2210945,2210977,2211009]),new Uint32Array([0,0,2105825,0,0,2111905,2105473,0,0,2112289,2108193,2112481,2112577,0,2098305,2108321]),new Uint32Array([0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([0,2097153,2134241,0,2132705,0,0,2131297,0,2133089,0,2133857,0,2220769,0,2235361]),new Uint32Array([14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,6291456,6291456,14680064]),new Uint32Array([23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,0]),new Uint32Array([2171873,6291456,2171905,6291456,2171937,6291456,2171969,6291456,2172001,6291456,2172033,6291456,2172065,6291456,2172097,6291456]),new Uint32Array([2220929,2220929,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2133857,2134145,2134145,2134145,2134145,2134241,2134241,2134241,2134241,2105889,2105889,2105889,2105889,2097185,2097185,2097185]),new Uint32Array([2173697,2173761,2173793,2174113,2173985,2173953,2148481,2173601,2173633,2173665,2173697,2173729,2148801,2173761,2143969,2173793]),new Uint32Array([0,0,0,0,0,0,0,0,0,0,0,0,10499619,10499715,10499811,10499907]),new Uint32Array([0,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,0,0,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,0,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,0,23068672,23068672,23068672,0,23068672,23068672,23068672,23068672,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,6291456,23068672,23068672]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,0,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,2144322,2144386,2144450,2144514,2144578,2144642,2144706,2144770]),new Uint32Array([23068672,23068672,23068672,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456]),new Uint32Array([2113153,2108481,2113345,2113441,2098209,2111137,0,2098241,2108353,2108417,2105825,0,0,2111905,2105473,2105569]),new Uint32Array([2236321,2236353,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2152194,2121283,2103684,2103812,2097986,2098533,2097990,2098693,2098595,2098853,2099013,2103940,2121379,2121475,2121571,2104068]),new Uint32Array([2206241,2206273,2206305,2206337,2206369,2206401,2206433,2206465,2206497,2206529,2206561,2206593,2206625,2206657,2206689,2206721]),new Uint32Array([6291456,6291456,6291456,6291456,16777216,16777216,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,23068672,23068672,10538818,10538882,6291456,6291456,2150338]),new Uint32Array([6291456,6291456,6291456,0,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2214369,2214401,2214433,2214465,2214497,2214529,2214561,2214593,2194977,2214625,2195073,2214657,2214689,2214721,6291456,6291456]),new Uint32Array([2097152,2097152,2097152,2097152,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2182081,6291456,2182113,6291456,2182145,6291456,2182177,6291456,2182209,6291456,2182241,6291456,2182273,6291456,2182305,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2146881,2146945,2147009,2147073,2147137,2147201,2147265,2147329]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,6291456,23068672,23068672]),new Uint32Array([0,0,0,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2122915,2123011,2123107,2104708,2123203,2123299,2123395,2100133,2104836,2100290,2100293,2104962,2104964,2098052,2123491,2123587]),new Uint32Array([23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456]),new Uint32Array([6291456,2171169,6291456,2171201,6291456,2171233,6291456,2171265,6291456,2171297,6291456,2171329,6291456,6291456,2171361,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([0,0,2148994,2149058,2149122,0,6291456,2149186,2186945,2173537,2148993,2149121,2149058,10531458,10496066,0]),new Uint32Array([2195009,2195041,2195073,2195105,2195137,2195169,2195201,2195233,2195265,2195297,2195329,2195361,2195393,2195425,2195457,2195489]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,0,0,6291456,6291456]),new Uint32Array([2182849,6291456,2182881,6291456,2182913,6291456,2182945,6291456,2182977,6291456,2183009,6291456,2183041,6291456,2183073,6291456]),new Uint32Array([2211553,2210081,2211585,2211617,2211649,2211681,2211713,2211745,2211777,2211809,2209569,2211841,2211873,2211905,2211937,2211969]),new Uint32Array([2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,2166594,2127298,2166658,2142978,2141827,2166722]),new Uint32Array([2173985,2173761,2174017,2174049,2174081,2174113,2174145,2174177,2149057,2233057,2148481,2173601,2173633,2173665,2173697,2173729]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,0,0,2185761,2185793,2185825,2185857,2185889,2185921,0,0]),new Uint32Array([6291456,2148481,2173601,2173633,2173665,2173697,2173729,2148801,2173761,2143969,2173793,2173825,2153473,2173857,2173889,2173921]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,6291456]),new Uint32Array([0,0,0,2220961,2220961,2220961,2220961,2144193,2144193,2159201,2159201,2159265,2159265,2144194,2220993,2220993]),new Uint32Array([2192641,2235393,2235425,2152257,2116609,2235457,2235489,2200065,2235521,2235553,2235585,2212449,2235617,2235649,2235681,2235713]),new Uint32Array([2194049,2194081,2194113,2194145,2194177,2194209,2194241,2194273,2194305,2194337,2194369,2194401,2194433,2194465,2194497,2194529]),new Uint32Array([2196673,2208641,2208673,2208705,2208737,2208769,2208801,2208833,2208865,2208897,2208929,2208961,2208993,2209025,2209057,2209089]),new Uint32Array([2191681,2191713,2191745,2191777,2153281,2191809,2191841,2191873,2191905,2191937,2191969,2192001,2192033,2192065,2192097,2192129]),new Uint32Array([2230946,2231010,2231074,2231138,2231202,2231266,2231330,2231394,2231458,2231522,2231586,2231650,2231714,2231778,2231842,2231906]),new Uint32Array([14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064,14680064]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,2185953,2185985,2186017,2186049,2186081,2186113,2186145,2186177]),new Uint32Array([2139811,2139907,2097284,2105860,2105988,2106116,2106244,2097444,2097604,2097155,10485778,10486344,2106372,6291456,0,0]),new Uint32Array([2110051,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([0,0,0,0,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2172385,6291456,2172417,6291456,2172449,6291456,2172481,6291456,2172513,6291456,2172545,6291456,2172577,6291456,2172609,6291456]),new Uint32Array([0,0,23068672,23068672,6291456,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2249345,2249377,2249409,2249441,2249473,2249505,2249537,2249570,2210209,2249633,2249665,2249697,2249729,2249761,2249793,2216769]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,6291456,6291456,6291456,6291456]),new Uint32Array([2187169,2187201,2187233,2187265,2187297,2187329,2187361,2187393,2187425,2187457,2187489,2187521,2187553,2187585,2187617,2187649]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([0,0,0,6291456,6291456,0,0,0,6291456,6291456,6291456,0,0,0,6291456,6291456]),new Uint32Array([2182337,6291456,2182369,6291456,2182401,6291456,2182433,6291456,2182465,6291456,2182497,6291456,2182529,6291456,2182561,6291456]),new Uint32Array([2138179,2138275,2138371,2138467,2134243,2134435,2138563,2138659,2138755,2138851,2138947,2139043,2138947,2138755,2139139,2139235]),new Uint32Array([23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,0]),new Uint32Array([0,0,23068672,23068672,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2250498,2250562,2250625,2250657,2208321,2250689,2250721,2250753,2250785,2250817,2250849,2218945,2250881,2250913,2250945,0]),new Uint32Array([2170369,2105569,2098305,2108481,2173249,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,6291456]),new Uint32Array([2100897,2111905,2105473,2105569,2105601,0,2108193,0,0,0,2098305,2108321,2108289,2100865,2113153,2108481]),new Uint32Array([2100897,2100897,2105569,2105569,6291456,2112289,2149826,6291456,6291456,2112481,2112577,2098177,2098177,2098177,6291456,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,6291456,6291456,6291456]),new Uint32Array([6291456,2169953,2169985,6291456,2170017,6291456,2170049,2170081,6291456,2170113,2170145,2170177,6291456,6291456,2170209,2170241]),new Uint32Array([6291456,6291456,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([0,0,0,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2220641,2220641,2220673,2220673,2220673,2220673,2220705,2220705,2220705,2220705,2220737,2220737,2220737,2220737,2220769,2220769]),new Uint32Array([2127650,2127746,2127842,2127938,2128034,2128130,2128226,2128322,2128418,2127523,2127619,2127715,2127811,2127907,2128003,2128099]),new Uint32Array([2143969,2173793,2173825,2153473,2173857,2173889,2173921,2173953,2173985,2173761,2174017,2174049,2174081,2174113,2174145,2174177]),new Uint32Array([0,0,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([2204705,2204737,2204769,2204801,2204833,2204865,2204897,2204929,2204961,2204993,2205025,2205057,2205089,2205121,2205153,2205185]),new Uint32Array([2176385,6291456,2176417,6291456,2176449,6291456,2176481,6291456,2176513,6291456,2176545,6291456,2176577,6291456,2176609,6291456]),new Uint32Array([2195521,2195553,2195585,2195617,2195649,2195681,2117857,2195713,2195745,2195777,2195809,2195841,2195873,2195905,2195937,2195969]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,6291456,6291456]),new Uint32Array([2173921,2173953,2173985,2174017,2174017,2174049,2174081,2174113,2174145,2174177,2149057,2233089,2173697,2173761,2173793,2174113]),new Uint32Array([2131586,2132450,2135970,2135778,2161602,2136162,2163650,2161794,2135586,2163714,2137186,2131810,2160290,2135170,2097506,2159554]),new Uint32Array([2134145,2097153,2134241,2105953,2132705,2130977,2160065,2131297,2162049,2133089,2160577,2133857,0,0,0,0]),new Uint32Array([2116513,2116609,2116705,2116801,2116897,2116993,2117089,2117185,2117281,2117377,2117473,2117569,2117665,2117761,2117857,2117953]),new Uint32Array([2100737,2098337,2101441,2101569,2101697,2101825,2101953,2102081,2102209,2100802,2101154,2101282,2101410,2101538,2101666,2101794]),new Uint32Array([2100289,2098657,2098049,2200737,2123489,2123681,2200769,2098625,2100321,2098145,2100449,2098017,2098753,2098977,2150241,2150305]),new Uint32Array([6291456,6291456,6291456,0,6291456,6291456,6291456,6291456,6291456,2109955,6291456,6291456,0,0,0,0]),new Uint32Array([18874368,18874368,18874368,18874368,18874368,18874368,18874368,18874368,18874368,18874368,18874368,18874368,18874368,18874368,18874368,18874368]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,6291456,0,6291456,0,0]),new Uint32Array([2130979,2131075,2131075,2131171,2131267,2131363,2131459,2131555,2131651,2131651,2131747,2131843,2131939,2132035,2132131,2132227]),new Uint32Array([0,2177793,6291456,2177825,6291456,2177857,6291456,2177889,6291456,2177921,6291456,2177953,6291456,2177985,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672]),new Uint32Array([6291456,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2113345,0,2098209,2111137,2105505,2098241,2108353,2108417,2105825,2111713,2100897,2111905,2105473,2105569,2105601,2112289]),new Uint32Array([2136643,2136739,2136835,2136931,2137027,2137123,2137219,2137315,2137411,2137507,2137603,2137699,2137795,2137891,2137987,2138083]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0]),new Uint32Array([2174433,6291456,2174465,6291456,2174497,6291456,2174529,6291456,2174561,6291456,2174593,6291456,2174625,6291456,2174657,6291456]),new Uint32Array([0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2105473,2105569,2105601,2112289,2108193,2112481,2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441]),new Uint32Array([10496547,10496643,2105505,2149698,6291456,10496739,10496835,2170273,6291456,2149762,2105825,2111713,2111713,2111713,2111713,2168673]),new Uint32Array([6291456,2143490,2143490,2143490,2171649,6291456,2171681,2171713,2171745,6291456,2171777,6291456,2171809,6291456,2171841,6291456]),new Uint32Array([2159106,2159106,2159170,2159170,2159234,2159234,2159298,2159298,2159298,2159362,2159362,2159362,2106401,2106401,2106401,2106401]),new Uint32Array([2105601,2112289,2108193,2112481,2112577,2098177,2098305,2108321,2108289,2100865,2113153,2108481,2113345,2113441,2098209,2111137]),new Uint32Array([2108417,2181217,2181249,2181281,2170433,2170401,2181313,2181345,2181377,2181409,2181441,2181473,2181505,2181537,2170529,2181569]),new Uint32Array([2218433,2245761,2245793,2245825,2245857,2245890,2245953,2245986,2209665,2246050,2246113,2246146,2246210,2246274,2246337,2246369]),new Uint32Array([2230754,2230818,2230882,0,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([6291456,0,6291456,6291456,6291456,6291456,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,0,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2184129,6291456,2184161,6291456,2184193,6291456,6291456,6291456,6291456,6291456,2146818,2183361,6291456,6291456,2142978,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2135170,2097506,2130691,2130787,2130883,2163970,2164034,2164098,2164162,2164226,2164290,2164354,2164418,2164482,2164546,2133122]),new Uint32Array([2108515,2108611,2100740,2108707,2108803,2108899,2108995,2109091,2109187,2109283,2109379,2109475,2109571,2109667,2109763,2100738]),new Uint32Array([2102788,2102916,2103044,2120515,2103172,2120611,2120707,2098373,2103300,2120803,2120899,2120995,2103428,2103556,2121091,2121187]),new Uint32Array([2158082,2158146,0,2158210,2158274,0,2158338,2158402,2158466,2129922,2158530,2158594,2158658,2158722,2158786,2158850]),new Uint32Array([10499619,10499715,10499811,10499907,10500003,10500099,10500195,10500291,10500387,10500483,10500579,10500675,10500771,10500867,10500963,10501059]),new Uint32Array([2239585,2239618,2239681,2239713,0,2191969,2239745,2239777,2192033,2239809,2239841,2239874,2239937,2239970,2240033,2240065]),new Uint32Array([2252705,2252738,2252801,2252833,2252865,2252897,2252930,2252994,2253057,2253089,2253121,2253154,2253217,2253250,2219361,2219361]),new Uint32Array([2105825,2111713,2100897,2111905,2105473,2105569,2105601,2112289,2108193,2112481,2112577,2098177,2098305,2108321,2108289,2100865]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,10538050,10538114,10538178,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([2226402,2226466,2226530,2226594,2226658,2226722,2226786,2226850,2226914,2226978,2227042,2227106,2227170,2227234,2227298,2227362]),new Uint32Array([23068672,6291456,6291456,6291456,6291456,2144066,2144130,2144194,2144258,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,23068672,23068672,23068672,6291456,23068672,23068672]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,0]),new Uint32Array([2124674,2124770,2123875,2123971,2124067,2124163,2124259,2124355,2124451,2124547,2124643,2124739,2124835,2124931,2125027,2125123]),new Uint32Array([2168065,6291456,2168097,6291456,2168129,6291456,2168161,6291456,2168193,6291456,2168225,6291456,2168257,6291456,2168289,6291456]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,0,0,0,0]),new Uint32Array([23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,2100610,2100611,6291456,2107842,2107843,6291456,6291456,6291456,6291456,10537922,6291456,10537986,6291456]),new Uint32Array([2174849,2174881,2174913,2174945,2174977,2175009,2175041,2175073,2175105,2175137,2175169,2175201,2175233,2175265,2175297,2175329]),new Uint32Array([2154562,2154626,2154690,2154754,2141858,2154818,2154882,2127298,2154946,2127298,2155010,2155074,2155138,2155202,2155266,2155202]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456,6291456,6291456,6291456,6291456,23068672,0]),new Uint32Array([2200641,2150786,2150850,2150914,2150978,2151042,2106562,2151106,2150562,2151170,2151234,2151298,2151362,2151426,2151490,2151554]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,23068672,0,0,0,0,0,0,0,0,6291456,6291456]),new Uint32Array([2220289,2220289,2220321,2220321,2220321,2220321,2220353,2220353,2220353,2220353,2220385,2220385,2220385,2220385,2220417,2220417]),new Uint32Array([2155330,2155394,0,2155458,2155522,2155586,2105732,0,2155650,2155714,2155778,2125314,2155842,2155906,2126274,2155970]),new Uint32Array([23068672,23068672,23068672,23068672,23068672,6291456,6291456,23068672,23068672,6291456,23068672,23068672,23068672,23068672,6291456,6291456]),new Uint32Array([6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,6291456,0,0,0,0,0,0]),new Uint32Array([2097729,2106017,2106017,2106017,2106017,2131297,2131297,2131297,2131297,2106081,2106081,2162049,2162049,2105953,2105953,2162337]),new Uint32Array([2097185,2097697,2097697,2097697,2097697,2135777,2135777,2135777,2135777,2097377,2097377,2097377,2097377,2097601,2097601,2097217]),new Uint32Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23068672]),new Uint32Array([2139331,2139427,2139523,2139043,2133571,2132611,2139619,2139715,0,0,0,0,0,0,0,0]),new Uint32Array([2174113,2174145,2100897,2098177,2108289,2100865,2173601,2173633,2173985,2174113,2174145,6291456,6291456,6291456,6291456,6291456]),new Uint32Array([6291456,6291456,23068672,6291456,6291456,6291456,23068672,6291456,6291456,6291456,6291456,23068672,6291456,6291456,6291456,6291456]),new Uint32Array([23068672,23068672,18923778,23068672,23068672,23068672,23068672,18923842,23068672,23068672,23068672,23068672,18923906,23068672,23068672,23068672]),new Uint32Array([2134145,2097153,2134241,0,2132705,2130977,2160065,2131297,0,2133089,0,2133857,0,0,0,0]),new Uint32Array([6291456,6291456,6291456,6291456,0,0,0,0,0,0,0,0,0,0,0,0]),new Uint32Array([2177537,6291456,2177569,6291456,2177601,6291456,2177633,6291456,2177665,6291456,2177697,6291456,2177729,6291456,2177761,6291456]),new Uint32Array([2212481,2212513,2212545,2212577,2197121,2212609,2212641,2212673,2212705,2212737,2212769,2212801,2212833,2212865,2212897,2212929]),new Uint32Array([6291456,6291456,23068672,23068672,23068672,6291456,6291456,0,0,0,0,0,0,0,0,0]),new Uint32Array([2098241,2108353,2170209,2105825,2111713,2100897,2111905,2105473,2105569,2105601,2112289,6291456,2108193,2172417,2112481,2098177]),new Uint32Array([6291456,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,23068672,6291456,6291456])],t=new Uint16Array([616,616,565,147,161,411,330,2,131,131,328,454,241,408,86,86,696,113,285,350,325,301,473,214,639,232,447,64,369,598,124,672,567,223,621,154,107,86,86,86,86,86,86,505,86,68,634,86,218,218,218,218,486,218,218,513,188,608,216,86,217,463,668,85,700,360,184,86,86,86,647,402,153,10,346,718,662,260,145,298,117,1,443,342,138,54,563,86,240,572,218,70,387,86,118,460,641,602,86,86,306,218,86,692,86,86,86,86,86,162,707,86,458,26,86,218,638,86,86,86,86,86,65,449,86,86,306,183,86,58,391,667,86,157,131,131,131,131,86,433,131,406,31,218,247,86,86,693,218,581,351,86,438,295,69,462,45,126,173,650,14,295,69,97,168,187,641,78,523,390,69,108,287,664,173,219,83,295,69,108,431,426,173,694,412,115,628,52,257,398,641,118,501,121,69,579,151,423,173,620,464,121,69,382,151,476,173,27,53,121,86,594,578,226,173,86,632,130,86,96,228,268,641,622,563,86,86,21,148,650,131,131,321,43,144,343,381,531,131,131,178,20,86,399,156,375,164,541,30,60,715,198,92,118,131,131,86,86,306,407,86,280,457,196,488,358,131,131,244,86,86,143,86,86,86,86,86,667,563,86,86,86,86,86,86,86,86,86,86,86,86,86,336,363,86,86,336,86,86,380,678,67,86,86,86,678,86,86,86,512,86,307,86,708,86,86,86,86,86,528,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,563,307,86,86,86,86,86,104,450,337,86,720,86,32,450,397,86,86,86,587,218,558,708,708,293,708,86,86,86,86,86,694,205,86,8,86,86,86,86,549,86,667,697,697,679,86,458,460,86,86,650,86,708,543,86,86,86,245,86,86,86,140,218,127,708,708,458,197,131,131,131,131,500,86,86,483,251,86,306,510,515,86,722,86,86,86,65,201,86,86,483,580,470,86,86,86,368,131,131,131,694,114,110,555,86,86,123,721,163,142,713,418,86,317,675,209,218,218,218,371,545,592,629,490,603,199,46,320,525,680,310,279,388,111,42,252,593,607,235,617,410,377,50,548,135,356,17,520,189,116,392,600,349,332,482,699,690,535,119,106,451,71,152,667,131,218,218,265,671,637,492,504,533,683,269,269,658,86,86,86,86,86,86,86,86,86,491,619,86,86,6,86,86,86,86,86,86,86,86,86,86,86,229,86,86,86,86,86,86,86,86,86,86,86,86,667,86,86,171,131,118,131,656,206,234,571,89,334,670,246,311,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,534,86,86,86,86,86,86,82,86,86,86,86,86,430,86,86,86,86,86,86,86,86,86,599,86,324,86,470,69,640,264,131,626,101,174,86,86,667,233,105,73,374,394,221,204,84,28,326,86,86,471,86,86,86,109,573,86,171,200,200,200,200,218,218,86,86,86,86,460,131,131,131,86,506,86,86,86,86,86,220,404,34,614,47,442,305,25,612,338,601,648,7,344,255,131,131,51,86,312,507,563,86,86,86,86,588,86,86,86,86,86,530,511,86,458,3,435,384,556,522,230,527,86,118,86,86,717,86,137,273,79,181,484,23,93,112,655,249,417,703,370,87,98,313,684,585,155,465,596,481,695,18,416,428,61,701,706,282,643,495,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,549,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,549,131,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,307,86,86,86,171,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,650,131,422,542,420,263,24,172,86,86,86,86,86,566,86,86,132,540,395,353,494,519,19,485,284,472,131,131,131,16,714,86,211,708,86,86,86,694,698,86,86,483,704,708,218,272,86,86,120,86,159,478,86,307,247,86,86,663,597,459,627,667,86,86,277,455,39,302,86,250,86,86,86,271,99,452,306,281,329,400,200,86,86,362,549,352,646,461,323,586,86,86,4,708,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,717,86,518,86,86,650,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,125,554,480,300,613,72,333,288,561,544,604,48,719,91,169,176,590,224,76,191,29,559,560,231,537,166,477,538,256,437,131,131,469,167,40,0,685,266,441,705,239,642,475,568,640,610,299,673,517,318,385,22,202,180,179,359,424,215,90,66,521,653,467,682,453,409,479,88,131,661,35,303,15,262,666,630,712,131,131,618,659,175,218,195,347,193,227,261,150,165,709,546,294,569,710,270,413,376,524,55,242,38,419,529,170,657,3,304,122,379,278,131,651,86,67,576,458,458,131,131,86,86,86,86,86,86,86,118,309,86,86,547,86,86,86,86,667,650,664,131,131,86,86,56,131,131,131,131,131,131,131,131,86,307,86,86,86,664,238,650,86,86,717,86,118,86,86,315,86,59,86,86,574,549,131,131,340,57,436,86,86,86,86,86,86,458,708,499,691,62,86,650,86,86,694,86,86,86,319,131,131,131,131,131,131,131,131,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,171,86,549,694,131,131,131,131,131,131,131,131,131,77,86,86,139,86,502,86,86,86,667,595,131,131,131,86,12,86,13,86,609,131,131,131,131,86,86,86,625,86,669,86,86,182,129,86,5,694,104,86,86,86,86,131,131,86,86,386,171,86,86,86,345,86,324,86,589,86,213,36,131,131,131,131,131,86,86,86,86,104,131,131,131,141,290,80,677,86,86,86,267,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,667,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,515,86,86,33,136,669,86,711,515,86,86,550,640,86,104,708,515,86,159,372,717,86,86,444,515,86,86,663,37,86,563,460,86,390,624,702,131,131,131,131,389,59,708,86,86,341,208,708,635,295,69,108,431,508,100,190,131,131,131,131,131,131,131,131,86,86,86,649,516,660,131,131,86,86,86,218,631,708,131,131,131,131,131,131,131,131,131,131,86,86,341,575,238,514,131,131,86,86,86,218,291,708,307,131,86,86,306,367,708,131,131,131,86,378,697,86,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,615,253,86,86,86,292,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,86,104,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,69,86,341,553,549,86,307,86,86,645,275,455,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,708,131,131,131,131,131,131,86,86,86,86,86,86,667,460,86,86,86,86,86,86,86,86,86,86,86,86,717,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,667,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,171,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,104,86,667,459,131,131,131,131,131,131,86,458,225,86,86,86,516,549,11,390,405,86,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,86,86,460,44,218,197,711,515,131,131,131,131,664,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,307,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,308,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,640,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,86,86,86,86,118,307,104,286,591,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,549,86,86,681,86,86,75,185,314,582,86,358,496,474,86,104,131,86,86,86,86,146,131,131,131,131,131,131,131,131,131,131,131,86,86,86,86,86,171,86,640,131,131,131,131,131,131,131,131,246,503,689,339,674,81,258,415,439,128,562,366,414,246,503,689,583,222,557,316,636,665,186,355,95,670,246,503,689,339,674,557,258,415,439,186,355,95,670,246,503,689,446,644,536,652,331,532,335,440,274,421,297,570,74,425,364,425,606,552,403,509,134,365,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,218,218,218,498,218,218,577,627,551,497,572,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,553,354,236,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,86,86,86,86,86,86,86,86,86,86,296,455,131,131,456,243,103,86,41,459,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,9,276,158,716,393,564,383,489,401,654,210,654,131,131,131,640,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,650,86,86,86,86,86,86,717,667,563,563,563,86,549,102,686,133,246,605,86,448,86,86,207,307,131,131,131,641,86,177,611,445,373,194,584,131,131,131,131,131,131,131,131,131,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,308,307,171,86,86,86,86,86,86,86,717,86,86,86,86,86,460,131,131,650,86,86,86,694,708,86,86,694,86,458,131,131,131,131,131,131,667,694,289,650,667,131,131,86,640,131,131,664,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,171,131,131,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,460,86,86,86,86,86,86,86,86,86,86,86,86,86,458,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,86,640,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,466,203,149,429,94,432,160,687,539,63,237,283,192,248,348,259,427,526,396,676,254,468,487,212,327,623,49,633,322,493,434,688,357,361,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131]);function r(r){return r>=196608?r>=917760&&r<=917999?18874368:0:e[t[r>>4]][15&r]}return{mapStr:"\u0635\u0644\u0649 \u0627\u0644\u0644\u0647 \u0639\u0644\u064a\u0647 \u0648\u0633\u0644\u0645\u062c\u0644 \u062c\u0644\u0627\u0644\u0647\u30ad\u30ed\u30e1\u30fc\u30c8\u30ebrad\u2215s2\u30a8\u30b9\u30af\u30fc\u30c9\u30ad\u30ed\u30b0\u30e9\u30e0\u30ad\u30ed\u30ef\u30c3\u30c8\u30b0\u30e9\u30e0\u30c8\u30f3\u30af\u30eb\u30bc\u30a4\u30ed\u30b5\u30f3\u30c1\u30fc\u30e0\u30d1\u30fc\u30bb\u30f3\u30c8\u30d4\u30a2\u30b9\u30c8\u30eb\u30d5\u30a1\u30e9\u30c3\u30c9\u30d6\u30c3\u30b7\u30a7\u30eb\u30d8\u30af\u30bf\u30fc\u30eb\u30de\u30f3\u30b7\u30e7\u30f3\u30df\u30ea\u30d0\u30fc\u30eb\u30ec\u30f3\u30c8\u30b2\u30f3\u2032\u2032\u2032\u20321\u204410viii(10)(11)(12)(13)(14)(15)(16)(17)(18)(19)(20)\u222b\u222b\u222b\u222b(\uc624\uc804)(\uc624\ud6c4)\u30a2\u30d1\u30fc\u30c8\u30a2\u30eb\u30d5\u30a1\u30a2\u30f3\u30da\u30a2\u30a4\u30cb\u30f3\u30b0\u30a8\u30fc\u30ab\u30fc\u30ab\u30e9\u30c3\u30c8\u30ab\u30ed\u30ea\u30fc\u30ad\u30e5\u30ea\u30fc\u30ae\u30eb\u30c0\u30fc\u30af\u30ed\u30fc\u30cd\u30b5\u30a4\u30af\u30eb\u30b7\u30ea\u30f3\u30b0\u30d0\u30fc\u30ec\u30eb\u30d5\u30a3\u30fc\u30c8\u30dd\u30a4\u30f3\u30c8\u30de\u30a4\u30af\u30ed\u30df\u30af\u30ed\u30f3\u30e1\u30ac\u30c8\u30f3\u30ea\u30c3\u30c8\u30eb\u30eb\u30fc\u30d6\u30eb\u682a\u5f0f\u4f1a\u793ekcalm\u2215s2c\u2215kg\u0627\u0643\u0628\u0631\u0645\u062d\u0645\u062f\u0635\u0644\u0639\u0645\u0631\u0633\u0648\u0644\u0631\u06cc\u0627\u06441\u204441\u204423\u20444 \u0308\u0301\u0fb2\u0f71\u0f80\u0fb3\u0f71\u0f80 \u0308\u0342 \u0313\u0300 \u0313\u0301 \u0313\u0342 \u0314\u0300 \u0314\u0301 \u0314\u0342 \u0308\u0300\u2035\u2035\u2035a/ca/sc/oc/utelfax1\u204471\u204491\u204432\u204431\u204452\u204453\u204454\u204451\u204465\u204461\u204483\u204485\u204487\u20448xii0\u20443\u222e\u222e\u222e(1)(2)(3)(4)(5)(6)(7)(8)(9)(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)(m)(n)(o)(p)(q)(r)(s)(t)(u)(v)(w)(x)(y)(z)::====(\u1100)(\u1102)(\u1103)(\u1105)(\u1106)(\u1107)(\u1109)(\u110b)(\u110c)(\u110e)(\u110f)(\u1110)(\u1111)(\u1112)(\uac00)(\ub098)(\ub2e4)(\ub77c)(\ub9c8)(\ubc14)(\uc0ac)(\uc544)(\uc790)(\ucc28)(\uce74)(\ud0c0)(\ud30c)(\ud558)(\uc8fc)(\u4e00)(\u4e8c)(\u4e09)(\u56db)(\u4e94)(\u516d)(\u4e03)(\u516b)(\u4e5d)(\u5341)(\u6708)(\u706b)(\u6c34)(\u6728)(\u91d1)(\u571f)(\u65e5)(\u682a)(\u6709)(\u793e)(\u540d)(\u7279)(\u8ca1)(\u795d)(\u52b4)(\u4ee3)(\u547c)(\u5b66)(\u76e3)(\u4f01)(\u8cc7)(\u5354)(\u796d)(\u4f11)(\u81ea)(\u81f3)pte10\u670811\u670812\u6708ergltd\u30a2\u30fc\u30eb\u30a4\u30f3\u30c1\u30a6\u30a9\u30f3\u30aa\u30f3\u30b9\u30aa\u30fc\u30e0\u30ab\u30a4\u30ea\u30ac\u30ed\u30f3\u30ac\u30f3\u30de\u30ae\u30cb\u30fc\u30b1\u30fc\u30b9\u30b3\u30eb\u30ca\u30b3\u30fc\u30dd\u30bb\u30f3\u30c1\u30c0\u30fc\u30b9\u30ce\u30c3\u30c8\u30cf\u30a4\u30c4\u30d1\u30fc\u30c4\u30d4\u30af\u30eb\u30d5\u30e9\u30f3\u30da\u30cb\u30d2\u30d8\u30eb\u30c4\u30da\u30f3\u30b9\u30da\u30fc\u30b8\u30d9\u30fc\u30bf\u30dc\u30eb\u30c8\u30dd\u30f3\u30c9\u30db\u30fc\u30eb\u30db\u30fc\u30f3\u30de\u30a4\u30eb\u30de\u30c3\u30cf\u30de\u30eb\u30af\u30e4\u30fc\u30c9\u30e4\u30fc\u30eb\u30e6\u30a2\u30f3\u30eb\u30d4\u30fc10\u70b911\u70b912\u70b913\u70b914\u70b915\u70b916\u70b917\u70b918\u70b919\u70b920\u70b921\u70b922\u70b923\u70b924\u70b9hpabardm2dm3khzmhzghzthzmm2cm2km2mm3cm3km3kpampagpalogmilmolppmv\u2215ma\u2215m10\u65e511\u65e512\u65e513\u65e514\u65e515\u65e516\u65e517\u65e518\u65e519\u65e520\u65e521\u65e522\u65e523\u65e524\u65e525\u65e526\u65e527\u65e528\u65e529\u65e530\u65e531\u65e5galffiffl\u05e9\u05bc\u05c1\u05e9\u05bc\u05c2 \u064c\u0651 \u064d\u0651 \u064e\u0651 \u064f\u0651 \u0650\u0651 \u0651\u0670\u0640\u064e\u0651\u0640\u064f\u0651\u0640\u0650\u0651\u062a\u062c\u0645\u062a\u062d\u062c\u062a\u062d\u0645\u062a\u062e\u0645\u062a\u0645\u062c\u062a\u0645\u062d\u062a\u0645\u062e\u062c\u0645\u062d\u062d\u0645\u064a\u062d\u0645\u0649\u0633\u062d\u062c\u0633\u062c\u062d\u0633\u062c\u0649\u0633\u0645\u062d\u0633\u0645\u062c\u0633\u0645\u0645\u0635\u062d\u062d\u0635\u0645\u0645\u0634\u062d\u0645\u0634\u062c\u064a\u0634\u0645\u062e\u0634\u0645\u0645\u0636\u062d\u0649\u0636\u062e\u0645\u0637\u0645\u062d\u0637\u0645\u0645\u0637\u0645\u064a\u0639\u062c\u0645\u0639\u0645\u0645\u0639\u0645\u0649\u063a\u0645\u0645\u063a\u0645\u064a\u063a\u0645\u0649\u0641\u062e\u0645\u0642\u0645\u062d\u0642\u0645\u0645\u0644\u062d\u0645\u0644\u062d\u064a\u0644\u062d\u0649\u0644\u062c\u062c\u0644\u062e\u0645\u0644\u0645\u062d\u0645\u062d\u062c\u0645\u062d\u064a\u0645\u062c\u062d\u0645\u062c\u0645\u0645\u062e\u0645\u0645\u062c\u062e\u0647\u0645\u062c\u0647\u0645\u0645\u0646\u062d\u0645\u0646\u062d\u0649\u0646\u062c\u0645\u0646\u062c\u0649\u0646\u0645\u064a\u0646\u0645\u0649\u064a\u0645\u0645\u0628\u062e\u064a\u062a\u062c\u064a\u062a\u062c\u0649\u062a\u062e\u064a\u062a\u062e\u0649\u062a\u0645\u064a\u062a\u0645\u0649\u062c\u0645\u064a\u062c\u062d\u0649\u062c\u0645\u0649\u0633\u062e\u0649\u0635\u062d\u064a\u0634\u062d\u064a\u0636\u062d\u064a\u0644\u062c\u064a\u0644\u0645\u064a\u064a\u062d\u064a\u064a\u062c\u064a\u064a\u0645\u064a\u0645\u0645\u064a\u0642\u0645\u064a\u0646\u062d\u064a\u0639\u0645\u064a\u0643\u0645\u064a\u0646\u062c\u062d\u0645\u062e\u064a\u0644\u062c\u0645\u0643\u0645\u0645\u062c\u062d\u064a\u062d\u062c\u064a\u0645\u062c\u064a\u0641\u0645\u064a\u0628\u062d\u064a\u0633\u062e\u064a\u0646\u062c\u064a\u0635\u0644\u06d2\u0642\u0644\u06d2\ud834\udd58\ud834\udd65\ud834\udd6e\ud834\udd58\ud834\udd65\ud834\udd6f\ud834\udd58\ud834\udd65\ud834\udd70\ud834\udd58\ud834\udd65\ud834\udd71\ud834\udd58\ud834\udd65\ud834\udd72\ud834\uddb9\ud834\udd65\ud834\udd6e\ud834\uddba\ud834\udd65\ud834\udd6e\ud834\uddb9\ud834\udd65\ud834\udd6f\ud834\uddba\ud834\udd65\ud834\udd6f\u3014s\u3015ppv\u3014\u672c\u3015\u3014\u4e09\u3015\u3014\u4e8c\u3015\u3014\u5b89\u3015\u3014\u70b9\u3015\u3014\u6253\u3015\u3014\u76d7\u3015\u3014\u52dd\u3015\u3014\u6557\u3015 \u0304 \u0301 \u0327ssi\u0307ijl\xb7\u02bcnd\u017eljnjdz \u0306 \u0307 \u030a \u0328 \u0303 \u030b \u03b9\u0565\u0582\u0627\u0674\u0648\u0674\u06c7\u0674\u064a\u0674\u0915\u093c\u0916\u093c\u0917\u093c\u091c\u093c\u0921\u093c\u0922\u093c\u092b\u093c\u092f\u093c\u09a1\u09bc\u09a2\u09bc\u09af\u09bc\u0a32\u0a3c\u0a38\u0a3c\u0a16\u0a3c\u0a17\u0a3c\u0a1c\u0a3c\u0a2b\u0a3c\u0b21\u0b3c\u0b22\u0b3c\u0e4d\u0e32\u0ecd\u0eb2\u0eab\u0e99\u0eab\u0ea1\u0f42\u0fb7\u0f4c\u0fb7\u0f51\u0fb7\u0f56\u0fb7\u0f5b\u0fb7\u0f40\u0fb5\u0f71\u0f72\u0f71\u0f74\u0fb2\u0f80\u0fb3\u0f80\u0f92\u0fb7\u0f9c\u0fb7\u0fa1\u0fb7\u0fa6\u0fb7\u0fab\u0fb7\u0f90\u0fb5a\u02be\u1f00\u03b9\u1f01\u03b9\u1f02\u03b9\u1f03\u03b9\u1f04\u03b9\u1f05\u03b9\u1f06\u03b9\u1f07\u03b9\u1f20\u03b9\u1f21\u03b9\u1f22\u03b9\u1f23\u03b9\u1f24\u03b9\u1f25\u03b9\u1f26\u03b9\u1f27\u03b9\u1f60\u03b9\u1f61\u03b9\u1f62\u03b9\u1f63\u03b9\u1f64\u03b9\u1f65\u03b9\u1f66\u03b9\u1f67\u03b9\u1f70\u03b9\u03b1\u03b9\u03ac\u03b9\u1fb6\u03b9 \u0342\u1f74\u03b9\u03b7\u03b9\u03ae\u03b9\u1fc6\u03b9\u1f7c\u03b9\u03c9\u03b9\u03ce\u03b9\u1ff6\u03b9 \u0333!! \u0305???!!?rs\xb0c\xb0fnosmtmivix\u2add\u0338 \u3099 \u309a\u3088\u308a\u30b3\u30c8333435\ucc38\uace0\uc8fc\uc758363738394042444546474849503\u67084\u67085\u67086\u67087\u67088\u67089\u6708hgev\u30ae\u30ac\u30c7\u30b7\u30c9\u30eb\u30ca\u30ce\u30d4\u30b3\u30d3\u30eb\u30da\u30bd\u30db\u30f3\u30ea\u30e9\u30ec\u30e0daauovpciu\u5e73\u6210\u662d\u548c\u5927\u6b63\u660e\u6cbbna\u03bcakakbmbgbpfnf\u03bcf\u03bcgmg\u03bclmldlklfmnm\u03bcmpsns\u03bcsmsnv\u03bcvkvpwnw\u03bcwmwkwk\u03c9m\u03c9bqcccddbgyhainkkktlnlxphprsrsvwbst\u0574\u0576\u0574\u0565\u0574\u056b\u057e\u0576\u0574\u056d\u05d9\u05b4\u05f2\u05b7\u05e9\u05c1\u05e9\u05c2\u05d0\u05b7\u05d0\u05b8\u05d0\u05bc\u05d1\u05bc\u05d2\u05bc\u05d3\u05bc\u05d4\u05bc\u05d5\u05bc\u05d6\u05bc\u05d8\u05bc\u05d9\u05bc\u05da\u05bc\u05db\u05bc\u05dc\u05bc\u05de\u05bc\u05e0\u05bc\u05e1\u05bc\u05e3\u05bc\u05e4\u05bc\u05e6\u05bc\u05e7\u05bc\u05e8\u05bc\u05ea\u05bc\u05d5\u05b9\u05d1\u05bf\u05db\u05bf\u05e4\u05bf\u05d0\u05dc\u0626\u0627\u0626\u06d5\u0626\u0648\u0626\u06c7\u0626\u06c6\u0626\u06c8\u0626\u06d0\u0626\u0649\u0626\u062c\u0626\u062d\u0626\u0645\u0626\u064a\u0628\u062c\u0628\u0645\u0628\u0649\u0628\u064a\u062a\u0649\u062a\u064a\u062b\u062c\u062b\u0645\u062b\u0649\u062b\u064a\u062e\u062d\u0636\u062c\u0636\u0645\u0637\u062d\u0638\u0645\u063a\u062c\u0641\u062c\u0641\u062d\u0641\u0649\u0641\u064a\u0642\u062d\u0642\u0649\u0642\u064a\u0643\u0627\u0643\u062c\u0643\u062d\u0643\u062e\u0643\u0644\u0643\u0649\u0643\u064a\u0646\u062e\u0646\u0649\u0646\u064a\u0647\u062c\u0647\u0649\u0647\u064a\u064a\u0649\u0630\u0670\u0631\u0670\u0649\u0670\u0626\u0631\u0626\u0632\u0626\u0646\u0628\u0632\u0628\u0646\u062a\u0631\u062a\u0632\u062a\u0646\u062b\u0631\u062b\u0632\u062b\u0646\u0645\u0627\u0646\u0631\u0646\u0632\u0646\u0646\u064a\u0631\u064a\u0632\u0626\u062e\u0626\u0647\u0628\u0647\u062a\u0647\u0635\u062e\u0646\u0647\u0647\u0670\u062b\u0647\u0633\u0647\u0634\u0647\u0637\u0649\u0637\u064a\u0639\u0649\u0639\u064a\u063a\u0649\u063a\u064a\u0633\u0649\u0633\u064a\u0634\u0649\u0634\u064a\u0635\u0649\u0635\u064a\u0636\u0649\u0636\u064a\u0634\u062e\u0634\u0631\u0633\u0631\u0635\u0631\u0636\u0631\u0627\u064b \u064b\u0640\u064b\u0640\u0651 \u0652\u0640\u0652\u0644\u0622\u0644\u0623\u0644\u0625\ud834\udd57\ud834\udd650,1,2,3,4,5,6,7,8,9,wzhvsdwcmcmddj\u307b\u304b\u30b3\u30b3\xe0\xe1\xe2\xe3\xe4\xe5\xe6\xe7\xe8\xe9\xea\xeb\xec\xed\xee\xef\xf0\xf1\xf2\xf3\xf4\xf5\xf6\xf8\xf9\xfa\xfb\xfc\xfd\xfe\u0101\u0103\u0105\u0107\u0109\u010b\u010d\u010f\u0111\u0113\u0115\u0117\u0119\u011b\u011d\u011f\u0121\u0123\u0125\u0127\u0129\u012b\u012d\u012f\u0135\u0137\u013a\u013c\u013e\u0142\u0144\u0146\u0148\u014b\u014d\u014f\u0151\u0153\u0155\u0157\u0159\u015b\u015d\u015f\u0161\u0163\u0165\u0167\u0169\u016b\u016d\u016f\u0171\u0173\u0175\u0177\xff\u017a\u017c\u0253\u0183\u0185\u0254\u0188\u0256\u0257\u018c\u01dd\u0259\u025b\u0192\u0260\u0263\u0269\u0268\u0199\u026f\u0272\u0275\u01a1\u01a3\u01a5\u0280\u01a8\u0283\u01ad\u0288\u01b0\u028a\u028b\u01b4\u01b6\u0292\u01b9\u01bd\u01ce\u01d0\u01d2\u01d4\u01d6\u01d8\u01da\u01dc\u01df\u01e1\u01e3\u01e5\u01e7\u01e9\u01eb\u01ed\u01ef\u01f5\u0195\u01bf\u01f9\u01fb\u01fd\u01ff\u0201\u0203\u0205\u0207\u0209\u020b\u020d\u020f\u0211\u0213\u0215\u0217\u0219\u021b\u021d\u021f\u019e\u0223\u0225\u0227\u0229\u022b\u022d\u022f\u0231\u0233\u2c65\u023c\u019a\u2c66\u0242\u0180\u0289\u028c\u0247\u0249\u024b\u024d\u024f\u0266\u0279\u027b\u0281\u0295\u0371\u0373\u02b9\u0377;\u03f3\u03ad\u03af\u03cc\u03cd\u03b2\u03b3\u03b4\u03b5\u03b6\u03b8\u03ba\u03bb\u03bd\u03be\u03bf\u03c0\u03c1\u03c3\u03c4\u03c5\u03c6\u03c7\u03c8\u03ca\u03cb\u03d7\u03d9\u03db\u03dd\u03df\u03e1\u03e3\u03e5\u03e7\u03e9\u03eb\u03ed\u03ef\u03f8\u03fb\u037b\u037c\u037d\u0450\u0451\u0452\u0453\u0454\u0455\u0456\u0457\u0458\u0459\u045a\u045b\u045c\u045d\u045e\u045f\u0430\u0431\u0432\u0433\u0434\u0435\u0436\u0437\u0438\u0439\u043a\u043b\u043c\u043d\u043e\u043f\u0440\u0441\u0442\u0443\u0444\u0445\u0446\u0447\u0448\u0449\u044a\u044b\u044c\u044d\u044e\u044f\u0461\u0463\u0465\u0467\u0469\u046b\u046d\u046f\u0471\u0473\u0475\u0477\u0479\u047b\u047d\u047f\u0481\u048b\u048d\u048f\u0491\u0493\u0495\u0497\u0499\u049b\u049d\u049f\u04a1\u04a3\u04a5\u04a7\u04a9\u04ab\u04ad\u04af\u04b1\u04b3\u04b5\u04b7\u04b9\u04bb\u04bd\u04bf\u04c2\u04c4\u04c6\u04c8\u04ca\u04cc\u04ce\u04d1\u04d3\u04d5\u04d7\u04d9\u04db\u04dd\u04df\u04e1\u04e3\u04e5\u04e7\u04e9\u04eb\u04ed\u04ef\u04f1\u04f3\u04f5\u04f7\u04f9\u04fb\u04fd\u04ff\u0501\u0503\u0505\u0507\u0509\u050b\u050d\u050f\u0511\u0513\u0515\u0517\u0519\u051b\u051d\u051f\u0521\u0523\u0525\u0527\u0529\u052b\u052d\u052f\u0561\u0562\u0563\u0564\u0566\u0567\u0568\u0569\u056a\u056c\u056e\u056f\u0570\u0571\u0572\u0573\u0575\u0577\u0578\u0579\u057a\u057b\u057c\u057d\u057f\u0580\u0581\u0583\u0584\u0585\u0586\u0f0b\u2d27\u2d2d\u10dc\u13f0\u13f1\u13f2\u13f3\u13f4\u13f5\ua64b\u0250\u0251\u1d02\u025c\u1d16\u1d17\u1d1d\u1d25\u0252\u0255\u025f\u0261\u0265\u026a\u1d7b\u029d\u026d\u1d85\u029f\u0271\u0270\u0273\u0274\u0278\u0282\u01ab\u1d1c\u0290\u0291\u1e01\u1e03\u1e05\u1e07\u1e09\u1e0b\u1e0d\u1e0f\u1e11\u1e13\u1e15\u1e17\u1e19\u1e1b\u1e1d\u1e1f\u1e21\u1e23\u1e25\u1e27\u1e29\u1e2b\u1e2d\u1e2f\u1e31\u1e33\u1e35\u1e37\u1e39\u1e3b\u1e3d\u1e3f\u1e41\u1e43\u1e45\u1e47\u1e49\u1e4b\u1e4d\u1e4f\u1e51\u1e53\u1e55\u1e57\u1e59\u1e5b\u1e5d\u1e5f\u1e61\u1e63\u1e65\u1e67\u1e69\u1e6b\u1e6d\u1e6f\u1e71\u1e73\u1e75\u1e77\u1e79\u1e7b\u1e7d\u1e7f\u1e81\u1e83\u1e85\u1e87\u1e89\u1e8b\u1e8d\u1e8f\u1e91\u1e93\u1e95\u1ea1\u1ea3\u1ea5\u1ea7\u1ea9\u1eab\u1ead\u1eaf\u1eb1\u1eb3\u1eb5\u1eb7\u1eb9\u1ebb\u1ebd\u1ebf\u1ec1\u1ec3\u1ec5\u1ec7\u1ec9\u1ecb\u1ecd\u1ecf\u1ed1\u1ed3\u1ed5\u1ed7\u1ed9\u1edb\u1edd\u1edf\u1ee1\u1ee3\u1ee5\u1ee7\u1ee9\u1eeb\u1eed\u1eef\u1ef1\u1ef3\u1ef5\u1ef7\u1ef9\u1efb\u1efd\u1eff\u1f10\u1f11\u1f12\u1f13\u1f14\u1f15\u1f30\u1f31\u1f32\u1f33\u1f34\u1f35\u1f36\u1f37\u1f40\u1f41\u1f42\u1f43\u1f44\u1f45\u1f51\u1f53\u1f55\u1f57\u1fb0\u1fb1\u1f72\u0390\u1fd0\u1fd1\u1f76\u03b0\u1fe0\u1fe1\u1f7a\u1fe5`\u1f78\u2010+\u2212\u2211\u3008\u3009\u2c30\u2c31\u2c32\u2c33\u2c34\u2c35\u2c36\u2c37\u2c38\u2c39\u2c3a\u2c3b\u2c3c\u2c3d\u2c3e\u2c3f\u2c40\u2c41\u2c42\u2c43\u2c44\u2c45\u2c46\u2c47\u2c48\u2c49\u2c4a\u2c4b\u2c4c\u2c4d\u2c4e\u2c4f\u2c50\u2c51\u2c52\u2c53\u2c54\u2c55\u2c56\u2c57\u2c58\u2c59\u2c5a\u2c5b\u2c5c\u2c5d\u2c5e\u2c61\u026b\u1d7d\u027d\u2c68\u2c6a\u2c6c\u2c73\u2c76\u023f\u0240\u2c81\u2c83\u2c85\u2c87\u2c89\u2c8b\u2c8d\u2c8f\u2c91\u2c93\u2c95\u2c97\u2c99\u2c9b\u2c9d\u2c9f\u2ca1\u2ca3\u2ca5\u2ca7\u2ca9\u2cab\u2cad\u2caf\u2cb1\u2cb3\u2cb5\u2cb7\u2cb9\u2cbb\u2cbd\u2cbf\u2cc1\u2cc3\u2cc5\u2cc7\u2cc9\u2ccb\u2ccd\u2ccf\u2cd1\u2cd3\u2cd5\u2cd7\u2cd9\u2cdb\u2cdd\u2cdf\u2ce1\u2ce3\u2cec\u2cee\u2cf3\u2d61\u6bcd\u9f9f\u4e28\u4e36\u4e3f\u4e59\u4e85\u4ea0\u4eba\u513f\u5165\u5182\u5196\u51ab\u51e0\u51f5\u5200\u529b\u52f9\u5315\u531a\u5338\u535c\u5369\u5382\u53b6\u53c8\u53e3\u56d7\u58eb\u5902\u590a\u5915\u5973\u5b50\u5b80\u5bf8\u5c0f\u5c22\u5c38\u5c6e\u5c71\u5ddb\u5de5\u5df1\u5dfe\u5e72\u5e7a\u5e7f\u5ef4\u5efe\u5f0b\u5f13\u5f50\u5f61\u5f73\u5fc3\u6208\u6236\u624b\u652f\u6534\u6587\u6597\u65a4\u65b9\u65e0\u66f0\u6b20\u6b62\u6b79\u6bb3\u6bcb\u6bd4\u6bdb\u6c0f\u6c14\u722a\u7236\u723b\u723f\u7247\u7259\u725b\u72ac\u7384\u7389\u74dc\u74e6\u7518\u751f\u7528\u7530\u758b\u7592\u7676\u767d\u76ae\u76bf\u76ee\u77db\u77e2\u77f3\u793a\u79b8\u79be\u7a74\u7acb\u7af9\u7c73\u7cf8\u7f36\u7f51\u7f8a\u7fbd\u8001\u800c\u8012\u8033\u807f\u8089\u81e3\u81fc\u820c\u821b\u821f\u826e\u8272\u8278\u864d\u866b\u8840\u884c\u8863\u897e\u898b\u89d2\u8a00\u8c37\u8c46\u8c55\u8c78\u8c9d\u8d64\u8d70\u8db3\u8eab\u8eca\u8f9b\u8fb0\u8fb5\u9091\u9149\u91c6\u91cc\u9577\u9580\u961c\u96b6\u96b9\u96e8\u9751\u975e\u9762\u9769\u97cb\u97ed\u97f3\u9801\u98a8\u98db\u98df\u9996\u9999\u99ac\u9aa8\u9ad8\u9adf\u9b25\u9b2f\u9b32\u9b3c\u9b5a\u9ce5\u9e75\u9e7f\u9ea5\u9ebb\u9ec3\u9ecd\u9ed1\u9ef9\u9efd\u9f0e\u9f13\u9f20\u9f3b\u9f4a\u9f52\u9f8d\u9f9c\u9fa0.\u3012\u5344\u5345\u1101\u11aa\u11ac\u11ad\u1104\u11b0\u11b1\u11b2\u11b3\u11b4\u11b5\u111a\u1108\u1121\u110a\u110d\u1161\u1162\u1163\u1164\u1165\u1166\u1167\u1168\u1169\u116a\u116b\u116c\u116d\u116e\u116f\u1170\u1171\u1172\u1173\u1174\u1175\u1114\u1115\u11c7\u11c8\u11cc\u11ce\u11d3\u11d7\u11d9\u111c\u11dd\u11df\u111d\u111e\u1120\u1122\u1123\u1127\u1129\u112b\u112c\u112d\u112e\u112f\u1132\u1136\u1140\u1147\u114c\u11f1\u11f2\u1157\u1158\u1159\u1184\u1185\u1188\u1191\u1192\u1194\u119e\u11a1\u4e0a\u4e2d\u4e0b\u7532\u4e19\u4e01\u5929\u5730\u554f\u5e7c\u7b8f\uc6b0\u79d8\u7537\u9069\u512a\u5370\u6ce8\u9805\u5199\u5de6\u53f3\u533b\u5b97\u591c\u30c6\u30cc\u30e2\u30e8\u30f0\u30f1\u30f2\ua641\ua643\ua645\ua647\ua649\ua64d\ua64f\ua651\ua653\ua655\ua657\ua659\ua65b\ua65d\ua65f\ua661\ua663\ua665\ua667\ua669\ua66b\ua66d\ua681\ua683\ua685\ua687\ua689\ua68b\ua68d\ua68f\ua691\ua693\ua695\ua697\ua699\ua69b\ua723\ua725\ua727\ua729\ua72b\ua72d\ua72f\ua733\ua735\ua737\ua739\ua73b\ua73d\ua73f\ua741\ua743\ua745\ua747\ua749\ua74b\ua74d\ua74f\ua751\ua753\ua755\ua757\ua759\ua75b\ua75d\ua75f\ua761\ua763\ua765\ua767\ua769\ua76b\ua76d\ua76f\ua77a\ua77c\u1d79\ua77f\ua781\ua783\ua785\ua787\ua78c\ua791\ua793\ua797\ua799\ua79b\ua79d\ua79f\ua7a1\ua7a3\ua7a5\ua7a7\ua7a9\u026c\u029e\u0287\uab53\ua7b5\ua7b7\uab37\uab52\u13a0\u13a1\u13a2\u13a3\u13a4\u13a5\u13a6\u13a7\u13a8\u13a9\u13aa\u13ab\u13ac\u13ad\u13ae\u13af\u13b0\u13b1\u13b2\u13b3\u13b4\u13b5\u13b6\u13b7\u13b8\u13b9\u13ba\u13bb\u13bc\u13bd\u13be\u13bf\u13c0\u13c1\u13c2\u13c3\u13c4\u13c5\u13c6\u13c7\u13c8\u13c9\u13ca\u13cb\u13cc\u13cd\u13ce\u13cf\u13d0\u13d1\u13d2\u13d3\u13d4\u13d5\u13d6\u13d7\u13d8\u13d9\u13da\u13db\u13dc\u13dd\u13de\u13df\u13e0\u13e1\u13e2\u13e3\u13e4\u13e5\u13e6\u13e7\u13e8\u13e9\u13ea\u13eb\u13ec\u13ed\u13ee\u13ef\u8c48\u66f4\u8cc8\u6ed1\u4e32\u53e5\u5951\u5587\u5948\u61f6\u7669\u7f85\u863f\u87ba\u88f8\u908f\u6a02\u6d1b\u70d9\u73de\u843d\u916a\u99f1\u4e82\u5375\u6b04\u721b\u862d\u9e1e\u5d50\u6feb\u85cd\u8964\u62c9\u81d8\u881f\u5eca\u6717\u6d6a\u72fc\u90ce\u4f86\u51b7\u52de\u64c4\u6ad3\u7210\u76e7\u8606\u865c\u8def\u9732\u9b6f\u9dfa\u788c\u797f\u7da0\u83c9\u9304\u8ad6\u58df\u5f04\u7c60\u807e\u7262\u78ca\u8cc2\u96f7\u58d8\u5c62\u6a13\u6dda\u6f0f\u7d2f\u7e37\u964b\u52d2\u808b\u51dc\u51cc\u7a1c\u7dbe\u83f1\u9675\u8b80\u62cf\u8afe\u4e39\u5be7\u6012\u7387\u7570\u5317\u78fb\u4fbf\u5fa9\u4e0d\u6ccc\u6578\u7d22\u53c3\u585e\u7701\u8449\u8aaa\u6bba\u6c88\u62fe\u82e5\u63a0\u7565\u4eae\u5169\u51c9\u6881\u7ce7\u826f\u8ad2\u91cf\u52f5\u5442\u5eec\u65c5\u6ffe\u792a\u95ad\u9a6a\u9e97\u9ece\u66c6\u6b77\u8f62\u5e74\u6190\u6200\u649a\u6f23\u7149\u7489\u79ca\u7df4\u806f\u8f26\u84ee\u9023\u934a\u5217\u52a3\u54bd\u70c8\u88c2\u5ec9\u5ff5\u637b\u6bae\u7c3e\u7375\u4ee4\u56f9\u5dba\u601c\u73b2\u7469\u7f9a\u8046\u9234\u96f6\u9748\u9818\u4f8b\u79ae\u91b4\u96b8\u60e1\u4e86\u50da\u5bee\u5c3f\u6599\u71ce\u7642\u84fc\u907c\u6688\u962e\u5289\u677b\u67f3\u6d41\u6e9c\u7409\u7559\u786b\u7d10\u985e\u622e\u9678\u502b\u5d19\u6dea\u8f2a\u5f8b\u6144\u6817\u9686\u5229\u540f\u5c65\u6613\u674e\u68a8\u6ce5\u7406\u75e2\u7f79\u88cf\u88e1\u96e2\u533f\u6eba\u541d\u71d0\u7498\u85fa\u96a3\u9c57\u9e9f\u6797\u6dcb\u81e8\u7b20\u7c92\u72c0\u7099\u8b58\u4ec0\u8336\u523a\u5207\u5ea6\u62d3\u7cd6\u5b85\u6d1e\u66b4\u8f3b\u964d\u5ed3\u5140\u55c0\u585a\u6674\u51de\u732a\u76ca\u793c\u795e\u7965\u798f\u9756\u7cbe\u8612\u8af8\u9038\u90fd\u98ef\u98fc\u9928\u9db4\u90de\u96b7\u4fae\u50e7\u514d\u52c9\u52e4\u5351\u559d\u5606\u5668\u5840\u58a8\u5c64\u6094\u6168\u618e\u61f2\u654f\u65e2\u6691\u6885\u6d77\u6e1a\u6f22\u716e\u722b\u7422\u7891\u7949\u7948\u7950\u7956\u798d\u798e\u7a40\u7a81\u7bc0\u7e09\u7e41\u7f72\u8005\u81ed\u8279\u8457\u8910\u8996\u8b01\u8b39\u8cd3\u8d08\u8fb6\u96e3\u97ff\u983b\u6075\ud850\udeee\u8218\u4e26\u51b5\u5168\u4f80\u5145\u5180\u52c7\u52fa\u5555\u5599\u55e2\u58b3\u5944\u5954\u5a62\u5b28\u5ed2\u5ed9\u5f69\u5fad\u60d8\u614e\u6108\u6160\u6234\u63c4\u641c\u6452\u6556\u671b\u6756\u6edb\u6ecb\u701e\u77a7\u7235\u72af\u7471\u7506\u753b\u761d\u761f\u76db\u76f4\u774a\u7740\u78cc\u7ab1\u7c7b\u7d5b\u7f3e\u8352\u83ef\u8779\u8941\u8986\u8abf\u8acb\u8aed\u8b8a\u8f38\u9072\u9199\u9276\u967c\u97db\u980b\u9b12\ud84a\udc4a\ud84a\udc44\ud84c\udfd5\u3b9d\u4018\u4039\ud854\ude49\ud857\udcd0\ud85f\uded3\u9f43\u9f8e\u05e2\u05dd\u0671\u067b\u067e\u0680\u067a\u067f\u0679\u06a4\u06a6\u0684\u0683\u0686\u0687\u068d\u068c\u068e\u0688\u0698\u0691\u06a9\u06af\u06b3\u06b1\u06ba\u06bb\u06c0\u06c1\u06be\u06d3\u06ad\u06cb\u06c5\u06c9\u3001\u3016\u3017\u2014\u2013_{}\u3010\u3011\u300a\u300b\u300c\u300d\u300e\u300f[]#&*-<>\\$%@\u0621\u0624\u0629\"'^|~\u2985\u2986\u30fb\u30a5\u30e3\xa2\xa3\xac\xa6\xa5\u20a9\u2502\u2190\u2191\u2192\u2193\u25a0\u25cb\ud801\udc28\ud801\udc29\ud801\udc2a\ud801\udc2b\ud801\udc2c\ud801\udc2d\ud801\udc2e\ud801\udc2f\ud801\udc30\ud801\udc31\ud801\udc32\ud801\udc33\ud801\udc34\ud801\udc35\ud801\udc36\ud801\udc37\ud801\udc38\ud801\udc39\ud801\udc3a\ud801\udc3b\ud801\udc3c\ud801\udc3d\ud801\udc3e\ud801\udc3f\ud801\udc40\ud801\udc41\ud801\udc42\ud801\udc43\ud801\udc44\ud801\udc45\ud801\udc46\ud801\udc47\ud801\udc48\ud801\udc49\ud801\udc4a\ud801\udc4b\ud801\udc4c\ud801\udc4d\ud801\udc4e\ud801\udc4f\ud801\udcd8\ud801\udcd9\ud801\udcda\ud801\udcdb\ud801\udcdc\ud801\udcdd\ud801\udcde\ud801\udcdf\ud801\udce0\ud801\udce1\ud801\udce2\ud801\udce3\ud801\udce4\ud801\udce5\ud801\udce6\ud801\udce7\ud801\udce8\ud801\udce9\ud801\udcea\ud801\udceb\ud801\udcec\ud801\udced\ud801\udcee\ud801\udcef\ud801\udcf0\ud801\udcf1\ud801\udcf2\ud801\udcf3\ud801\udcf4\ud801\udcf5\ud801\udcf6\ud801\udcf7\ud801\udcf8\ud801\udcf9\ud801\udcfa\ud801\udcfb\ud803\udcc0\ud803\udcc1\ud803\udcc2\ud803\udcc3\ud803\udcc4\ud803\udcc5\ud803\udcc6\ud803\udcc7\ud803\udcc8\ud803\udcc9\ud803\udcca\ud803\udccb\ud803\udccc\ud803\udccd\ud803\udcce\ud803\udccf\ud803\udcd0\ud803\udcd1\ud803\udcd2\ud803\udcd3\ud803\udcd4\ud803\udcd5\ud803\udcd6\ud803\udcd7\ud803\udcd8\ud803\udcd9\ud803\udcda\ud803\udcdb\ud803\udcdc\ud803\udcdd\ud803\udcde\ud803\udcdf\ud803\udce0\ud803\udce1\ud803\udce2\ud803\udce3\ud803\udce4\ud803\udce5\ud803\udce6\ud803\udce7\ud803\udce8\ud803\udce9\ud803\udcea\ud803\udceb\ud803\udcec\ud803\udced\ud803\udcee\ud803\udcef\ud803\udcf0\ud803\udcf1\ud803\udcf2\ud806\udcc0\ud806\udcc1\ud806\udcc2\ud806\udcc3\ud806\udcc4\ud806\udcc5\ud806\udcc6\ud806\udcc7\ud806\udcc8\ud806\udcc9\ud806\udcca\ud806\udccb\ud806\udccc\ud806\udccd\ud806\udcce\ud806\udccf\ud806\udcd0\ud806\udcd1\ud806\udcd2\ud806\udcd3\ud806\udcd4\ud806\udcd5\ud806\udcd6\ud806\udcd7\ud806\udcd8\ud806\udcd9\ud806\udcda\ud806\udcdb\ud806\udcdc\ud806\udcdd\ud806\udcde\ud806\udcdf\u0131\u0237\u2207\u2202\ud83a\udd22\ud83a\udd23\ud83a\udd24\ud83a\udd25\ud83a\udd26\ud83a\udd27\ud83a\udd28\ud83a\udd29\ud83a\udd2a\ud83a\udd2b\ud83a\udd2c\ud83a\udd2d\ud83a\udd2e\ud83a\udd2f\ud83a\udd30\ud83a\udd31\ud83a\udd32\ud83a\udd33\ud83a\udd34\ud83a\udd35\ud83a\udd36\ud83a\udd37\ud83a\udd38\ud83a\udd39\ud83a\udd3a\ud83a\udd3b\ud83a\udd3c\ud83a\udd3d\ud83a\udd3e\ud83a\udd3f\ud83a\udd40\ud83a\udd41\ud83a\udd42\ud83a\udd43\u066e\u06a1\u066f\u5b57\u53cc\u591a\u89e3\u4ea4\u6620\u7121\u524d\u5f8c\u518d\u65b0\u521d\u7d42\u8ca9\u58f0\u5439\u6f14\u6295\u6355\u904a\u6307\u7981\u7a7a\u5408\u6e80\u7533\u5272\u55b6\u914d\u5f97\u53ef\u4e3d\u4e38\u4e41\ud840\udd22\u4f60\u4fbb\u5002\u507a\u5099\u50cf\u349e\ud841\ude3a\u5154\u5164\u5177\ud841\udd1c\u34b9\u5167\ud841\udd4b\u5197\u51a4\u4ecc\u51ac\ud864\udddf\u5203\u34df\u523b\u5246\u5277\u3515\u5305\u5306\u5349\u535a\u5373\u537d\u537f\ud842\ude2c\u7070\u53ca\u53df\ud842\udf63\u53eb\u53f1\u5406\u549e\u5438\u5448\u5468\u54a2\u54f6\u5510\u5553\u5563\u5584\u55ab\u55b3\u55c2\u5716\u5717\u5651\u5674\u58ee\u57ce\u57f4\u580d\u578b\u5832\u5831\u58ac\ud845\udce4\u58f2\u58f7\u5906\u5922\u5962\ud845\udea8\ud845\udeea\u59ec\u5a1b\u5a27\u59d8\u5a66\u36ee\u5b08\u5b3e\ud846\uddc8\u5bc3\u5bd8\u5bf3\ud846\udf18\u5bff\u5c06\u3781\u5c60\u5cc0\u5c8d\ud847\udde4\u5d43\ud847\udde6\u5d6e\u5d6b\u5d7c\u5de1\u5de2\u382f\u5dfd\u5e28\u5e3d\u5e69\u3862\ud848\udd83\u387c\u5eb0\u5eb3\u5eb6\ud868\udf92\ud848\udf31\u8201\u5f22\u38c7\ud84c\udeb8\ud858\uddda\u5f62\u5f6b\u38e3\u5f9a\u5fcd\u5fd7\u5ff9\u6081\u393a\u391c\ud849\uded4\u60c7\u6148\u614c\u617a\u61b2\u61a4\u61af\u61de\u621b\u625d\u62b1\u62d4\u6350\ud84a\udf0c\u633d\u62fc\u6368\u6383\u63e4\ud84a\udff1\u6422\u63c5\u63a9\u3a2e\u6469\u647e\u649d\u6477\u3a6c\u656c\ud84c\udc0a\u65e3\u66f8\u6649\u3b19\u3b08\u3ae4\u5192\u5195\u6700\u669c\u80ad\u43d9\u6721\u675e\u6753\ud84c\udfc3\u3b49\u67fa\u6785\u6852\ud84d\udc6d\u688e\u681f\u6914\u6942\u69a3\u69ea\u6aa8\ud84d\udea3\u6adb\u3c18\u6b21\ud84e\udca7\u6b54\u3c4e\u6b72\u6b9f\u6bbb\ud84e\ude8d\ud847\udd0b\ud84e\udefa\u6c4e\ud84f\udcbc\u6cbf\u6ccd\u6c67\u6d16\u6d3e\u6d69\u6d78\u6d85\ud84f\udd1e\u6d34\u6e2f\u6e6e\u3d33\u6ec7\ud84f\uded1\u6df9\u6f6e\ud84f\udf5e\ud84f\udf8e\u6fc6\u7039\u701b\u3d96\u704a\u707d\u7077\u70ad\ud841\udd25\u7145\ud850\ude63\u719c\u7228\u7250\ud851\ude08\u7280\u7295\ud851\udf35\ud852\udc14\u737a\u738b\u3eac\u73a5\u3eb8\u7447\u745c\u7485\u74ca\u3f1b\u7524\ud853\udc36\u753e\ud853\udc92\ud848\udd9f\u7610\ud853\udfa1\ud853\udfb8\ud854\udc44\u3ffc\u4008\ud854\udcf3\ud854\udcf2\ud854\udd19\ud854\udd33\u771e\u771f\u778b\u4046\u4096\ud855\udc1d\u784e\u40e3\ud855\ude26\ud855\ude9a\ud855\udec5\u79eb\u412f\u7a4a\u7a4f\ud856\udd7c\ud856\udea7\u4202\ud856\udfab\u7bc6\u7bc9\u4227\ud857\udc80\u7cd2\u42a0\u7ce8\u7ce3\u7d00\ud857\udf86\u7d63\u4301\u7dc7\u7e02\u7e45\u4334\ud858\ude28\ud858\ude47\u4359\ud858\uded9\u7f7a\ud858\udf3e\u7f95\u7ffa\ud859\udcda\ud859\udd23\u8060\ud859\udda8\u8070\ud84c\udf5f\u43d5\u80b2\u8103\u440b\u813e\u5ab5\ud859\udfa7\ud859\udfb5\ud84c\udf93\ud84c\udf9c\u8204\u8f9e\u446b\u8291\u828b\u829d\u52b3\u82b1\u82b3\u82bd\u82e6\ud85a\udf3c\u831d\u8363\u83ad\u8323\u83bd\u83e7\u8353\u83ca\u83cc\u83dc\ud85b\udc36\ud85b\udd6b\ud85b\udcd5\u452b\u84f1\u84f3\u8516\ud85c\udfca\u8564\ud85b\udf2c\u455d\u4561\ud85b\udfb1\ud85c\udcd2\u456b\u8650\u8667\u8669\u86a9\u8688\u870e\u86e2\u8728\u876b\u8786\u87e1\u8801\u45f9\u8860\ud85d\ude67\u88d7\u88de\u4635\u88fa\u34bb\ud85e\udcae\ud85e\udd66\u46be\u46c7\u8aa0\ud85f\udca8\u8cab\u8cc1\u8d1b\u8d77\ud85f\udf2f\ud842\udc04\u8dcb\u8dbc\u8df0\ud842\udcde\u8ed4\ud861\uddd2\ud861\udded\u9094\u90f1\u9111\ud861\udf2e\u911b\u9238\u92d7\u92d8\u927c\u93f9\u9415\ud862\udffa\u958b\u4995\u95b7\ud863\udd77\u49e6\u96c3\u5db2\u9723\ud864\udd45\ud864\ude1a\u4a6e\u4a76\u97e0\ud865\udc0a\u4ab2\ud865\udc96\u9829\ud865\uddb6\u98e2\u4b33\u9929\u99a7\u99c2\u99fe\u4bce\ud866\udf30\u9c40\u9cfd\u4cce\u4ced\u9d67\ud868\udcce\u4cf8\ud868\udd05\ud868\ude0e\ud868\ude91\u4d56\u9efe\u9f05\u9f0f\u9f16\ud869\ude00",mapChar:r}}()}.apply(t,[]))||(e.exports=r)},2870:function(e,t,r){var n,i;n=[r(2776),r(5025)],void 0===(i=function(e,t){return function(e,t){function r(r,n,i){for(var a=[],o=e.ucs2.decode(r),u=0;u>23,h=l>>21&3,d=l>>5&65535,p=31&l,m=t.mapStr.substr(d,p);if(0===h||n&&1&f)throw new Error("Illegal char "+c);1===h?a.push(m):2===h?a.push(i?m:c):3===h&&a.push(c)}return a.join("").normalize("NFC")}function n(t,n,a){void 0===a&&(a=!1);var o=r(t,a,n).split(".");return(o=o.map((function(t){return t.startsWith("xn--")?i(t=e.decode(t.substring(4)),a,!1):i(t,a,n),t}))).join(".")}function i(e,n,i){if("-"===e[2]&&"-"===e[3])throw new Error("Failed to validate "+e);if(e.startsWith("-")||e.endsWith("-"))throw new Error("Failed to validate "+e);if(e.includes("."))throw new Error("Failed to validate "+e);if(r(e,n,i)!==e)throw new Error("Failed to validate "+e);var a=e.codePointAt(0);if(t.mapChar(a)&2<<23)throw new Error("Label contains illegal character: "+a)}function a(t,r){void 0===r&&(r={});var i,a=!("transitional"in r)||r.transitional,o="useStd3ASCII"in r&&r.useStd3ASCII,u="verifyDnsLength"in r&&r.verifyDnsLength,s=n(t,a,o).split(".").map(e.toASCII),c=s.join(".");if(u){if(c.length<1||c.length>253)throw new Error("DNS name has wrong length: "+c);for(i=0;i63)throw new Error("DNS label has wrong length: "+l)}}return c}function o(e,t){return void 0===t&&(t={}),n(e,!1,"useStd3ASCII"in t&&t.useStd3ASCII)}return{toUnicode:o,toAscii:a}}(e,t)}.apply(t,n))||(e.exports=i)},545:function(e,t){t.read=function(e,t,r,n,i){var a,o,u=8*i-n-1,s=(1<>1,l=-7,f=r?i-1:0,h=r?-1:1,d=e[t+f];for(f+=h,a=d&(1<<-l)-1,d>>=-l,l+=u;l>0;a=256*a+e[t+f],f+=h,l-=8);for(o=a&(1<<-l)-1,a>>=-l,l+=n;l>0;o=256*o+e[t+f],f+=h,l-=8);if(0===a)a=1-c;else{if(a===s)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),a-=c}return(d?-1:1)*o*Math.pow(2,a-n)},t.write=function(e,t,r,n,i,a){var o,u,s,c=8*a-i-1,l=(1<>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=n?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-o))<1&&(o--,s*=2),(t+=o+f>=1?h/s:h*Math.pow(2,1-f))*s>=2&&(o++,s/=2),o+f>=l?(u=0,o=l):o+f>=1?(u=(t*s-1)*Math.pow(2,i),o+=f):(u=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;e[r+d]=255&u,d+=p,u/=256,i-=8);for(o=o<0;e[r+d]=255&o,d+=p,o/=256,c-=8);e[r+d-p]|=128*m}},273:function(e){"function"===typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}}},8268:function(e,t,r){var n=r(9866),i=r(7086),a=r(2678);e.exports=function(e,t){if("string"!==typeof e)return!1;if(t instanceof Object||(t={}),(e=e.toLowerCase()).endsWith(".")&&(e=e.slice(0,e.length-1)),t.allowUnicode&&(e=n.toASCII(e)),e.length>253)return!1;if(!/^([\u0E00-\u0E7Fa-z0-9-._*]+)$/g.test(e))return!1;if(t.topLevel&&a[e.replace(/\.$/,"")])return!0;var r=e.match(/(.*)\.(([\u0E00-\u0E7Fa-z0-9]+)(\.[a-z0-9]+))/),o=null,u=null;if(r&&r.length>2&&i[r[2]]&&(o=r[2],u=r[1].split(".")),!u){if((u=e.split(".")).length<=1)return!1;o=u.pop();if(!/^(?:xn--)?(?!^\d+$)[\u0E00-\u0E7Fa-z0-9]+$/gi.test(o))return!1}return!(!1===t.subdomain&&u.length>1)&&u.every((function(e,r){if(t.wildcard&&0===r&&"*"===e&&u.length>1)return!0;var n=/^([\u0E00-\u0E7Fa-zA-Z0-9-_]+)$/g;r===u.length-1&&(n=/^([\u0E00-\u0E7Fa-zA-Z0-9-]+)$/g);var i=(e.match(/--(--)?/g)||[]).length,a=(e.match(/xn--/g)||[]).length;return(r!==u.length-1||i===a)&&(n.test(e)&&e.length<64&&!e.startsWith("-")&&!e.endsWith("-"))}))}},9866:function(e,t,r){"use strict";r.r(t),r.d(t,{decode:function(){return b},encode:function(){return w},toASCII:function(){return x},toUnicode:function(){return k},ucs2decode:function(){return m},ucs2encode:function(){return v}});var n=r(7762),i=r(3433),a=2147483647,o=36,u=/^xn--/,s=/[^\0-\x7F]/,c=/[\x2E\u3002\uFF0E\uFF61]/g,l={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=Math.floor,h=String.fromCharCode;function d(e){throw new RangeError(l[e])}function p(e,t){var r=e.split("@"),n="";r.length>1&&(n=r[0]+"@",e=r[1]);var i=function(e,t){for(var r=[],n=e.length;n--;)r[n]=t(e[n]);return r}((e=e.replace(c,".")).split("."),t).join(".");return n+i}function m(e){for(var t=[],r=0,n=e.length;r=55296&&i<=56319&&r>1,e+=f(e/t);e>455;n+=o)e=f(e/35);return f(n+36*e/(e+38))},b=function(e){var t,r=[],n=e.length,i=0,u=128,s=72,c=e.lastIndexOf("-");c<0&&(c=0);for(var l=0;l=128&&d("not-basic"),r.push(e.charCodeAt(l));for(var h=c>0?c+1:0;h=n&&d("invalid-input");var y=(t=e.charCodeAt(h++))>=48&&t<58?t-48+26:t>=65&&t<91?t-65:t>=97&&t<123?t-97:o;y>=o&&d("invalid-input"),y>f((a-i)/m)&&d("overflow"),i+=y*m;var b=v<=s?1:v>=s+26?26:v-s;if(yf(a/w)&&d("overflow"),m*=w}var k=r.length+1;s=g(i-p,k,0==p),f(i/k)>a-u&&d("overflow"),u+=f(i/k),i%=k,r.splice(i++,0,u)}return String.fromCodePoint.apply(String,r)},w=function(e){var t,r=[],i=(e=m(e)).length,u=128,s=0,c=72,l=(0,n.Z)(e);try{for(l.s();!(t=l.n()).done;){var p=t.value;p<128&&r.push(h(p))}}catch(U){l.e(U)}finally{l.f()}var v=r.length,b=v;for(v&&r.push("-");b=u&&Af((a-s)/E)&&d("overflow"),s+=(k-u)*E,u=k;var S,_=(0,n.Z)(e);try{for(_.s();!(S=_.n()).done;){var C=S.value;if(Ca&&d("overflow"),C===u){for(var P=s,O=o;;O+=o){var N=O<=c?1:O>=c+26?26:O-c;if(P>5,this.byteCount=this.blockCount<<2,this.outputBlocks=r>>5,this.extraBytes=(31&r)>>3;for(var n=0;n<50;++n)this.s[n]=0}function I(e,t,r){R.call(this,e,t,r)}R.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(i);if(null===e)throw new Error(i);if(l&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!l||!ArrayBuffer.isView(e)))throw new Error(i);t=!0}for(var n,a,o=this.blocks,u=this.byteCount,s=e.length,c=this.blockCount,f=0,h=this.s;f>2]|=e[f]<>2]|=a<>2]|=(192|a>>6)<>2]|=(128|63&a)<=57344?(o[n>>2]|=(224|a>>12)<>2]|=(128|a>>6&63)<>2]|=(128|63&a)<>2]|=(240|a>>18)<>2]|=(128|a>>12&63)<>2]|=(128|a>>6&63)<>2]|=(128|63&a)<=u){for(this.start=n-u,this.block=o[c],n=0;n>=8);r>0;)i.unshift(r),r=255&(e>>=8),++n;return t?i.push(n):i.unshift(n),this.update(i),i.length},R.prototype.encodeString=function(e){var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(i);if(null===e)throw new Error(i);if(l&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!l||!ArrayBuffer.isView(e)))throw new Error(i);t=!0}var n=0,a=e.length;if(t)n=a;else for(var o=0;o=57344?n+=3:(u=65536+((1023&u)<<10|1023&e.charCodeAt(++o)),n+=4)}return n+=this.encode(8*n),this.update(e),n},R.prototype.bytepad=function(e,t){for(var r=this.encode(t),n=0;n>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4&15]+f[15&e]+f[e>>12&15]+f[e>>8&15]+f[e>>20&15]+f[e>>16&15]+f[e>>28&15]+f[e>>24&15];o%t===0&&(B(r),a=0)}return i&&(e=r[a],u+=f[e>>4&15]+f[15&e],i>1&&(u+=f[e>>12&15]+f[e>>8&15]),i>2&&(u+=f[e>>20&15]+f[e>>16&15])),u},R.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,i=this.extraBytes,a=0,o=0,u=this.outputBits>>3;e=i?new ArrayBuffer(n+1<<2):new ArrayBuffer(u);for(var s=new Uint32Array(e);o>8&255,s[e+2]=t>>16&255,s[e+3]=t>>24&255;u%r===0&&B(n)}return a&&(e=u<<2,t=n[o],s[e]=255&t,a>1&&(s[e+1]=t>>8&255),a>2&&(s[e+2]=t>>16&255)),s},I.prototype=new R,I.prototype.finalize=function(){return this.encode(this.outputBits,!0),R.prototype.finalize.call(this)};var B=function(e){var t,r,n,i,a,o,u,s,c,l,f,h,d,m,v,y,g,b,w,k,x,A,E,S,_,C,P,O,N,T,M,U,R,I,B,L,j,F,D,z,Z,q,H,G,K,V,W,J,Q,Y,X,$,ee,te,re,ne,ie,ae,oe,ue,se,ce,le;for(n=0;n<48;n+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],a=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],u=e[3]^e[13]^e[23]^e[33]^e[43],s=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],l=e[6]^e[16]^e[26]^e[36]^e[46],f=e[7]^e[17]^e[27]^e[37]^e[47],t=(h=e[8]^e[18]^e[28]^e[38]^e[48])^(o<<1|u>>>31),r=(d=e[9]^e[19]^e[29]^e[39]^e[49])^(u<<1|o>>>31),e[0]^=t,e[1]^=r,e[10]^=t,e[11]^=r,e[20]^=t,e[21]^=r,e[30]^=t,e[31]^=r,e[40]^=t,e[41]^=r,t=i^(s<<1|c>>>31),r=a^(c<<1|s>>>31),e[2]^=t,e[3]^=r,e[12]^=t,e[13]^=r,e[22]^=t,e[23]^=r,e[32]^=t,e[33]^=r,e[42]^=t,e[43]^=r,t=o^(l<<1|f>>>31),r=u^(f<<1|l>>>31),e[4]^=t,e[5]^=r,e[14]^=t,e[15]^=r,e[24]^=t,e[25]^=r,e[34]^=t,e[35]^=r,e[44]^=t,e[45]^=r,t=s^(h<<1|d>>>31),r=c^(d<<1|h>>>31),e[6]^=t,e[7]^=r,e[16]^=t,e[17]^=r,e[26]^=t,e[27]^=r,e[36]^=t,e[37]^=r,e[46]^=t,e[47]^=r,t=l^(i<<1|a>>>31),r=f^(a<<1|i>>>31),e[8]^=t,e[9]^=r,e[18]^=t,e[19]^=r,e[28]^=t,e[29]^=r,e[38]^=t,e[39]^=r,e[48]^=t,e[49]^=r,m=e[0],v=e[1],V=e[11]<<4|e[10]>>>28,W=e[10]<<4|e[11]>>>28,O=e[20]<<3|e[21]>>>29,N=e[21]<<3|e[20]>>>29,ue=e[31]<<9|e[30]>>>23,se=e[30]<<9|e[31]>>>23,q=e[40]<<18|e[41]>>>14,H=e[41]<<18|e[40]>>>14,I=e[2]<<1|e[3]>>>31,B=e[3]<<1|e[2]>>>31,y=e[13]<<12|e[12]>>>20,g=e[12]<<12|e[13]>>>20,J=e[22]<<10|e[23]>>>22,Q=e[23]<<10|e[22]>>>22,T=e[33]<<13|e[32]>>>19,M=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,le=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,re=e[4]<<30|e[5]>>>2,L=e[14]<<6|e[15]>>>26,j=e[15]<<6|e[14]>>>26,b=e[25]<<11|e[24]>>>21,w=e[24]<<11|e[25]>>>21,Y=e[34]<<15|e[35]>>>17,X=e[35]<<15|e[34]>>>17,U=e[45]<<29|e[44]>>>3,R=e[44]<<29|e[45]>>>3,S=e[6]<<28|e[7]>>>4,_=e[7]<<28|e[6]>>>4,ne=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,F=e[26]<<25|e[27]>>>7,D=e[27]<<25|e[26]>>>7,k=e[36]<<21|e[37]>>>11,x=e[37]<<21|e[36]>>>11,$=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,G=e[8]<<27|e[9]>>>5,K=e[9]<<27|e[8]>>>5,C=e[18]<<20|e[19]>>>12,P=e[19]<<20|e[18]>>>12,ae=e[29]<<7|e[28]>>>25,oe=e[28]<<7|e[29]>>>25,z=e[38]<<8|e[39]>>>24,Z=e[39]<<8|e[38]>>>24,A=e[48]<<14|e[49]>>>18,E=e[49]<<14|e[48]>>>18,e[0]=m^~y&b,e[1]=v^~g&w,e[10]=S^~C&O,e[11]=_^~P&N,e[20]=I^~L&F,e[21]=B^~j&D,e[30]=G^~V&J,e[31]=K^~W&Q,e[40]=te^~ne&ae,e[41]=re^~ie&oe,e[2]=y^~b&k,e[3]=g^~w&x,e[12]=C^~O&T,e[13]=P^~N&M,e[22]=L^~F&z,e[23]=j^~D&Z,e[32]=V^~J&Y,e[33]=W^~Q&X,e[42]=ne^~ae&ue,e[43]=ie^~oe&se,e[4]=b^~k&A,e[5]=w^~x&E,e[14]=O^~T&U,e[15]=N^~M&R,e[24]=F^~z&q,e[25]=D^~Z&H,e[34]=J^~Y&$,e[35]=Q^~X&ee,e[44]=ae^~ue&ce,e[45]=oe^~se&le,e[6]=k^~A&m,e[7]=x^~E&v,e[16]=T^~U&S,e[17]=M^~R&_,e[26]=z^~q&I,e[27]=Z^~H&B,e[36]=Y^~$&G,e[37]=X^~ee&K,e[46]=ue^~ce&te,e[47]=se^~le&re,e[8]=A^~m&y,e[9]=E^~v&g,e[18]=U^~S&C,e[19]=R^~_&P,e[28]=q^~I&L,e[29]=H^~B&j,e[38]=$^~G&V,e[39]=ee^~K&W,e[48]=ce^~te&ne,e[49]=le^~re&ie,e[0]^=p[n],e[1]^=p[n+1]};if(s)e.exports=_;else{for(P=0;P>>0,this.mti=1;this.mti>>30;this.mt[this.mti]=(1812433253*((4294901760&e)>>>16)<<16)+1812433253*(65535&e)+this.mti,this.mt[this.mti]>>>=0}},t.prototype.init_by_array=function(e,t){var r,n,i;for(this.init_seed(19650218),r=1,n=0,i=this.N>t?this.N:t;i;i--){var a=this.mt[r-1]^this.mt[r-1]>>>30;this.mt[r]=(this.mt[r]^(1664525*((4294901760&a)>>>16)<<16)+1664525*(65535&a))+e[n]+n,this.mt[r]>>>=0,n++,++r>=this.N&&(this.mt[0]=this.mt[this.N-1],r=1),n>=t&&(n=0)}for(i=this.N-1;i;i--){a=this.mt[r-1]^this.mt[r-1]>>>30;this.mt[r]=(this.mt[r]^(1566083941*((4294901760&a)>>>16)<<16)+1566083941*(65535&a))-r,this.mt[r]>>>=0,++r>=this.N&&(this.mt[0]=this.mt[this.N-1],r=1)}this.mt[0]=2147483648},t.prototype.random_int=function(){var e,t=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var r;for(this.mti==this.N+1&&this.init_seed(5489),r=0;r>>1^t[1&e];for(;r>>1^t[1&e];e=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^e>>>1^t[1&e],this.mti=0}return e=this.mt[this.mti++],e^=e>>>11,e^=e<<7&2636928640,e^=e<<15&4022730752,(e^=e>>>18)>>>0},t.prototype.random_int31=function(){return this.random_int()>>>1},t.prototype.random_incl=function(){return this.random_int()*(1/4294967295)},t.prototype.random=function(){return this.random_int()*(1/4294967296)},t.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)},t.prototype.random_long=function(){return(67108864*(this.random_int()>>>5)+(this.random_int()>>>6))*(1/9007199254740992)},e.exports=t},5701:function(e){function t(e,t){if(!e)throw new Error(t||"Assertion failed")}e.exports=t,t.equal=function(e,t,r){if(e!=t)throw new Error(r||"Assertion failed: "+e+" != "+t)}},1729:function(e,t,r){"use strict";var n=r(9165);function i(){}function a(){}a.resetWarningCache=i,e.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function t(){return e}e.isRequired=e;var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:i};return r.PropTypes=r,r}},5192:function(e,t,r){e.exports=r(1729)()},9165:function(e){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},2776:function(e,t,r){"use strict";var n=r(4704).default,i=r(861).default,a=2147483647,o=36,u=/^xn--/,s=/[^\0-\x7E]/,c=/[\x2E\u3002\uFF0E\uFF61]/g,l={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},f=Math.floor,h=String.fromCharCode;function d(e){throw new RangeError(l[e])}function p(e,t){var r=e.split("@"),n="";r.length>1&&(n=r[0]+"@",e=r[1]);var i=function(e,t){for(var r=[],n=e.length;n--;)r[n]=t(e[n]);return r}((e=e.replace(c,".")).split("."),t).join(".");return n+i}function m(e){for(var t=[],r=0,n=e.length;r=55296&&i<=56319&&r>1,e+=f(e/t);e>455;n+=o)e=f(e/35);return f(n+36*e/(e+38))},g=function(e){var t,r=[],n=e.length,i=0,u=128,s=72,c=e.lastIndexOf("-");c<0&&(c=0);for(var l=0;l=128&&d("not-basic"),r.push(e.charCodeAt(l));for(var h=c>0?c+1:0;h=n&&d("invalid-input");var g=(t=e.charCodeAt(h++))-48<10?t-22:t-65<26?t-65:t-97<26?t-97:o;(g>=o||g>f((a-i)/m))&&d("overflow"),i+=g*m;var b=v<=s?1:v>=s+26?26:v-s;if(gf(a/w)&&d("overflow"),m*=w}var k=r.length+1;s=y(i-p,k,0==p),f(i/k)>a-u&&d("overflow"),u+=f(i/k),i%=k,r.splice(i++,0,u)}return String.fromCodePoint.apply(String,r)},b=function(e){var t,r=[],i=(e=m(e)).length,u=128,s=0,c=72,l=n(e);try{for(l.s();!(t=l.n()).done;){var p=t.value;p<128&&r.push(h(p))}}catch(U){l.e(U)}finally{l.f()}var g=r.length,b=g;for(g&&r.push("-");b=u&&Af((a-s)/E)&&d("overflow"),s+=(k-u)*E,u=k;var S,_=n(e);try{for(_.s();!(S=_.n()).done;){var C=S.value;if(Ca&&d("overflow"),C==u){for(var P=s,O=o;;O+=o){var N=O<=c?1:O>=c+26?26:O-c;if(P',(ee=te.firstChild).style.behavior="url(#default#VML)",!ee||"object"!=typeof ee.adj)return t.type=v;te=null}function re(e){if("function"==typeof e||Object(e)!==e)return e;var t=new e.constructor;for(var r in e)e[c](r)&&(t[r]=re(e[r]));return t}t.svg=!(t.vml="VML"==t.type),t._Paper=h,t.fn=n=h.prototype=t.prototype,t._id=0,t.is=function(e,t){return"finite"==(t=x.call(t))?!U[c](+e):"array"==t?e instanceof Array:"null"==t&&null===e||t==typeof e&&null!==e||"object"==t&&e===Object(e)||"array"==t&&Array.isArray&&Array.isArray(e)||T.call(e).slice(8,-1).toLowerCase()==t},t.angle=function(e,r,n,i,a,o){if(null==a){var u=e-n,s=r-i;return u||s?(180+180*A.atan2(-s,-u)/P+360)%360:0}return t.angle(e,r,a,o)-t.angle(n,i,a,o)},t.rad=function(e){return e%360*P/180},t.deg=function(e){return Math.round(180*e/P%360*1e3)/1e3},t.snapTo=function(e,r,n){if(n=t.is(n,"finite")?n:10,t.is(e,N)){for(var i=e.length;i--;)if(_(e[i]-r)<=n)return e[i]}else{var a=r%(e=+e);if(ae-n)return r-a+e}return r},t.createUUID=(i=/[xy]/g,a=function(e){var t=16*A.random()|0;return("x"==e?t:3&t|8).toString(16)},function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(i,a).toUpperCase()}),t.setWindow=function(r){e("raphael.setWindow",t,l.win,r),l.win=r,l.doc=l.win.document,t._engine.initWin&&t._engine.initWin(l.win)};var ne=function(e){if(t.vml){var r,n=/^\s+|\s+$/g;try{var i=new ActiveXObject("htmlfile");i.write(""),i.close(),r=i.body}catch(e){r=createPopup().document.body}var a=r.createTextRange();ne=ce((function(e){try{r.style.color=g(e).replace(n,v);var t=a.queryCommandValue("ForeColor");return"#"+("000000"+(t=(255&t)<<16|65280&t|(16711680&t)>>>16).toString(16)).slice(-6)}catch(e){return"none"}}))}else{var o=l.doc.createElement("i");o.title="Rapha\xebl Colour Picker",o.style.display="none",l.doc.body.appendChild(o),ne=ce((function(e){return o.style.color=e,l.doc.defaultView.getComputedStyle(o,v).getPropertyValue("color")}))}return ne(e)},ie=function(){return"hsb("+[this.h,this.s,this.b]+")"},ae=function(){return"hsl("+[this.h,this.s,this.l]+")"},oe=function(){return this.hex},ue=function(e,r,n){if(null==r&&t.is(e,"object")&&"r"in e&&"g"in e&&"b"in e&&(n=e.b,r=e.g,e=e.r),null==r&&t.is(e,"string")){var i=t.getRGB(e);e=i.r,r=i.g,n=i.b}return(e>1||r>1||n>1)&&(e/=255,r/=255,n/=255),[e,r,n]},se=function(e,r,n,i){var a={r:e*=255,g:r*=255,b:n*=255,hex:t.rgb(e,r,n),toString:oe};return t.is(i,"finite")&&(a.opacity=i),a};function ce(e,t,r){return function n(){var i=Array.prototype.slice.call(arguments,0),a=i.join("\u2400"),o=n.cache=n.cache||{},u=n.count=n.count||[];return o[c](a)?(function(e,t){for(var r=0,n=e.length;r=1e3&&delete o[u.shift()],u.push(a),o[a]=e[d](t,i),r?r(o[a]):o[a])}}function le(){return this.hex}function fe(e,t){for(var r=[],n=0,i=e.length;i-2*!t>n;n+=2){var a=[{x:+e[n-2],y:+e[n-1]},{x:+e[n],y:+e[n+1]},{x:+e[n+2],y:+e[n+3]},{x:+e[n+4],y:+e[n+5]}];t?n?i-4==n?a[3]={x:+e[0],y:+e[1]}:i-2==n&&(a[2]={x:+e[0],y:+e[1]},a[3]={x:+e[2],y:+e[3]}):a[0]={x:+e[i-2],y:+e[i-1]}:i-4==n?a[3]=a[2]:n||(a[0]={x:+e[n],y:+e[n+1]}),r.push(["C",(-a[0].x+6*a[1].x+a[2].x)/6,(-a[0].y+6*a[1].y+a[2].y)/6,(a[1].x+6*a[2].x-a[3].x)/6,(a[1].y+6*a[2].y-a[3].y)/6,a[2].x,a[2].y])}return r}t.color=function(e){var r;return t.is(e,"object")&&"h"in e&&"s"in e&&"b"in e?(r=t.hsb2rgb(e),e.r=r.r,e.g=r.g,e.b=r.b,e.hex=r.hex):t.is(e,"object")&&"h"in e&&"s"in e&&"l"in e?(r=t.hsl2rgb(e),e.r=r.r,e.g=r.g,e.b=r.b,e.hex=r.hex):(t.is(e,"string")&&(e=t.getRGB(e)),t.is(e,"object")&&"r"in e&&"g"in e&&"b"in e?(r=t.rgb2hsl(e),e.h=r.h,e.s=r.s,e.l=r.l,r=t.rgb2hsb(e),e.v=r.b):(e={hex:"none"}).r=e.g=e.b=e.h=e.s=e.v=e.l=-1),e.toString=oe,e},t.hsb2rgb=function(e,t,r,n){var i,a,o,u,s;return this.is(e,"object")&&"h"in e&&"s"in e&&"b"in e&&(r=e.b,t=e.s,n=e.o,e=e.h),u=(s=r*t)*(1-_((e=(e*=360)%360/60)%2-1)),i=a=o=r-s,se(i+=[s,u,0,0,u,s][e=~~e],a+=[u,s,s,u,0,0][e],o+=[0,0,u,s,s,u][e],n)},t.hsl2rgb=function(e,t,r,n){var i,a,o,u,s;return this.is(e,"object")&&"h"in e&&"s"in e&&"l"in e&&(r=e.l,t=e.s,e=e.h),(e>1||t>1||r>1)&&(e/=360,t/=100,r/=100),u=(s=2*t*(r<.5?r:1-r))*(1-_((e=(e*=360)%360/60)%2-1)),i=a=o=r-s/2,se(i+=[s,u,0,0,u,s][e=~~e],a+=[u,s,s,u,0,0][e],o+=[0,0,u,s,s,u][e],n)},t.rgb2hsb=function(e,t,r){var n,i;return e=(r=ue(e,t,r))[0],t=r[1],r=r[2],{h:((0==(i=(n=E(e,t,r))-S(e,t,r))?null:n==e?(t-r)/i:n==t?(r-e)/i+2:(e-t)/i+4)+360)%6*60/360,s:0==i?0:i/n,b:n,toString:ie}},t.rgb2hsl=function(e,t,r){var n,i,a,o;return e=(r=ue(e,t,r))[0],t=r[1],r=r[2],n=((i=E(e,t,r))+(a=S(e,t,r)))/2,{h:((0==(o=i-a)?null:i==e?(t-r)/o:i==t?(r-e)/o+2:(e-t)/o+4)+360)%6*60/360,s:0==o?0:n<.5?o/(2*n):o/(2-2*n),l:n,toString:ae}},t._path2string=function(){return this.join(",").replace(q,"$1")},t._preload=function(e,t){var r=l.doc.createElement("img");r.style.cssText="position:absolute;left:-9999em;top:-9999em",r.onload=function(){t.call(this),this.onload=null,l.doc.body.removeChild(this)},r.onerror=function(){l.doc.body.removeChild(this)},l.doc.body.appendChild(r),r.src=e},t.getRGB=ce((function(e){if(!e||(e=g(e)).indexOf("-")+1)return{r:-1,g:-1,b:-1,hex:"none",error:1,toString:le};if("none"==e)return{r:-1,g:-1,b:-1,hex:"none",toString:le};!Z[c](e.toLowerCase().substring(0,2))&&"#"!=e.charAt()&&(e=ne(e));var r,n,i,a,o,u,s=e.match(M);return s?(s[2]&&(i=L(s[2].substring(5),16),n=L(s[2].substring(3,5),16),r=L(s[2].substring(1,3),16)),s[3]&&(i=L((o=s[3].charAt(3))+o,16),n=L((o=s[3].charAt(2))+o,16),r=L((o=s[3].charAt(1))+o,16)),s[4]&&(u=s[4][b](z),r=B(u[0]),"%"==u[0].slice(-1)&&(r*=2.55),n=B(u[1]),"%"==u[1].slice(-1)&&(n*=2.55),i=B(u[2]),"%"==u[2].slice(-1)&&(i*=2.55),"rgba"==s[1].toLowerCase().slice(0,4)&&(a=B(u[3])),u[3]&&"%"==u[3].slice(-1)&&(a/=100)),s[5]?(u=s[5][b](z),r=B(u[0]),"%"==u[0].slice(-1)&&(r*=2.55),n=B(u[1]),"%"==u[1].slice(-1)&&(n*=2.55),i=B(u[2]),"%"==u[2].slice(-1)&&(i*=2.55),("deg"==u[0].slice(-3)||"\xb0"==u[0].slice(-1))&&(r/=360),"hsba"==s[1].toLowerCase().slice(0,4)&&(a=B(u[3])),u[3]&&"%"==u[3].slice(-1)&&(a/=100),t.hsb2rgb(r,n,i,a)):s[6]?(u=s[6][b](z),r=B(u[0]),"%"==u[0].slice(-1)&&(r*=2.55),n=B(u[1]),"%"==u[1].slice(-1)&&(n*=2.55),i=B(u[2]),"%"==u[2].slice(-1)&&(i*=2.55),("deg"==u[0].slice(-3)||"\xb0"==u[0].slice(-1))&&(r/=360),"hsla"==s[1].toLowerCase().slice(0,4)&&(a=B(u[3])),u[3]&&"%"==u[3].slice(-1)&&(a/=100),t.hsl2rgb(r,n,i,a)):((s={r:r,g:n,b:i,toString:le}).hex="#"+(16777216|i|n<<8|r<<16).toString(16).slice(1),t.is(a,"finite")&&(s.opacity=a),s)):{r:-1,g:-1,b:-1,hex:"none",error:1,toString:le}}),t),t.hsb=ce((function(e,r,n){return t.hsb2rgb(e,r,n).hex})),t.hsl=ce((function(e,r,n){return t.hsl2rgb(e,r,n).hex})),t.rgb=ce((function(e,t,r){function n(e){return e+.5|0}return"#"+(16777216|n(r)|n(t)<<8|n(e)<<16).toString(16).slice(1)})),t.getColor=function(e){var t=this.getColor.start=this.getColor.start||{h:0,s:1,b:e||.75},r=this.hsb2rgb(t.h,t.s,t.b);return t.h+=.075,t.h>1&&(t.h=0,t.s-=.2,t.s<=0&&(this.getColor.start={h:0,s:1,b:t.b})),r.hex},t.getColor.reset=function(){delete this.start},t.parsePathString=function(e){if(!e)return null;var r=he(e);if(r.arr)return be(r.arr);var n={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},i=[];return t.is(e,N)&&t.is(e[0],N)&&(i=be(e)),i.length||g(e).replace(H,(function(e,t,r){var a=[],o=t.toLowerCase();if(r.replace(K,(function(e,t){t&&a.push(+t)})),"m"==o&&a.length>2&&(i.push([t][p](a.splice(0,2))),o="l",t="m"==t?"l":"L"),"r"==o)i.push([t][p](a));else for(;a.length>=n[o]&&(i.push([t][p](a.splice(0,n[o]))),n[o]););})),i.toString=t._path2string,r.arr=be(i),i},t.parseTransformString=ce((function(e){if(!e)return null;var r=[];return t.is(e,N)&&t.is(e[0],N)&&(r=be(e)),r.length||g(e).replace(G,(function(e,t,n){var i=[];x.call(t),n.replace(K,(function(e,t){t&&i.push(+t)})),r.push([t][p](i))})),r.toString=t._path2string,r}),this,(function(e){if(!e)return e;for(var t=[],r=0;r1?1:s<0?0:s)/2,l=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],f=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],h=0,d=0;d<12;d++){var p=c*l[d]+c,m=de(p,e,r,i,o),v=de(p,t,n,a,u),y=m*m+v*v;h+=f[d]*A.sqrt(y)}return c*h}function me(e,t,r,n,i,a,o,u){if(!(E(e,r)E(i,o)||E(t,n)E(a,u))){var s=(e-r)*(a-u)-(t-n)*(i-o);if(s){var c=((e*n-t*r)*(i-o)-(e-r)*(i*u-a*o))/s,l=((e*n-t*r)*(a-u)-(t-n)*(i*u-a*o))/s,f=+c.toFixed(2),h=+l.toFixed(2);if(!(f<+S(e,r).toFixed(2)||f>+E(e,r).toFixed(2)||f<+S(i,o).toFixed(2)||f>+E(i,o).toFixed(2)||h<+S(t,n).toFixed(2)||h>+E(t,n).toFixed(2)||h<+S(a,u).toFixed(2)||h>+E(a,u).toFixed(2)))return{x:c,y:l}}}}function ve(e,r,n){var i=t.bezierBBox(e),a=t.bezierBBox(r);if(!t.isBBoxIntersect(i,a))return n?0:[];for(var o=pe.apply(0,e),u=pe.apply(0,r),s=E(~~(o/5),1),c=E(~~(u/5),1),l=[],f=[],h={},d=n?0:[],p=0;p=0&&C<=1.001&&P>=0&&P<=1.001&&(n?d++:d.push({x:A.x,y:A.y,t1:S(C,1),t2:S(P,1)}))}}return d}function ye(e,r,n){e=t._path2curve(e),r=t._path2curve(r);for(var i,a,o,u,s,c,l,f,h,d,p=n?0:[],m=0,v=e.length;mg||y=e.x&&t<=e.x2&&r>=e.y&&r<=e.y2},t.isBBoxIntersect=function(e,r){var n=t.isPointInsideBBox;return n(r,e.x,e.y)||n(r,e.x2,e.y)||n(r,e.x,e.y2)||n(r,e.x2,e.y2)||n(e,r.x,r.y)||n(e,r.x2,r.y)||n(e,r.x,r.y2)||n(e,r.x2,r.y2)||(e.xr.x||r.xe.x)&&(e.yr.y||r.ye.y)},t.pathIntersection=function(e,t){return ye(e,t)},t.pathIntersectionNumber=function(e,t){return ye(e,t,1)},t.isPointInsidePath=function(e,r,n){var i=t.pathBBox(e);return t.isPointInsideBBox(i,r,n)&&ye(e,[["M",r,n],["H",i.x2+10]],1)%2==1},t._removedFactory=function(t){return function(){e("raphael.log",null,"Rapha\xebl: you are calling to method \u201c"+t+"\u201d of removed object",t)}};var ge=t.pathBBox=function(e){var t=he(e);if(t.bbox)return re(t.bbox);if(!e)return{x:0,y:0,width:0,height:0,x2:0,y2:0};for(var r,n=0,i=0,a=[],o=[],u=0,s=(e=Ce(e)).length;u1&&(n*=w=A.sqrt(w),i*=w);var k=n*n,x=i*i,E=(o==u?-1:1)*A.sqrt(_((k*x-k*g*g-x*y*y)/(k*g*g+x*y*y))),S=E*n*g/i+(t+s)/2,C=E*-i*y/n+(r+c)/2,O=A.asin(((r-C)/i).toFixed(9)),N=A.asin(((c-C)/i).toFixed(9));(O=tN&&(O-=2*P),!u&&N>O&&(N-=2*P)}var T=N-O;if(_(T)>h){var M=N,U=s,R=c;N=O+h*(u&&N>O?1:-1),m=e(s=S+n*A.cos(N),c=C+i*A.sin(N),n,i,a,0,u,U,R,[N,M,S,C])}T=N-O;var I=A.cos(O),B=A.sin(O),L=A.cos(N),j=A.sin(N),F=A.tan(T/4),D=4/3*n*F,z=4/3*i*F,Z=[t,r],q=[t+D*B,r-z*I],H=[s+D*j,c-z*L],G=[s,c];if(q[0]=2*Z[0]-q[0],q[1]=2*Z[1]-q[1],l)return[q,H,G][p](m);for(var K=[],V=0,W=(m=[q,H,G][p](m).join()[b](",")).length;V"1e12"&&(h=.5),_(p)>"1e12"&&(p=.5),h>0&&h<1&&(s=Se(e,t,r,n,i,a,o,u,h),v.push(s.x),m.push(s.y)),p>0&&p<1&&(s=Se(e,t,r,n,i,a,o,u,p),v.push(s.x),m.push(s.y)),c=a-2*n+t-(u-2*a+n),f=t-n,h=(-(l=2*(n-t)-2*(a-n))+A.sqrt(l*l-4*c*f))/2/c,p=(-l-A.sqrt(l*l-4*c*f))/2/c,_(h)>"1e12"&&(h=.5),_(p)>"1e12"&&(p=.5),h>0&&h<1&&(s=Se(e,t,r,n,i,a,o,u,h),v.push(s.x),m.push(s.y)),p>0&&p<1&&(s=Se(e,t,r,n,i,a,o,u,p),v.push(s.x),m.push(s.y)),{min:{x:S[d](0,v),y:S[d](0,m)},max:{x:E[d](0,v),y:E[d](0,m)}}})),Ce=t._path2curve=ce((function(e,t){var r=!t&&he(e);if(!t&&r.curve)return be(r.curve);for(var n=ke(e),i=t&&ke(t),a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},u=function(e,t,r){var n,i;if(!e)return["C",t.x,t.y,t.x,t.y,t.x,t.y];switch(!(e[0]in{T:1,Q:1})&&(t.qx=t.qy=null),e[0]){case"M":t.X=e[1],t.Y=e[2];break;case"A":e=["C"][p](Ee[d](0,[t.x,t.y][p](e.slice(1))));break;case"S":"C"==r||"S"==r?(n=2*t.x-t.bx,i=2*t.y-t.by):(n=t.x,i=t.y),e=["C",n,i][p](e.slice(1));break;case"T":"Q"==r||"T"==r?(t.qx=2*t.x-t.qx,t.qy=2*t.y-t.qy):(t.qx=t.x,t.qy=t.y),e=["C"][p](Ae(t.x,t.y,t.qx,t.qy,e[1],e[2]));break;case"Q":t.qx=e[1],t.qy=e[2],e=["C"][p](Ae(t.x,t.y,e[1],e[2],e[3],e[4]));break;case"L":e=["C"][p](xe(t.x,t.y,e[1],e[2]));break;case"H":e=["C"][p](xe(t.x,t.y,e[1],t.y));break;case"V":e=["C"][p](xe(t.x,t.y,t.x,e[1]));break;case"Z":e=["C"][p](xe(t.x,t.y,t.X,t.Y))}return e},s=function(e,t){if(e[t].length>7){e[t].shift();for(var r=e[t];r.length;)l[t]="A",i&&(f[t]="A"),e.splice(t++,0,["C"][p](r.splice(0,6)));e.splice(t,1),y=E(n.length,i&&i.length||0)}},c=function(e,t,r,a,o){e&&t&&"M"==e[o][0]&&"M"!=t[o][0]&&(t.splice(o,0,["M",a.x,a.y]),r.bx=0,r.by=0,r.x=e[o][1],r.y=e[o][2],y=E(n.length,i&&i.length||0))},l=[],f=[],h="",m="",v=0,y=E(n.length,i&&i.length||0);v.01;)c=pe(e,t,r,n,i,a,o,u,f+=(ci){if(r&&!h.start){if(f+=["C"+(l=Ve(o,u,s[1],s[2],s[3],s[4],s[5],s[6],i-d)).start.x,l.start.y,l.m.x,l.m.y,l.x,l.y],a)return f;h.start=f,f=["M"+l.x,l.y+"C"+l.n.x,l.n.y,l.end.x,l.end.y,s[5],s[6]].join(),d+=c,o=+s[5],u=+s[6];continue}if(!e&&!r)return{x:(l=Ve(o,u,s[1],s[2],s[3],s[4],s[5],s[6],i-d)).x,y:l.y,alpha:l.alpha}}d+=c,o=+s[5],u=+s[6]}f+=s.shift()+s}return h.end=f,(l=e?d:r?h:t.findDotsAtSegment(o,u,s[0],s[1],s[2],s[3],s[4],s[5],1)).alpha&&(l={x:l.x,y:l.y,alpha:l.alpha}),l}},Je=We(1),Qe=We(),Ye=We(0,1);t.getTotalLength=Je,t.getPointAtLength=Qe,t.getSubpath=function(e,t,r){if(this.getTotalLength(e)-r<1e-6)return Ye(e,t).end;var n=Ye(e,r,1);return t?Ye(n,t).end:n},qe.getTotalLength=function(){var e=this.getPath();if(e)return this.node.getTotalLength?this.node.getTotalLength():Je(e)},qe.getPointAtLength=function(e){var t=this.getPath();if(t)return Qe(t,e)},qe.getPath=function(){var e,r=t._getPath[this.type];if("text"!=this.type&&"set"!=this.type)return r&&(e=r(this)),e},qe.getSubpath=function(e,r){var n=this.getPath();if(n)return t.getSubpath(n,e,r)};var Xe=t.easing_formulas={linear:function(e){return e},"<":function(e){return C(e,1.7)},">":function(e){return C(e,.48)},"<>":function(e){var t=.48-e/1.04,r=A.sqrt(.1734+t*t),n=r-t,i=-r-t,a=C(_(n),1/3)*(n<0?-1:1)+C(_(i),1/3)*(i<0?-1:1)+.5;return 3*(1-a)*a*a+a*a*a},backIn:function(e){var t=1.70158;return e*e*((t+1)*e-t)},backOut:function(e){var t=1.70158;return(e-=1)*e*((t+1)*e+t)+1},elastic:function(e){return e==!!e?e:C(2,-10*e)*A.sin(2*P*(e-.075)/.3)+1},bounce:function(e){var t=7.5625,r=2.75;return e<1/r?t*e*e:e<2/r?t*(e-=1.5/r)*e+.75:e<2.5/r?t*(e-=2.25/r)*e+.9375:t*(e-=2.625/r)*e+.984375}};Xe.easeIn=Xe["ease-in"]=Xe["<"],Xe.easeOut=Xe["ease-out"]=Xe[">"],Xe.easeInOut=Xe["ease-in-out"]=Xe["<>"],Xe["back-in"]=Xe.backIn,Xe["back-out"]=Xe.backOut;var $e=[],et=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){setTimeout(e,16)},tt=function r(){for(var n=+new Date,i=0;i<$e.length;i++){var a=$e[i];if(!a.el.removed&&!a.paused){var o,u,s=n-a.start,l=a.ms,f=a.easing,h=a.from,d=a.diff,m=a.to,v=(a.t,a.el),g={},b={};if(a.initstatus?(s=(a.initstatus*a.anim.top-a.prev)/(a.percent-a.prev)*l,a.status=a.initstatus,delete a.initstatus,a.stop&&$e.splice(i--,1)):a.status=(a.prev+(a.percent-a.prev)*(s/l))/a.anim.top,!(s<0))if(s1&&!a.next){for(u in m)m[c](u)&&(b[u]=a.totalOrigin[u]);a.el.attr(b),at(a.anim,a.el,a.anim.percents[0],null,a.totalOrigin,a.repeat-1)}a.next&&!a.stop&&at(a.anim,a.el,a.next,null,a.totalOrigin,a.repeat)}}}$e.length&&et(r)},rt=function(e){return e>255?255:e<0?0:e};function nt(e,t,r,n,i,a){var o=3*t,u=3*(n-t)-o,s=1-o-u,c=3*r,l=3*(i-r)-c,f=1-c-l;function h(e){return((s*e+u)*e+o)*e}return function(e,t){var r=function(e,t){var r,n,i,a,c,l;for(i=e,l=0;l<8;l++){if(a=h(i)-e,_(a)(n=1))return n;for(;ra?r=i:n=i,i=(n-r)/2+r}return i}(e,t);return((f*r+l)*r+c)*r}(e,1/(200*a))}function it(e,t){var r=[],n={};if(this.ms=t,this.times=1,e){for(var i in e)e[c](i)&&(n[B(i)]=e[i],r.push(B(i)));r.sort(W)}this.anim=n,this.top=r[r.length-1],this.percents=r}function at(r,n,i,a,u,s){i=B(i);var l,f,h,d,m,v,y=r.ms,w={},k={},x={};if(a)for(E=0,S=$e.length;Ea*r.top){i=r.percents[E],m=r.percents[E-1]||0,y=y/r.top*(i-m),d=r.percents[E+1],l=r.anim[i];break}a&&n.attr(r.anim[r.percents[E]])}if(l){if(f)f.initstatus=a,f.start=new Date-f.ms*a;else{for(var _ in l)if(l[c](_)&&(D[c](_)||n.paper.customAttributes[c](_)))switch(w[_]=n.attr(_),null==w[_]&&(w[_]=F[_]),k[_]=l[_],D[_]){case O:x[_]=(k[_]-w[_])/y;break;case"colour":w[_]=t.getRGB(w[_]);var C=t.getRGB(k[_]);x[_]={r:(C.r-w[_].r)/y,g:(C.g-w[_].g)/y,b:(C.b-w[_].b)/y};break;case"path":var P=Ce(w[_],k[_]),N=P[1];for(w[_]=P[0],x[_]=[],E=0,S=w[_].length;Es&&(s=f)}!e[s+="%"].callback&&(e[s].callback=i)}return new it(e,r)},qe.animate=function(e,r,n,i){if(this.removed)return i&&i.call(this),this;var a=e instanceof it?e:t.animation(e,r,n,i);return at(a,this,a.percents[0],null,this.attr()),this},qe.setTime=function(e,t){return e&&null!=t&&this.status(e,S(t,e.ms)/e.ms),this},qe.status=function(e,t){var r,n,i=[],a=0;if(null!=t)return at(e,this,-1,S(t,1)),this;for(r=$e.length;a1)for(var n=0,i=r.length;n.5)-1;s(h-.5,2)+s(d-.5,2)>.25&&(d=a.sqrt(.25-s(h-.5,2))*i+.5)&&.5!=d&&(d=d.toFixed(5)-1e-5*i)}return f}))).split(/\s*\-\s*/),"linear"==c){var w=i.shift();if(w=-n(w),isNaN(w))return null;var k=[0,0,a.cos(e.rad(w)),a.sin(e.rad(w))],x=1/(o(u(k[2]),u(k[3]))||1);k[2]*=x,k[3]*=x,k[2]<0&&(k[0]=-k[2],k[2]=0),k[3]<0&&(k[1]=-k[3],k[3]=0)}var A=e._parseDots(i);if(!A)return null;if(l=l.replace(/[\(\)\s,\xb0#]/g,"_"),t.gradient&&l!=t.gradient.id&&(m.defs.removeChild(t.gradient),delete t.gradient),!t.gradient){b=v(c+"Gradient",{id:l}),t.gradient=b,v(b,"radial"==c?{fx:h,fy:d}:{x1:k[0],y1:k[1],x2:k[2],y2:k[3],gradientTransform:t.matrix.invert()}),m.defs.appendChild(b);for(var E=0,S=A.length;E1?U.opacity/100:U.opacity});case"stroke":U=e.getRGB(m),s.setAttribute(p,U.hex),"stroke"==p&&U[t]("opacity")&&v(s,{"stroke-opacity":U.opacity>1?U.opacity/100:U.opacity}),"stroke"==p&&n._.arrows&&("startString"in n._.arrows&&w(n,n._.arrows.startString),"endString"in n._.arrows&&w(n,n._.arrows.endString,1));break;case"gradient":("circle"==n.type||"ellipse"==n.type||"r"!=r(m).charAt())&&y(n,m);break;case"opacity":l.gradient&&!l[t]("stroke-opacity")&&v(s,{"stroke-opacity":m>1?m/100:m});case"fill-opacity":if(l.gradient){(R=e._g.doc.getElementById(s.getAttribute("fill").replace(/^url\(#|\)$/g,f)))&&(I=R.getElementsByTagName("stop"),v(I[I.length-1],{"stop-opacity":m}));break}default:"font-size"==p&&(m=i(m,10)+"px");var B=p.replace(/(\-.)/g,(function(e){return e.substring(1).toUpperCase()}));s.style[B]=m,n._.dirty=1,s.setAttribute(p,m)}}E(n,a),s.style.visibility=h},E=function(n,a){if("text"==n.type&&(a[t]("text")||a[t]("font")||a[t]("font-size")||a[t]("x")||a[t]("y"))){var o=n.attrs,u=n.node,s=u.firstChild?i(e._g.doc.defaultView.getComputedStyle(u.firstChild,f).getPropertyValue("font-size"),10):10;if(a[t]("text")){for(o.text=a.text;u.firstChild;)u.removeChild(u.firstChild);for(var c,l=r(a.text).split("\n"),h=[],d=0,p=l.length;d"));var W=K.getBoundingClientRect();C.W=m.w=(W.right-W.left)/100,C.H=m.h=(W.bottom-W.top)/100,C.X=m.x,C.Y=m.y+C.H/2,("x"in s||"y"in s)&&(C.path.v=e.format("m{0},{1}l{2},{1}",a(m.x*g),a(m.y*g),a(m.x*g)+1));for(var J=["x","y","text","font","font-family","font-weight","font-style","font-size"],Q=0,Y=J.length;Q.25&&(r=i.sqrt(.25-u(t-.5,2))*(2*(r>.5)-1)+.5),c=t+f+r),h}))).split(/\s*\-\s*/),"linear"==s){var l=a.shift();if(l=-n(l),isNaN(l))return null}var d=e._parseDots(a);if(!d)return null;if(t=t.shape||t.node,d.length){t.removeChild(o),o.on=!0,o.method="none",o.color=d[0].color,o.color2=d[d.length-1].color;for(var p=[],m=0,v=d.length;m')}}catch(e){A=function(e){return t.createElement("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}},e._engine.initWin(e._g.win),e._engine.create=function(){var t=e._getContainer.apply(0,arguments),r=t.container,n=t.height,i=t.width,a=t.x,o=t.y;if(!r)throw new Error("VML container not found.");var u=new e._Paper,s=u.canvas=e._g.doc.createElement("div"),c=s.style;return a=a||0,o=o||0,i=i||512,n=n||342,u.width=i,u.height=n,i==+i&&(i+="px"),n==+n&&(n+="px"),u.coordsize=216e5+f+216e5,u.coordorigin="0 0",u.span=e._g.doc.createElement("span"),u.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",s.appendChild(u.span),c.cssText=e.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",i,n),1==r?(e._g.doc.body.appendChild(s),c.left=a+"px",c.top=o+"px",c.position="absolute"):r.firstChild?r.insertBefore(s,r.firstChild):r.appendChild(s),u.renderfix=function(){},u},e.prototype.clear=function(){e.eve("raphael.clear",this),this.canvas.innerHTML=h,this.span=e._g.doc.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas.appendChild(this.span),this.bottom=this.top=null},e.prototype.remove=function(){for(var t in e.eve("raphael.remove",this),this.canvas.parentNode.removeChild(this.canvas),this)this[t]="function"==typeof this[t]?e._removedFactory(t):null;return!0};var O=e.st;for(var N in P)P[t](N)&&!O[t](N)&&(O[N]=function(e){return function(){var t=arguments;return this.forEach((function(r){r[e].apply(r,t)}))}}(N))}}.apply(t,n))||(e.exports=i)}])},534:function(e,t,r){"use strict";var n=r(7313),i=r(2224);function a(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r