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 732d67000..7cc197c9c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,16 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "Inflector" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" -dependencies = [ - "lazy_static", - "regex", -] - [[package]] name = "addr2line" version = "0.21.0" @@ -39,9 +29,9 @@ dependencies = [ [[package]] name = "aes" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", "cipher", @@ -64,9 +54,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff" dependencies = [ "cfg-if", "once_cell", @@ -88,7 +78,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?tag=v0.6.0)", "serde", "serde_json", "wit-bindgen", @@ -100,11 +90,45 @@ 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?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "serde", + "thiserror", +] + +[[package]] +name = "alloy-json-rpc" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +dependencies = [ + "alloy-primitives", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "alloy-network" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +dependencies = [ + "alloy-eips", + "alloy-json-rpc", + "alloy-primitives", + "alloy-rlp", + "serde", +] + [[package]] name = "alloy-primitives" -version = "0.5.4" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c234f92024707f224510ff82419b2be0e1d8e1fd911defcac5a085cd7f83898" +checksum = "ef197eb250c64962003cb08b90b17f0882c192f4a6f2f544809d424fd7cb0e7d" dependencies = [ "alloy-rlp", "bytes", @@ -113,6 +137,7 @@ dependencies = [ "derive_more", "hex-literal", "itoa", + "k256", "keccak-asm", "proptest", "rand 0.8.5", @@ -121,6 +146,42 @@ dependencies = [ "tiny-keccak", ] +[[package]] +name = "alloy-providers" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +dependencies = [ + "alloy-network", + "alloy-primitives", + "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?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +dependencies = [ + "alloy-json-rpc", + "alloy-primitives", + "alloy-transport", + "bimap", + "futures", + "serde", + "serde_json", + "tokio", + "tower", + "tracing", +] + [[package]] name = "alloy-rlp" version = "0.3.4" @@ -143,31 +204,76 @@ dependencies = [ "syn 2.0.48", ] +[[package]] +name = "alloy-rpc-client" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +dependencies = [ + "alloy-json-rpc", + "alloy-primitives", + "alloy-pubsub", + "alloy-transport", + "alloy-transport-http", + "alloy-transport-ws", + "futures", + "pin-project", + "reqwest", + "serde", + "serde_json", + "tower", + "tracing", + "url", +] + +[[package]] +name = "alloy-rpc-trace-types" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +dependencies = [ + "alloy-primitives", + "alloy-rpc-types", + "serde", + "serde_json", +] + [[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?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" dependencies = [ "alloy-primitives", "alloy-rlp", "itertools 0.12.1", - "jsonrpsee-types", "serde", "serde_json", - "serde_with", + "thiserror", +] + +[[package]] +name = "alloy-signer" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +dependencies = [ + "alloy-network", + "alloy-primitives", + "async-trait", + "auto_impl", + "elliptic-curve", + "k256", + "rand 0.8.5", "thiserror", ] [[package]] name = "alloy-sol-macro" -version = "0.5.4" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "970e5cf1ca089e964d4f7f7afc7c9ad642bfb1bdc695a20b0cba3b3c28954774" +checksum = "82e92100dee7fd1e44abbe0ef6607f18758cf0ad4e483f4c65ff5c8d85428a6d" dependencies = [ "const-hex", "dunce", "heck", - "indexmap 2.2.2", + "indexmap", "proc-macro-error", "proc-macro2", "quote", @@ -178,9 +284,9 @@ dependencies = [ [[package]] name = "alloy-sol-types" -version = "0.5.4" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a059d4d2c78f8f21e470772c75f9abd9ac6d48c2aaf6b278d1ead06ed9ac664" +checksum = "3e7c6a8c492b1d6a4f92a8fc6a13cf39473978dd7d459d7221969ce5a73d97cd" dependencies = [ "alloy-primitives", "alloy-sol-macro", @@ -188,6 +294,52 @@ dependencies = [ "serde", ] +[[package]] +name = "alloy-transport" +version = "0.1.0" +source = "git+https://github.com/alloy-rs/alloy?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +dependencies = [ + "alloy-json-rpc", + "base64 0.21.7", + "futures-util", + "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?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +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?rev=6f8ebb4#6f8ebb45afca1a201a11d421ec46db0f7a1d8d08" +dependencies = [ + "alloy-pubsub", + "alloy-transport", + "futures", + "http 0.2.11", + "serde_json", + "tokio", + "tokio-tungstenite", + "tracing", + "ws_stream_wasm", +] + [[package]] name = "ambient-authority" version = "0.0.2" @@ -225,9 +377,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" @@ -268,11 +420,10 @@ name = "app_store" version = "0.3.0" dependencies = [ "alloy-primitives", - "alloy-rpc-types", "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?tag=v0.6.0)", "rand 0.8.5", "serde", "serde_json", @@ -426,15 +577,6 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" -[[package]] -name = "ascii-canvas" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" -dependencies = [ - "term", -] - [[package]] name = "async-trait" version = "0.1.77" @@ -523,19 +665,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] -name = "bech32" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" - -[[package]] -name = "beef" -version = "0.5.2" +name = "bimap" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a8241f3ebb85c056b509d4327ad0358fbbba6ffb340bf388f26350aeda225b1" -dependencies = [ - "serde", -] +checksum = "230c5f1ca6a325a32553f8640d31ac9b49f2411e901e427570154868b46da4f7" [[package]] name = "bincode" @@ -637,21 +770,11 @@ dependencies = [ "generic-array", ] -[[package]] -name = "bs58" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5353f36341f7451062466f0b755b96ac3a9547e4d7f6b70d603fc721a7d7896" -dependencies = [ - "sha2", - "tinyvec", -] - [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "d32a994c2b3ca201d9b263612a374263f05e7adde37c4707f693dcd375076d1f" [[package]] name = "byte-slice-cast" @@ -695,15 +818,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "camino" -version = "1.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" -dependencies = [ - "serde", -] - [[package]] name = "cap-fs-ext" version = "2.0.1" @@ -781,35 +895,12 @@ dependencies = [ "winx", ] -[[package]] -name = "cargo-platform" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d" -dependencies = [ - "serde", -] - -[[package]] -name = "cargo_metadata" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" -dependencies = [ - "camino", - "cargo-platform", - "semver 1.0.21", - "serde", - "serde_json", - "thiserror", -] - [[package]] 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?tag=v0.6.0)", "serde", "serde_json", "wit-bindgen", @@ -871,7 +962,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?tag=v0.6.0)", "pleco", "serde", "serde_json", @@ -881,15 +972,14 @@ dependencies = [ [[package]] name = "chrono" -version = "0.4.33" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" +checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", - "serde", "wasm-bindgen", "windows-targets 0.52.0", ] @@ -918,9 +1008,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", @@ -928,21 +1018,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", @@ -952,9 +1042,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" @@ -965,58 +1055,6 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "coins-bip32" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b6be4a5df2098cd811f3194f64ddb96c267606bffd9689ac7b0160097b01ad3" -dependencies = [ - "bs58", - "coins-core", - "digest 0.10.7", - "hmac", - "k256", - "serde", - "sha2", - "thiserror", -] - -[[package]] -name = "coins-bip39" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3db8fba409ce3dc04f7d804074039eb68b960b0829161f8e06c95fea3f122528" -dependencies = [ - "bitvec", - "coins-bip32", - "hmac", - "once_cell", - "pbkdf2 0.12.2", - "rand 0.8.5", - "sha2", - "thiserror", -] - -[[package]] -name = "coins-core" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5286a0843c21f8367f7be734f89df9b822e0321d8bcce8d6e735aadff7d74979" -dependencies = [ - "base64 0.21.7", - "bech32", - "bs58", - "digest 0.10.7", - "generic-array", - "hex", - "ripemd", - "serde", - "serde_derive", - "sha2", - "sha3", - "thiserror", -] - [[package]] name = "colorchoice" version = "1.0.0" @@ -1025,9 +1063,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", @@ -1096,18 +1134,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 +1164,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 +1198,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 +1210,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 +1227,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,19 +1237,28 @@ dependencies = [ "itertools 0.10.5", "log", "smallvec", - "wasmparser 0.116.1", + "wasmparser 0.118.2", "wasmtime-types", ] [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if", ] +[[package]] +name = "crossbeam-channel" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-deque" version = "0.8.5" @@ -1334,18 +1381,8 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" dependencies = [ - "darling_core 0.10.2", - "darling_macro 0.10.2", -] - -[[package]] -name = "darling" -version = "0.20.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc5d6b04b3fd0ba9926f945895de7d806260a2d7431ba82e7edaecb043c4c6b8" -dependencies = [ - "darling_core 0.20.5", - "darling_macro 0.20.5", + "darling_core", + "darling_macro", ] [[package]] @@ -1362,42 +1399,17 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "darling_core" -version = "0.20.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e48a959bcd5c761246f5d090ebc2fbf7b9cd527a492b07a67510c108f1e7e3" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim 0.10.0", - "syn 2.0.48", -] - [[package]] name = "darling_macro" version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" dependencies = [ - "darling_core 0.10.2", + "darling_core", "quote", "syn 1.0.109", ] -[[package]] -name = "darling_macro" -version = "0.20.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1545d67a2149e1d93b7e5c7752dce5a7426eb5d1357ddcfd89336b94444f77" -dependencies = [ - "darling_core 0.20.5", - "quote", - "syn 2.0.48", -] - [[package]] name = "dashmap" version = "5.5.3" @@ -1423,7 +1435,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef552e6f588e446098f6ba40d89ac146c8c7b64aade83c051ee00bb5d2bc18d" dependencies = [ - "uuid 1.7.0", + "uuid", ] [[package]] @@ -1443,7 +1455,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", - "serde", ] [[package]] @@ -1463,7 +1474,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2658621297f2cf68762a6f7dc0bb7e1ff2cfd6583daef8ee0fed6f7ec468ec0" dependencies = [ - "darling 0.10.2", + "darling", "derive_builder_core", "proc-macro2", "quote", @@ -1476,7 +1487,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2791ea3e372c8495c0bc2033991d76b512cd799d07491fbd6890124db9458bef" dependencies = [ - "darling 0.10.2", + "darling", "proc-macro2", "quote", "syn 1.0.109", @@ -1495,12 +1506,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "diff" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" - [[package]] name = "digest" version = "0.9.0" @@ -1551,20 +1556,10 @@ dependencies = [ ] [[package]] -name = "dirs-next" -version = "2.0.0" +name = "dirs-sys" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" +checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" dependencies = [ "libc", "redox_users", @@ -1611,7 +1606,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?tag=v0.6.0)", "serde", "serde_json", "wit-bindgen", @@ -1642,7 +1637,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?tag=v0.6.0)", "serde", "serde_json", "wit-bindgen", @@ -1650,9 +1645,9 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] name = "elliptic-curve" @@ -1674,15 +1669,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "ena" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c533630cf40e9caa44bd91aadc88a75d75a4c3a12b4cfde353cbed41daa1e1f1" -dependencies = [ - "log", -] - [[package]] name = "encoding_rs" version = "0.8.33" @@ -1698,24 +1684,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" -[[package]] -name = "enr" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe81b5c06ecfdbc71dd845216f225f53b62a10cb8a16c946836a3467f701d05b" -dependencies = [ - "base64 0.21.7", - "bytes", - "hex", - "k256", - "log", - "rand 0.8.5", - "rlp", - "serde", - "sha3", - "zeroize", -] - [[package]] name = "enum-as-inner" version = "0.3.4" @@ -1744,335 +1712,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "eth-keystore" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" -dependencies = [ - "aes", - "ctr", - "digest 0.10.7", - "hex", - "hmac", - "pbkdf2 0.11.0", - "rand 0.8.5", - "scrypt", - "serde", - "serde_json", - "sha2", - "sha3", - "thiserror", - "uuid 0.8.2", -] - -[[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" -version = "2.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c7cd562832e2ff584fa844cd2f6e5d4f35bbe11b28c7c9b8df957b2e1d0c701" -dependencies = [ - "ethers-addressbook", - "ethers-contract", - "ethers-core", - "ethers-etherscan", - "ethers-middleware", - "ethers-providers", - "ethers-signers", - "ethers-solc", -] - -[[package]] -name = "ethers-addressbook" -version = "2.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35dc9a249c066d17e8947ff52a4116406163cf92c7f0763cb8c001760b26403f" -dependencies = [ - "ethers-core", - "once_cell", - "serde", - "serde_json", -] - -[[package]] -name = "ethers-contract" -version = "2.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43304317c7f776876e47f2f637859f6d0701c1ec7930a150f169d5fbe7d76f5a" -dependencies = [ - "const-hex", - "ethers-contract-abigen", - "ethers-contract-derive", - "ethers-core", - "ethers-providers", - "futures-util", - "once_cell", - "pin-project", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "ethers-contract-abigen" -version = "2.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9f96502317bf34f6d71a3e3d270defaa9485d754d789e15a8e04a84161c95eb" -dependencies = [ - "Inflector", - "const-hex", - "dunce", - "ethers-core", - "ethers-etherscan", - "eyre", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "reqwest", - "serde", - "serde_json", - "syn 2.0.48", - "toml 0.8.9", - "walkdir", -] - -[[package]] -name = "ethers-contract-derive" -version = "2.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "452ff6b0a64507ce8d67ffd48b1da3b42f03680dcf5382244e9c93822cbbf5de" -dependencies = [ - "Inflector", - "const-hex", - "ethers-contract-abigen", - "ethers-core", - "proc-macro2", - "quote", - "serde_json", - "syn 2.0.48", -] - -[[package]] -name = "ethers-core" -version = "2.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aab3cef6cc1c9fd7f787043c81ad3052eff2b96a3878ef1526aa446311bdbfc9" -dependencies = [ - "arrayvec", - "bytes", - "cargo_metadata", - "chrono", - "const-hex", - "elliptic-curve", - "ethabi", - "generic-array", - "k256", - "num_enum", - "once_cell", - "open-fastrlp", - "rand 0.8.5", - "rlp", - "serde", - "serde_json", - "strum", - "syn 2.0.48", - "tempfile", - "thiserror", - "tiny-keccak", - "unicode-xid", -] - -[[package]] -name = "ethers-etherscan" -version = "2.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16d45b981f5fa769e1d0343ebc2a44cfa88c9bc312eb681b676318b40cef6fb1" -dependencies = [ - "chrono", - "ethers-core", - "reqwest", - "semver 1.0.21", - "serde", - "serde_json", - "thiserror", - "tracing", -] - -[[package]] -name = "ethers-middleware" -version = "2.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145211f34342487ef83a597c1e69f0d3e01512217a7c72cc8a25931854c7dca0" -dependencies = [ - "async-trait", - "auto_impl", - "ethers-contract", - "ethers-core", - "ethers-etherscan", - "ethers-providers", - "ethers-signers", - "futures-channel", - "futures-locks", - "futures-util", - "instant", - "reqwest", - "serde", - "serde_json", - "thiserror", - "tokio", - "tracing", - "tracing-futures", - "url", -] - -[[package]] -name = "ethers-providers" -version = "2.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb6b15393996e3b8a78ef1332d6483c11d839042c17be58decc92fa8b1c3508a" -dependencies = [ - "async-trait", - "auto_impl", - "base64 0.21.7", - "bytes", - "const-hex", - "enr", - "ethers-core", - "futures-channel", - "futures-core", - "futures-timer", - "futures-util", - "hashers", - "http 0.2.11", - "instant", - "jsonwebtoken", - "once_cell", - "pin-project", - "reqwest", - "serde", - "serde_json", - "thiserror", - "tokio", - "tokio-tungstenite", - "tracing", - "tracing-futures", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "ws_stream_wasm", -] - -[[package]] -name = "ethers-signers" -version = "2.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3b125a103b56aef008af5d5fb48191984aa326b50bfd2557d231dc499833de3" -dependencies = [ - "async-trait", - "coins-bip32", - "coins-bip39", - "const-hex", - "elliptic-curve", - "eth-keystore", - "ethers-core", - "rand 0.8.5", - "sha2", - "thiserror", - "tracing", -] - -[[package]] -name = "ethers-solc" -version = "2.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d21df08582e0a43005018a858cc9b465c5fff9cf4056651be64f844e57d1f55f" -dependencies = [ - "cfg-if", - "const-hex", - "dirs 5.0.1", - "dunce", - "ethers-core", - "glob", - "home", - "md-5", - "num_cpus", - "once_cell", - "path-slash", - "rayon", - "regex", - "semver 1.0.21", - "serde", - "serde_json", - "solang-parser", - "svm-rs", - "thiserror", - "tiny-keccak", - "tokio", - "tracing", - "walkdir", - "yansi", -] - -[[package]] -name = "eyre" -version = "0.6.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" -dependencies = [ - "indenter", - "once_cell", -] - [[package]] name = "fallible-iterator" version = "0.3.0" @@ -2141,12 +1780,6 @@ dependencies = [ "static_assertions", ] -[[package]] -name = "fixedbitset" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" - [[package]] name = "flate2" version = "1.0.28" @@ -2198,23 +1831,13 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "fs2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" -dependencies = [ - "libc", - "winapi", -] - [[package]] name = "ft_worker" 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?tag=v0.6.0)", "rand 0.8.5", "serde", "serde_json", @@ -2281,16 +1904,6 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" -[[package]] -name = "futures-locks" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ec6fe3675af967e67c5536c0b9d44e34e6c52f86bedc4ea49c5317b8e94d06" -dependencies = [ - "futures-channel", - "futures-task", -] - [[package]] name = "futures-macro" version = "0.3.30" @@ -2314,16 +1927,6 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" -[[package]] -name = "futures-timer" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" -dependencies = [ - "gloo-timers", - "send_wrapper 0.4.0", -] - [[package]] name = "futures-util" version = "0.3.30" @@ -2375,6 +1978,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?tag=v0.6.0)", + "serde", + "serde_json", + "wit-bindgen", +] + [[package]] name = "getrandom" version = "0.2.12" @@ -2403,7 +2016,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" dependencies = [ "fallible-iterator", - "indexmap 2.2.2", + "indexmap", "stable_deref_trait", ] @@ -2428,18 +2041,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" -[[package]] -name = "gloo-timers" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - [[package]] name = "group" version = "0.13.0" @@ -2463,19 +2064,13 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.11", - "indexmap 2.2.2", + "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" @@ -2495,15 +2090,6 @@ dependencies = [ "allocator-api2", ] -[[package]] -name = "hashers" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2bca93b15ea5a746f220e56587f71e73c6165eab783df9e26590069953e3c30" -dependencies = [ - "fxhash", -] - [[package]] name = "hashlink" version = "0.8.4" @@ -2548,9 +2134,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.4" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" [[package]] name = "hex" @@ -2571,7 +2157,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?tag=v0.6.0)", "serde", "serde_json", "wit-bindgen", @@ -2595,22 +2181,13 @@ dependencies = [ "digest 0.10.7", ] -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys 0.52.0", -] - [[package]] name = "homepage" 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?tag=v0.6.0)", "serde", "serde_json", "wit-bindgen", @@ -2685,20 +2262,6 @@ dependencies = [ "want", ] -[[package]] -name = "hyper-rustls" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" -dependencies = [ - "futures-util", - "http 0.2.11", - "hyper", - "rustls", - "tokio", - "tokio-rustls", -] - [[package]] name = "hyper-system-resolver" version = "0.5.0" @@ -2791,24 +2354,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" @@ -2843,28 +2388,11 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "indenter" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg 1.1.0", - "hashbrown 0.12.3", - "serde", -] - [[package]] name = "indexmap" -version = "2.2.2" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -2885,21 +2413,12 @@ 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?tag=v0.6.0)", "serde", "serde_json", "wit-bindgen", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", -] - [[package]] name = "io-extras" version = "0.18.1" @@ -2931,17 +2450,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "is-terminal" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" -dependencies = [ - "hermit-abi", - "rustix", - "windows-sys 0.52.0", -] - [[package]] name = "is-wsl" version = "0.4.0" @@ -2961,15 +2469,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -dependencies = [ - "either", -] - [[package]] name = "itertools" version = "0.12.1" @@ -3006,49 +2505,21 @@ dependencies = [ ] [[package]] -name = "jobserver" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" -dependencies = [ - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "jsonrpsee-types" -version = "0.20.3" +name = "jobserver" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be0be325642e850ed0bdff426674d2e66b2b7117c9be23a7caef68a2902b7d9" +checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" dependencies = [ - "anyhow", - "beef", - "serde", - "serde_json", - "thiserror", - "tracing", + "libc", ] [[package]] -name = "jsonwebtoken" -version = "8.3.0" +name = "js-sys" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" +checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" dependencies = [ - "base64 0.21.7", - "pem", - "ring 0.16.20", - "serde", - "serde_json", - "simple_asn1", + "wasm-bindgen", ] [[package]] @@ -3101,9 +2572,18 @@ dependencies = [ [[package]] name = "kinode" -version = "0.5.3" +version = "0.6.0" dependencies = [ "aes-gcm", + "alloy-primitives", + "alloy-providers", + "alloy-pubsub", + "alloy-rpc-client", + "alloy-rpc-types", + "alloy-signer", + "alloy-sol-macro", + "alloy-sol-types", + "alloy-transport-ws", "anyhow", "async-trait", "base64 0.13.1", @@ -3119,8 +2599,6 @@ dependencies = [ "dashmap", "digest 0.10.7", "elliptic-curve", - "ethers", - "ethers-providers", "flate2", "futures", "generic-array", @@ -3139,6 +2617,7 @@ dependencies = [ "open", "public-ip", "rand 0.8.5", + "rayon", "reqwest", "ring 0.16.20", "rmp-serde", @@ -3156,7 +2635,7 @@ dependencies = [ "tokio-stream", "tokio-tungstenite", "url", - "uuid 1.7.0", + "uuid", "walkdir", "warp", "wasmtime", @@ -3166,20 +2645,22 @@ dependencies = [ [[package]] name = "kinode_lib" -version = "0.5.3" +version = "0.6.0" dependencies = [ "lib", ] [[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?tag=v0.6.0#ccf9db2493ec1e112f9146994f852b7bb119dbb6" dependencies = [ + "alloy-json-rpc", + "alloy-primitives", "alloy-rpc-types", + "alloy-transport", "anyhow", "bincode", - "ethers-core", "http 1.0.0", "mime_guess", "rand 0.8.5", @@ -3192,8 +2673,8 @@ dependencies = [ [[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" +version = "0.6.0" +source = "git+https://github.com/kinode-dao/process_lib.git?rev=9d185e1#9d185e1e264c93af53d004ba32520fd5d046e7e5" dependencies = [ "anyhow", "bincode", @@ -3210,7 +2691,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=0e39c93#0e39c93d994e2955efd5655fb3ae0831c38865d0" dependencies = [ "anyhow", "base64 0.21.7", @@ -3219,7 +2700,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/kinode-dao/process_lib.git?rev=9d185e1)", "nix", "regex", "reqwest", @@ -3230,7 +2711,10 @@ dependencies = [ "thiserror", "tokio", "tokio-tungstenite", - "toml 0.8.9", + "toml 0.8.10", + "tracing", + "tracing-appender", + "tracing-subscriber", "walkdir", "zip", ] @@ -3240,46 +2724,17 @@ name = "kns_indexer" version = "0.2.0" dependencies = [ "alloy-primitives", - "alloy-rpc-types", "alloy-sol-types", "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?tag=v0.6.0)", "rmp-serde", "serde", "serde_json", "wit-bindgen", ] -[[package]] -name = "lalrpop" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da4081d44f4611b66c6dd725e6de3169f9f63905421e8626fcb86b6a898998b8" -dependencies = [ - "ascii-canvas", - "bit-set", - "diff", - "ena", - "is-terminal", - "itertools 0.10.5", - "lalrpop-util", - "petgraph", - "regex", - "regex-syntax 0.7.5", - "string_cache", - "term", - "tiny-keccak", - "unicode-xid", -] - -[[package]] -name = "lalrpop-util" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f35c735096c0293d313e8f2a641627472b83d01b937177fe76e5e2708d31e0d" - [[package]] name = "lazy_static" version = "1.4.0" @@ -3300,10 +2755,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "lib" -version = "0.5.3" +version = "0.6.0" dependencies = [ - "ethers", - "ethers-providers", + "alloy-rpc-types", "lazy_static", "rand 0.8.5", "reqwest", @@ -3454,7 +2908,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?tag=v0.6.0)", "regex", "serde", "serde_json", @@ -3470,6 +2924,15 @@ dependencies = [ "libc", ] +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] + [[package]] name = "matches" version = "0.1.10" @@ -3482,16 +2945,6 @@ version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" -[[package]] -name = "md-5" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" -dependencies = [ - "cfg-if", - "digest 0.10.7", -] - [[package]] name = "memchr" version = "2.7.1" @@ -3583,6 +3036,16 @@ dependencies = [ "version_check", ] +[[package]] +name = "namehash_to_name" +version = "0.1.0" +dependencies = [ + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)", + "rmp-serde", + "serde", + "wit-bindgen", +] + [[package]] name = "native-tls" version = "0.2.11" @@ -3602,10 +3065,14 @@ dependencies = [ ] [[package]] -name = "new_debug_unreachable" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +name = "net_diagnostics" +version = "0.1.0" +dependencies = [ + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)", + "rmp-serde", + "serde", + "wit-bindgen", +] [[package]] name = "nibble_vec" @@ -3643,6 +3110,16 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-bigint" version = "0.4.4" @@ -3662,19 +3139,18 @@ 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 = [ "autocfg 1.1.0", "libm", @@ -3690,27 +3166,6 @@ dependencies = [ "libc", ] -[[package]] -name = "num_enum" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02339744ee7253741199f897151b38e72257d13802d4ee837285cc2990a90845" -dependencies = [ - "num_enum_derive", -] - -[[package]] -name = "num_enum_derive" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "681030a937600a36906c185595136d26abfebb4aa9c65701cefcaf8578bb982b" -dependencies = [ - "proc-macro-crate 3.1.0", - "proc-macro2", - "quote", - "syn 2.0.48", -] - [[package]] name = "object" version = "0.32.2" @@ -3719,7 +3174,7 @@ checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "crc32fast", "hashbrown 0.14.3", - "indexmap 2.2.2", + "indexmap", "memchr", ] @@ -3746,31 +3201,6 @@ dependencies = [ "pathdiff", ] -[[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 = "openssl" version = "0.10.63" @@ -3821,6 +3251,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "parity-scale-codec" version = "3.6.9" @@ -3841,7 +3277,7 @@ version = "3.6.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" dependencies = [ - "proc-macro-crate 2.0.0", + "proc-macro-crate", "proc-macro2", "quote", "syn 1.0.109", @@ -3887,12 +3323,6 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" -[[package]] -name = "path-slash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" - [[package]] name = "pathdiff" version = "0.2.1" @@ -3911,16 +3341,6 @@ dependencies = [ "sha2", ] -[[package]] -name = "pbkdf2" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" -dependencies = [ - "digest 0.10.7", - "hmac", -] - [[package]] name = "peeking_take_while" version = "0.1.2" @@ -3928,12 +3348,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" [[package]] -name = "pem" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" +name = "peer" +version = "0.1.0" dependencies = [ - "base64 0.13.1", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)", + "rmp-serde", + "serde", + "wit-bindgen", +] + +[[package]] +name = "peers" +version = "0.1.0" +dependencies = [ + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)", + "rmp-serde", + "serde", + "wit-bindgen", ] [[package]] @@ -3953,16 +3384,6 @@ dependencies = [ "ucd-trie", ] -[[package]] -name = "petgraph" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" -dependencies = [ - "fixedbitset", - "indexmap 2.2.2", -] - [[package]] name = "pharos" version = "0.5.3" @@ -3973,57 +3394,6 @@ dependencies = [ "rustc_version 0.4.0", ] -[[package]] -name = "phf" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade2d8b8f33c7333b51bcf0428d37e217e9f32192ae4772156f65063b8ce03dc" -dependencies = [ - "phf_macros", - "phf_shared 0.11.2", -] - -[[package]] -name = "phf_generator" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48e4cc64c2ad9ebe670cb8fd69dd50ae301650392e81c05f9bfcb2d5bdbc24b0" -dependencies = [ - "phf_shared 0.11.2", - "rand 0.8.5", -] - -[[package]] -name = "phf_macros" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3444646e286606587e49f3bcf1679b8cef1dc2c5ecc29ddacaffc305180d464b" -dependencies = [ - "phf_generator", - "phf_shared 0.11.2", - "proc-macro2", - "quote", - "syn 2.0.48", -] - -[[package]] -name = "phf_shared" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" -dependencies = [ - "siphasher", -] - -[[package]] -name = "phf_shared" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" -dependencies = [ - "siphasher", -] - [[package]] name = "pin-project" version = "1.1.4" @@ -4068,9 +3438,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "platforms" @@ -4127,12 +3497,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "precomputed-hash" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" - [[package]] name = "prettyplease" version = "0.2.16" @@ -4151,22 +3515,9 @@ 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.0" @@ -4176,15 +3527,6 @@ dependencies = [ "toml_edit 0.20.7", ] -[[package]] -name = "proc-macro-crate" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" -dependencies = [ - "toml_edit 0.21.1", -] - [[package]] name = "proc-macro-error" version = "1.0.4" @@ -4520,10 +3862,19 @@ checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", - "regex-automata", + "regex-automata 0.4.5", "regex-syntax 0.8.2", ] +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + [[package]] name = "regex-automata" version = "0.4.5" @@ -4537,9 +3888,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.5" +version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" @@ -4562,7 +3913,6 @@ dependencies = [ "http 0.2.11", "http-body", "hyper", - "hyper-rustls", "hyper-tls", "ipnet", "js-sys", @@ -4572,7 +3922,6 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls", "rustls-pemfile", "serde", "serde_json", @@ -4581,13 +3930,11 @@ dependencies = [ "system-configuration", "tokio", "tokio-native-tls", - "tokio-rustls", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots", "winreg", ] @@ -4630,15 +3977,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "ripemd" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" -dependencies = [ - "digest 0.10.7", -] - [[package]] name = "rlp" version = "0.5.2" @@ -4646,21 +3984,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" @@ -4825,12 +4151,6 @@ dependencies = [ "untrusted 0.9.0", ] -[[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" @@ -4849,46 +4169,13 @@ version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" -[[package]] -name = "salsa20" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" -dependencies = [ - "cipher", -] - [[package]] name = "same-file" version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "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", +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", ] [[package]] @@ -4912,18 +4199,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "scrypt" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" -dependencies = [ - "hmac", - "pbkdf2 0.11.0", - "salsa20", - "sha2", -] - [[package]] name = "sct" version = "0.7.1" @@ -4985,9 +4260,6 @@ name = "semver" version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" -dependencies = [ - "serde", -] [[package]] name = "semver-parser" @@ -4998,12 +4270,6 @@ dependencies = [ "pest", ] -[[package]] -name = "send_wrapper" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" - [[package]] name = "send_wrapper" version = "0.6.0" @@ -5062,35 +4328,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_with" -version = "3.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b0ed1662c5a68664f45b76d18deb0e234aff37207086803165c961eb695e981" -dependencies = [ - "base64 0.21.7", - "chrono", - "hex", - "indexmap 1.9.3", - "indexmap 2.2.2", - "serde", - "serde_json", - "serde_with_macros", - "time", -] - -[[package]] -name = "serde_with_macros" -version = "3.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "568577ff0ef47b879f736cd66740e022f3672788cdf002a05a4e609ea5a6fb15" -dependencies = [ - "darling 0.20.5", - "proc-macro2", - "quote", - "syn 2.0.48", -] - [[package]] name = "sha1" version = "0.10.6" @@ -5133,6 +4370,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + [[package]] name = "shellexpand" version = "2.1.2" @@ -5188,24 +4434,6 @@ dependencies = [ "rand_core 0.6.4", ] -[[package]] -name = "simple_asn1" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" -dependencies = [ - "num-bigint", - "num-traits", - "thiserror", - "time", -] - -[[package]] -name = "siphasher" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" - [[package]] name = "slab" version = "0.4.9" @@ -5264,20 +4492,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "solang-parser" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c425ce1c59f4b154717592f0bdf4715c3a1d55058883622d3157e1f0908a5b26" -dependencies = [ - "itertools 0.11.0", - "lalrpop", - "lalrpop-util", - "phf", - "thiserror", - "unicode-xid", -] - [[package]] name = "spdx" version = "0.10.3" @@ -5321,6 +4535,16 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +[[package]] +name = "state" +version = "0.1.0" +dependencies = [ + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)", + "serde", + "serde_json", + "wit-bindgen", +] + [[package]] name = "static_assertions" version = "1.1.0" @@ -5344,19 +4568,6 @@ dependencies = [ "warp", ] -[[package]] -name = "string_cache" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91138e76242f575eb1d3b38b4f1362f10d3a43f47d182a5b359af488a02293b" -dependencies = [ - "new_debug_unreachable", - "once_cell", - "parking_lot", - "phf_shared 0.10.0", - "precomputed-hash", -] - [[package]] name = "strsim" version = "0.9.3" @@ -5365,31 +4576,9 @@ checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" [[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" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "rustversion", - "syn 2.0.48", -] +checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" [[package]] name = "subtle" @@ -5397,26 +4586,6 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" -[[package]] -name = "svm-rs" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11297baafe5fa0c99d5722458eac6a5e25c01eb1b8e5cd137f54079093daa7a4" -dependencies = [ - "dirs 5.0.1", - "fs2", - "hex", - "once_cell", - "reqwest", - "semver 1.0.21", - "serde", - "serde_json", - "sha2", - "thiserror", - "url", - "zip", -] - [[package]] name = "syn" version = "1.0.109" @@ -5441,9 +4610,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.5.4" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ede2e5b2c6bfac4bc0ff4499957a11725dc12a7ddb86270e827ef575892553" +checksum = "e656cbcef8a77543b5accbd76f60f9e0bc4be364b0aba4263a6f313f8a355511" dependencies = [ "paste", "proc-macro2", @@ -5508,35 +4677,23 @@ 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", ] -[[package]] -name = "term" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" -dependencies = [ - "dirs-next", - "rustversion", - "winapi", -] - [[package]] name = "terminal" 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?tag=v0.6.0)", "rand 0.8.5", "regex", "serde", @@ -5550,7 +4707,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?tag=v0.6.0)", "serde", "serde_json", "thiserror", @@ -5563,8 +4720,8 @@ version = "0.1.0" 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)", + "indexmap", + "kinode_process_lib 0.6.0 (git+https://github.com/kinode-dao/process_lib?tag=v0.6.0)", "serde", "serde_json", "thiserror", @@ -5573,24 +4730,34 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", "syn 2.0.48", ] +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + [[package]] name = "time" version = "0.3.34" @@ -5746,14 +4913,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.5", ] [[package]] @@ -5765,39 +4932,28 @@ dependencies = [ "serde", ] -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap 2.2.2", - "toml_datetime", - "winnow", -] - [[package]] name = "toml_edit" version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ - "indexmap 2.2.2", + "indexmap", "toml_datetime", - "winnow", + "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.21.1" +version = "0.22.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +checksum = "99e68c159e8f5ba8a28c4eb7b0c0c190d77bb479047ca713270048145a9ad28a" dependencies = [ - "indexmap 2.2.2", + "indexmap", "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.6.1", ] [[package]] @@ -5805,12 +4961,33 @@ 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?tag=v0.6.0)", "serde", "serde_json", "wit-bindgen", ] +[[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" @@ -5829,6 +5006,18 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-appender" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3566e8ce28cc0a3fe42519fc80e6b4c943cc4c8cef275620eb8dac2d3d4e06cf" +dependencies = [ + "crossbeam-channel", + "thiserror", + "time", + "tracing-subscriber", +] + [[package]] name = "tracing-attributes" version = "0.1.27" @@ -5847,6 +5036,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", + "valuable", ] [[package]] @@ -5861,6 +5051,48 @@ dependencies = [ "tracing", ] +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-serde" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "serde", + "serde_json", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", +] + [[package]] name = "trust-dns-client" version = "0.20.4" @@ -5994,9 +5226,9 @@ dependencies = [ [[package]] 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" @@ -6015,7 +5247,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?tag=v0.6.0)", "serde", "serde_json", "wit-bindgen", @@ -6078,16 +5310,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" -[[package]] -name = "uuid" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" -dependencies = [ - "getrandom", - "serde", -] - [[package]] name = "uuid" version = "1.7.0" @@ -6183,9 +5405,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", @@ -6201,14 +5423,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", @@ -6221,14 +5443,14 @@ dependencies = [ "tracing", "wasmtime", "wiggle", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[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", @@ -6236,9 +5458,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", @@ -6251,9 +5473,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", @@ -6263,9 +5485,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", @@ -6273,9 +5495,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", @@ -6286,99 +5508,89 @@ 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" -version = "0.36.2" +version = "0.38.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "822b645bf4f2446b949776ffca47e2af60b167209ffb70814ef8779d299cd421" +checksum = "0ad2b51884de9c7f4fe2fd1043fccb8dcad4b1e29558146ee57a144d15779f3f" dependencies = [ "leb128", ] [[package]] name = "wasm-encoder" -version = "0.38.1" +version = "0.41.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ad2b51884de9c7f4fe2fd1043fccb8dcad4b1e29558146ee57a144d15779f3f" +checksum = "972f97a5d8318f908dded23594188a90bcd09365986b1163e66d70170e5287ae" dependencies = [ "leb128", ] [[package]] name = "wasm-encoder" -version = "0.41.0" +version = "0.200.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e09bca7d6388637d27fb5edbeab11f56bfabcef8743c55ae34370e1e5030a071" +checksum = "b9e3fb0c8fbddd78aa6095b850dfeedbc7506cf5f81e633f69cf8f2333ab84b9" dependencies = [ "leb128", ] [[package]] name = "wasm-metadata" -version = "0.10.17" +version = "0.10.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c853d3809fc9fccf3bc0ad63f4f51d8eefad0bacf88f957aa991c1d9b88b016e" +checksum = "18ebaa7bd0f9e7a5e5dd29b9a998acf21c4abed74265524dd7e85934597bfb10" dependencies = [ "anyhow", - "indexmap 2.2.2", + "indexmap", "serde", "serde_derive", "serde_json", "spdx", - "wasm-encoder 0.41.0", - "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", + "wasm-encoder 0.41.2", + "wasmparser 0.121.2", ] [[package]] name = "wasmparser" -version = "0.118.1" +version = "0.118.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ee9723b928e735d53000dec9eae7b07a60e490c85ab54abb66659fc61bfcd9" +checksum = "77f1154f1ab868e2a01d9834a805faca7bf8b50d041b4ca714d005d0dab1c50c" dependencies = [ - "indexmap 2.2.2", + "indexmap", "semver 1.0.21", ] [[package]] name = "wasmparser" -version = "0.121.0" +version = "0.121.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "953cf6a7606ab31382cb1caa5ae403e77ba70c7f8e12eeda167e7040d42bfda8" +checksum = "9dbe55c8f9d0dbd25d9447a5a889ff90c0cc3feaa7395310d3d826b2c703eaab" dependencies = [ "bitflags 2.4.2", - "indexmap 2.2.2", + "indexmap", "semver 1.0.21", ] [[package]] name = "wasmprinter" -version = "0.2.78" +version = "0.2.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05e32c13c59fdc64d3f6998a1d52eb1d362b6904a88b754190ccb85661ad577a" +checksum = "60e73986a6b7fdfedb7c5bf9e7eb71135486507c8fbc4c0c42cffcb6532988b7" dependencies = [ "anyhow", - "wasmparser 0.121.0", + "wasmparser 0.121.2", ] [[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", @@ -6387,20 +5599,19 @@ dependencies = [ "cfg-if", "encoding_rs", "fxprof-processed-profile", - "indexmap 2.2.2", + "indexmap", "libc", "log", "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.2", "wasmtime-cache", "wasmtime-component-macro", "wasmtime-component-util", @@ -6411,23 +5622,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", @@ -6439,15 +5650,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", @@ -6460,15 +5671,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", @@ -6483,7 +5694,7 @@ dependencies = [ "object", "target-lexicon", "thiserror", - "wasmparser 0.116.1", + "wasmparser 0.118.2", "wasmtime-cranelift-shared", "wasmtime-environ", "wasmtime-versioned-export-macros", @@ -6491,9 +5702,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", @@ -6507,22 +5718,22 @@ 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", "gimli", - "indexmap 2.2.2", + "indexmap", "log", "object", "serde", "serde_derive", "target-lexicon", "thiserror", - "wasm-encoder 0.36.2", - "wasmparser 0.116.1", + "wasm-encoder 0.38.1", + "wasmparser 0.118.2", "wasmprinter", "wasmtime-component-util", "wasmtime-types", @@ -6530,9 +5741,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", @@ -6540,14 +5751,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", @@ -6567,14 +5778,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", @@ -6584,63 +5795,63 @@ 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", "cfg-if", "encoding_rs", - "indexmap 2.2.2", + "indexmap", "libc", "log", "mach", "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.2", ] [[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", @@ -6649,9 +5860,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", @@ -6679,21 +5890,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.2", "wasmtime-cranelift-shared", "wasmtime-environ", "winch-codegen", @@ -6701,21 +5912,21 @@ 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", - "indexmap 2.2.2", + "indexmap", "wit-parser", ] [[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" @@ -6728,31 +5939,31 @@ dependencies = [ [[package]] name = "wast" -version = "70.0.2" +version = "200.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3d5061300042ff5065123dae1e27d00c03f567d34a2937c8472255148a216dc" +checksum = "d1810d14e6b03ebb8fb05eef4009ad5749c989b65197d83bce7de7172ed91366" dependencies = [ "bumpalo", "leb128", "memchr", "unicode-width", - "wasm-encoder 0.41.0", + "wasm-encoder 0.200.0", ] [[package]] name = "wat" -version = "1.0.85" +version = "1.200.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afd7357b6cc46d46a2509c43dcb1dd4131dafbf4e75562d87017b5a05ffad2d6" +checksum = "776cbd10e217f83869beaa3f40e312bb9e91d5eee29bbf6f560db1261b6a4c3d" dependencies = [ - "wast 70.0.2", + "wast 200.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", @@ -6766,9 +5977,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", @@ -6781,9 +5992,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", @@ -6796,9 +6007,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", @@ -6839,9 +6050,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", @@ -6849,7 +6060,7 @@ dependencies = [ "regalloc2", "smallvec", "target-lexicon", - "wasmparser 0.116.1", + "wasmparser 0.118.2", "wasmtime-environ", ] @@ -6996,9 +6207,18 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.37" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cad8365489051ae9f054164e459304af2e7e9bb407c958076c8bf4aef52da5" +checksum = "d90f4e0f530c4c69f62b80d839e9ef3855edc9cba471a160c4d692deed62b401" dependencies = [ "memchr", ] @@ -7025,8 +6245,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", @@ -7034,8 +6254,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", @@ -7044,8 +6264,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", @@ -7056,8 +6276,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", @@ -7070,32 +6290,32 @@ dependencies = [ [[package]] name = "wit-component" -version = "0.18.2" +version = "0.20.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a35a2a9992898c9d27f1664001860595a4bc99d32dd3599d547412e17d7e2" +checksum = "a4436190e87b4e539807bcdcf5b817e79d2e29e16bc5ddb6445413fe3d1f5716" dependencies = [ "anyhow", "bitflags 2.4.2", - "indexmap 2.2.2", + "indexmap", "log", "serde", "serde_derive", "serde_json", - "wasm-encoder 0.38.1", + "wasm-encoder 0.41.2", "wasm-metadata", - "wasmparser 0.118.1", + "wasmparser 0.121.2", "wit-parser", ] [[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", - "indexmap 2.2.2", + "indexmap", "log", "semver 1.0.21", "serde", @@ -7128,7 +6348,7 @@ dependencies = [ "log", "pharos", "rustc_version 0.4.0", - "send_wrapper 0.6.0", + "send_wrapper", "thiserror", "wasm-bindgen", "wasm-bindgen-futures", @@ -7144,12 +6364,6 @@ dependencies = [ "tap", ] -[[package]] -name = "yansi" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" - [[package]] name = "zerocopy" version = "0.7.32" @@ -7204,7 +6418,7 @@ dependencies = [ "crossbeam-utils", "flate2", "hmac", - "pbkdf2 0.11.0", + "pbkdf2", "sha1", "time", "zstd", diff --git a/Cargo.toml b/Cargo.toml index cd2c20f38..aef2f9a85 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" @@ -18,9 +18,10 @@ 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/kns_indexer/state", "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/terminal/namehash_to_name", "kinode/packages/terminal/net_diagnostics", "kinode/packages/terminal/peer", "kinode/packages/terminal/peers", "kinode/packages/tester/tester", "kinode/packages/tester/test_runner", ] default-members = ["lib"] diff --git a/README.md b/README.md index c2e5eafb5..a5ef37b60 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,6 @@ If you have questions, join the [Kinode discord](https://discord.gg/TCgdca5Bjt) ## Setup -### Building components - On certain operating systems, you may need to install these dependencies if they are not already present: - openssl-sys: https://docs.rs/crate/openssl-sys/0.9.19 - libclang 5.0: https://rust-lang.github.io/rust-bindgen/requirements.html @@ -22,7 +20,7 @@ On certain operating systems, you may need to install these dependencies if they ```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. @@ -39,20 +37,34 @@ cargo install cargo-wasi cargo +nightly build -p kinode ``` -### Boot +## Security Status + +No security audits of this crate have ever been performed. This software is under active development and should be **used at your own risk**. + +## Boot Get an eth-sepolia-rpc API key and pass that as an argument. You can get one for free at `alchemy.com`. Make sure not to use the same home directory for two nodes at once! You can use any name for the home directory: here we just use `home`. The `--` here separates cargo arguments from binary arguments. -TODO: document feature flags `--simulation-mode` +TODO: document feature flags in `--simulation-mode` ```bash # OPTIONAL: --release flag -cargo +nightly run -p kinode -- home --rpc wss:// --testnet +cargo +nightly run -p kinode -- home --testnet ``` -On boot you will be prompted to navigate to `localhost:8080`. Make sure your ETH wallet is connected to the Sepolia test network. Login should be straightforward, just submit the transactions and follow the flow. If you want to register a new ID you will either need [Sepolia testnet tokens](https://www.infura.io/faucet/sepolia) or an invite code. +On boot you will be prompted to navigate to `localhost:8080`. Make sure your browser wallet matches the network that the node is being booted on. Follow the registration UI -- if you want to register a new ID you will either need [Sepolia testnet tokens](https://www.infura.io/faucet/sepolia) or an invite code. + +## Configuring the ETH RPC Provider + +By default, a node will use the hardcoded providers for the network ([testnet](./kinode/default_providers_testnet.json)/[mainnet](./kinode/default_providers_mainnet.json)) it is booted on. A node can use a WebSockets RPC URL directly, or use another Kinode as a relay point. To adjust the providers a node uses, just create and modify the `.eth_providers` file in the node's home folder (set at boot). See the Kinode Book for more docs, and see the [default providers file here](./kinode/default_providers_testnet.json) for a template to create `.eth_providers`. + +You may also add a RPC provider or otherwise modify your configuration by sending messages from the terminal to the `eth:distro:sys` process. Use this message format to add a provider -- this will make your node's performance better when accessing a blockchain: +``` +m our@eth:distro:sys '{"AddProvider": {"chain_id": , "trusted": true, "provider": {"RpcUrl": ""}}}' +``` +We will soon add a settings GUI for this. -### Distro and Runtime processes +## Distro and Runtime processes The base OS install comes with certain runtime modules. These are interacted with in the same way as userspace processes, but are deeply ingrained to the system and the APIs they present at their Process IDs are assumed to be available by userspace processes. All of these are identified in the `distro:sys` package. @@ -79,11 +91,11 @@ The distro userspace packages are: - `homepage:sys` - `kns_indexer:sys` - `terminal:sys` -- `tester:sys` (only installed in if compiled with feature flag `simulation-mode`) +- `tester:sys` (used with `kit` for running test suites) The `sys` publisher is not a real node ID, but it's also not a special case value. Packages, whether runtime or userspace, installed from disk when a node bootstraps do not have their package ID or publisher node ID validated. Packages installed (not injected locally, as is done during development) after a node has booted will have their publisher field validated. -### Terminal syntax +## Terminal syntax - CTRL+C or CTRL+D to gracefully shutdown node - CTRL+V to toggle through verbose modes (0-3, 0 is default and lowest verbosity) @@ -99,7 +111,8 @@ The `sys` publisher is not a real node ID, but it's also not a special case valu - CTRL+R to search history, CTRL+R again to toggle through search results, CTRL+G to cancel search - `m
`: send an inter-process message.
is formatted as @. is formatted as ::. JSON containing spaces must be wrapped in single-quotes (`''`). - - Example: `m our@net:distro:sys diagnostics` + - Example: `m our@eth:distro:sys "SetPublic" -a 5` + - the '-a' flag is used to expect a response with a given timeout - `our` will always be interpolated by the system as your node's name - `hi `: send a text message to another node's command line. - Example: `hi ben.os hello world` @@ -110,6 +123,9 @@ The `sys` publisher is not a real node ID, but it's also not a special case valu - Example: `cat /terminal:sys/pkg/scripts.json` - `echo `: print `text` to the terminal - Example: `echo foo` +- `net_diagnostics`: print some useful networking diagnostic data +- `peers`: print the peers the node currently hold connections with +- `peer `: print the peer's PKI info, if it exists ### Terminal example usage 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 7dbf00d90..0d6ff474e 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" @@ -14,10 +14,10 @@ path = "src/main.rs" [build-dependencies] anyhow = "1.0.71" -kit = { git = "https://github.com/kinode-dao/kit", rev = "25b098f" } -reqwest = { version = "0.11.22", features = ["blocking"] } +kit = { git = "https://github.com/kinode-dao/kit", rev = "0e39c93" } +rayon = "1.8.1" sha2 = "0.10" -tokio = { version = "1.28", features = ["macros"] } +tokio = "1.28" walkdir = "2.4" zip = "0.6" @@ -26,6 +26,15 @@ simulation-mode = [] [dependencies] aes-gcm = "0.10.2" +alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" } +alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" } +alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4", features = ["ws"]} +alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" } +alloy-providers = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" } +alloy-primitives = "0.6.2" +alloy-sol-macro = "0.6.2" +alloy-sol-types = "0.6.2" +alloy-signer = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" } anyhow = "1.0.71" async-trait = "0.1.71" base64 = "0.13" @@ -41,8 +50,6 @@ curve25519-dalek = "^4.1.2" 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" @@ -79,6 +86,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" -zip = "0.6" +wasmtime = "17.0.1" +wasmtime-wasi = "17.0.1" +zip = "0.6" \ No newline at end of file diff --git a/kinode/build.rs b/kinode/build.rs index 0a051b6f2..1ea3b6ecb 100644 --- a/kinode/build.rs +++ b/kinode/build.rs @@ -1,90 +1,101 @@ +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()); - - kit::build::execute(&entry_path, false, false, false, true).await?; +fn build_and_zip_package( + entry_path: PathBuf, + parent_pkg_path: &str, +) -> anyhow::Result<(String, String, Vec)> { + let rt = tokio::runtime::Runtime::new().unwrap(); + rt.block_on(async { + kit::build::execute(&entry_path, 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((entry_path.display().to_string(), zip_filename, zip_contents)) + }) +} - // Add zip bytes to bootstrapped_processes.rs - writeln!( - bootstrapped_processes, - " (\"{}\", include_bytes!(\"{}\")),", - zip_filename, zip_path, - ) - .unwrap(); +fn main() -> anyhow::Result<()> { + if std::env::var("SKIP_BUILD_SCRIPT").is_ok() { + println!("Skipping build script"); + return Ok(()); } - 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(()); + + 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], &[u8])] = &[" + )?; + + for result in results { + match result { + Ok((entry_path, zip_filename, zip_contents)) => { + // Further processing, like saving ZIP files and updating bootstrapped_processes + let metadata_path = format!("{}/metadata.json", entry_path); + let zip_path = format!("{}/target/{}", parent_dir.display(), zip_filename); + fs::write(&zip_path, &zip_contents)?; + + writeln!( + bootstrapped_processes, + " (\"{}\", include_bytes!(\"{}\"), include_bytes!(\"{}\")),", + zip_filename, metadata_path, 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..924f09dc7 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", tag = "v0.6.0" } rand = "0.8" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" @@ -18,7 +17,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/app_store/src/http_api.rs b/kinode/packages/app_store/app_store/src/http_api.rs index 30bb66e89..f687f820f 100644 --- a/kinode/packages/app_store/app_store/src/http_api.rs +++ b/kinode/packages/app_store/app_store/src/http_api.rs @@ -1,7 +1,7 @@ use crate::{DownloadResponse, PackageListing, PackageState, RequestedPackage, State}; use kinode_process_lib::{ http::{send_response, IncomingHttpRequest, Method, StatusCode}, - print_to_terminal, Address, NodeId, PackageId, + Address, NodeId, PackageId, }; use serde_json::json; use std::collections::HashMap; @@ -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"), @@ -38,15 +38,21 @@ pub fn handle_http_request( )])), body, ), - Err(e) => { - print_to_terminal(1, &format!("http error: {:?}", e)); - send_response(StatusCode::INTERNAL_SERVER_ERROR, None, vec![]) - } + Err(_e) => send_response(StatusCode::INTERNAL_SERVER_ERROR, None, vec![]), } 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>, @@ -81,6 +87,7 @@ fn gen_package_info( "caps_approved": state.caps_approved, "mirroring": state.mirroring, "auto_update": state.auto_update, + "verified": state.verified, }), None => json!(null), }, @@ -93,25 +100,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" - }; - - // print_to_terminal(0, &format!("HTTP {method} {path} {bound_path}")); + let bound_path: &str = req.bound_path(Some(&our.process.to_string())); + let url_params = req.url_params(); match bound_path { // GET all downloaded apps @@ -120,7 +112,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 @@ -139,7 +131,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 @@ -158,11 +150,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 { @@ -188,8 +183,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 @@ -203,18 +228,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 { @@ -235,22 +263,31 @@ 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() + .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() - .ok_or(anyhow::anyhow!("No metadata for package {package_id}"))? + .expect("Package does not have metadata") + .properties .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 + .as_ref(); + let download_from = body_json + .get("download_from") + .unwrap_or(&json!(mirrors + .first() + .ok_or(anyhow::anyhow!("No mirrors for package {package_id}"))?)) + .as_str() + .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; let desired_version_hash = None; @@ -258,7 +295,7 @@ fn serve_paths( our, requested_packages, &package_id, - download_from, + &download_from, mirror, auto_update, &desired_version_hash, @@ -278,18 +315,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) { @@ -316,18 +356,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 => { @@ -342,18 +385,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 => { @@ -368,14 +414,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/app_store/app_store/src/icon b/kinode/packages/app_store/app_store/src/icon new file mode 100644 index 000000000..a4b7f043f --- /dev/null +++ b/kinode/packages/app_store/app_store/src/icon @@ -0,0 +1 @@ +data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIgAAACJCAYAAAD35nD3AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAxGSURBVHgB7Z1PbBx3Fcff+83u2nHtHLJBkChVndI4iUhQwFzCBURFQVV6rdQTPSAOSJx6ogIJCZVbxY1e4YAQlXpKVKlISOWSXLBUkVZJtqVJVMtuRZ0D66y9a8+8vvcbb7y2Z3dnZ2fm95uZ30dy9t9kvN757nvf936/mR9CxSC6uwBtnIF6MA/YaOgnfVqI3NjDdvj6zqa+neP/iRfaUCEQSooWQrd+CoLeSQhgAZR3AggWIA3Q3+B99fjT2+CfNdhRm3j8/JdQQkojEHp89zT/e4rvngZVPwFBMAN5olQXgp1HAPU1gN11fOrCGpSAwgqE6N0Z6J5/BnZ7Z8GrfyN3QYxDBOPvfA61xn2YufcQ8cUuFJBCCUSLYvsspw24bCRKTAP5D0UsOPvNFhSIQgiEaLUJnfYii+JSoUQRBUKbPcw6zOJKEQyv1QLZ8xXLXE6cglLCQgEWisV+xUqBlF8Yh5CoorwVG9OPVQKpnDAOI0Kh4F82RRQrBKJ7Fh36YWWFcRjlt2zxKEYFoquSztlLpTCfmeCzP7m4AgYxJhCdTlD9ILXuZlkxnHZyF4iOGlvnvst3LoNjAsxEk1wFor3GlrrmokZCJJocC27k6U1yEwh1P2GfAcvOa0yJDBJKNJm/eBtyIBeBUOfjqy6lpEwDb2P93C3ImEwFslelvODK14yQaQfH8B9ZppzMBOL8Rk5k7EsyEYgTR85kKJLUBaJHXre3rzkzmjNiXgO6kfbMtlQF4sRhmAxEkppAnDgsIWWRKEiB0HN0XnDisACEBtTwx/qYpLK7KXGG1FJSMq5TRZBwXMWJw0rkmGzRC/Txu1NF9elSTPecG421GfKacObsVZiCxAKhx3eWwadFcNhN4C3pY5WQRAIJpwZ6iX+pI2+85fCYTc7EAtGmVCb6OIoFH7Mklc3kEWSbI4fzHcVDjpme9zsZEwkknNNBS+AoKN4p2rwz0bSL2ALR4Ukm/DgKDvuRCVJN/AgiqcV1SouPdFonSDWxBELb/11yqaVMcKqJWdXEiyCB71JL2ZCqJkaXdaxAdJPFVS3lQ47p6aVL4zYbKZCw5+G51FJWKLg8LoqMjiCu51FuxLCOiSJDBRKWtc6Ylp4xUWR4BNl2Yy2VYEwUiRQI0UcN/sedy1IVRkSR6AjSnV103qNCjIgi0QJxfY/qgcFi1NNHBKI7bC56VA+CZlR39WgEUa7vUVkiqtYDAtHm1JW21QW9xcNm9WAEEXPqqC5iVp8+/8zgUwcFItc9d1Qbv3d+8OETgej0gt4z4Kg25DUH08x+BNlWiWY9O0qG7ok82+w/rO2/UluUWqcYqDPc/Xua/5gnfwggdiCAVfBgg432BjiSE57vpC+7uS8Qm1vrGMyBr5YA6XlQyOLw546cVUwUnmkc6EcsEGpxyX7diSUBNW01bspd/TGHl8JWr4CNEL3EovgR385BIuiWE0oCOsHf8GsX2mEE2aYm2AYhR4zgVZ1GaJrUh1chCK5y9rzBaeg6OOKxUJeM0g5NKtXsSi/EqQSD1/heesJFuMY7/gNHI/u+DDbS652Umz2B7J4EW5CUgvAyZEOTo8lrTiQx8MIv555APDs+sFAc1yBbnEjisKcJRf+TicnQAOMEV3IQR58m+P4vwTEc1oRoQ8GcBUP7SkwyZpVWokEulyE3QRaT+ZmmgtrcCTAN6QNlIOTrEtqlmmFg0FA8QGf2fFuJHgTfB1P4/qvgiIYrGQW0Y7aCIcNhHrnfQkHYhJOOLXFEkR8MEjbmSgT7kJp5g4pXjI8BIf5RvwdCEUn4HOEGp583h3ZgJfIFXI4T/QVQdYbvnJt9BG8P3UZSnK1dXlVjk4qeSYFcmaiFTtDiI8jdUPwzC/ufoMdcMmN0ORyQVEFceeFvhm4jZbt0cgGi9yNRSn6H3s5CkOalD2JOIBRzeqOM1AK9xbdv8qMb/HOLv+Fv8wuvZ9w+jxZJeODPjN5Ghgr20qdUTFHbBBiac70dRxoL8X736199j9+gB2b46YEh+6HgX/nn30NebPE+JAo9C9nAvoQ4DbJICfn3yDAAv+9h2wCs6p6Owp/z/fqY/Ty//zI+za9/Bzz1EUfKLbABYmnT49YvwBxv8LsYbZIlrYSRY8Q2HKqVeiP5iK9VsPdRb9riS1K5mH9yKE4F9cHYLcQABsEqlAOrhgIMCyQG2n/E2i7VhXQMI1Mc2PyqM2AY+wUSN20Q2DMinQbydwf+b/nWXBMRjAskzrdejN0YpCeBUM4TvhB+ZrIMVuFCvYag4NHYbaTTKf2Gkfsp+aCbQjOdRNaGYol0wRj4WbzN+FsEcHRZC90ap5eNjuVkzwd6uqQJWBs1MIlS/McHz4/dLvQhr2ohIN4LjWvAnkNd5W5fmcdMNsJWfi4LpEfRqwH5m9wvMzMnJPBXWSSd2EZU+wzuvj6ZxFyU83gSweLgfghSvCouCwhZIEGtzSbPzKRl3b+gWwc7igYgxS17Q40pafJ53rEjz/v+llFxCMFuu8ZN9q7hL6IMuhkUiAjUYNcy/JJ0Ip4H46h6m02qMtvSRR5WD0dmzUCeO1dmGLTDVQz1zJW5fQK6EbtjmiYyEozujLuh8JdXwSaa/4D0ZBp8C3KFVo2Vj0Vh7dMNJedfGm2W9SFq5XhqJFcI3p/AMRzWBJ57sRs6IfTtCLP5nD/bLx9dahkFhpllTyA1e0ZCMxWJpBUnjlj4uwMCMV3JHEZEQvA6pDnnVFdK6vdOHDGpzw5cQGZm+wF06mAVYYhjkZCMwchoZrIJNHpGmvd3bkiVZUJRPmx29RfpSZOfOq1X7L7CsggFr+h2+7jWPMm0PbzJ1dEHJZpplh8IGzi39I7cHRiswwf8yU60pmq+4C3Qs9lBrgYts8RPcpQ5MSAWUfwWR4qWLptlOwrAkQB/v2gZuEaZ/5A/eYsFMkAYFVYjrzxkQ4u66NRmH/Tv7n+ac/6XVvRDHOZZvbPev/tEIIjf6lnTD3GYY9d/KA2y/sOD8dhr3ANHtUHxovscFIiUuy7NVJsvPn0w+PCAQHSaoYMKclSIwG8NphchYkEhvwWOaqLwyLE/IhB86sKaNErAUS3I39TH/hDRTQNv1pnVqhHgStTT0QJptFvOrFYIObPhkDntEymQsCeiboOjGmD93mFz2md4X3que9tFkYrQ2R1amAwViIsiFcH3P9TTTocwemTLRZFyI96jiyODwEiBuChScsR7jIgewvixcR1F5PxdR6nQfY/nVsZtNlYgYRTB98FRLob0PQ4Ta3ZN2GHz18FRDmTM5fiFWM3Q+NOvOhxFnGEtPmIXtuNFDyG2QEIz48fescNSOLWMM6aDTDSBE+cv3nappsBMkFr6TD7Ddy54z1U1BWTC1NJnYoG4qqag8DGbJLX0SXSOQFjVKOdHCoNaiZrrEet/QkJ0kyViBpLDMsR3xGiIDWO6s4xmezfd7DOLEd/x+f1bMAVTX4BTr7t7TBZE9ubBYQ8iji28nsR3DJLKFVqdSCwjJXEIqV3Cl2i1CY87L9mxineFkW73VvBOGuIQUr3GsxOJYUQcwdx1PH4mNV+Y+kXAQ5G0f+LSTc5kIA4h9WslIPIb5Pznuq05oj0Hp5WUxSFktoyAM645kaIhjSKzq63oNyyRxA3uZQiuw/r9d7ISh/4NkAP0+JNlbuktgyM9ZDb68Ys3IWNyW6mGNu9cBvCWXYUzJXrSlr8STr3InlyXMnK+ZEqC3iPYrr2XZUo5jJG1rlzKSQCnFPji/sqwUySzwthiaC6axESqFJnLkXC4flqMCaSPiyZDEK8hJ62ttT7MO2oMYlwggo4ms2xgFZVzceSJ4fK147+fp9cY+k7AIujx3dO60gFDiywah4UhFYqhdBKFVQLpQ/+/ex48b6k6QrFPGH2sFEgfHVG8xiXwdxehlNgrjD5WC6TPE4+Cu6cLX/X0zWdnt2WDxxhHIQQyCG3dWQScWSpUVNGikPVv/BVZKNBkVTIphRNIH/r43Rn4+rMsFu8UIC1a18IXUXj4gKPFGnx272GRRDFIYQVyGO1XqN4EDBaBqJm7YPpRghSLYmfDZl8xCaURyGH0zLbt9gIELBpPNSHYXeCDmGxZswM7ZiEorwuKxdDrbkKj8SXM7Kwj2u8nklBagQxDp6bnvj0Pnc0Z8Oqh4fXp6FJshD2oQZgW/J1NmJvvwif/2SxqqkjKV9FAFhU6frmtAAAAAElFTkSuQmCC \ No newline at end of file diff --git a/kinode/packages/app_store/app_store/src/lib.rs b/kinode/packages/app_store/app_store/src/lib.rs index 96bb5901f..34c47f909 100644 --- a/kinode/packages/app_store/app_store/src/lib.rs +++ b/kinode/packages/app_store/app_store/src/lib.rs @@ -1,4 +1,3 @@ -use kinode_process_lib::eth::{EthAction, EthAddress, EthSubEvent, SubscribeLogsRequest}; use kinode_process_lib::http::{bind_http_path, serve_ui, HttpServerRequest}; use kinode_process_lib::kernel_types as kt; use kinode_process_lib::*; @@ -39,7 +38,10 @@ use ft_worker_lib::{ /// - uninstalled + deleted /// - set to automatically update if a new version is available -const CONTRACT_ADDRESS: &str = "0x18c39eB547A0060C6034f8bEaFB947D1C16eADF1"; +const ICON: &str = include_str!("icon"); + +const CHAIN_ID: u64 = 11155111; // sepolia +const CONTRACT_ADDRESS: &str = "0x18c39eB547A0060C6034f8bEaFB947D1C16eADF1"; // sepolia const EVENTS: [&str; 3] = [ "AppRegistered(uint256,string,bytes,string,bytes32)", @@ -56,7 +58,7 @@ pub enum Req { RemoteRequest(RemoteRequest), FTWorkerCommand(FTWorkerCommand), FTWorkerResult(FTWorkerResult), - Eth(EthSubEvent), + Eth(eth::EthSubResult), Http(HttpServerRequest), } @@ -68,9 +70,36 @@ pub enum Resp { FTWorkerResult(FTWorkerResult), } +fn fetch_logs(eth_provider: ð::Provider, filter: ð::Filter) -> Vec { + loop { + match eth_provider.get_logs(filter) { + Ok(res) => return res, + Err(_) => { + println!("failed to fetch logs! trying again in 5s..."); + std::thread::sleep(std::time::Duration::from_secs(5)); + continue; + } + } + } +} + +fn subscribe_to_logs(eth_provider: ð::Provider, filter: eth::Filter) { + loop { + match eth_provider.subscribe(1, filter.clone()) { + Ok(()) => break, + Err(_) => { + println!("failed to subscribe to chain! trying again in 5s..."); + std::thread::sleep(std::time::Duration::from_secs(5)); + continue; + } + } + } + println!("subscribed to logs successfully"); +} + call_init!(init); fn init(our: Address) { - println!("{}: started", our.package()); + println!("started"); for path in [ "/apps", @@ -92,40 +121,69 @@ fn init(our: Address) { ) .expect("failed to serve static UI"); + // add ourselves to the homepage + Request::to(("our", "homepage", "homepage", "sys")) + .body( + serde_json::json!({ + "Add": { + "label": "App Store", + "icon": ICON, + "path": "/" // just our root + } + }) + .to_string() + .as_bytes() + .to_vec(), + ) + .send() + .unwrap(); + // load in our saved state or initalize a new one if none exists let mut state = get_typed_state(|bytes| Ok(bincode::deserialize(bytes)?)) .unwrap_or(State::new(CONTRACT_ADDRESS.to_string()).unwrap()); if state.contract_address != CONTRACT_ADDRESS { - println!("app store: warning: contract address mismatch--overwriting saved state"); + println!("warning: contract address mismatch--overwriting saved state"); state = State::new(CONTRACT_ADDRESS.to_string()).unwrap(); } - println!( - "app store: indexing on contract address {}", - state.contract_address - ); + println!("indexing on contract address {}", state.contract_address); + + // create new provider for sepolia with request-timeout of 60s + // can change, log requests can take quite a long time. + let eth_provider = eth::Provider::new(CHAIN_ID, 60); let mut requested_packages: HashMap = HashMap::new(); - // subscribe to events on the app store contract - SubscribeLogsRequest::new(1) // subscription id 1 - .address(EthAddress::from_str(&state.contract_address).unwrap()) + // get past logs, subscribe to new ones. + let filter = eth::Filter::new() + .address(eth::Address::from_str(&state.contract_address).unwrap()) .from_block(state.last_saved_block - 1) - .events(EVENTS) - .send() - .unwrap(); + .to_block(eth::BlockNumberOrTag::Latest) + .events(EVENTS); + + for log in fetch_logs(ð_provider, &filter) { + if let Err(e) = state.ingest_listings_contract_event(&our, log) { + println!("error ingesting log: {e:?}"); + }; + } + subscribe_to_logs(ð_provider, filter); loop { match await_message() { Err(send_error) => { // TODO handle these based on what they are triggered by - println!("app store: got network error: {send_error}"); + println!("got network error: {send_error}"); } Ok(message) => { - if let Err(e) = handle_message(&our, &mut state, &mut requested_packages, &message) - { - println!("app store: error handling message: {:?}", e) + if let Err(e) = handle_message( + &our, + &mut state, + ð_provider, + &mut requested_packages, + &message, + ) { + println!("error handling message: {:?}", e) } } } @@ -139,6 +197,7 @@ fn init(our: Address) { fn handle_message( our: &Address, mut state: &mut State, + eth_provider: ð::Provider, mut requested_packages: &mut HashMap, message: &Message, ) -> anyhow::Result<()> { @@ -153,8 +212,13 @@ fn handle_message( if our.node != source.node { return Err(anyhow::anyhow!("local request from non-local node")); } - let resp = - handle_local_request(&our, &local_request, &mut state, &mut requested_packages); + let resp = handle_local_request( + &our, + &local_request, + &mut state, + eth_provider, + &mut requested_packages, + ); if expects_response.is_some() { Response::new().body(serde_json::to_vec(&resp)?).send()?; } @@ -172,13 +236,26 @@ fn handle_message( spawn_receive_transfer(&our, &body)?; } Req::FTWorkerResult(r) => { - println!("app store: got weird ft_worker result: {r:?}"); + println!("got weird ft_worker result: {r:?}"); } - Req::Eth(e) => { + 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(&mut state, e)?; + if let Ok(eth::EthSub { result, .. }) = eth_result { + handle_eth_sub_event(our, &mut state, result)?; + } else { + println!("got eth subscription error"); + // attempt to resubscribe + subscribe_to_logs( + ð_provider, + eth::Filter::new() + .address(eth::Address::from_str(&state.contract_address).unwrap()) + .from_block(state.last_saved_block - 1) + .to_block(eth::BlockNumberOrTag::Latest) + .events(EVENTS), + ); + } } Req::Http(incoming) => { if source.node() != our.node() @@ -187,14 +264,14 @@ 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)?; } } }, Message::Response { body, context, .. } => { // the only kind of response we care to handle here! let Some(context) = context else { - return Err(anyhow::anyhow!("app store: missing context")); + return Err(anyhow::anyhow!("missing context")); }; handle_ft_worker_result(body, context)?; } @@ -254,6 +331,7 @@ fn handle_local_request( our: &Address, request: &LocalRequest, state: &mut State, + eth_provider: ð::Provider, requested_packages: &mut HashMap, ) -> LocalResponse { match request { @@ -268,7 +346,9 @@ 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 + manifest_hash: None, // generated in the add fn mirroring: *mirror, auto_update: false, // can't auto-update a local package metadata: None, // TODO @@ -321,16 +401,21 @@ 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(&EthAction::UnsubscribeLogs(1)).unwrap()) - .send() - .unwrap(); - SubscribeLogsRequest::new(1) // subscription id 1 - .address(EthAddress::from_str(&state.contract_address).unwrap()) + eth_provider + .unsubscribe(1) + .expect("app_store: failed to unsub from eth events!"); + + let filter = eth::Filter::new() + .address(eth::Address::from_str(&state.contract_address).unwrap()) .from_block(state.last_saved_block - 1) - .events(EVENTS) - .send() - .unwrap(); + .events(EVENTS); + + for log in fetch_logs(ð_provider, &filter) { + if let Err(e) = state.ingest_listings_contract_event(our, log) { + println!("error ingesting log: {e:?}"); + }; + } + subscribe_to_logs(ð_provider, filter); LocalResponse::RebuiltIndex } } @@ -385,70 +470,112 @@ fn handle_receive_download( let package_name = package_name[1..].trim_end_matches(".zip"); let Ok(package_id) = package_name.parse::() else { return Err(anyhow::anyhow!( - "app store: bad package filename fron download: {package_name}" + "bad package filename fron download: {package_name}" )); }; - println!("app store: successfully received {}", package_id); + println!("successfully received {}", package_id); // only save the package if we actually requested it let Some(requested_package) = requested_packages.remove(&package_id) else { - return Err(anyhow::anyhow!( - "app store: received unrequested package--rejecting!" - )); + return Err(anyhow::anyhow!("received unrequested package--rejecting!")); }; let Some(blob) = get_blob() else { - return Err(anyhow::anyhow!( - "app store: received download but found no blob" - )); + return Err(anyhow::anyhow!("received download but found no blob")); }; // 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 desired version--rejecting download! download hash: {download_hash}, desired hash: {hash}" + )); + } + } else { + verified = true; } } 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!" + "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!" - )); - } + let Some(metadata) = &package_listing.metadata else { + return Err(anyhow::anyhow!( + "downloaded package has no metadata to check validity against!" + )); + }; + let Some(latest_hash) = metadata + .properties + .code_hashes + .get(&metadata.properties.current_version) + else { + return Err(anyhow::anyhow!( + "downloaded package has no versions in manager--rejecting download!" + )); + }; + if &download_hash != latest_hash { + 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!( - "app store: downloaded package has no versions in manager--rejecting download!" + "downloaded package is not latest version--rejecting download! download hash: {download_hash}, latest hash: {latest_hash}" )); } } else { - println!("app store: warning: downloaded package has no listing metadata to check validity against!") + verified = true; } } } + 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 { mirrored_from: Some(requested_package.from), our_version: download_hash, installed: false, + verified, 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<()> { @@ -456,7 +583,7 @@ fn handle_ft_worker_result(body: &[u8], context: &[u8]) -> anyhow::Result<()> { let context = serde_json::from_slice::(context)?; if let FTWorkerResult::SendSuccess = ft_worker_result { println!( - "app store: successfully shared {} in {:.4}s", + "successfully shared {} in {:.4}s", context.file_name, std::time::SystemTime::now() .duration_since(context.start_time) @@ -464,17 +591,21 @@ fn handle_ft_worker_result(body: &[u8], context: &[u8]) -> anyhow::Result<()> { .as_secs_f64(), ); } else { - return Err(anyhow::anyhow!("app store: failed to share app")); + return Err(anyhow::anyhow!("failed to share app")); } } Ok(()) } -fn handle_eth_sub_event(state: &mut State, event: EthSubEvent) -> anyhow::Result<()> { - let EthSubEvent::Log(log) = event else { - return Err(anyhow::anyhow!("app store: got non-log event")); +fn handle_eth_sub_event( + our: &Address, + state: &mut State, + event: eth::SubscriptionResult, +) -> anyhow::Result<()> { + let eth::SubscriptionResult::Log(log) = event else { + return Err(anyhow::anyhow!("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> { @@ -511,7 +642,7 @@ pub fn handle_install( "drive": drive_path, }))?, ) else { - return Err(anyhow::anyhow!("app store: no read cap")); + return Err(anyhow::anyhow!("no read cap")); }; let Some(write_cap) = get_capability( &Address::new(&our.node, ("vfs", "distro", "sys")), @@ -520,13 +651,13 @@ pub fn handle_install( "drive": drive_path, }))?, ) else { - return Err(anyhow::anyhow!("app store: no write cap")); + return Err(anyhow::anyhow!("no write cap")); }; let Some(networking_cap) = get_capability( &Address::new(&our.node, ("kernel", "distro", "sys")), &"\"network\"".to_string(), ) else { - return Err(anyhow::anyhow!("app store: no net cap")); + return Err(anyhow::anyhow!("no net cap")); }; // first, for each process in manifest, initialize it // then, once all have been initialized, grant them requested caps @@ -540,7 +671,7 @@ pub fn handle_install( let wasm_path = format!("{}{}", drive_path, wasm_path); let process_id = format!("{}:{}", entry.process_name, package_id); let Ok(parsed_new_process_id) = process_id.parse::() else { - return Err(anyhow::anyhow!("app store: invalid process id!")); + return Err(anyhow::anyhow!("invalid process id!")); }; // kill process if it already exists Request::to(("our", "kernel", "distro", "sys")) @@ -638,7 +769,7 @@ pub fn handle_install( for entry in &manifest { let process_id = format!("{}:{}", entry.process_name, package_id); let Ok(parsed_new_process_id) = process_id.parse::() else { - return Err(anyhow::anyhow!("app store: invalid process id!")); + return Err(anyhow::anyhow!("invalid process id!")); }; for value in &entry.grant_capabilities { match value { diff --git a/kinode/packages/app_store/app_store/src/types.rs b/kinode/packages/app_store/app_store/src/types.rs index 3e9504f6c..afef5d014 100644 --- a/kinode/packages/app_store/app_store/src/types.rs +++ b/kinode/packages/app_store/app_store/src/types.rs @@ -1,5 +1,6 @@ -use alloy_rpc_types::Log; +use crate::LocalRequest; 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}; @@ -49,22 +50,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 OnchainPackageMetadata { - 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 metadata: Option, } #[derive(Debug, Serialize, Deserialize)] @@ -85,12 +71,14 @@ 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, + 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? pub auto_update: bool, - pub metadata: Option, + pub metadata: Option, } /// this process's saved state @@ -120,7 +108,7 @@ impl State { /// To create a new state, we populate the downloaded_packages map /// with all packages parseable from our filesystem. pub fn new(contract_address: String) -> anyhow::Result { - crate::print_to_terminal(1, "app store: producing new state"); + crate::print_to_terminal(1, "producing new state"); let mut state = State { contract_address, last_saved_block: 1, @@ -128,10 +116,7 @@ impl State { listed_packages: HashMap::new(), downloaded_packages: HashMap::new(), }; - crate::print_to_terminal( - 1, - &format!("populate: {:?}", state.populate_packages_from_filesystem()), - ); + state.populate_packages_from_filesystem()?; Ok(state) } @@ -171,7 +156,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 +200,14 @@ impl State { })?) .blob(blob) .send_and_await_response(5)??; + + let manifest_file = vfs::File { + path: format!("/{}/pkg/manifest.json", package_id), + timeout: 5, + }; + 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); @@ -276,12 +269,10 @@ impl State { return Err(anyhow::anyhow!("vfs: bad response")); }; let response = serde_json::from_slice::(&body)?; - crate::print_to_terminal(1, &format!("vfs response: {:?}", response)); let vfs::VfsResponse::ReadDir(entries) = response else { return Err(anyhow::anyhow!("vfs: unexpected response: {:?}", response)); }; for entry in entries { - crate::print_to_terminal(1, &format!("entry: {:?}", entry)); // ignore non-package dirs let Ok(package_id) = entry.path.parse::() else { continue; @@ -289,6 +280,7 @@ impl State { if entry.file_type == vfs::FileType::Directory { let zip_file = vfs::File { path: format!("/{}/pkg/{}.zip", package_id, package_id), + timeout: 5, }; let Ok(zip_file_bytes) = zip_file.read() else { continue; @@ -296,6 +288,11 @@ 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), + timeout: 5, + }; + 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. @@ -305,7 +302,9 @@ 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 + manifest_hash: Some(generate_metadata_hash(&manifest_bytes)), mirroring: false, auto_update: false, metadata: None, @@ -357,15 +356,19 @@ impl State { self.downloaded_packages.remove(package_id); crate::set_state(&bincode::serialize(self)?); - println!("app store: uninstalled {package_id}"); + println!("uninstalled {package_id}"); Ok(()) } /// 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"))? + .ok_or(anyhow::anyhow!("got log with no block number"))? .try_into()?; // let package_hash: alloy_primitives::U256 = log.topics[1].into(); @@ -382,27 +385,32 @@ impl State { crate::print_to_terminal( 1, &format!( - "app registered with publisher_dnswire {:?}, package_hash {}, package_name {}, metadata_url {}, metadata_hash {}", - publisher_dnswire, package_hash, package_name, metadata_url, metadata_hash - ) + "app registered with package_name {}, metadata_url {}, metadata_hash {}", + package_name, metadata_url, metadata_hash + ), ); if generate_package_hash(&package_name, publisher_dnswire.as_slice()) != package_hash { - return Err(anyhow::anyhow!( - "app store: got log with mismatched package hash" - )); + return Err(anyhow::anyhow!("got log with mismatched package hash")); } let Ok(publisher_name) = dnswire_decode(publisher_dnswire.as_slice()) else { - return Err(anyhow::anyhow!( - "app store: got log with invalid publisher name" - )); + return Err(anyhow::anyhow!("got log with invalid publisher name")); }; 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!( + "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,49 +435,60 @@ impl State { AppMetadataUpdated::abi_decode_data(&log.data, false)?; let metadata_hash = metadata_hash.to_string(); - crate::print_to_terminal( - 1, - &format!( - "app metadata updated with package_hash {}, metadata_url {}, metadata_hash {}", - package_hash, metadata_url, metadata_hash - ) - ); - let current_listing = self .get_listing_with_hash_mut(&package_hash.to_string()) - .ok_or(anyhow::anyhow!( - "app store: got log with no matching listing" - ))?; + .ok_or(anyhow::anyhow!("got log with no matching listing"))?; 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!( + "metadata publisher name mismatch: got {}, expected {}", + metadata.properties.publisher, current_listing.publisher + ))); + } + Some(metadata) + } Err(e) => { - crate::print_to_terminal( - 1, - &format!("app store: failed to fetch metadata: {e:?}"), - ); + crate::print_to_terminal(1, &format!("failed to fetch metadata: {e:?}")); None } }; 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!("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]); let to = alloy_primitives::Address::from_word(log.topics[2]); let package_hash = log.topics[3].to_string(); - crate::print_to_terminal( - 1, - &format!( - "handling transfer from {} to {} of pkghash {}", - from, to, package_hash - ), - ); - if from == alloy_primitives::Address::ZERO { - crate::print_to_terminal(1, "transfer from 0 address: new app listed"); match self.get_listing_with_hash_mut(&package_hash) { Some(current_listing) => { current_listing.owner = to.to_string(); @@ -486,15 +505,11 @@ impl State { } } } else if to == alloy_primitives::Address::ZERO { - crate::print_to_terminal(1, "transfer to 0 address: deleting listing"); self.delete_listing(&package_hash); } else { - crate::print_to_terminal(1, "transferring listing"); - let current_listing = - self.get_listing_with_hash_mut(&package_hash) - .ok_or(anyhow::anyhow!( - "app store: got log with no matching listing" - ))?; + let current_listing = self + .get_listing_with_hash_mut(&package_hash) + .ok_or(anyhow::anyhow!("got log with no matching listing"))?; current_listing.owner = to.to_string(); } } @@ -538,10 +553,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 +561,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/download/Cargo.toml b/kinode/packages/app_store/download/Cargo.toml index 0c0b563b5..d1b2a87ff 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", tag = "v0.6.0" } 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..67e66c6a5 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", tag = "v0.6.0" } 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..4fb46afd2 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", tag = "v0.6.0" } 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/metadata.json b/kinode/packages/app_store/metadata.json new file mode 100644 index 000000000..43106e135 --- /dev/null +++ b/kinode/packages/app_store/metadata.json @@ -0,0 +1,16 @@ +{ + "name": "App Store", + "description": "A package manager + app store.", + "image": "", + "properties": { + "package_name": "app_store", + "current_version": "0.3.0", + "publisher": "sys", + "mirrors": [], + "code_hashes": { + "0.3.0": "" + } + }, + "external_url": "https://kinode.org", + "animation_url": "" +} \ No newline at end of file diff --git a/kinode/packages/app_store/pkg/manifest.json b/kinode/packages/app_store/pkg/manifest.json index 5112319d4..14181b63a 100644 --- a/kinode/packages/app_store/pkg/manifest.json +++ b/kinode/packages/app_store/pkg/manifest.json @@ -7,12 +7,19 @@ "request_capabilities": [ "terminal:terminal:sys", "filesystem:distro:sys", + "homepage:homepage:sys", "http_server:distro:sys", "http_client:distro:sys", "net:distro:sys", "vfs:distro:sys", "kernel:distro:sys", "eth:distro:sys", + { + "process": "eth:distro:sys", + "params": { + "root": true + } + }, "sqlite:distro:sys", "kv:distro:sys", "chess:chess:sys", diff --git a/kinode/packages/app_store/pkg/metadata.json b/kinode/packages/app_store/pkg/metadata.json deleted file mode 100644 index ec1a13569..000000000 --- a/kinode/packages/app_store/pkg/metadata.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "package": "app_store", - "publisher": "sys", - "version": [ - 0, - 2, - 0 - ], - "description": "A package manager + app store." -} \ No newline at end of file diff --git a/kinode/packages/app_store/pkg/ui/assets/background-a451R5-M.jpg b/kinode/packages/app_store/pkg/ui/assets/background-a451R5-M.jpg new file mode 100644 index 000000000..e40de63eb Binary files /dev/null and b/kinode/packages/app_store/pkg/ui/assets/background-a451R5-M.jpg differ diff --git a/kinode/packages/app_store/pkg/ui/assets/index-CPkF34RS.js b/kinode/packages/app_store/pkg/ui/assets/index-CPkF34RS.js new file mode 100644 index 000000000..12927c6c4 --- /dev/null +++ b/kinode/packages/app_store/pkg/ui/assets/index-CPkF34RS.js @@ -0,0 +1,90 @@ +var iw=Object.defineProperty;var ow=(t,e,r)=>e in t?iw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var zh=(t,e,r)=>(ow(t,typeof e!="symbol"?e+"":e,r),r);function sw(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 Uo(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Fo(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 jm={exports:{}},hu={},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"),lw=Symbol.for("react.portal"),aw=Symbol.for("react.fragment"),uw=Symbol.for("react.strict_mode"),cw=Symbol.for("react.profiler"),fw=Symbol.for("react.provider"),dw=Symbol.for("react.context"),hw=Symbol.for("react.forward_ref"),pw=Symbol.for("react.suspense"),mw=Symbol.for("react.memo"),gw=Symbol.for("react.lazy"),$h=Symbol.iterator;function vw(t){return t===null||typeof t!="object"?null:(t=$h&&t[$h]||t["@@iterator"],typeof t=="function"?t:null)}var Um={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Fm=Object.assign,zm={};function zo(t,e,r){this.props=t,this.context=e,this.refs=zm,this.updater=r||Um}zo.prototype.isReactComponent={};zo.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")};zo.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function $m(){}$m.prototype=zo.prototype;function kd(t,e,r){this.props=t,this.context=e,this.refs=zm,this.updater=r||Um}var Nd=kd.prototype=new $m;Nd.constructor=kd;Fm(Nd,zo.prototype);Nd.isPureReactComponent=!0;var Hh=Array.isArray,Hm=Object.prototype.hasOwnProperty,Pd={current:null},qm={key:!0,ref:!0,__self:!0,__source:!0};function Wm(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)Hm.call(e,n)&&!qm.hasOwnProperty(n)&&(i[n]=e[n]);var l=arguments.length-2;if(l===1)i.children=r;else if(1>>1,h=_[k];if(0>>1;ki(y,R))ji(U,y)?(_[k]=U,_[j]=R,k=j):(_[k]=y,_[Z]=R,k=Z);else if(ji(U,R))_[k]=U,_[j]=R,k=j;else break e}}return I}function i(_,I){var R=_.sortIndex-I.sortIndex;return R!==0?R:_.id-I.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,g=!1,v=!1,E=!1,N=typeof setTimeout=="function"?setTimeout:null,x=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 I=r(u);I!==null;){if(I.callback===null)n(u);else if(I.startTime<=_)n(u),I.sortIndex=I.expirationTime,e(a,I);else break;I=r(u)}}function T(_){if(E=!1,b(_),!v)if(r(a)!==null)v=!0,A(B);else{var I=r(u);I!==null&&S(T,I.startTime-_)}}function B(_,I){v=!1,E&&(E=!1,x(H),H=-1),g=!0;var R=m;try{for(b(I),d=r(a);d!==null&&(!(d.expirationTime>I)||_&&!X());){var k=d.callback;if(typeof k=="function"){d.callback=null,m=d.priorityLevel;var h=k(d.expirationTime<=I);I=t.unstable_now(),typeof h=="function"?d.callback=h:d===r(a)&&n(a),b(I)}else n(a);d=r(a)}if(d!==null)var C=!0;else{var Z=r(u);Z!==null&&S(T,Z.startTime-I),C=!1}return C}finally{d=null,m=R,g=!1}}var D=!1,$=null,H=-1,Y=5,Q=-1;function X(){return!(t.unstable_now()-Q_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Y=0<_?Math.floor(1e3/_):5},t.unstable_getCurrentPriorityLevel=function(){return m},t.unstable_getFirstCallbackNode=function(){return r(a)},t.unstable_next=function(_){switch(m){case 1:case 2:case 3:var I=3;break;default:I=m}var R=m;m=I;try{return _()}finally{m=R}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(_,I){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var R=m;m=_;try{return I()}finally{m=R}},t.unstable_scheduleCallback=function(_,I,R){var k=t.unstable_now();switch(typeof R=="object"&&R!==null?(R=R.delay,R=typeof R=="number"&&0k?(_.sortIndex=R,e(u,_),r(a)===null&&_===r(u)&&(E?(x(H),H=-1):E=!0,S(T,R-k))):(_.sortIndex=h,e(a,_),v||g||(v=!0,A(B))),_},t.unstable_shouldYield=X,t.unstable_wrapCallback=function(_){var I=m;return function(){var R=m;m=I;try{return _.apply(this,arguments)}finally{m=R}}}})(Qm);Km.exports=Qm;var Cw=Km.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 Jm=L,pr=Cw;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"),df=Object.prototype.hasOwnProperty,Mw=/^[: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 Iw(t){return df.call(Gh,t)?!0:df.call(Wh,t)?!1:Mw.test(t)?Gh[t]=!0:(Wh[t]=!0,!1)}function Rw(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 Tw(t,e,r,n){if(e===null||typeof e>"u"||Rw(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 Md=/[\-:]([a-z])/g;function Id(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(Md,Id);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(Md,Id);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(Md,Id);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 Rd(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{pc=!1,Error.prepareStackTrace=r}return(t=t?t.displayName||t.name:"")?fs(t):""}function Ow(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=mc(t.type,!1),t;case 11:return t=mc(t.type.render,!1),t;case 1:return t=mc(t.type,!0),t;default:return""}}function gf(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 eo:return"Fragment";case Zi:return"Portal";case hf:return"Profiler";case Td:return"StrictMode";case pf:return"Suspense";case mf:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Zm:return(t.displayName||"Context")+".Consumer";case Xm:return(t._context.displayName||"Context")+".Provider";case Od:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Ld:return e=t.displayName||null,e!==null?e:gf(t.type)||"Memo";case Jn:e=t._payload,t=t._init;try{return gf(t(e))}catch{}}return null}function Lw(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 gf(e);case 8:return e===Td?"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 tg(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function Bw(t){var e=tg(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 Nl(t){t._valueTracker||(t._valueTracker=Bw(t))}function rg(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var r=e.getValue(),n="";return t&&(n=tg(t)?t.checked?"true":"false":t.value),t=n,t!==r?(e.setValue(t),!0):!1}function ka(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 vf(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 ng(t,e){e=e.checked,e!=null&&Rd(t,"checked",e,!1)}function yf(t,e){ng(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")?wf(t,e.type,r):e.hasOwnProperty("defaultValue")&&wf(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 wf(t,e,r){(e!=="number"||ka(t.ownerDocument)!==t)&&(r==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+r&&(t.defaultValue=""+r))}var ds=Array.isArray;function vo(t,e,r,n){if(t=t.options,e){e={};for(var i=0;i"+e.valueOf().toString()+"",e=Pl.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},jw=["Webkit","ms","Moz","O"];Object.keys(ws).forEach(function(t){jw.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ws[e]=ws[t]})});function lg(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 ag(t,e){t=t.style;for(var r in e)if(e.hasOwnProperty(r)){var n=r.indexOf("--")===0,i=lg(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 bf(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 _f=null;function Bd(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Sf=null,yo=null,wo=null;function Xh(t){if(t=ml(t)){if(typeof Sf!="function")throw Error(q(280));var e=t.stateNode;e&&(e=yu(e),Sf(t.stateNode,t.type,e))}}function ug(t){yo?wo?wo.push(t):wo=[t]:yo=t}function cg(){if(yo){var t=yo,e=wo;if(wo=yo=null,Xh(t),e)for(t=0;t>>=0,t===0?32:31-(Qw(t)/Jw|0)|0}var Cl=64,Ml=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 Ma(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 e2(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=Es),l0=" ",a0=!1;function Mg(t,e){switch(t){case"keyup":return P2.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ig(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var to=!1;function M2(t,e){switch(t){case"compositionend":return Ig(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 I2(t,e){if(to)return t==="compositionend"||!qd&&Mg(t,e)?(t=Pg(),ia=zd=ri=null,to=!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 Lg(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Lg(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Bg(){for(var t=window,e=ka();e instanceof t.HTMLIFrameElement;){try{var r=typeof e.contentWindow.location.href=="string"}catch{r=!1}if(r)t=e.contentWindow;else break;e=ka(t.document)}return e}function Wd(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 F2(t){var e=Bg(),r=t.focusedElem,n=t.selectionRange;if(e!==r&&r&&r.ownerDocument&&Lg(r.ownerDocument.documentElement,r)){if(n!==null&&Wd(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,ro=null,If=null,As=null,Rf=!1;function p0(t,e,r){var n=r.window===r?r.document:r.nodeType===9?r:r.ownerDocument;Rf||ro==null||ro!==ka(n)||(n=ro,"selectionStart"in n&&Wd(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}),As&&Us(As,n)||(As=n,n=Ta(If,"onSelect"),0oo||(t.current=Df[oo],Df[oo]=null,oo--)}function Qe(t,e){oo++,Df[oo]=t.current,t.current=e}var mi={},zt=wi(mi),er=wi(!1),Ri=mi;function No(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 La(){tt(er),tt(zt)}function E0(t,e,r){if(zt.current!==mi)throw Error(q(168));Qe(zt,e),Qe(er,r)}function Wg(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,Lw(t)||"Unknown",i));return ft({},r,n)}function Ba(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||mi,Ri=zt.current,Qe(zt,t),Qe(er,er.current),!0}function b0(t,e,r){var n=t.stateNode;if(!n)throw Error(q(169));r?(t=Wg(t,e,Ri),n.__reactInternalMemoizedMergedChildContext=t,tt(er),tt(zt),Qe(zt,t)):tt(er),Qe(er,r)}var bn=null,wu=!1,Cc=!1;function Gg(t){bn===null?bn=[t]:bn.push(t)}function X2(t){wu=!0,Gg(t)}function xi(){if(!Cc&&bn!==null){Cc=!0;var t=0,e=Re;try{var r=bn;for(Re=1;t>=s,i-=s,Sn=1<<32-Wr(e)+i|r<H?(Y=$,$=null):Y=$.sibling;var Q=m(x,$,b[H],T);if(Q===null){$===null&&($=Y);break}t&&$&&Q.alternate===null&&e(x,$),w=o(Q,w,H),D===null?B=Q:D.sibling=Q,D=Q,$=Y}if(H===b.length)return r(x,$),nt&&Ai(x,H),B;if($===null){for(;HH?(Y=$,$=null):Y=$.sibling;var X=m(x,$,Q.value,T);if(X===null){$===null&&($=Y);break}t&&$&&X.alternate===null&&e(x,$),w=o(X,w,H),D===null?B=X:D.sibling=X,D=X,$=Y}if(Q.done)return r(x,$),nt&&Ai(x,H),B;if($===null){for(;!Q.done;H++,Q=b.next())Q=d(x,Q.value,T),Q!==null&&(w=o(Q,w,H),D===null?B=Q:D.sibling=Q,D=Q);return nt&&Ai(x,H),B}for($=n(x,$);!Q.done;H++,Q=b.next())Q=g($,x,H,Q.value,T),Q!==null&&(t&&Q.alternate!==null&&$.delete(Q.key===null?H:Q.key),w=o(Q,w,H),D===null?B=Q:D.sibling=Q,D=Q);return t&&$.forEach(function(ie){return e(x,ie)}),nt&&Ai(x,H),B}function N(x,w,b,T){if(typeof b=="object"&&b!==null&&b.type===eo&&b.key===null&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case kl:e:{for(var B=b.key,D=w;D!==null;){if(D.key===B){if(B=b.type,B===eo){if(D.tag===7){r(x,D.sibling),w=i(D,b.props.children),w.return=x,x=w;break e}}else if(D.elementType===B||typeof B=="object"&&B!==null&&B.$$typeof===Jn&&C0(B)===D.type){r(x,D.sibling),w=i(D,b.props),w.ref=rs(x,D,b),w.return=x,x=w;break e}r(x,D);break}else e(x,D);D=D.sibling}b.type===eo?(w=Mi(b.props.children,x.mode,T,b.key),w.return=x,x=w):(T=da(b.type,b.key,b.props,null,x.mode,T),T.ref=rs(x,w,b),T.return=x,x=T)}return s(x);case Zi:e:{for(D=b.key;w!==null;){if(w.key===D)if(w.tag===4&&w.stateNode.containerInfo===b.containerInfo&&w.stateNode.implementation===b.implementation){r(x,w.sibling),w=i(w,b.children||[]),w.return=x,x=w;break e}else{r(x,w);break}else e(x,w);w=w.sibling}w=jc(b,x.mode,T),w.return=x,x=w}return s(x);case Jn:return D=b._init,N(x,w,D(b._payload),T)}if(ds(b))return v(x,w,b,T);if(Yo(b))return E(x,w,b,T);jl(x,b)}return typeof b=="string"&&b!==""||typeof b=="number"?(b=""+b,w!==null&&w.tag===6?(r(x,w.sibling),w=i(w,b),w.return=x,x=w):(r(x,w),w=Bc(b,x.mode,T),w.return=x,x=w),s(x)):r(x,w)}return N}var Co=ev(!0),tv=ev(!1),gl={},an=wi(gl),Hs=wi(gl),qs=wi(gl);function Pi(t){if(t===gl)throw Error(q(174));return t}function eh(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 Mo(){tt(an),tt(Hs),tt(qs)}function rv(t){Pi(qs.current);var e=Pi(an.current),r=Ef(e,t.type);e!==r&&(Qe(Hs,t),Qe(an,r))}function th(t){Hs.current===t&&(tt(an),tt(Hs))}var at=wi(0);function $a(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 Mc=[];function rh(){for(var t=0;tr?r:4,t(!0);var n=Ic.transition;Ic.transition={};try{t(!1),e()}finally{Re=r,Ic.transition=n}}function yv(){return Pr().memoizedState}function rx(t,e,r){var n=di(t);if(r={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null},wv(t))xv(e,r);else if(r=Jg(t,e,r,n),r!==null){var i=Wt();Gr(r,t,n,i),Ev(r,e,n)}}function nx(t,e,r){var n=di(t),i={lane:n,action:r,hasEagerState:!1,eagerState:null,next:null};if(wv(t))xv(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,Xd(e)):(i.next=a.next,a.next=i),e.interleaved=i;return}}catch{}finally{}r=Jg(t,e,i,n),r!==null&&(i=Wt(),Gr(r,t,n,i),Ev(r,e,n))}}function wv(t){var e=t.alternate;return t===ct||e!==null&&e===ct}function xv(t,e){_s=Ha=!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 qa={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},ix={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,aa(4194308,4,hv.bind(null,e,t),r)},useLayoutEffect:function(t,e){return aa(4194308,4,t,e)},useInsertionEffect:function(t,e){return aa(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=rx.bind(null,ct,t),[n.memoizedState,t]},useRef:function(t){var e=Zr();return t={current:t},e.memoizedState=t},useState:M0,useDebugValue:lh,useDeferredValue:function(t){return Zr().memoizedState=t},useTransition:function(){var t=M0(!1),e=t[0];return t=tx.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||ov(n,e,r)}i.memoizedState=r;var o={value:r,getSnapshot:e};return i.queue=o,I0(lv.bind(null,n,o,t),[t]),n.flags|=2048,Vs(9,sv.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,Mv(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;iRo&&(e.flags|=128,n=!0,ns(o,!1),e.lanes=4194304)}else{if(!n)if(t=$a(s),t!==null){if(e.flags|=128,n=!0,r=t.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),ns(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!nt)return Bt(e),null}else 2*vt()-o.renderingStartTime>Ro&&r!==1073741824&&(e.flags|=128,n=!0,ns(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 hh(),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 dx(t,e){switch(Vd(e),e.tag){case 1:return tr(e.type)&&La(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Mo(),tt(er),tt(zt),rh(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return th(e),null;case 13:if(tt(at),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(q(340));Po()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return tt(at),null;case 4:return Mo(),null;case 10:return Yd(e.type._context),null;case 22:case 23:return hh(),null;case 24:return null;default:return null}}var Ul=!1,jt=!1,hx=typeof WeakSet=="function"?WeakSet:Set,ee=null;function uo(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 Jf(t,e,r){try{r()}catch(n){ht(t,e,n)}}var F0=!1;function px(t,e){if(Tf=Ia,t=Bg(),Wd(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 g;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),(g=d.firstChild)!==null;)m=d,d=g;for(;;){if(d===t)break t;if(m===r&&++u===i&&(l=s),m===o&&++c===n&&(a=s),(g=d.nextSibling)!==null)break;d=m,m=d.parentNode}d=g}r=l===-1||a===-1?null:{start:l,end:a}}else r=null}r=r||{start:0,end:0}}else r=null;for(Of={focusedElem:t,selectionRange:r},Ia=!1,ee=e;ee!==null;)if(e=ee,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,ee=t;else for(;ee!==null;){e=ee;try{var v=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(v!==null){var E=v.memoizedProps,N=v.memoizedState,x=e.stateNode,w=x.getSnapshotBeforeUpdate(e.elementType===e.type?E:Dr(e.type,E),N);x.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var b=e.stateNode.containerInfo;b.nodeType===1?b.textContent="":b.nodeType===9&&b.documentElement&&b.removeChild(b.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(q(163))}}catch(T){ht(e,e.return,T)}if(t=e.sibling,t!==null){t.return=e.return,ee=t;break}ee=e.return}return v=F0,F0=!1,v}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&&Jf(e,r,o)}i=i.next}while(i!==n)}}function bu(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 Yf(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 Tv(t){var e=t.alternate;e!==null&&(t.alternate=null,Tv(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[jf],delete e[J2],delete e[Y2])),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 Ov(t){return t.tag===5||t.tag===3||t.tag===4}function z0(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||Ov(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 Xf(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=Oa));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}function Zf(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(Zf(t,e,r),t=t.sibling;t!==null;)Zf(t,e,r),t=t.sibling}var Mt=null,Fr=!1;function Vn(t,e,r){for(r=r.child;r!==null;)Lv(t,e,r),r=r.sibling}function Lv(t,e,r){if(ln&&typeof ln.onCommitFiberUnmount=="function")try{ln.onCommitFiberUnmount(pu,r)}catch{}switch(r.tag){case 5:jt||uo(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?Pc(t.parentNode,r):t.nodeType===1&&Pc(t,r),js(t)):Pc(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(!jt&&(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)&&Jf(r,e,s),i=i.next}while(i!==n)}Vn(t,e,r);break;case 1:if(!jt&&(uo(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?(jt=(n=jt)||r.memoizedState!==null,Vn(t,e,r),jt=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 hx),e.forEach(function(n){var i=Ax.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*gx(n/1960))-n,10t?16:t,ni===null)var n=!1;else{if(t=ni,ni=null,Va=0,be&6)throw Error(q(331));var i=be;for(be|=4,ee=t.current;ee!==null;){var o=ee,s=o.child;if(ee.flags&16){var l=o.deletions;if(l!==null){for(var a=0;avt()-fh?Ci(t,0):ch|=r),rr(t,e)}function Hv(t,e){e===0&&(t.mode&1?(e=Ml,Ml<<=1,!(Ml&130023424)&&(Ml=4194304)):e=1);var r=Wt();t=Rn(t,e),t!==null&&(hl(t,e,r),rr(t,r))}function bx(t){var e=t.memoizedState,r=0;e!==null&&(r=e.retryLane),Hv(t,r)}function Ax(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),Hv(t,r)}var qv;qv=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,cx(t,e,r);Zt=!!(t.flags&131072)}else Zt=!1,nt&&e.flags&1048576&&Vg(e,Da,e.index);switch(e.lanes=0,e.tag){case 2:var n=e.type;ua(t,e),t=e.pendingProps;var i=No(e,zt.current);Eo(e,r),i=ih(null,e,n,t,i,r);var o=oh();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,Ba(e)):o=!1,e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,Zd(e),i.updater=xu,e.stateNode=i,i._reactInternals=e,Hf(e,n,t,r),e=Gf(null,e,n,!0,o,r)):(e.tag=0,nt&&o&&Gd(e),qt(null,e,i,r),e=e.child),e;case 16:n=e.elementType;e:{switch(ua(t,e),t=e.pendingProps,i=n._init,n=i(n._payload),e.type=n,i=e.tag=Sx(n),t=Dr(n,t),i){case 0:e=Wf(null,e,n,t,r);break e;case 1:e=j0(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,Dr(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:Dr(n,i),Wf(t,e,n,i,r);case 1:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Dr(n,i),j0(t,e,n,i,r);case 3:e:{if(Nv(e),t===null)throw Error(q(387));n=e.pendingProps,o=e.memoizedState,i=o.element,Yg(t,e),za(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=Io(Error(q(423)),e),e=D0(t,e,n,r,i);break e}else if(n!==i){i=Io(Error(q(424)),e),e=D0(t,e,n,r,i);break e}else for(cr=ui(e.stateNode.containerInfo.firstChild),dr=e,nt=!0,zr=null,r=tv(e,null,n,r),e.child=r;r;)r.flags=r.flags&-3|4096,r=r.sibling;else{if(Po(),n===i){e=Tn(t,e,r);break e}qt(t,e,n,r)}e=e.child}return e;case 5:return rv(e),t===null&&Ff(e),n=e.type,i=e.pendingProps,o=t!==null?t.memoizedProps:null,s=i.children,Lf(n,i)?s=null:o!==null&&Lf(n,o)&&(e.flags|=32),kv(t,e),qt(t,e,s,r),e.child;case 6:return t===null&&Ff(e),null;case 13:return Pv(t,e,r);case 4:return eh(e,e.stateNode.containerInfo),n=e.pendingProps,t===null?e.child=Co(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:Dr(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(Ua,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),zf(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),zf(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=Dr(n,e.pendingProps),i=Dr(n.type,i),B0(t,e,n,i,r);case 15:return _v(t,e,e.type,e.pendingProps,r);case 17:return n=e.type,i=e.pendingProps,i=e.elementType===n?i:Dr(n,i),ua(t,e),e.tag=1,tr(n)?(t=!0,Ba(e)):t=!1,Eo(e,r),Zg(e,n,i),Hf(e,n,i,r),Gf(null,e,n,!0,t,r);case 19:return Cv(t,e,r);case 22:return Sv(t,e,r)}throw Error(q(156,e.tag))};function Wv(t,e){return vg(t,e)}function _x(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 _x(t,e,r,n)}function mh(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Sx(t){if(typeof t=="function")return mh(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Od)return 11;if(t===Ld)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 da(t,e,r,n,i,o){var s=2;if(n=t,typeof t=="function")mh(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case eo:return Mi(r.children,i,o,e);case Td:s=8,i|=8;break;case hf:return t=Sr(12,r,e,i|2),t.elementType=hf,t.lanes=o,t;case pf:return t=Sr(13,r,e,i),t.elementType=pf,t.lanes=o,t;case mf:return t=Sr(19,r,e,i),t.elementType=mf,t.lanes=o,t;case eg:return _u(r,i,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Xm:s=10;break e;case Zm:s=9;break e;case Od:s=11;break e;case Ld: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 _u(t,e,r,n){return t=Sr(22,t,n,e),t.elementType=eg,t.lanes=r,t.stateNode={isHidden:!1},t}function Bc(t,e,r){return t=Sr(6,t,null,e),t.lanes=r,t}function jc(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 kx(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=vc(0),this.expirationTimes=vc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=vc(0),this.identifierPrefix=n,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function gh(t,e,r,n,i,o,s,l,a){return t=new kx(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},Zd(o),t}function Nx(t,e,r){var n=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Qv)}catch(t){console.error(t)}}Qv(),Vm.exports=gr;var Qs=Vm.exports,J0=Qs;ff.createRoot=J0.createRoot,ff.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 xh(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function Tx(){return Math.random().toString(36).substr(2,8)}function X0(t,e){return{usr:t.state,key:t.key,idx:e}}function id(t,e,r,n){return r===void 0&&(r=null),Js({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?qo(e):e,{state:r,key:e&&e.key||n||Tx()})}function Jv(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 qo(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 Ox(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 N=c(),x=N==null?null:N-u;u=N,a&&a({action:l,location:E.location,delta:x})}function m(N,x){l=ii.Push;let w=id(E.location,N,x);r&&r(w,N),u=c()+1;let b=X0(w,u),T=E.createHref(w);try{s.pushState(b,"",T)}catch(B){if(B instanceof DOMException&&B.name==="DataCloneError")throw B;i.location.assign(T)}o&&a&&a({action:l,location:E.location,delta:1})}function g(N,x){l=ii.Replace;let w=id(E.location,N,x);r&&r(w,N),u=c();let b=X0(w,u),T=E.createHref(w);s.replaceState(b,"",T),o&&a&&a({action:l,location:E.location,delta:0})}function v(N){let x=i.location.origin!=="null"?i.location.origin:i.location.href,w=typeof N=="string"?N:Jv(N);return _t(x,"No window.location.(origin|href) available to create URL for href: "+w),new URL(w,x)}let E={get action(){return l},get location(){return t(i,s)},listen(N){if(a)throw new Error("A history only accepts one active listener");return i.addEventListener(Y0,d),a=N,()=>{i.removeEventListener(Y0,d),a=null}},createHref(N){return e(i,N)},createURL:v,encodeLocation(N){let x=v(N);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:m,replace:g,go(N){return s.go(N)}};return E}var Z0;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(Z0||(Z0={}));function Lx(t,e,r){r===void 0&&(r="/");let n=typeof e=="string"?qo(e):e,i=Zv(n.pathname||"/",r);if(i==null)return null;let o=Yv(t);Bx(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+'".')),Yv(o.children,e,c,u)),!(o.path==null&&!o.index)&&e.push({path:u,score:Hx(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 Xv(o.path))i(o,s,a)}),e}function Xv(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=Xv(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 Bx(t){t.sort((e,r)=>e.score!==r.score?r.score-e.score:qx(e.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}const jx=/^:[\w-]+$/,Dx=3,Ux=2,Fx=1,zx=10,$x=-2,ep=t=>t==="*";function Hx(t,e){let r=t.split("/"),n=r.length;return r.some(ep)&&(n+=$x),e&&(n+=Ux),r.filter(i=>!ep(i)).reduce((i,o)=>i+(jx.test(o)?Dx:o===""?Fx:zx),n)}function qx(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 Wx(t,e){let{routesMeta:r}=t,n={},i="/",o=[];for(let s=0;s{let{paramName:m,isOptional:g}=c;if(m==="*"){let E=l[d]||"";s=o.slice(0,o.length-E.length).replace(/(.)\/+$/,"$1")}const v=l[d];return g&&!v?u[m]=void 0:u[m]=Qx(v||"",m),u},{}),pathname:o,pathnameBase:s,pattern:t}}function Vx(t,e,r){e===void 0&&(e=!1),r===void 0&&(r=!0),xh(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 Kx(t){try{return decodeURI(t)}catch(e){return xh(!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 Qx(t,e){try{return decodeURIComponent(t)}catch(r){return xh(!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 Zv(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 Jx(t,e){e===void 0&&(e="/");let{pathname:r,search:n="",hash:i=""}=typeof t=="string"?qo(t):t;return{pathname:r?r.startsWith("/")?r:Yx(r,e):e,search:rE(n),hash:nE(i)}}function Yx(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 Xx(t){return t.filter((e,r)=>r===0||e.route.path&&e.route.path.length>0)}function Zx(t,e){let r=Xx(t);return e?r.map((n,i)=>i===t.length-1?n.pathname:n.pathnameBase):r.map(n=>n.pathnameBase)}function eE(t,e,r,n){n===void 0&&(n=!1);let i;typeof t=="string"?i=qo(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=Jx(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,"/"),tE=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),rE=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,nE=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function iE(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const ey=["post","put","patch","delete"];new Set(ey);const oE=["get",...ey];new Set(oE);/** + * 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=eE(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 aE(){let{matches:t}=L.useContext($i),e=t[t.length-1];return e?e.params:{}}function uE(t,e){return cE(t,e)}function cE(t,e,r,n){Iu()||_t(!1);let{navigator:i}=L.useContext(Cu),{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=Ru(),c;if(e){var d;let N=typeof e=="string"?qo(e):e;a==="/"||(d=N.pathname)!=null&&d.startsWith(a)||_t(!1),c=N}else c=u;let m=c.pathname||"/",g=a==="/"?m:m.slice(a.length)||"/",v=Lx(t,{pathname:g}),E=mE(v&&v.map(N=>Object.assign({},N,{params:Object.assign({},l,N.params),pathname:Ii([a,i.encodeLocation?i.encodeLocation(N.pathname).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?a:Ii([a,i.encodeLocation?i.encodeLocation(N.pathnameBase).pathname:N.pathnameBase])})),o,r,n);return e&&E?L.createElement(Mu.Provider,{value:{location:Ys({pathname:"/",search:"",hash:"",state:null,key:"default"},c),navigationType:ii.Pop}},E):E}function fE(){let t=wE(),e=iE(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 dE=L.createElement(fE,null);class hE 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(ty.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function pE(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 mE(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 g,v=!1,E=null,N=null;r&&(g=l&&d.route.id?l[d.route.id]:void 0,E=d.route.errorElement||dE,a&&(u<0&&m===0?(EE("route-fallback",!1),v=!0,N=null):u===m&&(v=!0,N=d.route.hydrateFallbackElement||null)));let x=e.concat(s.slice(0,m+1)),w=()=>{let b;return g?b=E:v?b=N:d.route.Component?b=L.createElement(d.route.Component,null):d.route.element?b=d.route.element:b=c,L.createElement(pE,{match:d,routeContext:{outlet:c,matches:x,isDataRoute:r!=null},children:b})};return r&&(d.route.ErrorBoundary||d.route.errorElement||m===0)?L.createElement(hE,{location:r.location,revalidation:r.revalidation,component:E,error:g,children:w(),routeContext:{outlet:null,matches:x,isDataRoute:!0}}):w()},null)}var ny=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(ny||{}),Ja=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}(Ja||{});function gE(t){let e=L.useContext(Eh);return e||_t(!1),e}function vE(t){let e=L.useContext(sE);return e||_t(!1),e}function yE(t){let e=L.useContext($i);return e||_t(!1),e}function iy(t){let e=yE(),r=e.matches[e.matches.length-1];return r.route.id||_t(!1),r.route.id}function wE(){var t;let e=L.useContext(ty),r=vE(Ja.UseRouteError),n=iy(Ja.UseRouteError);return e!==void 0?e:(t=r.errors)==null?void 0:t[n]}function xE(){let{router:t}=gE(ny.UseNavigateStable),e=iy(Ja.UseNavigateStable),r=L.useRef(!1);return ry(()=>{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 EE(t,e,r){!e&&!tp[t]&&(tp[t]=!0)}function ms(t){_t(!1)}function bE(t){let{basename:e="/",children:r=null,location:n,navigationType:i=ii.Pop,navigator:o,static:s=!1,future:l}=t;Iu()&&_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=qo(n));let{pathname:c="/",search:d="",hash:m="",state:g=null,key:v="default"}=n,E=L.useMemo(()=>{let N=Zv(c,a);return N==null?null:{location:{pathname:N,search:d,hash:m,state:g,key:v},navigationType:i}},[a,c,d,m,g,v,i]);return E==null?null:L.createElement(Cu.Provider,{value:u},L.createElement(Mu.Provider,{children:r,value:E}))}function AE(t){let{children:e,location:r}=t;return uE(od(e),r)}new Promise(()=>{});function od(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,od(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=od(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 _E="startTransition",rp=bw[_E];function SE(t){let{basename:e,children:r,future:n,window:i}=t,o=L.useRef();o.current==null&&(o.current=Rx({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(bE,{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 bh={exports:{}};const kE={},NE=Object.freeze(Object.defineProperty({__proto__:null,default:kE},Symbol.toStringTag,{value:"Module"})),PE=Fo(NE);bh.exports;(function(t){(function(e,r){function n(M,f){if(!M)throw new Error(f||"Assertion failed")}function i(M,f){M.super_=f;var p=function(){};p.prototype=f.prototype,M.prototype=new p,M.prototype.constructor=M}function o(M,f,p){if(o.isBN(M))return M;this.negative=0,this.words=null,this.length=0,this.red=null,M!==null&&((f==="le"||f==="be")&&(p=f,f=10),this._init(M||0,f||10,p||"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=PE.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,p){return f.cmp(p)>0?f:p},o.min=function(f,p){return f.cmp(p)<0?f:p},o.prototype._init=function(f,p,A){if(typeof f=="number")return this._initNumber(f,p,A);if(typeof f=="object")return this._initArray(f,p,A);p==="hex"&&(p=16),n(p===(p|0)&&p>=2&&p<=36),f=f.toString().replace(/\s+/g,"");var S=0;f[0]==="-"&&(S++,this.negative=1),S=0;S-=3)I=f[S]|f[S-1]<<8|f[S-2]<<16,this.words[_]|=I<>>26-R&67108863,R+=24,R>=26&&(R-=26,_++);else if(A==="le")for(S=0,_=0;S>>26-R&67108863,R+=24,R>=26&&(R-=26,_++);return this._strip()};function l(M,f){var p=M.charCodeAt(f);if(p>=48&&p<=57)return p-48;if(p>=65&&p<=70)return p-55;if(p>=97&&p<=102)return p-87;n(!1,"Invalid character in "+M)}function a(M,f,p){var A=l(M,p);return p-1>=f&&(A|=l(M,p-1)<<4),A}o.prototype._parseHex=function(f,p,A){this.length=Math.ceil((f.length-p)/6),this.words=new Array(this.length);for(var S=0;S=p;S-=2)R=a(f,p,S)<<_,this.words[I]|=R&67108863,_>=18?(_-=18,I+=1,this.words[I]|=R>>>26):_+=8;else{var k=f.length-p;for(S=k%2===0?p+1:p;S=18?(_-=18,I+=1,this.words[I]|=R>>>26):_+=8}this._strip()};function u(M,f,p,A){for(var S=0,_=0,I=Math.min(M.length,p),R=f;R=49?_=k-49+10:k>=17?_=k-17+10:_=k,n(k>=0&&_1&&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"],g=[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],v=[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,p){f=f||10,p=p|0||1;var A;if(f===16||f==="hex"){A="";for(var S=0,_=0,I=0;I>>24-S&16777215,S+=2,S>=26&&(S-=26,I--),_!==0||I!==this.length-1?A=m[6-k.length]+k+A:A=k+A}for(_!==0&&(A=_.toString(16)+A);A.length%p!==0;)A="0"+A;return this.negative!==0&&(A="-"+A),A}if(f===(f|0)&&f>=2&&f<=36){var h=g[f],C=v[f];A="";var Z=this.clone();for(Z.negative=0;!Z.isZero();){var y=Z.modrn(C).toString(f);Z=Z.idivn(C),Z.isZero()?A=y+A:A=m[h-y.length]+y+A}for(this.isZero()&&(A="0"+A);A.length%p!==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,p){return this.toArrayLike(s,f,p)}),o.prototype.toArray=function(f,p){return this.toArrayLike(Array,f,p)};var E=function(f,p){return f.allocUnsafe?f.allocUnsafe(p):new f(p)};o.prototype.toArrayLike=function(f,p,A){this._strip();var S=this.byteLength(),_=A||Math.max(1,S);n(S<=_,"byte array longer than desired length"),n(_>0,"Requested array length <= 0");var I=E(f,_),R=p==="le"?"LE":"BE";return this["_toArrayLike"+R](I,S),I},o.prototype._toArrayLikeLE=function(f,p){for(var A=0,S=0,_=0,I=0;_>8&255),A>16&255),I===6?(A>24&255),S=0,I=0):(S=R>>>24,I+=2)}if(A=0&&(f[A--]=R>>8&255),A>=0&&(f[A--]=R>>16&255),I===6?(A>=0&&(f[A--]=R>>24&255),S=0,I=0):(S=R>>>24,I+=2)}if(A>=0)for(f[A--]=S;A>=0;)f[A--]=0},Math.clz32?o.prototype._countBits=function(f){return 32-Math.clz32(f)}:o.prototype._countBits=function(f){var p=f,A=0;return p>=4096&&(A+=13,p>>>=13),p>=64&&(A+=7,p>>>=7),p>=8&&(A+=4,p>>>=4),p>=2&&(A+=2,p>>>=2),A+p},o.prototype._zeroBits=function(f){if(f===0)return 26;var p=f,A=0;return p&8191||(A+=13,p>>>=13),p&127||(A+=7,p>>>=7),p&15||(A+=4,p>>>=4),p&3||(A+=2,p>>>=2),p&1||A++,A},o.prototype.bitLength=function(){var f=this.words[this.length-1],p=this._countBits(f);return(this.length-1)*26+p};function N(M){for(var f=new Array(M.bitLength()),p=0;p>>S&1}return f}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,p=0;pf.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 p;this.length>f.length?p=f:p=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 p,A;this.length>f.length?(p=this,A=f):(p=f,A=this);for(var S=0;Sf.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 p=Math.ceil(f/26)|0,A=f%26;this._expand(p),A>0&&p--;for(var S=0;S0&&(this.words[S]=~this.words[S]&67108863>>26-A),this._strip()},o.prototype.notn=function(f){return this.clone().inotn(f)},o.prototype.setn=function(f,p){n(typeof f=="number"&&f>=0);var A=f/26|0,S=f%26;return this._expand(A+1),p?this.words[A]=this.words[A]|1<f.length?(A=this,S=f):(A=f,S=this);for(var _=0,I=0;I>>26;for(;_!==0&&I>>26;if(this.length=A.length,_!==0)this.words[this.length]=_,this.length++;else if(A!==this)for(;If.length?this.clone().iadd(f):f.clone().iadd(this)},o.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var p=this.iadd(f);return f.negative=1,p._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 S,_;A>0?(S=this,_=f):(S=f,_=this);for(var I=0,R=0;R<_.length;R++)p=(S.words[R]|0)-(_.words[R]|0)+I,I=p>>26,this.words[R]=p&67108863;for(;I!==0&&R>26,this.words[R]=p&67108863;if(I===0&&R>>26,Z=k&67108863,y=Math.min(h,f.length-1),j=Math.max(0,h-M.length+1);j<=y;j++){var U=h-j|0;S=M.words[U]|0,_=f.words[j]|0,I=S*_+Z,C+=I/67108864|0,Z=I&67108863}p.words[h]=Z|0,k=C|0}return k!==0?p.words[h]=k|0:p.length--,p._strip()}var w=function(f,p,A){var S=f.words,_=p.words,I=A.words,R=0,k,h,C,Z=S[0]|0,y=Z&8191,j=Z>>>13,U=S[1]|0,F=U&8191,W=U>>>13,oe=S[2]|0,J=oe&8191,V=oe>>>13,Je=S[3]|0,K=Je&8191,le=Je>>>13,Qr=S[4]|0,Te=Qr&8191,Ne=Qr>>>13,Jr=S[5]|0,Pe=Jr&8191,ce=Jr>>>13,wr=S[6]|0,fe=wr&8191,Oe=wr>>>13,Yr=S[7]|0,me=Yr&8191,ze=Yr>>>13,gn=S[8]|0,$e=gn&8191,He=gn>>>13,Ht=S[9]|0,Le=Ht&8191,qe=Ht>>>13,Rr=_[0]|0,Ce=Rr&8191,We=Rr>>>13,vn=_[1]|0,Be=vn&8191,Ge=vn>>>13,yn=_[2]|0,je=yn&8191,ne=yn>>>13,ot=_[3]|0,ge=ot&8191,de=ot>>>13,rt=_[4]|0,Ae=rt&8191,_e=rt>>>13,Ct=_[5]|0,Me=Ct&8191,De=Ct>>>13,Kt=_[6]|0,Ve=Kt&8191,Ke=Kt>>>13,Qt=_[7]|0,Ie=Qt&8191,Ue=Qt>>>13,xr=_[8]|0,ke=xr&8191,Ye=xr>>>13,bi=_[9]|0,Xe=bi&8191,Ze=bi>>>13;A.negative=f.negative^p.negative,A.length=19,k=Math.imul(y,Ce),h=Math.imul(y,We),h=h+Math.imul(j,Ce)|0,C=Math.imul(j,We);var $n=(R+k|0)+((h&8191)<<13)|0;R=(C+(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,C=Math.imul(W,We),k=k+Math.imul(y,Be)|0,h=h+Math.imul(y,Ge)|0,h=h+Math.imul(j,Be)|0,C=C+Math.imul(j,Ge)|0;var Hn=(R+k|0)+((h&8191)<<13)|0;R=(C+(h>>>13)|0)+(Hn>>>26)|0,Hn&=67108863,k=Math.imul(J,Ce),h=Math.imul(J,We),h=h+Math.imul(V,Ce)|0,C=Math.imul(V,We),k=k+Math.imul(F,Be)|0,h=h+Math.imul(F,Ge)|0,h=h+Math.imul(W,Be)|0,C=C+Math.imul(W,Ge)|0,k=k+Math.imul(y,je)|0,h=h+Math.imul(y,ne)|0,h=h+Math.imul(j,je)|0,C=C+Math.imul(j,ne)|0;var qn=(R+k|0)+((h&8191)<<13)|0;R=(C+(h>>>13)|0)+(qn>>>26)|0,qn&=67108863,k=Math.imul(K,Ce),h=Math.imul(K,We),h=h+Math.imul(le,Ce)|0,C=Math.imul(le,We),k=k+Math.imul(J,Be)|0,h=h+Math.imul(J,Ge)|0,h=h+Math.imul(V,Be)|0,C=C+Math.imul(V,Ge)|0,k=k+Math.imul(F,je)|0,h=h+Math.imul(F,ne)|0,h=h+Math.imul(W,je)|0,C=C+Math.imul(W,ne)|0,k=k+Math.imul(y,ge)|0,h=h+Math.imul(y,de)|0,h=h+Math.imul(j,ge)|0,C=C+Math.imul(j,de)|0;var Wn=(R+k|0)+((h&8191)<<13)|0;R=(C+(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,C=Math.imul(Ne,We),k=k+Math.imul(K,Be)|0,h=h+Math.imul(K,Ge)|0,h=h+Math.imul(le,Be)|0,C=C+Math.imul(le,Ge)|0,k=k+Math.imul(J,je)|0,h=h+Math.imul(J,ne)|0,h=h+Math.imul(V,je)|0,C=C+Math.imul(V,ne)|0,k=k+Math.imul(F,ge)|0,h=h+Math.imul(F,de)|0,h=h+Math.imul(W,ge)|0,C=C+Math.imul(W,de)|0,k=k+Math.imul(y,Ae)|0,h=h+Math.imul(y,_e)|0,h=h+Math.imul(j,Ae)|0,C=C+Math.imul(j,_e)|0;var Gn=(R+k|0)+((h&8191)<<13)|0;R=(C+(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,C=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,C=C+Math.imul(Ne,Ge)|0,k=k+Math.imul(K,je)|0,h=h+Math.imul(K,ne)|0,h=h+Math.imul(le,je)|0,C=C+Math.imul(le,ne)|0,k=k+Math.imul(J,ge)|0,h=h+Math.imul(J,de)|0,h=h+Math.imul(V,ge)|0,C=C+Math.imul(V,de)|0,k=k+Math.imul(F,Ae)|0,h=h+Math.imul(F,_e)|0,h=h+Math.imul(W,Ae)|0,C=C+Math.imul(W,_e)|0,k=k+Math.imul(y,Me)|0,h=h+Math.imul(y,De)|0,h=h+Math.imul(j,Me)|0,C=C+Math.imul(j,De)|0;var Xu=(R+k|0)+((h&8191)<<13)|0;R=(C+(h>>>13)|0)+(Xu>>>26)|0,Xu&=67108863,k=Math.imul(fe,Ce),h=Math.imul(fe,We),h=h+Math.imul(Oe,Ce)|0,C=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,C=C+Math.imul(ce,Ge)|0,k=k+Math.imul(Te,je)|0,h=h+Math.imul(Te,ne)|0,h=h+Math.imul(Ne,je)|0,C=C+Math.imul(Ne,ne)|0,k=k+Math.imul(K,ge)|0,h=h+Math.imul(K,de)|0,h=h+Math.imul(le,ge)|0,C=C+Math.imul(le,de)|0,k=k+Math.imul(J,Ae)|0,h=h+Math.imul(J,_e)|0,h=h+Math.imul(V,Ae)|0,C=C+Math.imul(V,_e)|0,k=k+Math.imul(F,Me)|0,h=h+Math.imul(F,De)|0,h=h+Math.imul(W,Me)|0,C=C+Math.imul(W,De)|0,k=k+Math.imul(y,Ve)|0,h=h+Math.imul(y,Ke)|0,h=h+Math.imul(j,Ve)|0,C=C+Math.imul(j,Ke)|0;var Zu=(R+k|0)+((h&8191)<<13)|0;R=(C+(h>>>13)|0)+(Zu>>>26)|0,Zu&=67108863,k=Math.imul(me,Ce),h=Math.imul(me,We),h=h+Math.imul(ze,Ce)|0,C=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,C=C+Math.imul(Oe,Ge)|0,k=k+Math.imul(Pe,je)|0,h=h+Math.imul(Pe,ne)|0,h=h+Math.imul(ce,je)|0,C=C+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,C=C+Math.imul(Ne,de)|0,k=k+Math.imul(K,Ae)|0,h=h+Math.imul(K,_e)|0,h=h+Math.imul(le,Ae)|0,C=C+Math.imul(le,_e)|0,k=k+Math.imul(J,Me)|0,h=h+Math.imul(J,De)|0,h=h+Math.imul(V,Me)|0,C=C+Math.imul(V,De)|0,k=k+Math.imul(F,Ve)|0,h=h+Math.imul(F,Ke)|0,h=h+Math.imul(W,Ve)|0,C=C+Math.imul(W,Ke)|0,k=k+Math.imul(y,Ie)|0,h=h+Math.imul(y,Ue)|0,h=h+Math.imul(j,Ie)|0,C=C+Math.imul(j,Ue)|0;var ec=(R+k|0)+((h&8191)<<13)|0;R=(C+(h>>>13)|0)+(ec>>>26)|0,ec&=67108863,k=Math.imul($e,Ce),h=Math.imul($e,We),h=h+Math.imul(He,Ce)|0,C=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,C=C+Math.imul(ze,Ge)|0,k=k+Math.imul(fe,je)|0,h=h+Math.imul(fe,ne)|0,h=h+Math.imul(Oe,je)|0,C=C+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,C=C+Math.imul(ce,de)|0,k=k+Math.imul(Te,Ae)|0,h=h+Math.imul(Te,_e)|0,h=h+Math.imul(Ne,Ae)|0,C=C+Math.imul(Ne,_e)|0,k=k+Math.imul(K,Me)|0,h=h+Math.imul(K,De)|0,h=h+Math.imul(le,Me)|0,C=C+Math.imul(le,De)|0,k=k+Math.imul(J,Ve)|0,h=h+Math.imul(J,Ke)|0,h=h+Math.imul(V,Ve)|0,C=C+Math.imul(V,Ke)|0,k=k+Math.imul(F,Ie)|0,h=h+Math.imul(F,Ue)|0,h=h+Math.imul(W,Ie)|0,C=C+Math.imul(W,Ue)|0,k=k+Math.imul(y,ke)|0,h=h+Math.imul(y,Ye)|0,h=h+Math.imul(j,ke)|0,C=C+Math.imul(j,Ye)|0;var tc=(R+k|0)+((h&8191)<<13)|0;R=(C+(h>>>13)|0)+(tc>>>26)|0,tc&=67108863,k=Math.imul(Le,Ce),h=Math.imul(Le,We),h=h+Math.imul(qe,Ce)|0,C=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,C=C+Math.imul(He,Ge)|0,k=k+Math.imul(me,je)|0,h=h+Math.imul(me,ne)|0,h=h+Math.imul(ze,je)|0,C=C+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,C=C+Math.imul(Oe,de)|0,k=k+Math.imul(Pe,Ae)|0,h=h+Math.imul(Pe,_e)|0,h=h+Math.imul(ce,Ae)|0,C=C+Math.imul(ce,_e)|0,k=k+Math.imul(Te,Me)|0,h=h+Math.imul(Te,De)|0,h=h+Math.imul(Ne,Me)|0,C=C+Math.imul(Ne,De)|0,k=k+Math.imul(K,Ve)|0,h=h+Math.imul(K,Ke)|0,h=h+Math.imul(le,Ve)|0,C=C+Math.imul(le,Ke)|0,k=k+Math.imul(J,Ie)|0,h=h+Math.imul(J,Ue)|0,h=h+Math.imul(V,Ie)|0,C=C+Math.imul(V,Ue)|0,k=k+Math.imul(F,ke)|0,h=h+Math.imul(F,Ye)|0,h=h+Math.imul(W,ke)|0,C=C+Math.imul(W,Ye)|0,k=k+Math.imul(y,Xe)|0,h=h+Math.imul(y,Ze)|0,h=h+Math.imul(j,Xe)|0,C=C+Math.imul(j,Ze)|0;var rc=(R+k|0)+((h&8191)<<13)|0;R=(C+(h>>>13)|0)+(rc>>>26)|0,rc&=67108863,k=Math.imul(Le,Be),h=Math.imul(Le,Ge),h=h+Math.imul(qe,Be)|0,C=Math.imul(qe,Ge),k=k+Math.imul($e,je)|0,h=h+Math.imul($e,ne)|0,h=h+Math.imul(He,je)|0,C=C+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,C=C+Math.imul(ze,de)|0,k=k+Math.imul(fe,Ae)|0,h=h+Math.imul(fe,_e)|0,h=h+Math.imul(Oe,Ae)|0,C=C+Math.imul(Oe,_e)|0,k=k+Math.imul(Pe,Me)|0,h=h+Math.imul(Pe,De)|0,h=h+Math.imul(ce,Me)|0,C=C+Math.imul(ce,De)|0,k=k+Math.imul(Te,Ve)|0,h=h+Math.imul(Te,Ke)|0,h=h+Math.imul(Ne,Ve)|0,C=C+Math.imul(Ne,Ke)|0,k=k+Math.imul(K,Ie)|0,h=h+Math.imul(K,Ue)|0,h=h+Math.imul(le,Ie)|0,C=C+Math.imul(le,Ue)|0,k=k+Math.imul(J,ke)|0,h=h+Math.imul(J,Ye)|0,h=h+Math.imul(V,ke)|0,C=C+Math.imul(V,Ye)|0,k=k+Math.imul(F,Xe)|0,h=h+Math.imul(F,Ze)|0,h=h+Math.imul(W,Xe)|0,C=C+Math.imul(W,Ze)|0;var nc=(R+k|0)+((h&8191)<<13)|0;R=(C+(h>>>13)|0)+(nc>>>26)|0,nc&=67108863,k=Math.imul(Le,je),h=Math.imul(Le,ne),h=h+Math.imul(qe,je)|0,C=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,C=C+Math.imul(He,de)|0,k=k+Math.imul(me,Ae)|0,h=h+Math.imul(me,_e)|0,h=h+Math.imul(ze,Ae)|0,C=C+Math.imul(ze,_e)|0,k=k+Math.imul(fe,Me)|0,h=h+Math.imul(fe,De)|0,h=h+Math.imul(Oe,Me)|0,C=C+Math.imul(Oe,De)|0,k=k+Math.imul(Pe,Ve)|0,h=h+Math.imul(Pe,Ke)|0,h=h+Math.imul(ce,Ve)|0,C=C+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,C=C+Math.imul(Ne,Ue)|0,k=k+Math.imul(K,ke)|0,h=h+Math.imul(K,Ye)|0,h=h+Math.imul(le,ke)|0,C=C+Math.imul(le,Ye)|0,k=k+Math.imul(J,Xe)|0,h=h+Math.imul(J,Ze)|0,h=h+Math.imul(V,Xe)|0,C=C+Math.imul(V,Ze)|0;var ic=(R+k|0)+((h&8191)<<13)|0;R=(C+(h>>>13)|0)+(ic>>>26)|0,ic&=67108863,k=Math.imul(Le,ge),h=Math.imul(Le,de),h=h+Math.imul(qe,ge)|0,C=Math.imul(qe,de),k=k+Math.imul($e,Ae)|0,h=h+Math.imul($e,_e)|0,h=h+Math.imul(He,Ae)|0,C=C+Math.imul(He,_e)|0,k=k+Math.imul(me,Me)|0,h=h+Math.imul(me,De)|0,h=h+Math.imul(ze,Me)|0,C=C+Math.imul(ze,De)|0,k=k+Math.imul(fe,Ve)|0,h=h+Math.imul(fe,Ke)|0,h=h+Math.imul(Oe,Ve)|0,C=C+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,C=C+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,C=C+Math.imul(Ne,Ye)|0,k=k+Math.imul(K,Xe)|0,h=h+Math.imul(K,Ze)|0,h=h+Math.imul(le,Xe)|0,C=C+Math.imul(le,Ze)|0;var oc=(R+k|0)+((h&8191)<<13)|0;R=(C+(h>>>13)|0)+(oc>>>26)|0,oc&=67108863,k=Math.imul(Le,Ae),h=Math.imul(Le,_e),h=h+Math.imul(qe,Ae)|0,C=Math.imul(qe,_e),k=k+Math.imul($e,Me)|0,h=h+Math.imul($e,De)|0,h=h+Math.imul(He,Me)|0,C=C+Math.imul(He,De)|0,k=k+Math.imul(me,Ve)|0,h=h+Math.imul(me,Ke)|0,h=h+Math.imul(ze,Ve)|0,C=C+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,C=C+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,C=C+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,C=C+Math.imul(Ne,Ze)|0;var sc=(R+k|0)+((h&8191)<<13)|0;R=(C+(h>>>13)|0)+(sc>>>26)|0,sc&=67108863,k=Math.imul(Le,Me),h=Math.imul(Le,De),h=h+Math.imul(qe,Me)|0,C=Math.imul(qe,De),k=k+Math.imul($e,Ve)|0,h=h+Math.imul($e,Ke)|0,h=h+Math.imul(He,Ve)|0,C=C+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,C=C+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,C=C+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,C=C+Math.imul(ce,Ze)|0;var lc=(R+k|0)+((h&8191)<<13)|0;R=(C+(h>>>13)|0)+(lc>>>26)|0,lc&=67108863,k=Math.imul(Le,Ve),h=Math.imul(Le,Ke),h=h+Math.imul(qe,Ve)|0,C=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,C=C+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,C=C+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,C=C+Math.imul(Oe,Ze)|0;var ac=(R+k|0)+((h&8191)<<13)|0;R=(C+(h>>>13)|0)+(ac>>>26)|0,ac&=67108863,k=Math.imul(Le,Ie),h=Math.imul(Le,Ue),h=h+Math.imul(qe,Ie)|0,C=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,C=C+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,C=C+Math.imul(ze,Ze)|0;var uc=(R+k|0)+((h&8191)<<13)|0;R=(C+(h>>>13)|0)+(uc>>>26)|0,uc&=67108863,k=Math.imul(Le,ke),h=Math.imul(Le,Ye),h=h+Math.imul(qe,ke)|0,C=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,C=C+Math.imul(He,Ze)|0;var cc=(R+k|0)+((h&8191)<<13)|0;R=(C+(h>>>13)|0)+(cc>>>26)|0,cc&=67108863,k=Math.imul(Le,Xe),h=Math.imul(Le,Ze),h=h+Math.imul(qe,Xe)|0,C=Math.imul(qe,Ze);var fc=(R+k|0)+((h&8191)<<13)|0;return R=(C+(h>>>13)|0)+(fc>>>26)|0,fc&=67108863,I[0]=$n,I[1]=Hn,I[2]=qn,I[3]=Wn,I[4]=Gn,I[5]=Xu,I[6]=Zu,I[7]=ec,I[8]=tc,I[9]=rc,I[10]=nc,I[11]=ic,I[12]=oc,I[13]=sc,I[14]=lc,I[15]=ac,I[16]=uc,I[17]=cc,I[18]=fc,R!==0&&(I[19]=R,A.length++),A};Math.imul||(w=x);function b(M,f,p){p.negative=f.negative^M.negative,p.length=M.length+f.length;for(var A=0,S=0,_=0;_>>26)|0,S+=I>>>26,I&=67108863}p.words[_]=R,A=I,I=S}return A!==0?p.words[_]=A:p.length--,p._strip()}function T(M,f,p){return b(M,f,p)}o.prototype.mulTo=function(f,p){var A,S=this.length+f.length;return this.length===10&&f.length===10?A=w(this,f,p):S<63?A=x(this,f,p):S<1024?A=b(this,f,p):A=T(this,f,p),A},o.prototype.mul=function(f){var p=new o(null);return p.words=new Array(this.length+f.length),this.mulTo(f,p)},o.prototype.mulf=function(f){var p=new o(null);return p.words=new Array(this.length+f.length),T(this,f,p)},o.prototype.imul=function(f){return this.clone().mulTo(f,this)},o.prototype.imuln=function(f){var p=f<0;p&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var A=0,S=0;S>=26,A+=_/67108864|0,A+=I>>>26,this.words[S]=I&67108863}return A!==0&&(this.words[S]=A,this.length++),p?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 p=N(f);if(p.length===0)return new o(1);for(var A=this,S=0;S=0);var p=f%26,A=(f-p)/26,S=67108863>>>26-p<<26-p,_;if(p!==0){var I=0;for(_=0;_>>26-p}I&&(this.words[_]=I,this.length++)}if(A!==0){for(_=this.length-1;_>=0;_--)this.words[_+A]=this.words[_];for(_=0;_=0);var S;p?S=(p-p%26)/26:S=0;var _=f%26,I=Math.min((f-_)/26,this.length),R=67108863^67108863>>>_<<_,k=A;if(S-=I,S=Math.max(0,S),k){for(var h=0;hI)for(this.length-=I,h=0;h=0&&(C!==0||h>=S);h--){var Z=this.words[h]|0;this.words[h]=C<<26-_|Z>>>_,C=Z&R}return k&&C!==0&&(k.words[k.length++]=C),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(f,p,A){return n(this.negative===0),this.iushrn(f,p,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 p=f%26,A=(f-p)/26,S=1<=0);var p=f%26,A=(f-p)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=A)return this;if(p!==0&&A++,this.length=Math.min(A,this.length),p!==0){var S=67108863^67108863>>>p<=67108864;p++)this.words[p]-=67108864,p===this.length-1?this.words[p+1]=1:this.words[p+1]++;return this.length=Math.max(this.length,p+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 p=0;p>26)-(k/67108864|0),this.words[_+A]=I&67108863}for(;_>26,this.words[_+A]=I&67108863;if(R===0)return this._strip();for(n(R===-1),R=0,_=0;_>26,this.words[_]=I&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(f,p){var A=this.length-f.length,S=this.clone(),_=f,I=_.words[_.length-1]|0,R=this._countBits(I);A=26-R,A!==0&&(_=_.ushln(A),S.iushln(A),I=_.words[_.length-1]|0);var k=S.length-_.length,h;if(p!=="mod"){h=new o(null),h.length=k+1,h.words=new Array(h.length);for(var C=0;C=0;y--){var j=(S.words[_.length+y]|0)*67108864+(S.words[_.length+y-1]|0);for(j=Math.min(j/I|0,67108863),S._ishlnsubmul(_,j,y);S.negative!==0;)j--,S.negative=0,S._ishlnsubmul(_,1,y),S.isZero()||(S.negative^=1);h&&(h.words[y]=j)}return h&&h._strip(),S._strip(),p!=="div"&&A!==0&&S.iushrn(A),{div:h||null,mod:S}},o.prototype.divmod=function(f,p,A){if(n(!f.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var S,_,I;return this.negative!==0&&f.negative===0?(I=this.neg().divmod(f,p),p!=="mod"&&(S=I.div.neg()),p!=="div"&&(_=I.mod.neg(),A&&_.negative!==0&&_.iadd(f)),{div:S,mod:_}):this.negative===0&&f.negative!==0?(I=this.divmod(f.neg(),p),p!=="mod"&&(S=I.div.neg()),{div:S,mod:I.mod}):this.negative&f.negative?(I=this.neg().divmod(f.neg(),p),p!=="div"&&(_=I.mod.neg(),A&&_.negative!==0&&_.isub(f)),{div:I.div,mod:_}):f.length>this.length||this.cmp(f)<0?{div:new o(0),mod:this}:f.length===1?p==="div"?{div:this.divn(f.words[0]),mod:null}:p==="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,p)},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 p=this.divmod(f);if(p.mod.isZero())return p.div;var A=p.div.negative!==0?p.mod.isub(f):p.mod,S=f.ushrn(1),_=f.andln(1),I=A.cmp(S);return I<0||_===1&&I===0?p.div:p.div.negative!==0?p.div.isubn(1):p.div.iaddn(1)},o.prototype.modrn=function(f){var p=f<0;p&&(f=-f),n(f<=67108863);for(var A=(1<<26)%f,S=0,_=this.length-1;_>=0;_--)S=(A*S+(this.words[_]|0))%f;return p?-S:S},o.prototype.modn=function(f){return this.modrn(f)},o.prototype.idivn=function(f){var p=f<0;p&&(f=-f),n(f<=67108863);for(var A=0,S=this.length-1;S>=0;S--){var _=(this.words[S]|0)+A*67108864;this.words[S]=_/f|0,A=_%f}return this._strip(),p?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 p=this,A=f.clone();p.negative!==0?p=p.umod(f):p=p.clone();for(var S=new o(1),_=new o(0),I=new o(0),R=new o(1),k=0;p.isEven()&&A.isEven();)p.iushrn(1),A.iushrn(1),++k;for(var h=A.clone(),C=p.clone();!p.isZero();){for(var Z=0,y=1;!(p.words[0]&y)&&Z<26;++Z,y<<=1);if(Z>0)for(p.iushrn(Z);Z-- >0;)(S.isOdd()||_.isOdd())&&(S.iadd(h),_.isub(C)),S.iushrn(1),_.iushrn(1);for(var j=0,U=1;!(A.words[0]&U)&&j<26;++j,U<<=1);if(j>0)for(A.iushrn(j);j-- >0;)(I.isOdd()||R.isOdd())&&(I.iadd(h),R.isub(C)),I.iushrn(1),R.iushrn(1);p.cmp(A)>=0?(p.isub(A),S.isub(I),_.isub(R)):(A.isub(p),I.isub(S),R.isub(_))}return{a:I,b:R,gcd:A.iushln(k)}},o.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var p=this,A=f.clone();p.negative!==0?p=p.umod(f):p=p.clone();for(var S=new o(1),_=new o(0),I=A.clone();p.cmpn(1)>0&&A.cmpn(1)>0;){for(var R=0,k=1;!(p.words[0]&k)&&R<26;++R,k<<=1);if(R>0)for(p.iushrn(R);R-- >0;)S.isOdd()&&S.iadd(I),S.iushrn(1);for(var h=0,C=1;!(A.words[0]&C)&&h<26;++h,C<<=1);if(h>0)for(A.iushrn(h);h-- >0;)_.isOdd()&&_.iadd(I),_.iushrn(1);p.cmp(A)>=0?(p.isub(A),S.isub(_)):(A.isub(p),_.isub(S))}var Z;return p.cmpn(1)===0?Z=S:Z=_,Z.cmpn(0)<0&&Z.iadd(f),Z},o.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var p=this.clone(),A=f.clone();p.negative=0,A.negative=0;for(var S=0;p.isEven()&&A.isEven();S++)p.iushrn(1),A.iushrn(1);do{for(;p.isEven();)p.iushrn(1);for(;A.isEven();)A.iushrn(1);var _=p.cmp(A);if(_<0){var I=p;p=A,A=I}else if(_===0||A.cmpn(1)===0)break;p.isub(A)}while(!0);return A.iushln(S)},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 p=f%26,A=(f-p)/26,S=1<>>26,R&=67108863,this.words[I]=R}return _!==0&&(this.words[I]=_,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(f){var p=f<0;if(this.negative!==0&&!p)return-1;if(this.negative===0&&p)return 1;this._strip();var A;if(this.length>1)A=1;else{p&&(f=-f),n(f<=67108863,"Number is too big");var S=this.words[0]|0;A=S===f?0:Sf.length)return 1;if(this.length=0;A--){var S=this.words[A]|0,_=f.words[A]|0;if(S!==_){S<_?p=-1:S>_&&(p=1);break}}return p},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 X(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 D(M,f){this.name=M,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()}D.prototype._tmp=function(){var f=new o(null);return f.words=new Array(Math.ceil(this.n/13)),f},D.prototype.ireduce=function(f){var p=f,A;do this.split(p,this.tmp),p=this.imulK(p),p=p.iadd(this.tmp),A=p.bitLength();while(A>this.n);var S=A0?p.isub(this.p):p.strip!==void 0?p.strip():p._strip(),p},D.prototype.split=function(f,p){f.iushrn(this.n,0,p)},D.prototype.imulK=function(f){return f.imul(this.k)};function $(){D.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i($,D),$.prototype.split=function(f,p){for(var A=4194303,S=Math.min(f.length,9),_=0;_>>22,I=R}I>>>=22,f.words[_-10]=I,I===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 p=0,A=0;A>>=26,f.words[A]=_,p=S}return p!==0&&(f.words[f.length++]=p),f},o._prime=function(f){if(B[f])return B[f];var p;if(f==="k256")p=new $;else if(f==="p224")p=new H;else if(f==="p192")p=new Y;else if(f==="p25519")p=new Q;else throw new Error("Unknown prime "+f);return B[f]=p,p};function X(M){if(typeof M=="string"){var f=o._prime(M);this.m=f.p,this.prime=f}else n(M.gtn(1),"modulus must be greater than 1"),this.m=M,this.prime=null}X.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},X.prototype._verify2=function(f,p){n((f.negative|p.negative)===0,"red works only with positives"),n(f.red&&f.red===p.red,"red works only with red numbers")},X.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(c(f,f.umod(this.m)._forceRed(this)),f)},X.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},X.prototype.add=function(f,p){this._verify2(f,p);var A=f.add(p);return A.cmp(this.m)>=0&&A.isub(this.m),A._forceRed(this)},X.prototype.iadd=function(f,p){this._verify2(f,p);var A=f.iadd(p);return A.cmp(this.m)>=0&&A.isub(this.m),A},X.prototype.sub=function(f,p){this._verify2(f,p);var A=f.sub(p);return A.cmpn(0)<0&&A.iadd(this.m),A._forceRed(this)},X.prototype.isub=function(f,p){this._verify2(f,p);var A=f.isub(p);return A.cmpn(0)<0&&A.iadd(this.m),A},X.prototype.shl=function(f,p){return this._verify1(f),this.imod(f.ushln(p))},X.prototype.imul=function(f,p){return this._verify2(f,p),this.imod(f.imul(p))},X.prototype.mul=function(f,p){return this._verify2(f,p),this.imod(f.mul(p))},X.prototype.isqr=function(f){return this.imul(f,f.clone())},X.prototype.sqr=function(f){return this.mul(f,f)},X.prototype.sqrt=function(f){if(f.isZero())return f.clone();var p=this.m.andln(3);if(n(p%2===1),p===3){var A=this.m.add(new o(1)).iushrn(2);return this.pow(f,A)}for(var S=this.m.subn(1),_=0;!S.isZero()&&S.andln(1)===0;)_++,S.iushrn(1);n(!S.isZero());var I=new o(1).toRed(this),R=I.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 C=this.pow(h,S),Z=this.pow(f,S.addn(1).iushrn(1)),y=this.pow(f,S),j=_;y.cmp(I)!==0;){for(var U=y,F=0;U.cmp(I)!==0;F++)U=U.redSqr();n(F=0;_--){for(var C=p.words[_],Z=h-1;Z>=0;Z--){var y=C>>Z&1;if(I!==S[0]&&(I=this.sqr(I)),y===0&&R===0){k=0;continue}R<<=1,R|=y,k++,!(k!==A&&(_!==0||Z!==0))&&(I=this.mul(I,S[R]),k=0,R=0)}h=26}return I},X.prototype.convertTo=function(f){var p=f.umod(this.m);return p===f?p.clone():p},X.prototype.convertFrom=function(f){var p=f.clone();return p.red=null,p},o.mont=function(f){return new ie(f)};function ie(M){X.call(this,M),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(ie,X),ie.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},ie.prototype.convertFrom=function(f){var p=this.imod(f.mul(this.rinv));return p.red=null,p},ie.prototype.imul=function(f,p){if(f.isZero()||p.isZero())return f.words[0]=0,f.length=1,f;var A=f.imul(p),S=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=A.isub(S).iushrn(this.shift),I=_;return _.cmp(this.m)>=0?I=_.isub(this.m):_.cmpn(0)<0&&(I=_.iadd(this.m)),I._forceRed(this)},ie.prototype.mul=function(f,p){if(f.isZero()||p.isZero())return new o(0)._forceRed(this);var A=f.mul(p),S=A.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=A.isub(S).iushrn(this.shift),I=_;return _.cmp(this.m)>=0?I=_.isub(this.m):_.cmpn(0)<0&&(I=_.iadd(this.m)),I._forceRed(this)},ie.prototype.invm=function(f){var p=this.imod(f._invmp(this.m).mul(this.r2));return p._forceRed(this)}})(t,Fe)})(bh);var CE=bh.exports;const ue=Uo(CE),ME="logger/5.7.0";let op=!1,sp=!1;const ha={debug:1,default:2,info:2,warning:3,error:4,off:5};let lp=ha.default,Uc=null;function IE(){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=IE();var sd;(function(t){t.DEBUG="DEBUG",t.INFO="INFO",t.WARNING="WARNING",t.ERROR="ERROR",t.OFF="OFF"})(sd||(sd={}));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 O{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,r){const n=e.toLowerCase();ha[n]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(lp>ha[n])&&console.log.apply(console,r)}debug(...e){this._log(O.levels.DEBUG,e)}info(...e){this._log(O.levels.INFO,e)}warn(...e){this._log(O.levels.WARNING,e)}makeError(e,r,n){if(sp)return this.makeError("censored error",r,{});r||(r=O.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,O.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",O.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,O.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(r,O.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,O.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:r})}checkNew(e,r){(e===Object||e==null)&&this.throwError("missing new",O.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",O.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",O.errors.MISSING_NEW,{name:r.name})}static globalLogger(){return Uc||(Uc=new O(ME)),Uc}static setCensorship(e,r){if(!e&&r&&this.globalLogger().throwError("cannot permanently disable censorship",O.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),op){if(!e)return;this.globalLogger().throwError("error censorship permanent",O.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}sp=!!e,op=!!r}static setLogLevel(e){const r=ha[e.toLowerCase()];if(r==null){O.globalLogger().warn("invalid log level - "+e);return}lp=r}static from(e){return new O(e)}}O.errors=Ur;O.levels=sd;const RE="bytes/5.7.0",dt=new O(RE);function oy(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 Ah(t){return pe(t)&&!(t.length%2)||Tu(t)}function cp(t){return typeof t=="number"&&t==t&&t%1===0}function Tu(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),oy(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 To(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 Fc="0123456789abcdef";function re(t,e){if(e||(e={}),typeof t=="number"){dt.checkSafeUint53(t,"invalid hexlify value");let r="";for(;t;)r=Fc[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),oy(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(Tu(t)){let r="0x";for(let n=0;n>4]+Fc[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 Ou(t){const e=TE(re(t,{hexPad:"left"}));return e==="0x"?"0x0":e}function TE(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 Lu(t){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Ah(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=pa(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 OE="bignumber/5.7.0";var Xs=ue.BN;const xn=new O(OE),zc={},fp=9007199254740991;let dp=!1;class G{constructor(e,r){e!==zc&&xn.throwError("cannot call constructor directly; use BigNumber.from",O.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()&&Er("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()&&Er("division-by-zero","mod"),Jt(ve(this).umod(r))}pow(e){const r=ve(e);return r.isNeg()&&Er("negative-power","pow"),Jt(ve(this).pow(r))}and(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&Er("unbound-bitwise-result","and"),Jt(ve(this).and(r))}or(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&Er("unbound-bitwise-result","or"),Jt(ve(this).or(r))}xor(e){const r=ve(e);return(this.isNegative()||r.isNeg())&&Er("unbound-bitwise-result","xor"),Jt(ve(this).xor(r))}mask(e){return(this.isNegative()||e<0)&&Er("negative-width","mask"),Jt(ve(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Er("negative-width","shl"),Jt(ve(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Er("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{Er("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return xn.throwError("this platform does not support BigInt",O.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?dp||(dp=!0,xn.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?xn.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",O.errors.UNEXPECTED_ARGUMENT,{}):xn.throwError("BigNumber.toString does not accept parameters",O.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(zc,Zs(e)):e.match(/^-?[0-9]+$/)?new G(zc,Zs(new Xs(e))):xn.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Er("underflow","BigNumber.from",e),(e>=fp||e<=-fp)&&Er("overflow","BigNumber.from",e),G.from(String(e));const r=e;if(typeof r=="bigint")return G.from(r.toString());if(Tu(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 xn.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]==="-"&&xn.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 Er(t,e,r){const n={fault:t,operation:e};return r!=null&&(n.value=r),xn.throwError(t,O.errors.NUMERIC_FAULT,n)}function LE(t){return new Xs(t,36).toString(16)}function BE(t){return new Xs(t,16).toString(36)}const jE="properties/5.7.0";var DE=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 Ya=new O(jE);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 DE(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 UE(t,e){(!t||typeof t!="object")&&Ya.throwArgumentError("invalid object","object",t),Object.keys(t).forEach(r=>{e[r]||Ya.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 FE={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function sy(t){if(t==null||FE[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 Ya.throwArgumentError(`Cannot deepCopy ${typeof t}`,"object",t)}function nr(t){return zE(t)}class yl{constructor(e){for(const r in e)this[r]=nr(e[r])}}const wl="abi/5.7.0",xe=new O(wl),ji={};let hp={calldata:!0,memory:!0,storage:!0},$E={calldata:!0,memory:!0};function $l(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")&&$E[e])return!0;return(hp[e]||e==="payable")&&xe.throwArgumentError("invalid modifier","name",e),!1}function HE(t,e){let r=t;function n(l){xe.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(ji,{name:e.name||null,type:Yi(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(HE(e,!!r))}static isParamType(e){return!!(e!=null&&e._isParamType)}}function el(t,e){return GE(t).map(r=>kt.fromString(r,e))}class Nn{constructor(e,r){e!==ji&&xe.throwError("use a static from method",O.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),ma(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 xe.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()):xe.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]||xe.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"&&xe.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(ji,r)}static fromString(e){let r=e.match(rl);r||xe.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:xe.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 ly(t,e){e.gas=null;let r=t.split("@");return r.length!==1?(r.length>2&&xe.throwArgumentError("invalid human-readable ABI signature","value",t),r[1].match(/^[0-9]+$/)||xe.throwArgumentError("invalid human-readable ABI signature gas","value",t),e.gas=G.from(r[1]),r[0]):t}function ay(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 uy(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&&xe.throwArgumentError("cannot have constant function with mutability "+e.stateMutability,"value",t),e.payable=e.stateMutability==="payable",t.payable!=null&&!!t.payable!==e.payable&&xe.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"&&xe.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&&xe.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"&&xe.throwArgumentError("unable to determine stateMutability","value",t),e}class on extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||xe.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&&xe.throwError("cannot format a constructor for sighash",O.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"&&xe.throwArgumentError("invalid constructor object","value",e);let r=uy(e);r.constant&&xe.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(ji,n)}static fromString(e){let r={type:"constructor"};e=ly(e,r);let n=e.match(rl);return(!n||n[1].trim()!=="constructor")&&xe.throwArgumentError("invalid constructor string","value",e),r.inputs=el(n[2].trim(),!1),ay(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]||xe.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"&&xe.throwArgumentError("invalid function object","value",e);let r=uy(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(ji,n)}static fromString(e){let r={type:"function"};e=ly(e,r);let n=e.split(" returns ");n.length>2&&xe.throwArgumentError("invalid function string","value",e);let i=n[0].match(rl);if(i||xe.throwArgumentError("invalid function signature","value",e),r.name=i[1].trim(),r.name&&tl(r.name),r.inputs=el(i[2],!1),ay(i[3].trim(),r),n.length>1){let o=n[1].match(rl);(o[1].trim()!=""||o[3].trim()!="")&&xe.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)")&&xe.throwArgumentError(`cannot specify user defined ${e} error`,"fragment",t),t}class ei extends Nn{format(e){if(e||(e=Se.sighash),Se[e]||xe.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"&&xe.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(ji,r))}static fromString(e){let r={type:"error"},n=e.match(rl);return n||xe.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 Yi(t){return t.match(/^uint($|[^1-9])/)?t="uint256"+t.substring(4):t.match(/^int($|[^1-9])/)&&(t="int256"+t.substring(3)),t}const WE=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function tl(t){return(!t||!t.match(WE))&&xe.throwArgumentError(`invalid identifier "${t}"`,"value",t),t}const rl=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");function GE(t){t=t.trim();let e=[],r="",n=0;for(let i=0;ithis.wordSize&&_h.throwError("value out-of-bounds",O.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 Xa{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):Xa.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",O.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+i})),this._data.slice(this._offset,this._offset+i)}subReader(e){return new Xa(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 cy={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],g=[6,1536,393216,100663296],v=[0,8,16,24],E=[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],N=[224,256,384,512],x=[128,256],w=["hex","buffer","arrayBuffer","array","digest"],b={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 T=function(y,j,U){return function(F){return new h(y,j,y).update(F)[U]()}},B=function(y,j,U){return function(F,W){return new h(y,j,W).update(F)[U]()}},D=function(y,j,U){return function(F,W,oe,J){return f["cshake"+y].update(F,W,oe,J)[U]()}},$=function(y,j,U){return function(F,W,oe,J){return f["kmac"+y].update(F,W,oe,J)[U]()}},H=function(y,j,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 j,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);j=!0}for(var F=this.blocks,W=this.byteCount,oe=y.length,J=this.blockCount,V=0,Je=this.s,K,le;V>2]|=y[V]<>2]|=le<>2]|=(192|le>>6)<>2]|=(128|le&63)<=57344?(F[K>>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=K-W,this.block=F[J],K=0;K>8,U=y&255;U>0;)W.unshift(U),y=y>>8,U=y&255,++F;return j?W.push(F):W.unshift(F),this.update(W),W.length},h.prototype.encodeString=function(y){var j,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);j=!0}var F=0,W=y.length;if(j)F=W;else for(var oe=0;oe=57344?F+=3:(J=65536+((J&1023)<<10|y.charCodeAt(++oe)&1023),F+=4)}return F+=this.encode(F*8),this.update(y),F},h.prototype.bytepad=function(y,j){for(var U=this.encode(j),F=0;F>2]|=this.padding[j&3],this.lastByteIndex===this.byteCount)for(y[0]=y[U],j=1;j>4&15]+u[V&15]+u[V>>12&15]+u[V>>8&15]+u[V>>20&15]+u[V>>16&15]+u[V>>28&15]+u[V>>24&15];oe%y===0&&(Z(j),W=0)}return F&&(V=j[W],J+=u[V>>4&15]+u[V&15],F>1&&(J+=u[V>>12&15]+u[V>>8&15]),F>2&&(J+=u[V>>20&15]+u[V>>16&15])),J},h.prototype.arrayBuffer=function(){this.finalize();var y=this.blockCount,j=this.s,U=this.outputBlocks,F=this.extraBytes,W=0,oe=0,J=this.outputBits>>3,V;F?V=new ArrayBuffer(U+1<<2):V=new ArrayBuffer(J);for(var Je=new Uint32Array(V);oe>8&255,J[V+2]=Je>>16&255,J[V+3]=Je>>24&255;oe%y===0&&Z(j)}return F&&(V=oe<<2,Je=j[W],J[V]=Je&255,F>1&&(J[V+1]=Je>>8&255),F>2&&(J[V+2]=Je>>16&255)),J};function C(y,j,U){h.call(this,y,j,U)}C.prototype=new h,C.prototype.finalize=function(){return this.encode(this.outputBits,!0),h.prototype.finalize.call(this)};var Z=function(y){var j,U,F,W,oe,J,V,Je,K,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,je,ne,ot,ge,de,rt,Ae,_e,Ct,Me,De,Kt,Ve,Ke,Qt,Ie,Ue,xr,ke,Ye,bi,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],J=y[2]^y[12]^y[22]^y[32]^y[42],V=y[3]^y[13]^y[23]^y[33]^y[43],Je=y[4]^y[14]^y[24]^y[34]^y[44],K=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],j=Te^(J<<1|V>>>31),U=Ne^(V<<1|J>>>31),y[0]^=j,y[1]^=U,y[10]^=j,y[11]^=U,y[20]^=j,y[21]^=U,y[30]^=j,y[31]^=U,y[40]^=j,y[41]^=U,j=W^(Je<<1|K>>>31),U=oe^(K<<1|Je>>>31),y[2]^=j,y[3]^=U,y[12]^=j,y[13]^=U,y[22]^=j,y[23]^=U,y[32]^=j,y[33]^=U,y[42]^=j,y[43]^=U,j=J^(le<<1|Qr>>>31),U=V^(Qr<<1|le>>>31),y[4]^=j,y[5]^=U,y[14]^=j,y[15]^=U,y[24]^=j,y[25]^=U,y[34]^=j,y[35]^=U,y[44]^=j,y[45]^=U,j=Je^(Te<<1|Ne>>>31),U=K^(Ne<<1|Te>>>31),y[6]^=j,y[7]^=U,y[16]^=j,y[17]^=U,y[26]^=j,y[27]^=U,y[36]^=j,y[37]^=U,y[46]^=j,y[47]^=U,j=le^(W<<1|oe>>>31),U=Qr^(oe<<1|W>>>31),y[8]^=j,y[9]^=U,y[18]^=j,y[19]^=U,y[28]^=j,y[29]^=U,y[38]^=j,y[39]^=U,y[48]^=j,y[49]^=U,Jr=y[0],Pe=y[1],De=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,Ae=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,je=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,bi=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,xr=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^~je&ot,y[21]=yn^~ne&ge,y[30]=Ct^~De&Ve,y[31]=Me^~Kt&Ke,y[40]=ke^~bi&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]=je^~ot&de,y[23]=ne^~ge&rt,y[32]=De^~Ve&Qt,y[33]=Kt^~Ke&Ie,y[42]=bi^~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&Ae,y[25]=ge^~rt&_e,y[34]=Ve^~Qt&Ue,y[35]=Ke^~Ie&xr,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^~Ae&Ge,y[27]=rt^~_e&yn,y[36]=Qt^~Ue&Ct,y[37]=Ie^~xr&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]=Ae^~Ge&je,y[29]=_e^~yn&ne,y[38]=Ue^~Ct&De,y[39]=xr^~Me&Kt,y[48]=Wn^~ke&bi,y[49]=Gn^~Ye&Xe,y[0]^=E[F],y[1]^=E[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",O.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:i}}function dy(t,e){if(t.length===0&&tn.throwError("data too short",O.errors.BUFFER_OVERRUN,{}),t[e]>=248){const r=t[e]-247;e+1+r>t.length&&tn.throwError("data short segment too short",O.errors.BUFFER_OVERRUN,{});const n=gp(t,e+1,r);return e+1+r+n>t.length&&tn.throwError("data long segment too short",O.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",O.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",O.errors.BUFFER_OVERRUN,{});const n=gp(t,e+1,r);e+1+r+n>t.length&&tn.throwError("data array too short",O.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",O.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=dy(e,0);return r.consumed!==e.length&&tn.throwArgumentError("invalid rlp data","data",t),r.result}const YE="address/5.7.0",oi=new O(YE);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 XE=9007199254740991;function ZE(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(ZE(XE));function hy(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)!==hy(t)&&oi.throwArgumentError("bad icap checksum","address",t),e=LE(t.substring(4));e.length<40;)e="0"+e;e=yp("0x"+e)}else oi.throwArgumentError("invalid address","address",t);return e}function eb(t){try{return mt(t),!0}catch{}return!1}function tb(t){let e=BE(mt(t).substring(2)).toUpperCase();for(;e.length<30;)e="0"+e;return"XE"+hy("XE00"+e)+e}function Nh(t){let e=null;try{e=mt(t.from)}catch{oi.throwArgumentError("missing from address","transaction",t)}const r=To(se(G.from(t.nonce).toHexString()));return mt(It(ut(Bu([e,r])),12))}function rb(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 nb=Object.freeze(Object.defineProperty({__proto__:null,getAddress:mt,getContractAddress:Nh,getCreate2Address:rb,getIcapAddress:tb,isAddress:eb},Symbol.toStringTag,{value:"Module"}));class ib extends Dn{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 ob extends Dn{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 fo=new O(wl);function py(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||fo.throwError("cannot encode object for signature with missing names",O.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),a[c]&&fo.throwError("cannot encode object for signature with duplicate names",O.errors.INVALID_ARGUMENT,{argument:"values",coder:u,value:r}),a[c]=!0,r[c]})}else fo.throwArgumentError("invalid tuple value","tuple",r);e.length!==n.length&&fo.throwArgumentError("types/value length mismatch","tuple",r);let i=new ld(t.wordSize),o=new ld(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(g=>{m(g+d)})}else a.encode(i,c)}),s.forEach(a=>{a(i.length)});let l=t.appendWriter(i);return l+=t.appendWriter(o),l}function my(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===O.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===O.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 sb extends Dn{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&&fo.throwError("insufficient data length",O.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 wb(t,e,r,n,i){return t===ar.OVERLONG?(n.push(i),0):(n.push(65533),wy(t,e,r))}const xb=Object.freeze({error:yb,ignore:wy,replace:wb});function xy(t,e){e==null&&(e=xb.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&&(yy.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 Eb(t){return t.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function xl(t,e){return Eb(xy(t,e))}function bb(t,e=nl.current){return xy(mr(t,e))}class Ab extends gy{constructor(e){super("string",e)}defaultValue(){return""}encode(e,r){return super.encode(e,mr(r))}decode(e){return xl(super.decode(e))}}class Hl extends Dn{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 py(e,this.coders,r)}decode(e){return e.coerce(this.name,my(e,this.coders))}}const ql=new O(wl),_b=new RegExp(/^bytes([0-9]*)$/),Sb=new RegExp(/^(u?int)([0-9]*)$/);class kb{constructor(e){z(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new ib(e.name);case"bool":return new lb(e.name);case"string":return new Ab(e.name);case"bytes":return new ab(e.name);case"array":return new sb(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new Hl((e.components||[]).map(n=>this._getCoder(n)),e.name);case"":return new cb(e.name)}let r=e.type.match(Sb);if(r){let n=parseInt(r[2]||"256");return(n===0||n>256||n%8!==0)&&ql.throwArgumentError("invalid "+r[1]+" bit length","param",e),new gb(n/8,r[1]==="int",e.name)}if(r=e.type.match(_b),r){let n=parseInt(r[1]);return(n===0||n>32)&&ql.throwArgumentError("invalid bytes length","param",e),new ub(n,e.name)}return ql.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,r){return new Xa(e,this._getWordSize(),this.coerceFunc,r)}_getWriter(){return new ld(this._getWordSize())}getDefaultValue(e){const r=e.map(i=>this._getCoder(kt.from(i)));return new Hl(r,"_").defaultValue()}encode(e,r){e.length!==r.length&&ql.throwError("types/values length mismatch",O.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 Hl(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 Hl(i,"_").decode(this._getReader(se(r),n))}}const Nb=new kb;function ho(t){return ut(mr(t))}const Ey="hash/5.7.0";function by(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 Pb(t){const e={};for(let r=0;r>--a&1}const d=31,m=Math.pow(2,d),g=m>>>1,v=g>>1,E=m-1;let N=0;for(let B=0;B1;){let Q=D+$>>>1;B>>1|c(),H=H<<1^g,Y=(Y^g)<<1|g|1;w=H,b=1+Y-H}let T=n-4;return x.map(B=>{switch(B-T){case 3:return T+65792+(t[l++]<<16|t[l++]<<8|t[l++]);case 2:return T+256+(t[l++]<<8|t[l++]);case 1:return T+t[l++];default:return B-1}})}function Mb(t){let e=0;return()=>t[e++]}function Ib(t){return Mb(Cb(t))}function Rb(t){return t&1?~t>>1:t>>1}function Tb(t,e){let r=Array(t);for(let n=0;ne[s]):r}function Lb(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(jb(r,t))}for(;;){let r=t()-1;if(r<0)break;e.push(Db(r,t))}return Pb(_y(e))}function Bb(t){let e=[];for(;;){let r=t();if(r==0)break;e.push(r)}return e}function Sy(t,e,r){let n=Array(t).fill(void 0).map(()=>[]);for(let i=0;in[s].push(o));return n}function jb(t,e){let r=1+e(),n=e(),i=Bb(e),o=Sy(i.length,1+t,e);return _y(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(g=>g+m)]})}))}function Db(t,e){let r=1+e();return Sy(r,1+t,e).map(i=>[i[0],i.slice(1)])}function Ub(t){let e=Za(t).sort((n,i)=>n-i);return r();function r(){let n=[];for(;;){let u=Za(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 Fb(){return Ib(by("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 ju=Fb(),zb=new Set(Za(ju)),$b=new Set(Za(ju)),Hb=Lb(ju),qb=Ub(ju),Ep=45,bp=95;function ky(t){return bb(t)}function Wb(t){return t.filter(e=>e!=65039)}function Ny(t){for(let e of t.split(".")){let r=ky(e);try{for(let n=r.lastIndexOf(bp)-1;n>=0;n--)if(r[n]!==bp)throw new Error("underscore only allowed at start");if(r.length>=4&&r.every(n=>n<128)&&r[2]===Ep&&r[3]===Ep)throw new Error("invalid label extension")}catch(n){throw new Error(`Invalid label "${e}": ${n.message}`)}}return t}function Gb(t){return Ny(Vb(t,Wb))}function Vb(t,e){let r=ky(t).reverse(),n=[];for(;r.length;){let i=Qb(r);if(i){n.push(...e(i));continue}let o=r.pop();if(zb.has(o)){n.push(o);continue}if($b.has(o))continue;let s=Hb[o];if(s){n.push(...s);continue}throw new Error(`Disallowed codepoint: 0x${o.toString(16).toUpperCase()}`)}return Ny(Kb(String.fromCodePoint(...n)))}function Kb(t){return t.normalize("NFC")}function Qb(t,e){var r;let n=qb,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 Jb=new O(Ey),Py=new Uint8Array(32);Py.fill(0);function Ap(t){if(t.length===0)throw new Error("invalid ENS name; empty component");return t}function Cy(t){const e=mr(Gb(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(Ap(e.slice(n))),r}function ga(t){typeof t!="string"&&Jb.throwArgumentError("invalid ENS name; not a string","name",t);let e=Py;const r=Cy(t);for(;r.length;)e=ut(Ut([e,ut(r.pop())]));return re(e)}function Yb(t){return re(Ut(Cy(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 Xb=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 O(Ey),My=new Uint8Array(32);My.fill(0);const Zb=G.from(-1),Iy=G.from(0),Ry=G.from(1),eA=G.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function tA(t){const e=se(t),r=e.length%32;return r?Xt([e,My.slice(r)]):re(e)}const rA=pt(Ry.toHexString(),32),nA=pt(Iy.toHexString(),32),_p={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},$c=["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 iA={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 Hc(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=eA.mask(r?n-1:n),o=r?i.add(Ry).mul(Zb):Iy;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),tA(n)}}}switch(t){case"address":return function(e){return pt(mt(e),32)};case"bool":return function(e){return e?rA:nA};case"bytes":return function(e){return ut(e)};case"string":return function(e){return ho(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),!Hc(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=Hc(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=ho(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(Hc(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)=>$c.indexOf(n.name)-$c.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 Xb(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=[];$c.forEach(a=>{const u=e[a];u!=null&&(i[a]=iA[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 O(wl);class oA extends yl{}class sA extends yl{}class lA extends yl{}class ad extends yl{static isIndexed(e){return!!(e&&e._isIndexed)}}const aA={"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 ud{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 Nb}static getAddress(e){return mt(e)}static getSighash(e){return It(ho(e.format()),0,4)}static getEventTopic(e){return ho(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=aA[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,O.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(),O.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:r});let n=[];e.anonymous||n.push(this.getEventTopic(e));const i=(o,s)=>o.type==="string"?ho(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(ho(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",O.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:m,value:n[0]}),n=n.slice(1)}let i=[],o=[],s=[];e.inputs.forEach((m,g)=>{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,g)=>{if(m.indexed)if(l==null)u[g]=new ad({_isIndexed:!0,hash:null});else if(s[g])u[g]=new ad({_isIndexed:!0,hash:l[d++]});else try{u[g]=l[d++]}catch(v){u[g]=v}else try{u[g]=a[c++]}catch(v){u[g]=v}if(m.name&&u[m.name]==null){const v=u[g];v instanceof Error?Object.defineProperty(u,m.name,{enumerable:!0,get:()=>{throw Np(`property ${JSON.stringify(m.name)}`,v)}}):u[m.name]=v}});for(let m=0;m{throw Np(`index ${m}`,g)}})}return Object.freeze(u)}parseTransaction(e){let r=this.getFunction(e.data.substring(0,10).toLowerCase());return r?new sA({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 oA({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 lA({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 uA="abstract-provider/5.7.0";var cA=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 fA=new O(uA);class dA extends yl{static isForkEvent(e){return!!(e&&e._isForkEvent)}}class Wo{constructor(){fA.checkAbstract(new.target,Wo),z(this,"_isProvider",!0)}getFeeData(){return cA(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 hA="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 br=new O(hA),pA=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],mA=[O.errors.INSUFFICIENT_FUNDS,O.errors.NONCE_EXPIRED,O.errors.REPLACEMENT_UNDERPRICED];class El{constructor(){br.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)pA.indexOf(n)===-1&&br.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()&&br.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&&br.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)?br.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e):(r.type===0||r.type===1)&&n&&br.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&&br.throwError("network does not support EIP-1559",O.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=i.gasPrice),r.type=0):br.throwError("failed to get consistent fee data",O.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(mA.indexOf(i.code)>=0)throw i;return br.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",O.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]&&br.throwArgumentError("chainId address mismatch","transaction",e),i[0])),yield yt(r)})}_checkProvider(e){this.provider||br.throwError("missing provider",O.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(()=>{br.throwError(e,O.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 Ty={},we={},bl=Oy;function Oy(t,e){if(!t)throw new Error(e||"Assertion failed")}Oy.equal=function(e,r,n){if(e!=r)throw new Error(n||"Assertion failed: "+e+" != "+r)};var cd={exports:{}};typeof Object.create=="function"?cd.exports=function(e,r){r&&(e.super_=r,e.prototype=Object.create(r.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:cd.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 gA=cd.exports,vA=bl,yA=gA;we.inherits=yA;function wA(t,e){return(t.charCodeAt(e)&64512)!==55296||e<0||e+1>=t.length?!1:(t.charCodeAt(e+1)&64512)===56320}function xA(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):wA(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=Ly;function bA(t,e){for(var r="",n=0;n>>0}return o}we.join32=AA;function _A(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=_A;function SA(t,e){return t>>>e|t<<32-e}we.rotr32=SA;function kA(t,e){return t<>>32-e}we.rotl32=kA;function NA(t,e){return t+e>>>0}we.sum32=NA;function PA(t,e,r){return t+e+r>>>0}we.sum32_3=PA;function CA(t,e,r,n){return t+e+r+n>>>0}we.sum32_4=CA;function MA(t,e,r,n,i){return t+e+r+n+i>>>0}we.sum32_5=MA;function IA(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=IA;function RA(t,e,r,n){var i=e+n>>>0,o=(i>>0}we.sum64_hi=RA;function TA(t,e,r,n){var i=e+n;return i>>>0}we.sum64_lo=TA;function OA(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=OA;function LA(t,e,r,n,i,o,s,l){var a=e+n+o+l;return a>>>0}we.sum64_4_lo=LA;function BA(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=BA;function jA(t,e,r,n,i,o,s,l,a,u){var c=e+n+o+l+u;return c>>>0}we.sum64_5_lo=jA;function DA(t,e,r){var n=e<<32-r|t>>>r;return n>>>0}we.rotr64_hi=DA;function UA(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}we.rotr64_lo=UA;function FA(t,e,r){return t>>>r}we.shr64_hi=FA;function zA(t,e,r){var n=t<<32-r|e>>>r;return n>>>0}we.shr64_lo=zA;var Go={},Pp=we,$A=bl;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}Go.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=VA;function KA(t){return un(t,17)^un(t,19)^t>>>10}mn.g1_256=KA;var Oo=we,QA=Go,JA=mn,qc=Oo.rotl32,os=Oo.sum32,YA=Oo.sum32_5,XA=JA.ft_1,zy=QA.BlockHash,ZA=[1518500249,1859775393,2400959708,3395469782];function dn(){if(!(this instanceof dn))return new dn;zy.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Oo.inherits(dn,zy);var e_=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()),z_(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?E=(m>>1)-N:E=N,g.isubn(E)):E=0,d[v]=E,g.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,g;a.cmpn(-d)>0||u.cmpn(-m)>0;){var v=a.andln(3)+d&3,E=u.andln(3)+m&3;v===3&&(v=-1),E===3&&(E=-1);var N;v&1?(g=a.andln(7)+d&7,(g===3||g===5)&&E===2?N=-v:N=v):N=0,c[0].push(N);var x;E&1?(g=u.andln(7)+m&7,(g===3||g===5)&&v===2?x=-E:x=E):x=0,c[1].push(x),2*d===N+1&&(d=1-d),2*m===x+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}),eu=yr.getNAF,q_=yr.getJSF,tu=yr.assert;function Ei(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=Ei;Ei.prototype.point=function(){throw new Error("Not implemented")};Ei.prototype.validate=function(){throw new Error("Not implemented")};Ei.prototype._fixedNafMul=function(e,r){tu(e.precomputed);var n=e._getDoubles(),i=eu(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];tu(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};Ei.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 v=c-1,E=c;if(s[v]!==1||s[E]!==1){a[v]=eu(n[v],s[v],this._bitLength),a[E]=eu(n[E],s[E],this._bitLength),u=Math.max(a[v].length,u),u=Math.max(a[E].length,u);continue}var N=[r[v],null,null,r[E]];r[v].y.cmp(r[E].y)===0?(N[1]=r[v].add(r[E]),N[2]=r[v].toJ().mixedAdd(r[E].neg())):r[v].y.cmp(r[E].y.redNeg())===0?(N[1]=r[v].toJ().mixedAdd(r[E]),N[2]=r[v].add(r[E].neg())):(N[1]=r[v].toJ().mixedAdd(r[E]),N[2]=r[v].toJ().mixedAdd(r[E].neg()));var x=[-3,-1,-5,-7,0,7,5,1,3],w=q_(n[v],n[E]);for(u=Math.max(w[0].length,u),a[v]=new Array(u),a[E]=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][Y-1>>1]:Y<0&&(m=l[d][-Y-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&&(g=u,v=c),d.negative&&(d=d.neg(),m=m.neg()),g.negative&&(g=g.neg(),v=v.neg()),[{a:d,b:m},{a:g,b:v}]};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),g=u.redSqr().redIAdd(d).redISub(m).redISub(m),v=u.redMul(m.redISub(g)).redISub(s.redMul(d)),E=this.z.redMul(e.z).redMul(a);return this.curve.jpoint(g,v,E)};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),g=a.redMul(d.redISub(m)).redISub(o.redMul(c)),v=this.z.redMul(l);return this.curve.jpoint(m,g,v)};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 va=Qo(function(t,e){var r=e;r.base=Hi,r.short=G_,r.mont=null,r.edwards=null}),ya=Qo(function(t,e){var r=e,n=yr.assert;function i(l){l.type==="short"?this.curve=new va.short(l):l.type==="edwards"?this.curve=new va.edwards(l):this.curve=new va.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 Zy=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 V_=yr.assert;function Uu(t,e){if(t instanceof Uu)return t;this._importDER(t,e)||(V_(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 Fu=Uu;function K_(){this.place=0}function Vc(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)}Uu.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];Kc(i,r.length),i=i.concat(r),i.push(2),Kc(i,n.length);var o=i.concat(n),s=[48];return Kc(s,o.length),s=s.concat(o),yr.encode(s,e)};var Q_=function(){throw new Error("unsupported")},e1=yr.assert;function Cr(t){if(!(this instanceof Cr))return new Cr(t);typeof t=="string"&&(e1(Object.prototype.hasOwnProperty.call(ya,t),"Unknown curve "+t),t=ya[t]),t instanceof ya.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 J_=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 Zy({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||Q_(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 Zy({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 g=m.getX(),v=g.umod(this.n);if(v.cmpn(0)!==0){var E=d.invm(this.n).mul(v.mul(r.getPrivate()).iadd(e));if(E=E.umod(this.n),E.cmpn(0)!==0){var N=(m.getY().isOdd()?1:0)|(g.cmp(v)!==0?2:0);return i.canonical&&E.cmp(this.nh)>0&&(E=this.n.sub(E),N^=1),new Fu({r:v,s:E,recoveryParam:N})}}}}}};Cr.prototype.verify=function(e,r,n,i){e=this._truncateToN(new ue(e,16)),n=this.keyFromPublic(n,i),r=new Fu(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){e1((3&r)===r,"The recovery param is more than two bits"),e=new Fu(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 Fu(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 Y_=Qo(function(t,e){var r=e;r.version="6.5.4",r.utils=yr,r.rand=function(){throw new Error("unsupported")},r.curve=va,r.curves=ya,r.ec=J_,r.eddsa=null}),X_=Y_.ec;const Z_="signing-key/5.7.0",pd=new O(Z_);let Qc=null;function rn(){return Qc||(Qc=new X_("secp256k1")),Qc}class e3{constructor(e){z(this,"curve","secp256k1"),z(this,"privateKey",re(e)),On(this.privateKey)!==32&&pd.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&&pd.throwArgumentError("bad digest length","digest",e);const i=r.sign(n,{canonical:!0});return Lu({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(t1(e)));return pt("0x"+r.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function t3(t,e){const r=Lu(e),n={r:se(r.r),s:se(r.s)};return"0x"+rn().recoverPubKey(se(t),n,r.recoveryParam).encode("hex",!1)}function t1(t,e){const r=se(t);if(r.length===32){const n=new e3(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 pd.throwArgumentError("invalid public or private key","key","[REDACTED]")}const r3="transactions/5.7.0",Un=new O(r3);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 Dt(t){return t==="0x"?vy:G.from(t)}function n3(t){const e=t1(t);return mt(It(ut(It(e,1)),12))}function r1(t,e){return n3(t3(se(t),e))}function ur(t,e){const r=To(G.from(t).toHexString());return r.length>32&&Un.throwArgumentError("invalid length for "+e,"transaction:"+e,t),r}function Jc(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),Jc(r[0],r[1])):Jc(r.address,r.storageKeys));const e=Object.keys(t).map(r=>{const n=t[r].reduce((i,o)=>(i[o]=!0,i),{});return Jc(r,Object.keys(n).sort())});return e.sort((r,n)=>r.address.localeCompare(n.address)),e}function n1(t){return qi(t).map(e=>[e.address,e.storageKeys])}function i3(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",n1(t.accessList||[])];if(e){const n=Lu(e);r.push(ur(n.recoveryParam,"recoveryParam")),r.push(To(n.r)),r.push(To(n.s))}return Xt(["0x02",Bu(r)])}function o3(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",n1(t.accessList||[])];if(e){const n=Lu(e);r.push(ur(n.recoveryParam,"recoveryParam")),r.push(To(n.r)),r.push(To(n.s))}return Xt(["0x01",Bu(r)])}function i1(t,e,r){try{const n=Dt(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=r1(n,{r:t.r,s:t.s,recoveryParam:t.v})}catch{}}function s3(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=Dt(e[2]),n=Dt(e[3]),i={type:2,chainId:Dt(e[0]).toNumber(),nonce:Dt(e[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:Dt(e[4]),to:Rh(e[5]),value:Dt(e[6]),data:e[7],accessList:qi(e[8])};return e.length===9||(i.hash=ut(t),i1(i,e.slice(9),i3)),i}function l3(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:Dt(e[0]).toNumber(),nonce:Dt(e[1]).toNumber(),gasPrice:Dt(e[2]),gasLimit:Dt(e[3]),to:Rh(e[4]),value:Dt(e[5]),data:e[6],accessList:qi(e[7])};return e.length===8||(r.hash=ut(t),i1(r,e.slice(8),o3)),r}function a3(t){const e=Sh(t);e.length!==9&&e.length!==6&&Un.throwArgumentError("invalid raw transaction","rawTransaction",t);const r={nonce:Dt(e[0]).toNumber(),gasPrice:Dt(e[1]),gasLimit:Dt(e[2]),to:Rh(e[3]),value:Dt(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(Bu(i));try{r.from=r1(o,{r:re(r.r),s:re(r.s),recoveryParam:n})}catch{}r.hash=ut(t)}return r.type=null,r}function u3(t){const e=se(t);if(e[0]>127)return a3(e);switch(e[0]){case 1:return l3(e);case 2:return s3(e)}return Un.throwError(`unsupported transaction type: ${e[0]}`,O.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:e[0]})}const c3="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 O(c3);function ru(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",O.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 wa(t,e,r){return Ui(this,void 0,void 0,function*(){return Array.isArray(r)?yield Promise.all(r.map((n,i)=>wa(t,Array.isArray(e)?e[i]:e[n.name],n))):r.type==="address"?yield ru(t,e):r.type==="tuple"?yield wa(t,e,r.components):r.baseType==="array"?Array.isArray(e)?yield Promise.all(e.map(n=>wa(t,n,r.arrayChildren))):Promise.reject(gt.makeError("invalid value for array",O.errors.INVALID_ARGUMENT,{argument:"value",value:e})):e})}function zu(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:ru(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",O.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),u.override})):n.from=t.signer.getAddress():n.from&&(n.from=ru(t.provider,n.from));const i=yield yt({args:wa(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(",")}`,O.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:a}),s})}function f3(t,e){return function(...r){return zu(t,e,r)}}function d3(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",O.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield zu(t,e,n);return yield r.estimateGas(i)})}}function h3(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 o1(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 zu(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===O.errors.CALL_EXCEPTION&&(a.address=t.address,a.args=i,a.transaction=s),a}})}}function p3(t,e){return function(...r){return Ui(this,void 0,void 0,function*(){t.signer||gt.throwError("sending a transaction requires a signer",O.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),t.deployTransaction!=null&&(yield t._deployed());const n=yield zu(t,e,r),i=yield t.signer.sendTransaction(n);return h3(t,i),i})}}function Op(t,e,r){return e.constant?o1(t,e,r):p3(t,e)}function s1(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 m3 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(s1(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=VE(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 g3{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)):Wo.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",ru(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",O.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,o1(this,l,!0)),this.populateTransaction[s]==null&&z(this.populateTransaction,s,f3(this,l)),this.estimateGas[s]==null&&z(this.estimateGas,s,d3(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 ud.isInterface(e)?e:new ud(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",O.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this))),this._deployedPromise}fallback(e){this.signer||gt.throwError("sending a transactions require a signer",O.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const r=it(e||{});return["from","to"].forEach(function(n){r[n]!=null&>.throwError("cannot override "+n,O.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 ad.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 m3);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(s1(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",O.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 v3 extends g3{}class l1{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 w3="networks/5.7.1",Dp=new O(w3);function x3(t){return t&&typeof t.renetwork=="function"}function An(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 An(r)},e}function nu(t,e){const r=function(n,i){return n.JsonRpcProvider?new n.JsonRpcProvider(t,e):null};return r.renetwork=function(n){return nu(t,n)},r}const Up={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:An("homestead")},Fp={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:An("ropsten")},zp={chainId:63,name:"classicMordor",_defaultProvider:nu("https://www.ethercluster.com/mordor","classicMordor")},Gl={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:An("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:An("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:An("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:An("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:nu("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:zp,classicTestnet:zp,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:nu("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:An("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:An("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 Gl){const i=Gl[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=Gl[t];return n==null?null:{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress,_defaultProvider:n._defaultProvider||null}}const e=Gl[t.name];if(!e)return typeof t.chainId!="number"&&Dp.throwArgumentError("invalid network chainId","network",t),t;t.chainId!==0&&t.chainId!==e.chainId&&Dp.throwArgumentError("network chainId mismatch","network",t);let r=t._defaultProvider||null;return r==null&&e._defaultProvider&&(x3(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 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())})};function A3(t,e){return b3(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 _3=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 O(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(Ah(t)){if(e&&(e.split("/")[0]==="text"||e.split(";")[0].trim()==="application/json"))try{return xl(t)}catch{}return re(t)}return t}function S3(t){return mr(t.replace(/%([0-9a-f][0-9a-f])/gi,(e,r)=>String.fromCharCode(parseInt(r,16))))}function k3(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 x in t.headers)l[x.toLowerCase()]={key:x,value:String(t.headers[x])},["if-none-match","if-modified-since"].indexOf(x.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",O.errors.INVALID_ARGUMENT,{argument:"url",url:a,user:t.user,password:"[REDACTED]"});const x=t.user+":"+t.password;l.authorization={key:"Authorization",value:"Basic "+Ay(mr(x))}}t.skipFetchSetup!=null&&(u.skipFetchSetup=!!t.skipFetchSetup),t.fetchOptions!=null&&(u.fetchOptions=it(t.fetchOptions))}const m=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),g=a?a.match(m):null;if(g)try{const x={statusCode:200,statusMessage:"OK",headers:{"content-type":g[1]||"text/plain"},body:g[2]?by(g[3]):S3(g[3])};let w=x.body;return r&&(w=r(x.body,x)),Promise.resolve(w)}catch(x){Br.throwError("processing response error",O.errors.SERVER_ERROR,{body:Qn(g[1],g[2]),error:x,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 v={};Object.keys(l).forEach(x=>{const w=l[x];v[w.key]=w.value}),u.headers=v;const E=function(){let x=null;return{promise:new Promise(function(T,B){d&&(x=setTimeout(()=>{x!=null&&(x=null,B(Br.makeError("timeout",O.errors.TIMEOUT,{requestBody:Qn(u.body,v["content-type"]),requestMethod:u.method,timeout:d,url:a})))},d))}),cancel:function(){x!=null&&(clearTimeout(x),x=null)}}}(),N=function(){return _3(this,void 0,void 0,function*(){for(let x=0;x=300)&&(E.cancel(),Br.throwError("bad response",O.errors.SERVER_ERROR,{status:w.statusCode,headers:w.headers,body:Qn(b,w.headers?w.headers["content-type"]:null),requestBody:Qn(u.body,v["content-type"]),requestMethod:u.method,url:a})),r)try{const T=yield r(b,w);return E.cancel(),T}catch(T){if(T.throttleRetry&&x{let l=null;if(o!=null)try{l=JSON.parse(xl(o))}catch(a){Br.throwError("invalid JSON",O.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 k3(t,i,n)}function po(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 iu="qpzry9x8gf2tvdw0s3jn54khce6mua7l",gd={};for(var Vl=0;Vl>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 a1(t){for(var e=1,r=0;r126)return"Invalid prefix ("+t+")";e=_o(e)^n>>5}for(e=_o(e),r=0;rr)throw new TypeError("Exceeds length limit");t=t.toLowerCase();var n=a1(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=_o(n)^s,i+=iu.charAt(s)}for(o=0;o<6;++o)n=_o(n);for(n^=1,o=0;o<6;++o){var l=n>>(5-o)*5&31;i+=iu.charAt(l)}return i}function u1(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=a1(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 P3(){var t=u1.apply(null,arguments);if(typeof t=="object")return t}function C3(t){var e=u1.apply(null,arguments);if(typeof e=="object")return e;throw new Error(e)}function $u(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:te.allowNull(this.accessList.bind(this),null),blockHash:te.allowNull(s,null),blockNumber:te.allowNull(a,null),transactionIndex:te.allowNull(a,null),confirmations:te.allowNull(a,null),from:r,gasPrice:te.allowNull(n),maxPriorityFeePerGas:te.allowNull(n),maxFeePerGas:te.allowNull(n),gasLimit:n,to:te.allowNull(r,null),value:n,nonce:a,data:o,r:te.allowNull(this.uint256),s:te.allowNull(this.uint256),v:te.allowNull(a),creates:te.allowNull(r,null),raw:te.allowNull(o)},e.transactionRequest={from:te.allowNull(r),nonce:te.allowNull(a),gasLimit:te.allowNull(n),gasPrice:te.allowNull(n),maxPriorityFeePerGas:te.allowNull(n),maxFeePerGas:te.allowNull(n),to:te.allowNull(r),value:te.allowNull(n),data:te.allowNull(c),type:te.allowNull(a),accessList:te.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:a,blockNumber:a,transactionHash:s,address:r,topics:te.arrayOf(s),data:o,logIndex:a,blockHash:s},e.receipt={to:te.allowNull(this.address,null),from:te.allowNull(this.address,null),contractAddress:te.allowNull(r,null),transactionIndex:a,root:te.allowNull(l),gasUsed:n,logsBloom:te.allowNull(o),blockHash:s,transactionHash:s,logs:te.arrayOf(this.receiptLog.bind(this)),blockNumber:a,confirmations:te.allowNull(a,null),cumulativeGasUsed:n,effectiveGasPrice:te.allowNull(n),status:te.allowNull(a),type:u},e.block={hash:te.allowNull(s),parentHash:s,number:a,timestamp:a,nonce:te.allowNull(l),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:te.allowNull(r),extraData:o,transactions:te.allowNull(te.arrayOf(s)),baseFeePerGas:te.allowNull(n)},e.blockWithTransactions=it(e.block),e.blockWithTransactions.transactions=te.allowNull(te.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:te.allowNull(i,void 0),toBlock:te.allowNull(i,void 0),blockHash:te.allowNull(s,void 0),address:te.allowNull(r,void 0),topics:te.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:te.allowNull(a),blockHash:te.allowNull(s),transactionIndex:a,removed:te.allowNull(this.boolean.bind(this)),address:r,data:te.allowFalsish(o,"0x"),topics:te.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():ls.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===fb?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 Ou(e);throw new Error("invalid blockTag")}hash(e,r){const n=this.hex(e,r);return On(n)!==32?ls.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=te.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 te.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=te.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 u3(e)}receiptLog(e){return te.check(this.formats.receiptLog,e)}receipt(e){const r=te.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&&ls.throwArgumentError("alt-root-status/status mismatch","value",{root:r.root,status:r.status}),r.status=n,delete r.root):ls.throwArgumentError("invalid alt-root-status","value.root",r.root)}else r.root.length!==66&&ls.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 te.check(this.formats.filter,e)}filterLog(e){return te.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 c1(t){return t&&typeof t.isCommunityResource=="function"}function vd(t){return c1(t)&&t.isCommunityResource()}let qp=!1;function _l(){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 O($t),L3=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 B3(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(dA.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 as(){return new Date().getTime()}function Vp(t){return new Promise(e=>{setTimeout(e,t)})}const j3=["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=B3(e[2]),i={};return n.length>0&&(i.topics=n),r&&r!=="*"&&(i.address=r),i}pollable(){return this.tag.indexOf(":")>=0||j3.indexOf(this.tag)>=0}}const U3={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 Xc(t){return pt(G.from(t).toHexString(),32)}function Kp(t){return md.encode(Ut([t,It(jp(jp(t)),0,4)]))}const f1=new RegExp("^(ipfs)://(.*)$","i"),Qp=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),f1,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function xa(t,e){try{return xl(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 Zc(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 F3(t){if(t.length%32===0)return t;const e=new Uint8Array(Math.ceil(t.length/32)*32);return e.set(t),e}function d1(t){const e=[];let r=0;for(let n=0;nG.from(e).eq(1)).catch(e=>{if(e.code===O.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,ga(this.name),r||"0x"])};let i=!1;(yield this.supportsWildcard())&&(i=!0,n.data=Xt(["0x9061b923",d1([Yb(this.name),n.data])]));try{let o=yield this.provider.call(n);return se(o).length%32===4&&he.throwError("resolver threw error",O.errors.CALL_EXCEPTION,{transaction:n,data:o}),i&&(o=ol(o,0)),o}catch(o){if(o.code===O.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=U3[String(e)];if(n==null&&he.throwError(`unsupported coin type: ${e}`,O.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===mb?null:this.provider.formatter.callAddress(i)}catch(i){if(i.code===O.errors.CALL_EXCEPTION)return null;throw i}const r=yield this._fetchBytes("0xf1cb7e06",Xc(e));if(r==null||r==="0x")return null;const n=this._getAddress(e,r);return n==null&&he.throwError("invalid or unsupported coin data",O.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",O.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})})}getText(e){return ae(this,void 0,void 0,function*(){let r=mr(e);r=Ut([Xc(64),Xc(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:xl(n)})}}let ef=null,z3=1;class Hu extends Wo{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",O.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 po(()=>this._ready().then(e=>e,e=>{if(!(e.code===O.errors.NETWORK_ERROR&&e.event==="noNetwork"))throw e}))}static getFormatter(){return ef==null&&(ef=new te),ef}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,(g,v)=>(g.status=v.statusCode,g));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}`,O.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(", ")}`,O.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(as()-o.respTime<=e)return o.blockNumber;break}catch{if(this._internalBlockNumber===i)break}}const r=as(),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=as();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=z3++,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",O.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",O.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",O.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=as();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,g=null;const v=E=>ae(this,void 0,void 0,function*(){u||(yield Vp(1e3),this.getTransactionCount(i.from).then(N=>ae(this,void 0,void 0,function*(){if(!u){if(N<=i.nonce)m=E;else{{const x=yield this.getTransaction(e);if(x&&x.blockNumber!=null)return}for(g==null&&(g=m-3,g{u||this.once("block",v)}))});if(u)return;this.once("block",v),a.push(()=>{this.removeListener("block",v)})}if(typeof n=="number"&&n>0){const m=setTimeout(()=>{c()||l(he.makeError("timeout exceeded",O.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 G.from(e)}catch(r){return he.throwError("bad result from backend",O.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",O.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",O.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",O.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=>Ou(s))}),o=yield this.perform("getStorageAt",i);try{return re(o)}catch(s){return he.throwError("bad result from backend",O.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.",O.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",O.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>=L3&&he.throwError("CCIP read exceeded maximum redirections",O.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",O.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 x=0;xae(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 po(()=>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 po(()=>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)}),te.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 yd(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",O.errors.UNSUPPORTED_OPERATION,{operation:r,network:n.name});try{const i=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+ga(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=xa(yield this.call({to:n,data:"0x691f3431"+ga(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 yd(this,s,o);try{const l=yield r.getAvatar();if(l)return l.url}catch(l){if(l.code!==O.errors.CALL_EXCEPTION)throw l}try{const l=xa(yield this.call({to:s,data:"0x691f3431"+ga(o).substring(2)}),0);r=yield this.getResolver(l)}catch(l){if(l.code!==O.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",O.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 En=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 O($t),$3=["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 h1(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",O.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",O.errors.UNPREDICTABLE_GAS_LIMIT,{reason:o.message,method:t,transaction:n,error:e})}let i=e.message;throw e.code===O.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",O.errors.INSUFFICIENT_FUNDS,{error:e,method:t,transaction:n}),i.match(/nonce (is )?too low/i)&&wt.throwError("nonce has already been used",O.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",O.errors.REPLACEMENT_UNDERPRICED,{error:e,method:t,transaction:n}),i.match(/only replay-protected/i)&&wt.throwError("legacy pre-eip-155 transactions not supported",O.errors.UNSUPPORTED_OPERATION,{error:e,method:t,transaction:n}),$3.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",O.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:n}),e}function Yp(t){return new Promise(function(e){setTimeout(e,t)})}function H3(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 us(t){return t&&t.toLowerCase()}const wd={};class Oh extends El{constructor(e,r,n){if(super(),e!==wd)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",O.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new q3(wd,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,O.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=>En(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",O.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:n}),h1("sendTransaction",s,o)))})}signTransaction(e){return wt.throwError("signing transactions is unsupported",O.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return En(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 po(()=>En(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 En(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",O.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),i}})}_legacySignMessage(e){return En(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",O.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),i}})}_signTypedData(e,r,n){return En(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",O.errors.ACTION_REJECTED,{action:"_signTypedData",from:o,messageData:{domain:i.domain,types:r,value:i.value}}),s}})}unlock(e){return En(this,void 0,void 0,function*(){const r=this.provider,n=yield this.getAddress();return r.send("personal_unlockAccount",[n.toLowerCase(),e,null])})}}class q3 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 W3={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 Hu{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 En(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",O.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:n})}}return wt.throwError("could not detect network",O.errors.NETWORK_ERROR,{event:"noNetwork"})})}getSigner(e){return new Oh(wd,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),H3).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",[us(r.address),r.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[us(r.address),r.blockTag]];case"getCode":return["eth_getCode",[us(r.address),r.blockTag]];case"getStorageAt":return["eth_getStorageAt",[us(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=us(r.filter.address)),["eth_getLogs",[r.filter]]}return null}perform(e,r){return En(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",O.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(n[0],n[1])}catch(i){return h1(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(W3);if(r)for(const o in r)r[o]&&(n[o]=!0);UE(e,n);const i={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(function(o){if(e[o]==null)return;const s=Ou(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 O($t);Cs=function(){e.throwError("WebSockets not supported in this environment",O.errors.UNSUPPORTED_OPERATION,{operation:"new WebSocket()"})}}var tf=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 Kl=new O($t);let G3=1;class qu extends vi{constructor(e,r){r==="any"&&Kl.throwError("WebSocketProvider does not support 'any' network yet",O.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){Kl.throwError("cannot reset events block on WebSocketProvider",O.errors.UNSUPPORTED_OPERATION,{operation:"resetEventBlock"})}set pollingInterval(e){Kl.throwError("cannot set polling interval on WebSocketProvider",O.errors.UNSUPPORTED_OPERATION,{operation:"setPollingInterval"})}poll(){return tf(this,void 0,void 0,function*(){return null})}set polling(e){e&&Kl.throwError("cannot set polling on WebSocketProvider",O.errors.UNSUPPORTED_OPERATION,{operation:"setPolling"})}send(e,r){const n=G3++;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 tf(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 tf(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 V3=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 O($t);class p1 extends vi{detectNetwork(){const e=Object.create(null,{detectNetwork:{get:()=>super.detectNetwork}});return V3(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",O.errors.UNKNOWN_ERROR,{}),this._network==null&&(z(this,"_network",r),this.emit("network",r,null))),r})}}class Fn extends p1{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",O.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",O.errors.NOT_IMPLEMENTED,{operation:"getUrl"})}}const Xp=new O($t),Ea="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";class m1 extends qu{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 m1(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&&_l(),Promise.resolve(!0))}}isCommunityResource(){return this.apiKey===Ea}}const K3=new O($t),Ql="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function Q3(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 K3.throwArgumentError("unsupported network","name",t)}class g1 extends Fn{isCommunityResource(){return this.apiKey===Ql}static getApiKey(e){return e??Ql}static getUrl(e,r){r==null&&(r=Ql);const n={allowGzip:!0,url:"https://"+Q3(e.name)+r,throttleCallback:(i,o)=>(r.apiKey===Ql&&_l(),Promise.resolve(!0))};return r.projectSecret!=null&&(n.user="",n.password=r.projectSecret),n}}var J3=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 O($t);class v1 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 J3(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 Jl=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 O($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=Ou(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 Y3(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 rf(t,e,r){if(t==="call"&&e.code===O.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",O.errors.CALL_EXCEPTION,{error:e,data:"0x"})}}let n=e.message;throw e.code===O.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",O.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",O.errors.NONCE_EXPIRED,{error:e,method:t,transaction:r}),n.match(/another transaction with same nonce/)&&ti.throwError("replacement fee too low",O.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",O.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,method:t,transaction:r}),e}class y1 extends Hu{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 Jl(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:Y3;this.emit("debug",{action:"request",request:i,provider:this});const l={url:i,throttleSlotInterval:1e3,throttleCallback:(c,d)=>(this.isCommunityResource()&&_l(),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 Jl(this,void 0,void 0,function*(){return this.network})}perform(e,r){const n=Object.create(null,{perform:{get:()=>super.perform}});return Jl(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=>rf("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 rf("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 rf("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",O.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",O.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 ou=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 O($t);function Yl(){return new Date().getTime()}function nm(t){let e=null;for(let r=0;re?null:(n+i)/2}function mo(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=>mo(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=mo(n),JSON.stringify(r)+":"+n}).join(",")+"}"}throw new Error("unknown value type: "+typeof t)}let X3=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 Z3=[O.errors.CALL_EXCEPTION,O.errors.INSUFFICIENT_FUNDS,O.errors.NONCE_EXPIRED,O.errors.REPLACEMENT_UNDERPRICED,O.errors.UNPREDICTABLE_GAS_LIMIT],eS=["address","args","errorArgs","errorSignature","method","transaction"];function Xl(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 tS(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 rS(t,e,r){let n=mo;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,mo(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)),mo(i))}:n=function(i){return i==null?null:mo(i)};break;default:throw new Error("unknown method: "+e)}return tS(n,t.quorum)}function cs(t,e){return ou(this,void 0,void 0,function*(){const r=t.provider;return r.blockNumber!=null&&r.blockNumber>=e||e===-1?r:po(()=>new Promise((n,i)=>{setTimeout(function(){return r.blockNumber>=e?n(r):t.cancelled?n(null):n(void 0)},0)}),{oncePoll:r})})}function nS(t,e,r,n){return ou(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 cs(t,e)),i[r](n.address,n.blockTag||"latest");case"getStorageAt":return n.blockTag&&pe(n.blockTag)&&(i=yield cs(t,e)),i.getStorageAt(n.address,n.position,n.blockTag||"latest");case"getBlock":return n.blockTag&&pe(n.blockTag)&&(i=yield cs(t,e)),i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash);case"call":case"estimateGas":return n.blockTag&&pe(n.blockTag)&&(i=yield cs(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 cs(t,e)),i.getLogs(o)}}return Si.throwError("unknown method error",O.errors.UNKNOWN_ERROR,{method:r,params:n})})}class w1 extends Hu{constructor(e,r){e.length===0&&Si.throwArgumentError("missing providers","providers",e);const n=e.map((s,l)=>{if(Wo.isProvider(s)){const c=vd(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=vd(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 ou(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 ou(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=Yl();let u=i.filter(g=>g.runner&&a-g.startg+v.weight,0);for(;u{g.staller=null}),g.runner=nS(g,o,e,r).then(E=>{g.done=!0,g.result=E,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:v,backend:Xl(g,Yl()),request:{method:e,params:nr(r)},provider:this})},E=>{g.done=!0,g.error=E,this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:v,backend:Xl(g,Yl()),request:{method:e,params:nr(r)},provider:this})}),this.listenerCount("debug")&&this.emit("debug",{action:"request",rid:v,backend:Xl(g,null),request:{method:e,params:nr(r)},provider:this}),u+=g.weight}const c=[];i.forEach(g=>{g.done||!g.runner||(c.push(g.runner),g.staller&&c.push(g.staller.getPromise()))}),c.length&&(yield Promise.race(c));const d=i.filter(g=>g.done&&g.error==null);if(d.length>=this.quorum){const g=n(d);if(g!==void 0)return i.forEach(v=>{v.staller&&v.staller.cancel(),v.cancelled=!0}),g;l||(yield om(100).getPromise()),l=!1}const m=i.reduce((g,v)=>{if(!v.done||v.error==null)return g;const E=v.error.code;return Z3.indexOf(E)>=0&&(g[E]||(g[E]={error:v.error,weight:0}),g[E].weight+=v.weight),g},{});if(Object.keys(m).forEach(g=>{const v=m[g];if(v.weight{x.staller&&x.staller.cancel(),x.cancelled=!0});const E=v.error,N={};eS.forEach(x=>{E[x]!=null&&(N[x]=E[x])}),Si.throwError(E.reason||E.message,g,N)}),i.filter(g=>!g.done).length===0)break}return i.forEach(a=>{a.staller&&a.staller.cancel(),a.cancelled=!0}),Si.throwError("failed to meet quorum",O.errors.SERVER_ERROR,{method:e,params:r,results:i.map(a=>Xl(a)),provider:this})})}}const x1=null,ba=new O($t),vs="84842078b09946638c03157f83405213";class E1 extends qu{constructor(e,r){const n=new Bh(e,r),i=n.connection;i.password&&ba.throwError("INFURA WebSocket project secrets unsupported",O.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?(ba.assertArgument(typeof e.projectId=="string","projectSecret requires a projectId","projectId",e.projectId),ba.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:ba.throwError("unsupported network",O.errors.INVALID_ARGUMENT,{argument:"network",value:e})}const i={allowGzip:!0,url:"https://"+n+"/v3/"+r.projectId,throttleCallback:(o,s)=>(r.projectId===vs&&_l(),Promise.resolve(!0))};return r.projectSecret!=null&&(i.user="",i.password=r.projectSecret),i}isCommunityResource(){return this.projectId===vs}}class iS 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 nf=new O($t),oS="ETHERS_JS_SHARED";class b1 extends Fn{static getApiKey(e){return e&&typeof e!="string"&&nf.throwArgumentError("invalid apiKey","apiKey",e),e||oS}static getUrl(e,r){nf.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:nf.throwArgumentError("unsupported network","network",arguments[0])}return n+"?apiKey="+r}}const sm=new O($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",O.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 O($t);let sS=1;function um(t,e){const r="Web3LegacyFetcher";return function(n,i){const o={method:n,params:i,id:sS++,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 lS(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 _1 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=lS(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 O($t);function aS(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 qu(t);default:cm.throwArgumentError("unsupported URL scheme","network",t)}}const r=Th(t);return(!r||!r._defaultProvider)&&cm.throwError("unsupported getDefaultProvider network",O.errors.NETWORK_ERROR,{operation:"getDefaultProvider",network:t}),r._defaultProvider({FallbackProvider:w1,AlchemyProvider:Lh,AnkrProvider:g1,CloudflareProvider:v1,EtherscanProvider:y1,InfuraProvider:Bh,JsonRpcProvider:vi,NodesmithProvider:b1,PocketProvider:A1,Web3Provider:_1,IpcProvider:x1},e)}const uS=Object.freeze(Object.defineProperty({__proto__:null,AlchemyProvider:Lh,AlchemyWebSocketProvider:m1,AnkrProvider:g1,BaseProvider:Hu,CloudflareProvider:v1,EtherscanProvider:y1,FallbackProvider:w1,Formatter:te,InfuraProvider:Bh,InfuraWebSocketProvider:E1,IpcProvider:x1,JsonRpcBatchProvider:iS,JsonRpcProvider:vi,JsonRpcSigner:Oh,NodesmithProvider:b1,PocketProvider:A1,Provider:Wo,Resolver:yd,StaticJsonRpcProvider:p1,UrlJsonRpcProvider:Fn,Web3Provider:_1,WebSocketProvider:qu,getDefaultProvider:aS,getNetwork:Th,isCommunityResourcable:c1,isCommunityResource:vd,showThrottleMessage:_l},Symbol.toStringTag,{value:"Module"})),cS="solidity/5.7.0",fS=new RegExp("^bytes([0-9]+)$"),dS=new RegExp("^(u?int)([0-9]*)$"),hS=new RegExp("^(.*)\\[([0-9]*)\\]$"),pS="0000000000000000000000000000000000000000000000000000000000000000",Xi=new O(cS);function S1(t,e,r){switch(t){case"address":return r?pa(e,32):se(e);case"string":return mr(e);case"bytes":return se(e);case"bool":return e=e?"0x01":"0x00",r?pa(e,32):se(e)}let n=t.match(dS);if(n){let i=parseInt(n[2]||"256");return(n[2]&&String(i)!==n[2]||i%8!==0||i===0||i>256)&&Xi.throwArgumentError("invalid number type","type",t),r&&(i=256),e=G.from(e).toTwos(i),pa(e,i/8)}if(n=t.match(fS),n){const i=parseInt(n[1]);return(String(i)!==n[1]||i===0||i>32)&&Xi.throwArgumentError("invalid bytes type","type",t),se(e).byteLength!==i&&Xi.throwArgumentError(`invalid value for ${t}`,"value",e),r?se((e+pS).substring(0,66)):e}if(n=t.match(hS),n&&Array.isArray(e)){const i=n[1];parseInt(n[2]||String(e.length))!=e.length&&Xi.throwArgumentError(`invalid array length for ${t}`,"value",e);const s=[];return e.forEach(function(l){s.push(S1(i,l,!0))}),Ut(s)}return Xi.throwArgumentError("invalid type","type",t)}function mS(t,e){t.length!=e.length&&Xi.throwArgumentError("wrong number of values; expected ${ types.length }","values",e);const r=[];return t.forEach(function(n,i){r.push(S1(n,e[i]))}),re(Ut(r))}function gS(t,e){return ut(mS(t,e))}var Wu={},Cn={},k1={};const vS=Fo(nb);var yS={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:()=>{(yS?"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},N1=t=>t?fm(t):fm;var P1={exports:{}},C1={},M1={exports:{}},I1={};/** + * @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 jo=L;function wS(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var xS=typeof Object.is=="function"?Object.is:wS,ES=jo.useState,bS=jo.useEffect,AS=jo.useLayoutEffect,_S=jo.useDebugValue;function SS(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,of(i)&&o({inst:i})},[t,r,e]),bS(function(){return of(i)&&o({inst:i}),t(function(){of(i)&&o({inst:i})})},[t]),_S(r),r}function of(t){var e=t.getSnapshot;t=t.value;try{var r=e();return!xS(t,r)}catch{return!0}}function kS(t,e){return e()}var NS=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?kS:SS;I1.useSyncExternalStore=jo.useSyncExternalStore!==void 0?jo.useSyncExternalStore:NS;M1.exports=I1;var PS=M1.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 Gu=L,CS=PS;function MS(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var IS=typeof Object.is=="function"?Object.is:MS,RS=CS.useSyncExternalStore,TS=Gu.useRef,OS=Gu.useEffect,LS=Gu.useMemo,BS=Gu.useDebugValue;C1.useSyncExternalStoreWithSelector=function(t,e,r,n,i){var o=TS(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=LS(function(){function a(g){if(!u){if(u=!0,c=g,g=n(g),i!==void 0&&s.hasValue){var v=s.value;if(i(v,g))return d=v}return d=g}if(v=d,IS(c,g))return v;var E=n(g);return i!==void 0&&i(v,E)?v:(c=g,d=E)}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=RS(t,o[0],o[1]);return OS(function(){s.hasValue=!0,s.value=l},[l]),BS(l),l};P1.exports=C1;var jS=P1.exports;const Vu=Uo(jS),{useSyncExternalStoreWithSelector:DS}=Vu;function R1(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"?N1(t):t,r=(n,i)=>R1(e,n,i);return Object.assign(r,e),r},T1=t=>t?dm(t):dm;var US=t=>T1(t);const FS=Object.freeze(Object.defineProperty({__proto__:null,create:T1,createStore:N1,default:US,useStore:R1},Symbol.toStringTag,{value:"Module"})),zS=Fo(FS);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createWeb3ReactStoreAndActions=t.MAX_SAFE_CHAIN_ID=void 0;const e=vS,r=zS;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 g=0;g{var v,E;const N=(v=m.chainId)!==null&&v!==void 0?v:g.chainId,x=(E=m.accounts)!==null&&E!==void 0?E:g.accounts;let w=g.activating;return w&&N&&x&&(w=!1),{chainId:N,accounts:x,activating:w}})}function d(){a++,l.setState(o)}return[l,{startActivation:u,update:c,resetState:d}]}t.createWeb3ReactStoreAndActions=s})(k1);var $S={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:()=>{($S?"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},jh=t=>t?hm(t):hm,{useSyncExternalStoreWithSelector:HS}=Vu;function O1(t,e=t.getState,r){const n=HS(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const pm=t=>{const e=typeof t=="function"?jh(t):t,r=(n,i)=>O1(e,n,i);return Object.assign(r,e),r},L1=t=>t?pm(t):pm;var qS=t=>L1(t);const WS=Object.freeze(Object.defineProperty({__proto__:null,create:L1,createStore:jh,default:qS,useStore:O1},Symbol.toStringTag,{value:"Module"})),GS=Fo(WS),{useSyncExternalStoreWithSelector:VS}=Vu;function B1(t,e=t.getState,r){const n=VS(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return L.useDebugValue(n),n}const mm=(t,e)=>{const r=jh(t),n=(i,o=e)=>B1(r,i,o);return Object.assign(n,r),n},KS=(t,e)=>t?mm(t,e):mm,QS=Object.freeze(Object.defineProperty({__proto__:null,createWithEqualityFn:KS,useStoreWithEqualityFn:B1},Symbol.toStringTag,{value:"Module"})),JS=Fo(QS),YS=Fo(uS);var XS=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]}),ZS=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),ek=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)&&XS(e,t,r);return ZS(e,t),e},tk=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 rk=k1,go=L,gm=GS,nk=JS;let So;function ik(){return tk(this,void 0,void 0,function*(){if(So===void 0)try{const{Web3Provider:t}=yield Promise.resolve().then(()=>ek(YS));So=t}catch{console.debug("@ethersproject/providers not available"),So=null}})}function ok(t){const[e,r]=(0,rk.createWeb3ReactStoreAndActions)(),n=t(r),i=dk(e),o=hk(i),s=pk(n,i,o);return[n,Object.assign(Object.assign(Object.assign({},i),o),s),e]}Cn.initializeConnector=ok;function sk({chainId:t,accounts:e,activating:r}){return!!(t&&e&&!r)}function j1(...t){function e(d){const m=t.findIndex(([g])=>d===g);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:g}])=>g())[e(d)]}function i(d){return t.map(([,{useAccounts:g}])=>g())[e(d)]}function o(d){return t.map(([,{useIsActivating:g}])=>g())[e(d)]}function s(d){return t.map(([,{useAccount:g}])=>g())[e(d)]}function l(d){return t.map(([,{useIsActive:g}])=>g())[e(d)]}function a(d,m){const g=e(d);return t.map(([,{useProvider:E}],N)=>E(m,N===g))[g]}function u(d,m){const g=e(d);return t.map(([,{useENSNames:E}],N)=>E(N===g?m:void 0))[g]}function c(d,m){const g=e(d);return t.map(([,{useENSName:E}],N)=>E(N===g?m:void 0))[g]}return{useSelectedStore:r,useSelectedChainId:n,useSelectedAccounts:i,useSelectedIsActivating:o,useSelectedAccount:s,useSelectedIsActive:l,useSelectedProvider:a,useSelectedENSNames:u,useSelectedENSName:c}}Cn.getSelectedConnector=j1;function lk(...t){const{useSelectedStore:e,useSelectedChainId:r,useSelectedAccounts:n,useSelectedIsActivating:i,useSelectedAccount:o,useSelectedIsActive:s,useSelectedProvider:l,useSelectedENSNames:a,useSelectedENSName:u}=j1(...t);function c(){const B=t.map(([,{useIsActive:D}])=>D()).findIndex(D=>D);return t[B===-1?0:B][0]}function d(){return e(c())}function m(){return r(c())}function g(){return n(c())}function v(){return i(c())}function E(){return o(c())}function N(){return s(c())}function x(T){return l(c(),T)}function w(T){return a(c(),T)}function b(T){return u(c(),T)}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:g,usePriorityIsActivating:v,usePriorityAccount:E,usePriorityIsActive:N,usePriorityProvider:x,usePriorityENSNames:w,usePriorityENSName:b}}Cn.getPriorityConnector=lk;const ak=({chainId:t})=>t,uk=({accounts:t})=>t,ck=({activating:t})=>t,fk=(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 dk(t){function e(){return(0,gm.useStore)(t,ak)}function r(){return(0,nk.useStoreWithEqualityFn)(t,uk,fk)}function n(){return(0,gm.useStore)(t,ck)}return{useChainId:e,useAccounts:r,useIsActivating:n}}function hk({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 sk({chainId:o,accounts:s,activating:l})}return{useAccount:n,useIsActive:i}}function vm(t,e=[]){const[r,n]=(0,go.useState)();return(0,go.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 pk(t,{useAccounts:e,useChainId:r},{useAccount:n,useIsActive:i}){function o(a,u=!0){const c=i(),d=r(),[m,g]=(0,go.useState)(So!==void 0);return(0,go.useEffect)(()=>{if(m)return;let v=!1;return ik().then(()=>{v||g(!0)}),()=>{v=!0}},[m]),(0,go.useMemo)(()=>{if(u){if(t.customProvider)return t.customProvider;if(So&&t.provider)return new So(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,go.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 Ku={},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 g=new i(c,d||a,m),v=r?r+u:u;return a._events[v]?a._events[v].fn?a._events[v]=[a._events[v],g]:a._events[v].push(g):(a._events[v]=g,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,g=d.length,v=new Array(g);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)}}Ku.MockEIP1193Provider=vk;var Do={},yk=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]}),wk=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),xk=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)&&yk(e,t,r);return wk(e,t),e};Object.defineProperty(Do,"__esModule",{value:!0});Do.useWeb3React=Do.Web3ReactProvider=void 0;const su=xk(L),Ek=Cn,U1=(0,su.createContext)(void 0);function bk({children:t,connectors:e,connectorOverride:r,network:n,lookupENS:i=!0}){const o=(0,su.useRef)(e);if(e.length!=o.current.length||e.some((Q,X)=>{const ie=o.current[X];return Q[0]!==ie[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:g,useSelectedENSNames:v,useSelectedENSName:E}=s,N=l(),x=r??N,w=a(x),b=u(x),T=c(x),B=d(x),D=m(x),$=g(x,n),H=v(x,i?$:void 0),Y=E(x,i?$:void 0);return su.default.createElement(U1.Provider,{value:{connector:x,chainId:w,accounts:b,isActivating:T,account:B,isActive:D,provider:$,ENSNames:H,ENSName:Y,hooks:s}},t)}Do.Web3ReactProvider=bk;function Ak(){const t=(0,su.useContext)(U1);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(Ku,t),r(Do,t)})(Wu);const sf=[{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 xd{static createInterface(){return new ud(sf)}static connect(e,r){return new v3(e,sf,r)}}zh(xd,"abi",sf);var F1={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ym=qr.createContext&&qr.createContext(F1),_k=["attr","size","title"];function Sk(t,e){if(t==null)return{};var r=kk(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 kk(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 lu(){return lu=Object.assign?Object.assign.bind():function(t){for(var e=1;eqr.createElement(e.tag,au({key:r},e.attr),z1(e.child)))}function zn(t){return e=>qr.createElement(Mk,lu({attr:au({},t.attr)},e),z1(t.child))}function Mk(t){var e=r=>{var{attr:n,size:i,title:o}=t,s=Sk(t,_k),l=i||r.size||"1em",a;return r.className&&(a=r.className),t.className&&(a=(a?a+" ":"")+t.className),qr.createElement("svg",lu({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},r.attr,n,s,{className:a,style:au(au({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(F1)}function Ik(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 Rk(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 Tk(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 Ok(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 Lk(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 Bk(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 jk(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 $1(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 Uk={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 xm=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:()=>{(Uk?"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},Fk=t=>t?xm(t):xm;var H1={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:zk}=qr,{useSyncExternalStoreWithSelector:$k}=Vu;let Em=!1;function Hk(t,e=t.getState,r){(H1?"production":void 0)!=="production"&&r&&!Em&&(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"),Em=!0);const n=$k(t.subscribe,t.getState,t.getServerState||t.getState,e,r);return zk(n),n}const bm=t=>{(H1?"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"?Fk(t):t,r=(n,i)=>Hk(e,n,i);return Object.assign(r,e),r},qk=t=>t?bm(t):bm;var Wk={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 q1(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)}}}},Gk=(t,e)=>(r,n,i)=>{let o={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:N=>N,version:0,merge:(N,x)=>({...x,...N}),...e},s=!1;const l=new Set,a=new Set;let u;try{u=o.getStorage()}catch{}if(!u)return t((...N)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...N)},n,i);const c=sl(o.serialize),d=()=>{const N=o.partialize({...n()});let x;const w=c({state:N,version:o.version}).then(b=>u.setItem(o.name,b)).catch(b=>{x=b});if(x)throw x;return w},m=i.setState;i.setState=(N,x)=>{m(N,x),d()};const g=t((...N)=>{r(...N),d()},n,i);let v;const E=()=>{var N;if(!u)return;s=!1,l.forEach(w=>w(n()));const x=((N=o.onRehydrateStorage)==null?void 0:N.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 b;return v=o.merge(w,(b=n())!=null?b:g),r(v,!0),d()}).then(()=>{x==null||x(v,void 0),s=!0,a.forEach(w=>w(v))}).catch(w=>{x==null||x(void 0,w)})};return i.persist={setOptions:N=>{o={...o,...N},N.getStorage&&(u=N.getStorage())},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>E(),hasHydrated:()=>s,onHydrate:N=>(l.add(N),()=>{l.delete(N)}),onFinishHydration:N=>(a.add(N),()=>{a.delete(N)})},E(),v||g},Vk=(t,e)=>(r,n,i)=>{let o={storage:q1(()=>localStorage),partialize:E=>E,version:0,merge:(E,N)=>({...N,...E}),...e},s=!1;const l=new Set,a=new Set;let u=o.storage;if(!u)return t((...E)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),r(...E)},n,i);const c=()=>{const E=o.partialize({...n()});return u.setItem(o.name,{state:E,version:o.version})},d=i.setState;i.setState=(E,N)=>{d(E,N),c()};const m=t((...E)=>{r(...E),c()},n,i);let g;const v=()=>{var E,N;if(!u)return;s=!1,l.forEach(w=>{var b;return w((b=n())!=null?b:m)});const x=((N=o.onRehydrateStorage)==null?void 0:N.call(o,(E=n())!=null?E: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 b;return g=o.merge(w,(b=n())!=null?b:m),r(g,!0),c()}).then(()=>{x==null||x(g,void 0),g=n(),s=!0,a.forEach(w=>w(g))}).catch(w=>{x==null||x(void 0,w)})};return i.persist={setOptions:E=>{o={...o,...E},E.storage&&(u=E.storage)},clearStorage:()=>{u==null||u.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>v(),hasHydrated:()=>s,onHydrate:E=>(l.add(E),()=>{l.delete(E)}),onFinishHydration:E=>(a.add(E),()=>{a.delete(E)})},o.skipHydration||v(),g||m},Kk=(t,e)=>"getStorage"in e||"serialize"in e||"deserialize"in e?((Wk?"production":void 0)!=="production"&&console.warn("[DEPRECATED] `getStorage`, `serialize` and `deserialize` options are deprecated. Use `storage` option instead."),Gk(t,e)):Vk(t,e),Qk=Kk;var jr=(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))(jr||{});const Ee=t=>`${t.package}:${t.publisher}`,Vi=t=>{var e;return((e=t.metadata)==null?void 0:e.name)||Ee(t)},lf=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",Zl=(t,e)=>t.package===e.package&&t.publisher===e.publisher,Jo=qk()(Qk((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=lf(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/${Ee(r)}`)).json(),o=lf(i),s=e().myApps;s[o]=s[o].map(a=>Zl(a,i)?i:a);const l=[...e().listedApps].map(a=>Zl(a,i)?i:a);return t({myApps:s,listedApps:l}),i},installApp:async r=>{if((await fetch(`${or}/apps/${Ee(r)}/caps`,{method:"POST"})).status!==jr.OK)throw new Error(`Failed to approve caps for app: ${Ee(r)}`);if((await fetch(`${or}/apps/${Ee(r)}`,{method:"POST"})).status!==jr.CREATED)throw new Error(`Failed to install app: ${Ee(r)}`)},updateApp:async r=>{if((await fetch(`${or}/apps/${Ee(r)}`,{method:"PUT"})).status!==jr.NO_CONTENT)throw new Error(`Failed to update app: ${Ee(r)}`)},uninstallApp:async r=>{if(!confirm(`Are you sure you want to remove ${Ee(r)}?`))return;if((await fetch(`${or}/apps/${Ee(r)}`,{method:"DELETE"})).status!==jr.NO_CONTENT)throw new Error(`Failed to remove app: ${Ee(r)}`);const i={...e().myApps},o=lf(r);i[o]=i[o].filter(l=>!Zl(l,r));const s=e().listedApps.map(l=>Zl(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!==jr.OK)throw new Error(`Failed to get app: ${r}`);return await n.json()},downloadApp:async(r,n)=>{if((await fetch(`${or}/apps/listed/${Ee(r)}`,{method:"POST",body:JSON.stringify({download_from:n})})).status!==jr.CREATED)throw new Error(`Failed to get app: ${Ee(r)}`)},getCaps:async r=>{const n=await fetch(`${or}/apps/${Ee(r)}/caps`);if(n.status!==jr.OK)throw new Error(`Failed to get app: ${Ee(r)}`);return(await n.json())[0]},approveCaps:async r=>{if((await fetch(`${or}/apps/${Ee(r)}/caps`,{method:"POST"})).status!==jr.OK)throw new Error(`Failed to get app: ${Ee(r)}`)},setMirroring:async(r,n)=>{if((await fetch(`${or}/apps/${Ee(r)}/mirror`,{method:n?"PUT":"DELETE"})).status!==jr.OK)throw new Error(`Failed to start mirror: ${Ee(r)}`);e().getMyApp(r)},setAutoUpdate:async(r,n)=>{if((await fetch(`${or}/apps/${Ee(r)}/auto-update`,{method:n?"PUT":"DELETE"})).status!==jr.OK)throw new Error(`Failed to change auto update: ${Ee(r)}`);e().getMyApp(r)},get:e,set:t}),{name:"app_store",storage:q1(()=>sessionStorage)}));function W1({app:t,size:e="medium",...r}){var i,o,s,l,a;const n=vl();return P.jsxs("div",{...r,className:`app-header row ${e} ${r.className||""}`,onClick:()=>n(`/app-details/${Ee(t)}`),children:[P.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"}),P.jsxs("div",{className:"col title",children:[P.jsx("div",{className:"app-name ellipsis",children:((o=t.metadata)==null?void 0:o.name)||Ee(t)}),((s=t.metadata)==null?void 0:s.description)&&e!=="large"&&P.jsx("div",{className:"ellipsis",children:(a=(l=t.metadata)==null?void 0:l.description)==null?void 0:a.slice(0,100)})]})]})}const Jk=({show:t,hide:e,hideClose:r=!1,title:n,...i})=>{const o=s=>{s.stopPropagation()};return t?P.jsx("div",{className:`modal-backdrop ${t?"show":""}`,onClick:e,children:P.jsxs("div",{...i,className:`col modal ${i.className||""}`,onClick:o,children:[!!n&&P.jsx("h4",{className:"modal-title",children:n}),!r&&P.jsx(Bk,{className:"close",onClick:e}),P.jsx("div",{className:"col modal-content",onClick:o,children:i.children})]})}):null};function Ed({msg:t}){return P.jsxs("div",{id:"loading",className:"col center",children:[P.jsx("h4",{children:t}),P.jsxs("div",{id:"loader",children:[" ",P.jsx("div",{})," ",P.jsx("div",{})," ",P.jsx("div",{})," ",P.jsx("div",{})," "]})]})}function G1({app:t,...e}){var Q,X,ie,M,f,p,A;const{updateApp:r,downloadApp:n,installApp:i,getCaps:o,getMyApp:s}=Jo(),[l,a]=L.useState(!1),[u,c]=L.useState(((ie=(X=(Q=t.metadata)==null?void 0:Q.properties)==null?void 0:X.mirrors)==null?void 0:ie[0])||"Other"),[d,m]=L.useState(""),[g,v]=L.useState([]),[E,N]=L.useState(""),{clean:x,installed:w,downloaded:b,updatable:T}=L.useMemo(()=>{var h,C,Z,y;const _=(Object.entries(((C=(h=t==null?void 0:t.metadata)==null?void 0:h.properties)==null?void 0:C.code_hashes)||{}).find(([j])=>{var U,F;return j===((F=(U=t.metadata)==null?void 0:U.properties)==null?void 0:F.current_version)})||[])[1],I=t.installed,R=!!t.state,k=!!((Z=t.state)!=null&&Z.our_version&&_)&&((y=t.state)==null?void 0:y.our_version)!==_&&t.publisher!==window.our.node;return{clean:!I&&!R&&!k,installed:I,downloaded:R,updatable:k}},[t]);L.useEffect(()=>{var S,_,I;c(((I=(_=(S=t.metadata)==null?void 0:S.properties)==null?void 0:_.mirrors)==null?void 0:I[0])||"Other")},[(f=(M=t.metadata)==null?void 0:M.properties)==null?void 0:f.mirrors]);const B=L.useCallback(async()=>{w&&!T?window.alert("App is installed"):(b&&o(t).then(S=>{v(S.request_capabilities)}),a(!0))},[t,w,b,T,a,o]),D=L.useCallback(async S=>{S.preventDefault(),S.stopPropagation();const _=u==="Other"?d:u;if(!_){window.alert("Please select a mirror");return}try{N(`Downloading ${Vi(t)}...`),await n(t,_);const I=setInterval(()=>{s(t).then(()=>{N(""),a(!1),clearInterval(I)}).catch(console.log)},2e3)}catch(I){console.error(I),window.alert(`Failed to download app from ${_}, please try a different mirror.`),N("")}},[u,d,t,n,s]),$=L.useCallback(async()=>{try{N(`Installing ${Vi(t)}...`),await i(t);const S=setInterval(()=>{s(t).then(_=>{_.installed&&(N(""),a(!1),clearInterval(S))}).catch(console.log)},2e3)}catch(S){console.error(S),window.alert("Failed to install, please try again."),N("")}},[t,i,s]),H=L.useCallback(async()=>{try{N(`Updating ${Vi(t)}...`),await r(t);const S=setInterval(()=>{s(t).then(_=>{_.installed&&(N(""),a(!1),clearInterval(S))}).catch(console.log)},2e3)}catch(S){console.error(S),window.alert("Failed to update, please try again."),N("")}},[t,r,s]),Y=Vi(t);return P.jsxs(P.Fragment,{children:[P.jsx("button",{...e,type:"button",className:`small action-btn ${e.className||""}`,onClick:B,children:w&&T?"Update":w?"Installed":b?"Install":"Download"}),P.jsx(Jk,{show:l,hide:()=>a(!1),children:E?P.jsx(Ed,{msg:E}):x?P.jsxs("form",{className:"col",style:{alignItems:"center",gap:"1em"},onSubmit:D,children:[P.jsxs("h4",{children:["Download '",Y,"'"]}),P.jsx("h5",{style:{margin:0},children:"Select Mirror"}),P.jsx("select",{value:u,onChange:S=>c(S.target.value),children:(((A=(p=t.metadata)==null?void 0:p.properties)==null?void 0:A.mirrors)||[]).concat(["Other"]).map(S=>P.jsx("option",{value:S,children:S},S))}),u==="Other"&&P.jsx("input",{type:"text",value:d,onChange:S=>m(S.target.value),placeholder:"Mirror, i.e. 'template.os'",style:{padding:"0.5em",maxWidth:240,width:"100%"},required:!0,autoFocus:!0}),P.jsx("button",{type:"submit",children:"Download"})]}):b?P.jsxs(P.Fragment,{children:[P.jsx("h4",{children:"Approve App Permissions"}),P.jsxs("h5",{style:{margin:0},children:[Vi(t)," needs the following permissions:"]}),P.jsx("ul",{className:"col",style:{alignItems:"flex-start"},children:g.map(S=>P.jsx("li",{children:S},S))}),P.jsx("button",{type:"button",onClick:$,children:"Approve & Install"})]}):P.jsxs(P.Fragment,{children:[P.jsx("h4",{children:"Approve App Permissions"}),P.jsxs("h5",{style:{margin:0},children:[Vi(t)," needs the following permissions:"]}),P.jsx("br",{}),P.jsx("ul",{className:"col",style:{alignItems:"flex-start"},children:g.map(S=>P.jsx("li",{children:S},S))}),P.jsx("button",{type:"button",onClick:H,children:"Approve & Update"})]})})]})}const V1=t=>!!t&&t[0]==="o",Am=Qs.unstable_batchedUpdates||(t=>t()),Ki=(t,e,r=1e-4)=>Math.abs(t-e)t===!0||!!(t&&t[e]),hr=(t,e)=>typeof t=="function"?t(e):t,K1="_szhsinMenu",Yk=t=>t[K1],Xk=(t,e)=>Object.defineProperty(e,K1,{value:t}),Qu=(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),Zk=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]}},af=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 Q1(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]),eN="szh-menu-container",Aa="szh-menu",tN="szh-menu-button",rN="arrow",nN="item",J1=L.createContext(),Y1=L.createContext({}),Sm=L.createContext({}),X1=L.createContext({}),iN=L.createContext({}),Dh=L.createContext({}),$r=Object.freeze({ENTER:"Enter",ESC:"Escape",SPACE:" ",HOME:"Home",END:"End",LEFT:"ArrowLeft",RIGHT:"ArrowRight",UP:"ArrowUp",DOWN:"ArrowDown"}),Et=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"}),oN=Object.freeze({entering:"opening",entered:"open",exiting:"closing",exited:"closed"}),uf="absolute",sN="presentation",Z1="menuitem",km={"aria-hidden":!0,role:Z1},lN=Xk("MenuButton",L.forwardRef(function({className:e,isOpen:r,disabled:n,children:i,...o},s){const l=L.useMemo(()=>({open:r}),[r]);return P.jsx("button",{"aria-haspopup":!0,"aria-expanded":r,"aria-disabled":n||void 0,type:"button",disabled:n,...o,ref:s,className:al({block:tN,modifiers:l,className:e}),children:i})})),aN=({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 P.jsx("div",{...Qu({onKeyDown:u,onBlur:c},r),className:al({block:eN,modifiers:L.useMemo(()=>({theme:o,itemTransition:a}),[o,a]),className:t}),style:{position:"absolute",...r==null?void 0:r.style},ref:e,children:n})},uN=()=>{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)}}},cN=(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,g=()=>{if(o.sorted)return;const N=t.current.querySelectorAll(".szh-menu__item");d.sort((x,w)=>_m(N,x)-_m(N,w)),o.sorted=!0};let v=-1,E;switch(a){case Et.RESET:break;case Et.SET:E=u;break;case Et.UNSET:E=N=>N===u?void 0:N;break;case Et.FIRST:g(),v=0,E=d[v];break;case Et.LAST:g(),v=d.length-1,E=d[v];break;case Et.SET_INDEX:g(),v=c,E=d[v];break;case Et.INCREASE:g(),v=m,v<0&&(v=d.indexOf(u)),v++,v>=d.length&&(v=0),E=d[v];break;case Et.DECREASE:g(),v=m,v<0&&(v=d.indexOf(u)),v--,v<0&&(v=d.length-1),E=d[v];break}E||(v=-1),n(E),o.hoverIndex=v},[t,o]);return{hoverItem:r,dispatch:l,updateItems:s}},fN=(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=Zk(n),a=v=>v+o.left-s.left-l.left,u=v=>v+o.left+i.width-s.right+l.right,c=v=>v+o.top-s.top-l.top,d=v=>v+o.top+i.height-s.bottom+l.bottom;return{menuRect:i,containerRect:o,getLeftOverflow:a,getRightOverflow:u,getTopOverflow:c,getBottomOverflow:d,confineHorizontally:v=>{let E=a(v);if(E<0)v-=E;else{const N=u(v);N>0&&(v-=N,E=a(v),E<0&&(v-=E))}return v},confineVertically:v=>{let E=c(v);if(E<0)v-=E;else{const N=d(v);N>0&&(v-=N,E=c(v),E<0&&(v-=E))}return v}}},dN=({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},hN=({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:g})=>{let v=m,E=n;g!=="initial"&&(E=u(E),g==="anchor"&&(E=Math.min(E,t.bottom-e.top),E=Math.max(E,t.top-e.top-r.height)));let N,x,w;return v==="left"?(N=i,g!=="initial"&&(x=s(N),x<0&&(w=l(o),(w<=0||-x>w)&&(N=o,v="right")))):(N=o,g!=="initial"&&(w=l(N),w>0&&(x=s(i),(x>=0||-x{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},mN=({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:g})=>{let v=m==="top"?"top":"bottom",E=n;g!=="initial"&&(E=a(E),g==="anchor"&&(E=Math.min(E,t.right-e.left),E=Math.max(E,t.left-e.left-r.width)));let N,x,w;return v==="top"?(N=i,g!=="initial"&&(x=s(N),x<0&&(w=l(o),(w<=0||-x>w)&&(N=o,v="bottom")))):(N=o,g!=="initial"&&(w=l(N),w>0&&(x=s(i),(x>=0||-x{const{menuRect:u,containerRect:c}=a,d=r==="left"||r==="right";let m=d?n:i,g=d?i:n;if(t){const B=l.current;d?m+=B.offsetWidth:g+=B.offsetHeight}const v=s.left-c.left-u.width-m,E=s.right-c.left+m,N=s.top-c.top-u.height-g,x=s.bottom-c.top+g;let w,b;e==="end"?(w=s.right-c.left-u.width,b=s.bottom-c.top-u.height):e==="center"?(w=s.left-c.left-(u.width-s.width)/2,b=s.top-c.top-(u.height-s.height)/2):(w=s.left-c.left,b=s.top-c.top),w+=m,b+=g;const T={...a,anchorRect:s,placeLeftX:v,placeRightX:E,placeLeftorRightY:b,placeTopY:N,placeBottomY:x,placeToporBottomX:w,arrowRef:l,arrow:t,direction:r,position:o};switch(r){case"left":case"right":return hN(T);case"top":case"bottom":default:return mN(T)}},_a=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,vN=({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:g="bottom",position:v="auto",overflow:E="visible",setDownOverflow:N,repositionFlag:x,captureFocus:w=!0,state:b,endTransition:T,isDisabled:B,menuItemFocus:D,gap:$=0,shift:H=0,children:Y,onClose:Q,...X})=>{const[ie,M]=L.useState({x:Pm,y:Pm}),[f,p]=L.useState({}),[A,S]=L.useState(),[_,I]=L.useState(g),[R]=L.useState(uN),[k,h]=L.useReducer(ne=>ne+1,1),{transition:C,boundingBoxRef:Z,boundingBoxPadding:y,rootMenuRef:j,rootAnchorRef:U,scrollNodesRef:F,reposition:W,viewScroll:oe,submenuCloseDelay:J}=L.useContext(Dh),{submenuCtx:V,reposSubmenu:Je=x}=L.useContext(Sm),K=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}=cN(K,le),fe=V1(b),Oe=ll(C,"open"),Yr=ll(C,"close"),me=F.current,ze=ne=>{switch(ne.key){case $r.HOME:ce(Et.FIRST);break;case $r.END:ce(Et.LAST);break;case $r.UP:ce(Et.DECREASE,Pe);break;case $r.DOWN:ce(Et.INCREASE,Pe);break;case $r.SPACE:ne.target&&ne.target.className.indexOf(Aa)!==-1&&ne.preventDefault();return;default:return}ne.preventDefault(),ne.stopPropagation()},gn=()=>{b==="closing"&&S(),hr(T)},$e=ne=>{ne.stopPropagation(),R.on(J,()=>{ce(Et.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=(Z?Z.current:af(j.current))||window);const de=fN(l,K,me.menu,y);let{arrowX:rt,arrowY:Ae,x:_e,y:Ct,computedDirection:Me}=gN({arrow:n,align:m,direction:g,gap:$,shift:H,position:v,anchorRect:ge,arrowRef:Qr,positionHelpers:de});const{menuRect:De}=de;let Kt=De.height;if(!ne&&E!=="visible"){const{getTopOverflow:Ve,getBottomOverflow:Ke}=de;let Qt,Ie;const Ue=Ne.current.height,xr=Ke(Ct);if(xr>0||Ki(xr,0)&&Ki(Kt,Ue))Qt=Kt-xr,Ie=xr;else{const ke=Ve(Ct);(ke<0||Ki(ke,0)&&Ki(Kt,Ue))&&(Qt=Kt+ke,Ie=0-ke,Qt>=0&&(Ct-=ke))}Qt>=0?(Kt=Qt,S({height:Qt,overflowAmt:Ie})):S()}n&&p({x:rt,y:Ae}),M({x:_e,y:Ct}),I(Me),Ne.current={width:De.width,height:Kt}},[n,m,y,g,$,H,v,E,o,s,l,Z,j,me]);_a(()=>{fe&&(Ht(),Te.current&&h()),Te.current=fe,Jr.current=Ht},[fe,Ht,Je]),_a(()=>{A&&!N&&(K.current.scrollTop=0)},[A,N]),_a(()=>wr,[wr]),L.useEffect(()=>{let{menu:ne}=me;if(!fe||!ne)return;if(ne=ne.addEventListener?ne:window,!me.anchors){me.anchors=[];let rt=af(U&&U.current);for(;rt&&rt!==ne;)me.anchors.push(rt),rt=af(rt)}let ot=oe;if(me.anchors.length&&ot==="initial"&&(ot="auto"),ot==="initial")return;const ge=()=>{ot==="auto"?Am(()=>Ht(!0)):hr(Q,{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,Q,oe,Ht]);const Le=!!A&&A.overflowAmt>0;L.useEffect(()=>{if(Le||!fe||!d)return;const ne=()=>Am(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 Ae,_e;if(de){const{inlineSize:Ct,blockSize:Me}=de[0]||de;Ae=Ct,_e=Me}else{const Ct=rt.getBoundingClientRect();Ae=Ct.width,_e=Ct.height}Ae===0||_e===0||Ki(Ae,Ne.current.width,1)&&Ki(_e,Ne.current.height,1)||Qs.flushSync(()=>{Jr.current(),h()})}),ot=K.current;return ne.observe(ot,{box:"border-box"}),()=>ne.unobserve(ot)},[W]),L.useEffect(()=>{if(!fe){ce(Et.RESET),Yr||S();return}const{position:ne,alwaysUpdate:ot}=D||{},ge=()=>{ne===Ms.FIRST?ce(Et.FIRST):ne===Ms.LAST?ce(Et.LAST):ne>=-1&&ce(Et.SET_INDEX,void 0,ne)};if(ot)ge();else if(w){const de=setTimeout(()=>{const rt=K.current;rt&&!rt.contains(document.activeElement)&&(le.current.focus(),ge())},Oe?170:100);return()=>clearTimeout(de)}},[fe,Oe,Yr,w,D,ce]);const qe=L.useMemo(()=>({isParentOpen:fe,submenuCtx:R,dispatch:ce,updateItems:wr}),[fe,R,ce,wr]);let Rr,Ce;A&&(N?Ce=A.overflowAmt:Rr=A.height);const We=L.useMemo(()=>({reposSubmenu:k,submenuCtx:R,overflow:E,overflowAmt:Ce,parentMenuRef:K,parentDir:_}),[k,R,E,Ce,_]),vn=Rr>=0?{maxHeight:Rr,overflow:E}:void 0,Be=L.useMemo(()=>({state:b,dir:_}),[b,_]),Ge=L.useMemo(()=>({dir:_}),[_]),yn=al({block:Aa,element:rN,modifiers:Ge,className:i.className}),je=P.jsxs("ul",{role:"menu","aria-label":t,...Q1(B),...Qu({onPointerEnter:V==null?void 0:V.off,onPointerMove:$e,onPointerLeave:He,onKeyDown:ze,onAnimationEnd:gn},X),ref:Uh(c,K),className:al({block:Aa,modifiers:Be,className:e}),style:{...r,...vn,margin:0,display:b==="closed"?"none":void 0,position:uf,left:ie.x,top:ie.y},children:[P.jsx("li",{tabIndex:-1,style:{position:uf,left:0,top:0,display:"block",outline:"none"},ref:le,...km,...u}),n&&P.jsx("li",{...km,...i,className:yn,style:{display:"block",position:uf,left:f.x,top:f.y,...i.style},ref:Qr}),P.jsx(Sm.Provider,{value:We,children:P.jsx(Y1.Provider,{value:qe,children:P.jsx(J1.Provider,{value:Pe,children:hr(Y,Be)})})})]});return a?P.jsx(aN,{...a,isOpen:fe,children:je}):je},yN=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:g="initial",portal:v,theming:E,onItemClick:N,...x},w){const b=L.useRef(null),T=L.useRef({}),{anchorRef:B,state:D,onClose:$}=x,H=L.useMemo(()=>({initialMounted:i,unmountOnClose:o,transition:s,transitionTimeout:l,boundingBoxRef:a,boundingBoxPadding:u,rootMenuRef:b,rootAnchorRef:B,scrollNodesRef:T,reposition:c,viewScroll:g,submenuOpenDelay:d,submenuCloseDelay:m}),[i,o,s,l,B,a,u,c,g,d,m]),Y=L.useMemo(()=>({handleClick(X,ie){X.stopPropagation||hr(N,X);let M=X.keepOpen;M===void 0&&(M=ie&&X.key===$r.SPACE),M||hr($,{value:X.value,key:X.key,reason:ul.CLICK})},handleClose(X){hr($,{key:X,reason:ul.CLICK})}}),[N,$]);if(!D)return null;const Q=P.jsx(Dh.Provider,{value:H,children:P.jsx(X1.Provider,{value:Y,children:P.jsx(vN,{...x,ariaLabel:e||"Menu",externalRef:w,containerRef:b,containerProps:{className:r,containerRef:b,containerProps:n,theming:E,transition:s,onClose:$}})})});return v===!0&&typeof document<"u"?Qs.createPortal(Q,document.body):v?v.target?Qs.createPortal(Q,v.target):v.stablePosition?null:Q:Q}),bd=0,Ad=1,uu=2,cu=3,fu=4,wN=5,ew=6,xN=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],tw=t=>({_s:t,status:xN[t],isEnter:tfu}),_d=t=>t?ew:wN,EN=(t,e)=>{switch(t){case Ad:case bd:return uu;case fu:case cu:return _d(e)}},bN=t=>typeof t=="object"?[t.enter,t.exit]:[t,t],AN=(t,e)=>setTimeout(()=>{isNaN(document.body.offsetTop)||t(e+1)},0),Cm=(t,e,r,n,i)=>{clearTimeout(n.current);const o=tw(t);e(o),r.current=o,i&&i({current:o})},_N=({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(()=>tw(o?uu:_d(s))),d=L.useRef(u),m=L.useRef(),[g,v]=bN(i),E=L.useCallback(()=>{const x=EN(d.current._s,l);x&&Cm(x,c,d,m,a)},[a,l]),N=L.useCallback(x=>{const w=T=>{switch(Cm(T,c,d,m,a),T){case Ad:g>=0&&(m.current=setTimeout(E,g));break;case fu:v>=0&&(m.current=setTimeout(E,v));break;case bd:case cu:m.current=AN(w,T);break}},b=d.current.isEnter;typeof x!="boolean"&&(x=!b),x?!b&&w(t?r?bd:Ad:uu):b&&w(e?n?cu:fu:_d(l))},[E,a,t,e,r,n,g,v,l]);return L.useEffect(()=>()=>clearTimeout(m.current),[]),[u,N,E]},SN=({initialOpen:t,initialMounted:e,unmountOnClose:r,transition:n,transitionTimeout:i=500}={})=>{const[{status:o},s,l]=_N({initialEntered:t,mountOnEnter:!e,unmountOnExit:r,timeout:i,enter:ll(n,"open"),exit:ll(n,"close")});return[{state:oN[o],endTransition:l},s]},kN=t=>{const[e,r]=SN(t),[n,i]=L.useState(),o=(s,l)=>{i({position:s,alwaysUpdate:l}),r(!0)};return[{menuItemFocus:n,...e},r,o]},NN=(t,e)=>{const[r]=L.useState({});return{onMouseDown:()=>{r.v=t&&t!=="closed"},onClick:n=>r.v?r.v=!1:e(!0,n)}},PN=(t,e)=>{const r=L.useRef(e);L.useEffect(()=>{r.current!==e&&hr(t,{open:e}),r.current=e},[t,e])},CN=L.forwardRef(function({"aria-label":e,captureFocus:r,initialOpen:n,menuButton:i,instanceRef:o,onMenuChange:s,...l},a){const[u,c,d]=kN(l),{state:m}=u,g=V1(m),v=L.useRef(null),E=NN(m,(B,D)=>d(D.detail?void 0:Ms.FIRST)),N=L.useCallback(B=>{c(!1),B.key&&v.current.focus()},[c]),x=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:g});if(!w||!w.type)throw new Error("Menu requires a menuButton prop.");const b={ref:Uh(w.ref,v),...Qu({onKeyDown:x,...E},w.props)};Yk(w.type)==="MenuButton"&&(b.isOpen=g);const T=L.cloneElement(w,b);return PN(s,g),L.useImperativeHandle(o,()=>({openMenu:d,closeMenu:()=>c(!1)})),P.jsxs(L.Fragment,{children:[T,P.jsx(yN,{...l,...u,"aria-label":e||(typeof w.props.children=="string"?w.props.children:"Menu"),anchorRef:v,ref:a,onClose:N})]})}),MN=(t,e)=>{const r=L.memo(e),n=L.forwardRef((i,o)=>{const s=L.useRef(null);return P.jsx(r,{...i,itemRef:s,externalRef:o,isHovering:L.useContext(J1)===s.current})});return n.displayName=`WithHovering(${t})`,n},IN=(t,e,r)=>{_a(()=>{if(t)return;const n=e.current;return r(n,!0),()=>{r(n)}},[t,e,r])},RN=(t,e,r,n)=>{const{submenuCloseDelay:i}=L.useContext(Dh),{isParentOpen:o,submenuCtx:s,dispatch:l,updateItems:a}=L.useContext(Y1),u=()=>{!r&&!n&&l(Et.SET,t.current)},c=()=>{!n&&l(Et.UNSET,t.current)},d=v=>{r&&!v.currentTarget.contains(v.relatedTarget)&&c()},m=v=>{n||(v.stopPropagation(),s.on(i,u,u))},g=(v,E)=>{s.off(),!E&&c()};return IN(n,t,a),L.useEffect(()=>{r&&o&&e.current&&e.current.focus()},[e,r,o]),{setHover:u,onBlur:d,onPointerMove:m,onPointerLeave:g}},Qi=MN("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 g=!!s,{setHover:v,...E}=RN(c,c,u,g),N=L.useContext(X1),x=L.useContext(iN),w=i==="radio",b=i==="checkbox",T=!!n&&!g&&!w&&!b,B=w?x.value===r:b?!!o:!1,D=X=>{if(g){X.stopPropagation(),X.preventDefault();return}const ie={value:r,syntheticEvent:X};X.key!==void 0&&(ie.key=X.key),b&&(ie.checked=!B),w&&(ie.name=x.name),hr(a,ie),w&&hr(x.onRadioChange,ie),N.handleClick(ie,b||w)},$=X=>{if(u)switch(X.key){case $r.ENTER:X.preventDefault();case $r.SPACE:T?c.current.click():D(X)}},H=L.useMemo(()=>({type:i,disabled:g,hover:u,checked:B,anchor:T}),[i,g,u,B,T]),Y=Qu({...E,onPointerDown:v,onKeyDown:$,onClick:D},m),Q={role:w?"menuitemradio":b?"menuitemcheckbox":Z1,"aria-checked":w||b?B:void 0,...Q1(g,u),...Y,ref:Uh(d,c),className:al({block:Aa,element:nN,modifiers:H,className:e}),children:L.useMemo(()=>hr(l,H),[l,H])};return T?P.jsx("li",{role:sN,children:P.jsx("a",{href:n,...Q})}):P.jsx("li",{...Q})});function Mm({...t}){return P.jsx(CN,{...t,className:"dropdown "+t.className,menuButton:P.jsx(lN,{className:"small",children:P.jsx(Lk,{style:{marginBottom:"-0.125em"}})}),children:t.children})}function TN({app:t}){var s,l,a,u,c;const{uninstallApp:e,setMirroring:r,setAutoUpdate:n}=Jo(),i=vl();return!t.state?t.metadata?P.jsxs(Mm,{children:[((s=t.metadata)==null?void 0:s.description)&&P.jsx(Qi,{className:"action-entry",onClick:()=>i(`/app-details/${Ee(t)}`),children:"View Details"}),((l=t.metadata)==null?void 0:l.external_url)&&P.jsx(Qi,{children:P.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"})})]}):P.jsx("div",{style:{width:38}}):P.jsxs(Mm,{children:[P.jsx(Qi,{className:"action-entry",onClick:()=>i(`/app-details/${Ee(t)}`),children:"View Details"}),t.installed&&P.jsxs(P.Fragment,{children:[P.jsx(Qi,{className:"action-entry",onClick:()=>e(t),children:"Uninstall"}),P.jsxs(Qi,{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"]}),P.jsxs(Qi,{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:Ee(t),className:"app-entry row between"},P.jsx(W1,{app:t,size:"small"}),P.jsxs("div",{className:"app-actions row",children:[!((r=t.state)!=null&&r.caps_approved)&&P.jsx(G1,{app:t,style:{marginRight:"1em"}}),P.jsx(TN,{app:t})]}))}const Sd="/my-apps";function Ju({value:t="",onChange:e=()=>null,onBack:r,hideSearch:n=!1}){const i=vl(),o=Ru(),s=qr.useRef(null),l=o.key!=="default",a=o.pathname===Sd;return P.jsxs("div",{className:"search-header row between",children:[o.pathname!=="/"?P.jsx("button",{className:"back-btn col center",onClick:()=>{r?r():i(l?-1:"/")},children:P.jsx(Ik,{})}):P.jsx("button",{className:"back-btn col center",onClick:()=>i("/publish"),children:P.jsx($1,{})}),!n&&P.jsxs("div",{className:"searchbar row",children:[P.jsx(jk,{className:"search-icon",onClick:()=>{var u;return(u=s.current)==null?void 0:u.focus()}}),P.jsx("input",{ref:s,onChange:u=>e(u.target.value),value:t,placeholder:"Search for apps..."}),t.length>0&&P.jsx(Dk,{className:"search-icon",style:{margin:"0 -0.25em 0 0.25em"},onClick:()=>e("")})]}),P.jsx("div",{className:"row",children:P.jsxs("button",{className:`my-pkg-btn row ${a?"selected":""}`,onClick:()=>i(a?-1:Sd),children:[P.jsx(Ok,{style:{marginRight:"0.5em"}}),"My Packages"]})})]})}function ON(t){const{listedApps:e,getListedApps:r}=Jo(),[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)},(v,E)=>E+1),[l]);L.useEffect(()=>{const v=(u-1)*10,E=v+10;a(e.slice(v,E))},[e]),L.useEffect(()=>{r().then(v=>{a(Object.values(v))}).catch(v=>console.error(v))},[]);const m=L.useCallback(async v=>{},[]),g=L.useCallback(v=>{s(v);const E=e.filter(N=>{var x,w,b,T;return N.package.toLowerCase().includes(v.toLowerCase())||((w=(x=N.metadata)==null?void 0:x.description)==null?void 0:w.toLowerCase().includes(v.toLowerCase()))||((T=(b=N.metadata)==null?void 0:b.description)==null?void 0:T.toLowerCase().includes(v.toLowerCase()))},[e]);a(E)},[e]);return P.jsxs("div",{style:{width:"100%"},children:[P.jsx(Ju,{value:o,onChange:g}),P.jsxs("div",{className:"row between page-title",children:[P.jsx("h4",{children:"New"}),P.jsxs("select",{value:n,onChange:v=>{i(v.target.value),m(v.target.value)},children:[P.jsx("option",{children:"Recently published"}),P.jsx("option",{children:"Most popular"}),P.jsx("option",{children:"Best rating"}),P.jsx("option",{children:"Recently updated"})]})]}),P.jsxs("div",{className:"new card col",style:{flex:1,overflowY:"scroll",gap:"1em"},children:[l.map(v=>{var E;return P.jsx(ys,{app:v},Ee(v)+(((E=v.state)==null?void 0:E.our_version)||""))}),d.length>1&&P.jsxs("div",{className:"row",style:{alignSelf:"center"},children:[u!==d[0]&&P.jsx(Rk,{onClick:()=>c(u-1)}),d.map(v=>P.jsx("div",{className:`page-selector ${v===u?"selected":""}`,onClick:()=>c(v),children:v},`page-${v}`)),u!==d[d.length-1]&&P.jsx(Tk,{onClick:()=>c(u+1)})]})]})]})}function LN(t){const{myApps:e,getMyApps:r}=Jo(),n=vl(),[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(g=>{var v,E,N,x;return g.package.toLowerCase().includes(u.toLowerCase())||((E=(v=g.metadata)==null?void 0:v.description)==null?void 0:E.toLowerCase().includes(u.toLowerCase()))||((x=(N=g.metadata)==null?void 0:N.description)==null?void 0:x.toLowerCase().includes(u.toLowerCase()))}),d),{downloaded:[],installed:[],local:[],system:[]});l(c)},[e]);return L.useEffect(()=>{i?a(i):l(e)},[e]),P.jsxs("div",{style:{width:"100%",height:"100%"},children:[P.jsx(Ju,{value:i,onChange:a}),P.jsxs("div",{className:"row between page-title",children:[P.jsx("h4",{style:{marginBottom:"0.5em"},children:"My Packages"}),P.jsxs("button",{className:"row",onClick:()=>n("/publish"),children:[P.jsx($1,{style:{marginRight:"0.5em"}}),"Publish Package"]})]}),P.jsx("div",{className:"my-apps-list",children:P.jsxs("div",{className:"new card col",style:{gap:"1em"},children:[P.jsx("h4",{children:"Downloaded"}),(s.downloaded||[]).map(u=>P.jsx(ys,{app:u},Ee(u))),P.jsx("h4",{children:"Installed"}),(s.installed||[]).map(u=>P.jsx(ys,{app:u},Ee(u))),P.jsx("h4",{children:"Local"}),(s.local||[]).map(u=>P.jsx(ys,{app:u},Ee(u))),P.jsx("h4",{children:"System"}),(s.system||[]).map(u=>P.jsx(ys,{app:u},Ee(u)))]})})]})}function BN(t){var m,g,v,E,N,x,w,b;const{myApps:e,listedApps:r,getListedApp:n}=Jo(),i=vl(),o=aE(),[s,l]=L.useState(void 0);L.useEffect(()=>{const T=e.local.find(B=>Ee(B)===o.id);if(T)return l(T);if(o.id){const B=r.find(D=>Ee(D)===o.id);B?l(B):n(o.id).then(D=>l(D)).catch(console.error)}},[o.id]);const a=L.useCallback(()=>{i("/publish",{state:{app:s}})},[s,i]),u=L.useMemo(()=>{var T,B;return((B=(T=s==null?void 0:s.metadata)==null?void 0:T.properties)==null?void 0:B.current_version)||"Unknown"},[s]),c=Object.entries(((g=(m=s==null?void 0:s.metadata)==null?void 0:m.properties)==null?void 0:g.code_hashes)||{}),d=((v=s==null?void 0:s.state)==null?void 0:v.our_version)||(c[(c.length||1)-1]||["",""])[1];return P.jsxs("div",{style:{width:"100%"},children:[P.jsx(Ju,{value:"",onChange:()=>null,hideSearch:!0}),P.jsx("div",{className:"card",style:{marginTop:"1em"},children:s?P.jsxs(P.Fragment,{children:[P.jsxs("div",{className:"row between",children:[P.jsx(W1,{app:s,size:"large"}),P.jsx(G1,{app:s,style:{marginRight:"0.5em"}})]}),P.jsxs("div",{className:"col",style:{marginTop:"1em"},children:[P.jsxs("div",{className:"app-details row",children:[P.jsx("div",{className:"title",children:"Description"}),P.jsx("div",{className:"value",children:(((E=s.metadata)==null?void 0:E.description)||"No description given").slice(0,2e3)})]}),P.jsxs("div",{className:"app-details row",children:[P.jsx("div",{className:"title",children:"Publisher"}),P.jsx("div",{className:"value underline",children:s.publisher})]}),P.jsxs("div",{className:"app-details row",children:[P.jsx("div",{className:"title",children:"Version"}),P.jsx("div",{className:"value",children:u})]}),P.jsxs("div",{className:"app-details row",children:[P.jsx("div",{className:"title",children:"Mirrors"}),P.jsx("div",{className:"col",children:(((x=(N=s.metadata)==null?void 0:N.properties)==null?void 0:x.mirrors)||[]).map((T,B)=>P.jsx("div",{className:"value underline",children:T},B+T))})]}),P.jsxs("div",{className:"app-details row",children:[P.jsx("div",{className:"title",children:"Hash"}),P.jsx("div",{className:"value",style:{wordBreak:"break-all"},children:d})]})]}),P.jsx("div",{className:"app-screenshots row",children:(((b=(w=s.metadata)==null?void 0:w.properties)==null?void 0:b.screenshots)||[]).map((T,B)=>P.jsx("img",{src:T},B+T))}),s.installed&&P.jsx("button",{type:"button",onClick:a,children:"Publish"})]}):P.jsxs(P.Fragment,{children:[P.jsx("h4",{children:"App details not found for "}),P.jsx("h4",{children:o.id})]})})]})}var Sa=(t=>(t[t.SEPOLIA=11155111]="SEPOLIA",t[t.OPTIMISM=10]="OPTIMISM",t[t.OPTIMISM_GOERLI=420]="OPTIMISM_GOERLI",t[t.LOCAL=1337]="LOCAL",t))(Sa||{});const du="0xaa36a7",Im="0xa",Rm={11155111:"0x18c39eB547A0060C6034f8bEaFB947D1C16eADF1"},jN="4902",Tm={[du]:{chainId:du,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"]}},DN=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(jN))await((i=window.ethereum)==null?void 0:i.request({method:"wallet_addEthereumChain",params:[Tm[t]]}));else throw window.alert(`You must enable the ${DN(t)} network in your wallet.`),new Error(`User cancelled connection to ${t}`)}};var cl={},Yu={};Object.defineProperty(Yu,"__esModule",{value:!0});Yu.Connector=void 0;class UN{constructor(e,r){this.actions=e,this.onError=r}resetState(){this.actions.resetState()}}Yu.Connector=UN;var cf,Lm;function FN(){if(Lm)return cf;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 cf=t,cf}var zN=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]}),$N=Fe&&Fe.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),HN=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)&&zN(e,t,r);return $N(e,t),e},Ji=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 rw=cl.MetaMask=cl.NoMetaMaskError=void 0;const qN=Yu;class fl extends Error{constructor(){super("MetaMask not installed"),this.name=fl.name,Object.setPrototypeOf(this,fl.prototype)}}cl.NoMetaMaskError=fl;function ea(t){return Number.parseInt(t,16)}class WN extends qN.Connector{constructor({actions:e,options:r,onError:n}){super(e,n),this.options=r}isomorphicInitialize(){return Ji(this,void 0,void 0,function*(){if(!this.eagerConnection)return this.eagerConnection=Promise.resolve().then(()=>HN(FN())).then(e=>Ji(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:ea(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:ea(o)})}),this.provider.on("accountsChanged",o=>{o.length===0?this.actions.resetState():this.actions.update({accounts:o})}))}))})}connectEagerly(){return Ji(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:ea(n),accounts:r})}catch(r){console.debug("Could not connect eagerly",r),this.actions.resetState()}})}activate(e){var r,n;return Ji(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(()=>Ji(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=ea(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 Ji(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})})}}rw=cl.MetaMask=WN;const[nw,Fh]=Wu.initializeConnector(t=>new rw({actions:t}));function GN(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 Bm=/^\d+\.\d+\.\d+$/,VN=({app:t,packageName:e,publisherId:r,goBack:n})=>{var d,m,g,v,E,N,x,w;const[i,o]=L.useState({name:((d=t==null?void 0:t.metadata)==null?void 0:d.name)||"",description:((m=t==null?void 0:t.metadata)==null?void 0:m.description)||"",image:((g=t==null?void 0:t.metadata)==null?void 0:g.image)||"",external_url:((v=t==null?void 0:t.metadata)==null?void 0:v.external_url)||"",animation_url:((E=t==null?void 0:t.metadata)==null?void 0:E.animation_url)||"",package_name:e,current_version:"",publisher:r,mirrors:[r]}),[s,l]=L.useState(Object.entries(((x=(N=t==null?void 0:t.metadata)==null?void 0:N.properties)==null?void 0:x.code_hashes)||{}).concat([["",((w=t==null?void 0:t.state)==null?void 0:w.our_version)||""]])),a=(b,T)=>{o({...i,[b]:T})};L.useEffect(()=>{a("package_name",e)},[e]),L.useEffect(()=>{a("publisher",r)},[r]);const u=L.useCallback(()=>{const b=s.reduce((H,[Y,Q])=>(H[Y]=Q,H),{});if(Bm.test(i.current_version))if(b[i.current_version]){if(!Object.keys(b).reduce((H,Y)=>H&&Bm.test(Y),!0)){window.alert("Code hashes must be a JSON object with valid version keys");return}}else{window.alert(`Code hashes must include current version (${i.current_version})`);return}else{window.alert("Current version must be in the format x.y.z");return}const T=JSON.stringify({name:i.name,description:i.description,image:i.image,external_url:i.external_url,animation_url:i.animation_url,properties:{package_name:i.package_name,current_version:i.current_version,publisher:i.publisher,mirrors:i.mirrors,code_hashes:b}}),B=new Blob([T],{type:"application/json"}),D=URL.createObjectURL(B),$=document.createElement("a");$.href=D,$.download=i.package_name+"_"+i.publisher+"_metadata.json",$.click(),URL.revokeObjectURL(D)},[i,s]),c=()=>{o({name:"",description:"",image:"",external_url:"",animation_url:"",package_name:"",current_version:"",publisher:"",mirrors:[]}),l([])};return P.jsxs("form",{className:"col card metadata",style:{gap:"0.5em"},children:[P.jsx("h4",{children:"Fill out metadata"}),P.jsxs("div",{className:"col label",children:[P.jsx("label",{className:"metadata-label",children:"Name"}),P.jsx("input",{type:"text",placeholder:"Name",value:i.name,onChange:b=>a("name",b.target.value)})]}),P.jsxs("div",{className:"col label",children:[P.jsx("label",{className:"metadata-label",children:"Description"}),P.jsx("input",{type:"text",placeholder:"Description",value:i.description,onChange:b=>a("description",b.target.value)})]}),P.jsxs("div",{className:"col label",children:[P.jsx("label",{className:"metadata-label",children:"Image URL"}),P.jsx("input",{type:"text",placeholder:"Image URL",value:i.image,onChange:b=>a("image",b.target.value)})]}),P.jsxs("div",{className:"col label",children:[P.jsx("label",{className:"metadata-label",children:"External URL"}),P.jsx("input",{type:"text",placeholder:"External URL",value:i.external_url,onChange:b=>a("external_url",b.target.value)})]}),P.jsxs("div",{className:"col label",children:[P.jsx("label",{className:"metadata-label",children:"Animation URL"}),P.jsx("input",{type:"text",placeholder:"Animation URL",value:i.animation_url,onChange:b=>a("animation_url",b.target.value)})]}),P.jsxs("div",{className:"col label",children:[P.jsx("label",{className:"metadata-label",children:"Package Name"}),P.jsx("input",{type:"text",placeholder:"Package Name",value:i.package_name,onChange:b=>a("package_name",b.target.value)})]}),P.jsxs("div",{className:"col label",children:[P.jsx("label",{className:"metadata-label",children:"Current Version"}),P.jsx("input",{type:"text",placeholder:"Current Version",value:i.current_version,onChange:b=>a("current_version",b.target.value)})]}),P.jsxs("div",{className:"col label",children:[P.jsx("label",{className:"metadata-label",children:"Publisher"}),P.jsx("input",{type:"text",placeholder:"Publisher",value:i.publisher,onChange:b=>a("publisher",b.target.value)})]}),P.jsxs("div",{className:"col label",children:[P.jsx("label",{className:"metadata-label",children:"Mirrors (separated by commas)"}),P.jsx("input",{type:"text",placeholder:"Mirrors (separated by commas)",value:i.mirrors.join(","),onChange:b=>a("mirrors",b.target.value.split(",").map(T=>T.trim()))})]}),P.jsxs("div",{className:"col label",style:{gap:"0.5em"},children:[P.jsxs("div",{className:"row",style:{gap:"0.5em",marginTop:0,justifyContent:"space-between",width:"100%"},children:[P.jsx("h5",{style:{margin:0},children:"Code Hashes"}),P.jsx("button",{type:"button",onClick:()=>l([...s,["",""]]),className:"small",children:"Add code hash"})]}),s.map(([b,T],B,D)=>P.jsxs("div",{className:"row",style:{gap:"0.5em",marginTop:0,width:"100%"},children:[P.jsx("input",{type:"text",placeholder:"Version",value:b,onChange:$=>l(H=>{const Y=[...H];return Y[B][0]=$.target.value,Y}),style:{flex:1}}),P.jsx("input",{type:"text",placeholder:"Hash",value:T,onChange:$=>l(H=>{const Y=[...H];return Y[B][1]=$.target.value,Y}),style:{flex:5}}),D.length>1&&P.jsx("button",{type:"button",onClick:()=>l($=>$.filter((H,Y)=>Y!==B)),style:{fontSize:"2em",height:32,lineHeight:"1em",padding:"0 0.2em"},children:"×"})]},B+"_code_hash"))]}),P.jsxs("div",{className:"row",style:{gap:"0.5em",margin:"1em 0"},children:[P.jsx("button",{type:"button",onClick:u,children:"Download JSON"}),P.jsx("button",{type:"button",onClick:c,children:"Clear Form"}),P.jsx("button",{type:"button",onClick:n,children:"Done"})]})]})};function KN({readOnly:t=!1,checked:e,setChecked:r}){return P.jsxs("div",{style:{position:"relative"},children:[P.jsx("input",{type:"checkbox",id:"checked",name:"checked",checked:e,onChange:n=>r&&r(n.target.checked),autoFocus:!0,readOnly:t}),e&&P.jsx("span",{onClick:()=>r&&r(!1),className:"checkmark",children:"✓"})]})}const{useIsActivating:QN}=Fh;function JN({provider:t,packageAbi:e}){var X;const{state:r}=Ru(),{listedApps:n}=Jo(),{account:i,isActive:o}=Wu.useWeb3React(),s=QN(),[l,a]=L.useState(""),[u,c]=L.useState(),[d,m]=L.useState(!1),[g,v]=L.useState(""),[E,N]=L.useState(((X=window.our)==null?void 0:X.node)||""),[x,w]=L.useState(""),[b,T]=L.useState(""),[B,D]=L.useState(!1);L.useEffect(()=>{const ie=r==null?void 0:r.app;ie&&(v(ie.package),N(ie.publisher),D(!0))},[r]);const $=L.useCallback(async()=>{await nw.activate().catch(()=>{});try{Om(du)}catch(ie){console.error(ie)}},[]),H=L.useCallback(async()=>{if(!x){T("");return}try{const M=await(await fetch(x)).text();JSON.parse(M);const f=ut(mr(M));T(f)}catch{window.alert("Error calculating metadata hash. Please ensure the URL is valid and the metadata is in JSON format.")}},[x]),Y=L.useCallback(async ie=>{var f;ie.preventDefault(),ie.stopPropagation();let M=b;try{if(!M){const S=await fetch(x);await S.json();const _=await S.text();M=ut(mr(_))}a("Please confirm the transaction in your wallet");const p=GN(E);await Om(du);const A=await(B?e.updateMetadata(G.from(gS(["string","bytes"],[g,p])),x,M):e.registerApp(g,p,x,M));await new Promise(S=>setTimeout(S,2e3)),a("Publishing package..."),await A.wait(),c({packageName:g,publisherId:E}),v(""),N(((f=window.our)==null?void 0:f.node)||E),w(""),T(""),D(!1)}catch(p){console.error(p),window.alert("Error publishing package. Please ensure the package name and publisher ID are valid, and the metadata is in JSON format.")}finally{a("")}},[g,B,E,x,b,e,c,v,N,w,T,D]),Q=L.useCallback(async()=>{B||g&&E&&n.find(ie=>ie.package===g&&ie.publisher===E)&&D(!0)},[n,g,E,B,D]);return P.jsxs("div",{style:{width:"100%"},children:[P.jsx(Ju,{hideSearch:!0,onBack:d?()=>m(!1):void 0}),P.jsxs("div",{className:"row between page-title",children:[P.jsx("h4",{children:"Publish Package"}),!!i&&P.jsxs("div",{style:{textAlign:"right",lineHeight:1.5},children:[" ","Connected as"," ",(i==null?void 0:i.slice(0,6))+"..."+(i==null?void 0:i.slice(i.length-6))]})]}),l?P.jsx("div",{className:"col center",children:P.jsx(Ed,{msg:l})}):u?P.jsxs("div",{className:"col center",children:[P.jsx("h4",{style:{marginBottom:"0.5em"},children:"Package Published!"}),P.jsxs("div",{style:{marginBottom:"0.5em"},children:[P.jsx("strong",{children:"Package Name:"})," ",u.packageName]}),P.jsxs("div",{style:{marginBottom:"0.5em"},children:[P.jsx("strong",{children:"Publisher ID:"})," ",u.publisherId]}),P.jsx("button",{className:"my-pkg-btn row",style:{marginTop:"1em"},onClick:()=>c(void 0),children:"Publish Another Package"})]}):d?P.jsx(VN,{packageName:g,publisherId:E,app:r==null?void 0:r.app,goBack:()=>m(!1)}):!i||!o?P.jsxs(P.Fragment,{children:[P.jsx("h4",{style:{},children:"Please connect your wallet to publish a package"}),P.jsx("button",{className:"connect-wallet row",onClick:$,children:"Connect Wallet"})]}):s?P.jsx(Ed,{msg:"Approve connection in your wallet"}):P.jsxs("form",{className:"new card col",style:{flex:1,overflowY:"scroll"},onSubmit:Y,children:[P.jsxs("div",{className:"row between",style:{cursor:"pointer",padding:"0.5em",margin:"0 0 0 -0.5em"},onClick:()=>D(!B),children:[P.jsx(KN,{checked:B,readOnly:!0}),P.jsx("label",{htmlFor:"update",style:{cursor:"pointer",marginLeft:8},children:"Update existing package"})]}),P.jsxs("div",{className:"col f-width",children:[P.jsx("label",{htmlFor:"package-name",children:"Package Name"}),P.jsx("input",{style:{minWidth:"80%"},id:"package-name",type:"text",required:!0,placeholder:"my-package",value:g,onChange:ie=>v(ie.target.value),onBlur:Q})]}),P.jsxs("div",{className:"col f-width",children:[P.jsx("label",{htmlFor:"publisher-id",children:"Publisher ID"}),P.jsx("input",{style:{minWidth:"80%"},id:"publisher-id",type:"text",required:!0,value:E,onChange:ie=>N(ie.target.value),onBlur:Q})]}),P.jsxs("div",{className:"col f-width",children:[P.jsx("label",{htmlFor:"metadata-url",children:"Metadata URL"}),P.jsx("input",{style:{minWidth:"80%"},id:"metadata-url",type:"text",required:!0,value:x,onChange:ie=>w(ie.target.value),onBlur:H,placeholder:"https://github/my-org/my-repo/metadata.json"}),P.jsxs("div",{style:{textAlign:"left",margin:"0.5em 0 0"},children:["Metadata is a JSON file that describes your package.",P.jsx("br",{})," You can"," ",P.jsx("a",{onClick:()=>m(!0),style:{cursor:"pointer",textDecoration:"underline"},children:"fill out a template here"}),"."]})]}),P.jsxs("div",{className:"col f-width",children:[P.jsx("label",{htmlFor:"metadata-hash",children:"Metadata Hash"}),P.jsx("input",{style:{minWidth:"80%"},readOnly:!0,id:"metadata-hash",type:"text",value:b,onChange:ie=>T(ie.target.value),placeholder:"Calculated automatically from metadata URL"})]}),P.jsx("button",{type:"submit",className:"primary",children:"Publish"})]})]})}var YN={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 XN=[[nw,Fh]],{useProvider:ZN}=Fh,e4="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 t4=`${YN.VITE_NODE_URL||"http://localhost:8080"}${Is}`;function r4(){const t=ZN(),[e,r]=L.useState(!0),[n,i]=L.useState(xd.connect(Rm[Sa.SEPOLIA],new vi(e4)));if(L.useEffect(()=>{t==null||t.getNetwork().then(s=>{s.chainId===Sa.SEPOLIA&&i(xd.connect(Rm[Sa.SEPOLIA],t.getSigner()))})},[t]),L.useEffect(()=>{},[]),!e)return P.jsxs("div",{className:"node-not-connected",children:[P.jsx("h2",{style:{color:"red"},children:"Node not connected"}),P.jsxs("h4",{children:["You need to start a node at ",t4," before you can use this UI in development."]})]});const o={provider:t,packageAbi:n};return P.jsx(Wu.Web3ReactProvider,{connectors:XN,children:P.jsx(SE,{basename:Is,children:P.jsxs(AE,{children:[P.jsx(ms,{path:"/",element:P.jsx(ON,{...o})}),P.jsx(ms,{path:Sd,element:P.jsx(LN,{...o})}),P.jsx(ms,{path:"/app-details/:id",element:P.jsx(BN,{...o})}),P.jsx(ms,{path:"/publish",element:P.jsx(JN,{...o})})]})})})}ff.createRoot(document.getElementById("root")).render(P.jsx(qr.StrictMode,{children:P.jsx(r4,{})})); diff --git a/kinode/packages/app_store/pkg/ui/assets/index-aUqPNadJ.css b/kinode/packages/app_store/pkg/ui/assets/index-aUqPNadJ.css deleted file mode 100644 index 1c8e0cdf3..000000000 --- a/kinode/packages/app_store/pkg/ui/assets/index-aUqPNadJ.css +++ /dev/null @@ -1 +0,0 @@ -#root{max-width:700px;margin:0 auto;padding:2rem;text-align:center;width:75%;max-height:calc(100vh - 64px);min-height:calc(100vh - 64px)}.row{display:flex;flex-direction:row;align-items:center}.row.center{justify-content:center}.row.between{justify-content:space-between}.row.around{justify-content:space-around}.col{display:flex;flex-direction:column;align-items:flex-start}.col.center{align-items:center}.card{background-color:var(--bg-gray-light);border-radius:.75em;border:1px solid var(--bg-gray-medium);padding:1em}button.unstyled{background-color:transparent;border:none;cursor:pointer;padding:.25em;height:auto}button.unstyled:hover{background-color:transparent}.searchbar{background-color:#000;border:.125em solid black;height:2.25em;padding:0 1em;border-radius:40px;flex:1}.searchbar>input{border:none;height:1.5em;margin-left:.5em;background-color:#000;flex:1}.my-pkg-btn{margin-left:1em}.my-pkg-btn.selected{background-color:var(--bg-gray-medium)}button.action-btn{color:var(--btn-blue)}button.action-btn:hover{transform:scale(1.05)}.app-header{cursor:pointer;width:calc(100% - 9em);justify-content:flex-start}.app-header:hover{text-decoration:underline}.app-header.small>img{height:3em;margin-right:.5em;border-radius:.375em}.app-header>img{height:3em;margin-right:.5em;border-radius:.375em}.app-header.large>img{height:5em;margin-right:1em;border-radius:.5em}.app-header.large .app-name{font-size:1.5em}.app-entry{margin-bottom:.5em;padding:.125em;width:100%}.app-actions{margin-right:.5em}.dropdown{cursor:pointer;position:relative}.dropdown>ul{background-color:var(--bg-gray-solid);padding:.5em 1em;border-radius:.5em;align-items:flex-start;text-align:left}.dropdown .dropdown-header{align-self:flex-end}.dropdown .dropdown-list{position:absolute;top:1em;right:-.5em}.page-selector{margin:.25em .5em}.page-selector.selected{font-weight:900}.back-btn{margin-right:1em;justify-content:center;width:2.5em}.app-details{margin-top:.5em;align-items:flex-start}.app-details .title{width:8em;text-align:left}.app-details .value{margin-bottom:.5em;text-align:left;max-width:calc(100% - 8em)}.app-details .value.underline{text-decoration:underline}.app-details .value.permission{background-color:var(--bg-gray-medium);border-radius:2em;padding:.25em .5em;margin-bottom:.5em}.app-screenshots{margin-top:.5em;overflow-x:scroll;max-width:100%}.app-screenshots>img{margin-right:1em;max-height:10em;max-width:100%;border-radius:.5em;border:1px solid var(--bg-gray-medium)}.search-icon{cursor:pointer;color:var(--bg-gray-solid);font-size:1.25em}.f-width{width:100%}#loading h3{text-align:center}#loader{display:inline-block;position:relative;width:48px;height:48px;margin-top:16px}#loader div{box-sizing:border-box;display:block;position:absolute;width:36px;height:36px;margin:6px;border:6px solid #fff;border-radius:50%;animation:loader 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#fff transparent transparent transparent}#loader div:nth-child(1){animation-delay:-.45s}#loader div:nth-child(2){animation-delay:-.3s}#loader div:nth-child(3){animation-delay:-.15s}@keyframes loader{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.action-entry{margin-bottom:.25em;color:inherit;white-space:nowrap;cursor:pointer;padding:.25em}.action-entry:hover{transform:scale(1.05);font-weight:700}.action-entry:first-child{margin-top:.25em}.my-apps-list{flex:1;height:100%;overflow-y:scroll;max-height:calc(100vh - 10em);border-radius:.5em}@media (prefers-color-scheme: light){.searchbar{background-color:#fff;border-color:var(--bg-gray-medium)}.searchbar>input{background-color:#fff}#loader div{border-color:#000 transparent transparent transparent}}@media (prefers-color-scheme: dark){.app-details .value{color:#fff}}.ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.title{width:calc(100% - 4em)}.title>div{max-width:100%}.modal-backdrop{background-color:#0003;position:fixed;top:0;bottom:0;left:0;right:0;display:flex;flex-direction:column;justify-content:center;align-items:center;z-index:3;min-height:10em;min-width:20em}.modal-backdrop .close{position:absolute;top:.5em;right:.5em;font-size:18px;font-weight:200;cursor:pointer;transform:rotate(45deg)}.modal{position:relative;background-color:#fff;color:#000;border-radius:8px;padding:24px;line-height:24px;max-width:500px;min-width:300px}.modal .modal-content select{color:#000}.modal .modal-content button{background-color:var(--btn-blue)}.modal .modal-title{margin-top:0;margin-bottom:.5em}.modal .modal-content{align-items:center;width:100%}:root{font-family:Montserrat,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:var(--text-light);background-color:var(--bg-black);font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;--k-red: #a30101;--k-darkred: #4d0c0c;--k-lightred: #dd0207;--k-petal: #e94f33;--k-lightpetal: #f0907f;--k-yellow: #e6b95e;--k-beige: #e5c4a1;--k-green: #0f6f4c;--k-darkgreen: #29322f;--k-lightgreen: #a0a271;--k-mediumgreen: #424031;--k-black: #281b13;--bg-black: #191919;--bg-gray-light: rgba(200, 200, 200, .2);--bg-gray-medium: rgba(127, 127, 127, .5);--bg-gray-solid: rgba(127, 127, 127, 1);--full-black: rgba(0, 0, 0, 1);--text-light: rgba(255,255,255,.7);--btn-blue: #4E9EFD;--medium-gray: rgb(101,101,101)}body{margin:0;display:flex;place-items:center;min-width:320px;min-height:100vh}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}h1{font-size:3.2em;line-height:1.1}h2,h3,h4,h5,h6{text-align:left}ul{list-style:none;padding:0;margin:0}button{border-radius:2em;border:1px solid transparent;padding:.5em 1em;background-color:var(--bg-gray-light);color:var(--text-light);font-size:1em;font-weight:500;font-family:inherit;cursor:pointer;transition:background-color .25s;height:2.5em}button:hover{background-color:var(--bg-gray-medium)}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}input{padding:.25em .5em;font-size:1rem}select{padding:.25em .5em;font-size:.9rem;border:none;background-color:transparent}@media (prefers-color-scheme: light){:root{color:var(--bg-black);background-color:#fff}a:hover{color:#747bff}button{color:var(--bg-black)}input:focus-visible{outline:-webkit-focus-ring-color auto 1px}select{border:1px solid var(--bg-gray-solid);border-radius:.25em}}input:focus-visible{outline:var(--text-light) auto 1px} diff --git a/kinode/packages/app_store/pkg/ui/assets/index-jnOcECnM.css b/kinode/packages/app_store/pkg/ui/assets/index-jnOcECnM.css new file mode 100644 index 000000000..c9edae766 --- /dev/null +++ b/kinode/packages/app_store/pkg/ui/assets/index-jnOcECnM.css @@ -0,0 +1 @@ +#root{max-width:700px;margin:0 auto;padding:2rem;text-align:center;width:75%;max-height:calc(100vh - 64px);min-height:calc(100vh - 64px)}.row.center{justify-content:center}.row.between{justify-content:space-between}.row.around{justify-content:space-around}.col{display:flex;flex-direction:column;align-items:flex-start}.col.center{align-items:center}.card{background-color:var(--input-background);border-radius:.75em;border:1px solid var(--orange-medium);padding:1em}button.action-btn{min-width:100px}button.small{padding:.25em .5em;height:auto}.searchbar{height:2.25em;padding:.5em 1em;border-radius:16px;flex:1;background-color:var(--input-background);text-align:left}.searchbar>input{border:none;height:1.5em;margin-left:.5em;flex:1}button.connect-wallet{margin:1em auto 0}.my-pkg-btn{margin-left:1em}.my-pkg-btn.selected{background-color:var(--bg-gray-medium)}.app-header{cursor:pointer;width:calc(100% - 9em);justify-content:flex-start}.app-header:hover{text-decoration:underline}.app-header.large:hover{text-decoration:none;cursor:default}.app-header.small>img{height:3em;margin-right:1em;border-radius:.375em}.app-header>img{height:3em;margin-right:1em;border-radius:.375em}.app-header.large>img{height:5em;margin-right:1em;border-radius:.5em}.app-header.large .app-name{font-size:1.5em}.app-entry{padding:.125em;width:100%}.app-actions{margin-right:.5em}.dropdown{cursor:pointer;position:relative}.dropdown>ul{background-color:var(--orange-medium);padding:.5em 1em;border-radius:.5em;align-items:flex-start;text-align:left;border:1px solid var(--orange-medium)}.dropdown .dropdown-header{align-self:flex-end}.dropdown .dropdown-list{position:absolute;top:1em;right:-.5em}.page-selector{margin:.25em .5em}.page-selector.selected{font-weight:900}.back-btn{margin-right:1em;justify-content:center;width:2.5em}.app-details{margin-top:.5em;align-items:flex-start}.app-details .title{width:8em;text-align:left}.app-details .value{margin-bottom:.5em;text-align:left;max-width:calc(100% - 8em)}.app-details .value.underline{text-decoration:underline}.app-details .value.permission{background-color:var(--bg-gray-medium);border-radius:2em;padding:.25em .5em;margin-bottom:.5em}.app-screenshots{margin-top:.5em;overflow-x:scroll;max-width:100%}.app-screenshots>img{margin-right:1em;max-height:10em;max-width:100%;border-radius:.5em;border:1px solid var(--bg-gray-medium)}.search-icon{cursor:pointer;color:var(--bg-gray-solid);font-size:1.25em}.f-width{width:100%}#loading h3{text-align:center}#loader{display:inline-block;position:relative;width:48px;height:48px;margin-top:16px}#loader div{box-sizing:border-box;display:block;position:absolute;width:36px;height:36px;margin:6px;border:6px solid #fff;border-radius:50%;animation:loader 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#fff transparent transparent transparent}#loader div:nth-child(1){animation-delay:-.45s}#loader div:nth-child(2){animation-delay:-.3s}#loader div:nth-child(3){animation-delay:-.15s}@keyframes loader{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.action-entry{margin-bottom:.25em;color:inherit;white-space:nowrap;cursor:pointer;padding:.25em}.action-entry:hover{transform:scale(1.05)}.action-entry:first-child{margin-top:.25em}.my-apps-list{flex:1;height:100%;overflow-y:scroll;max-height:calc(100vh - 10em);border-radius:.5em}.ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.title{width:calc(100% - 4em)}.title>div{max-width:100%}.modal-backdrop{background-color:#0000004d;position:fixed;top:0;bottom:0;left:0;right:0;display:flex;flex-direction:column;justify-content:center;align-items:center;z-index:3;min-height:10em;min-width:20em}.modal-backdrop .close{position:absolute;top:.5em;right:.5em;font-size:18px;font-weight:200;cursor:pointer;transform:rotate(45deg)}.modal{position:relative;background-color:var(--dark-background);color:#000;border-radius:8px;padding:24px;line-height:24px;max-width:500px;min-width:300px;color:var(--text-light)}.modal .modal-title{margin-top:0;margin-bottom:.5em}.modal .modal-content{align-items:center;width:100%;gap:1em}form.new{gap:1em}form.metadata{gap:.5em;align-items:center}form.metadata input{width:100%}form.metadata .row{margin-top:1em}form.metadata .col.label{width:80%}.page-title{align-items:center;margin:1em 0}@tailwind base;@tailwind components;@tailwind utilities;:root{--text-light: #FFF5D9;--text-dark: #22211F;--text-orange: #FF7533;--orange-light: #F36822;--orange-medium: #F35422;--orange-burnt: #E25F35;--medium-gray: #7E7E7E;--gray-button: rgba(253, 245, 220, .25);--dark-background: rgb(130, 59, 28);--input-background: rgba(243, 84, 34, .25)}body{margin:0;padding:2em;font-size:16px;color:var(--text-light);font-weight:400;background:url(/main:app_store:sys/assets/background-a451R5-M.jpg) no-repeat center center fixed;background-size:cover;background-color:var(--dark-background);height:100vh;width:100vw;overflow-y:scroll}body,h1,h2,h3,h4,h5,h6,p,a,button,input{font-family:Barlow Condensed,sans-serif}h1,h2,h3,h4,h5,h6{line-height:1.5em;font-weight:500;margin:0}h1{font-size:64px}h2{font-size:48px}h3{font-size:36px}h4{font-size:24px}h5{font-size:20px}h6{font-size:16px}.col{display:flex;flex-direction:column}.row{display:flex;flex-direction:row;align-items:center}input,button{all:unset}input[type=text],input[type=password],input[type=checkbox]{padding:1em;border:1px solid var(--orange-medium);border-radius:8px;box-sizing:border-box;font-size:1em;background-color:var(--input-background);color:var(--text-light);text-align:left}input[type=text],input[type=password]{width:100%}input[type=checkbox]{padding:.25em .8em;cursor:pointer}input[type=checkbox]:checked{background-color:var(--orange-medium)}.checkmark{position:absolute;left:4px;font-size:24px;top:-5px;cursor:pointer}::placeholder{color:var(--text-light)}::-webkit-input-placeholder::placeholder{color:var(--text-light)}::-moz-placeholder::placeholder{color:var(--text-light)}::-ms-input-placeholder{color:var(--text-light)}label{font-size:20px}button,[type=button],[type=reset],[type=submit]{padding:.75em 1em;margin:0;font-weight:500;border-width:1px;border-style:solid;border-color:var(--orange-medium);border-radius:8px;background:var(--orange-medium);box-sizing:border-box;cursor:pointer;font-size:1.125em;transition:all .1s;box-shadow:0 1px 2px var(--orange-light);color:var(--text-light)}button.alt{background-color:var(--text-light);color:var(--text-dark);border-color:var(--text-light);box-shadow:0 1px 2px var(--text-light)}button:hover{opacity:.9;box-shadow:none}button:disabled{background-color:var(--medium-gray);border:1px solid var(--medium-gray);box-shadow:0 1px 2px var(--medium-gray);opacity:.7;cursor:not-allowed}ul,li{all:unset}select{padding:.25em 2em .25em .5em;font-size:.9rem;border:1px solid var(--orange-medium);background-color:var(--input-background);color:var(--text-light);border-radius:8px;background-image:url("data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23FFF5D9'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%3e%3cpath%20d='M6%209l6%206%206-6'/%3e%3c/svg%3e");background-repeat:no-repeat;background-position:right 8px center;background-size:16px;-webkit-appearance:none;-moz-appearance:none;appearance:none} 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..ae554635b 100644 --- a/kinode/packages/app_store/pkg/ui/index.html +++ b/kinode/packages/app_store/pkg/ui/index.html @@ -1,27 +1,26 @@ - - - - Package Store - - - - - - - - - - - -
- - + + + + + Package Store + + + + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/kinode/packages/app_store/uninstall/Cargo.toml b/kinode/packages/app_store/uninstall/Cargo.toml index e54c0b660..b220008af 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", tag = "v0.6.0" } 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..f38219c97 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", tag = "v0.6.0" } 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/chess/chess/src/icon b/kinode/packages/chess/chess/src/icon new file mode 100644 index 000000000..00f10fd83 --- /dev/null +++ b/kinode/packages/chess/chess/src/icon @@ -0,0 +1 @@ +data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIgAAACJCAYAAAD35nD3AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA24SURBVHgB7Z3LbxTJHcd/v+qxDX6sIryRso5XwbvBgAJatD7BZVeLxGEF110pJ25RuPIv7DV/Q9hLDpsjCGkPicgFn5xsAhHY3gRHEJwomEjYHuNHV+3vVz1jz3j6Ud3TM1M1XR/JM0NPd7twf/v3qkcjVBilnk7pD3WYit1hHDb5DfHcJlQUhCFGC+CtmgYxMQly+10IYQxEcApQjIKUY7lOJsQuqP0tULBHf7UNCCbewEH9NYz/cwPx810YUoZGIErdH4P6B9NQGz8F+9s/hWDkJ7lFUBQWj9x/DbWJZywanDj3EoYEpwWiRbF34QwcbM+BGDnVN0Fk0RRMMLoMY/vrLrso5wTSJgoI3gMnCNddFYszAlHbT2fodcEdUSSgwn9BAMt48vwaOIDVAoniirkL5D4uWOM+ygIpQxLBku1WxUqBDLUwjsNCQXJBJ3DJRqFYJZBKCSOWcAnGccUmoVgjELX9ZKG6wmiBLYoMH+Pk+UdgAQMXiA4+UXxCBagp8ByhXc/IIp6cW4MBMjCBaHeyc+Zj+nARPMmIcGWQ8clABKJ2npwGGPmk8u7ElEbGgyc+XIE+01eBeKvRJaP4CNZW/4xn+tf30zeB6I6zHXHdxxpdwtbkpLzXL5fTF4Got0/mQY1c9i6lJLhHuRY87IfL6blAdPoKwQJ4ekC4hBPnl6CH9EwgOt7YmrtMwdU8eHoHZTnUr/MAekRPBBIFo3MUbwTT4Ok9GG7Av5/d60XwWrpAomBUXfPi6DM9Cl5LFYjPVAZMD0RSmkC8OCyhZJEIKIEo5mC34sUxcPga0LVQq/dLKSmUIhAfkFoGX4uZuWtQAl0LRNVXL3tx2EjwHvV5fQpd0pVAdBHM96vYiwzmo0JlcQoLJOqR9RVS+wkWogHfxSgkEJ2xqOAyeNxAiWuH00xzUsyC+HTWLRBGdZZZgNwCieIOLw7noERC7a/mtvq5BBL5Mh93OMueupg3HslnQXhwscdt6BrmKaIZC8S7liGBr+HpMx+b7m4kkCgC9q5laGBX82b5XZNdzSzIjiilbOuxiEAaBayZAlFv/zFPZsmX0ocOKsUbBKzZFkSG3rUMKwZJR6pAGtbDB6bDCl1btfUktS8t3YJ461EBqK8mJe1NFIi3HhWBy/DvzSXOPEi2IN56VAcRXEj8Km6jtx4Vg2ORhIwm3oKEe2fBUzFUrMfoEEijaur2SoKFkZfo5ab+QVWxGYFUF4mprtY69nvLJXUF1UTM0v89qjAqfEWvfV+PY6AEwc/o9VXrpk6BKFU964FIMRdZDCXP0udom/4s+LsV+q4aQlGSayJtk8HbXIwOVKoYnCrul1A3tFCa6M+0TVXI1VDKezxYbY9B/Ex8T6hOt/6zXSBVdC8a/Jp+fkUfHrZsu9vYdg+qxDEjcSiQyrqXNnADqs4xN3MUpCJFsKpC2YtSV0HgdXofT9iBY5KrINXO4SbEb+j1Oxh6auxJ9DNvjlyMOjAaYTQ8qMXsXUg8CNP6B4CtSwXEwewfWhAtEKX+Plq54hiKOrnUPxjvL8RdqAxUNGv08EYWpB5UzHo0UPKP5DbqBntuVKYW0mTmAz2KsOFiatXMXoytCFbIejRopLsNgewXntzrPGxF0uHYIzteGTYaGW0kkCqv76GtSJr7qJhraTISnOI3oQNUHlXkOijHdWebohK5/pznWEwWAQZ/gX60wTZ4jAgFqjXnA1ShpiHkLnruOwmjZfkUv8hFqgrepTpGVvHrffq5nvitkl/SSf8KabAYJNVMUHxGbRgv0AY7mfhwSkAwMgmuwuKQcJsuSEwfEvLa8LepGDadcY56ZiajMqyB0m2IKboZtsFWTtVOCYpW3S2vK33np/3xybqENyH9HFeTq6mNc2jLkHQ8VVwBZ6GbNtgKaUOQ+XNTIGw9FFzJ3C/qtu90o4JjBXVbCyQT3e1/I/78kD2FkdvQOpTAFeQ+CUQcuCkQie+b74xnOo+Xl8j0z4IpAtmKtItBKbZeZu5DyhzttQQJYzVwFnUSuuMeWY97FETO0sUjC6N+3fkr4AUEwW95yb6uA03Ebtvbf0aCyRqlcZNuDkHFF8ZjZxE3EnuqpaTzkBA4UO2MReqN7xMg4UR1lOyUFvG5g73lo4LNCLjJc8P+EbN+FAUmfTLtsDhSBdTSBhmugoMIt4tkeCc1RdVWQfwGCp/eRDTUhqgcn4L6RovJNahYVs5a7YOCXYdUX+lYoQP1ggLZrwBNY4eYTEeBiesgCwUswu9i24AsUOHsOBLHBaILWFfoTo/JRjhDkVd6XqQ6bENcGkttUOEVZwtlEDcvxhV4yCCK62Qhku9yrm5KntKgu+sXU841HfvkHMxIYVvbkBiA6mrqfGYbLMVNC8KlbwGzRtmDrlOoS+nlchEvhKzUVND3qmXMaloblLpC/TPOWZKafgara4FqNNDna7rov9d1DCAr0VlVJb+Pi7TPit4fUx6ulWSFlLYM44kBJtdRAO9p98KFN+yoyra3wcF6Qo3uxF1qt5uZTHMsB/KcWnn8y+fAFwiNjORsyu/gcREZnXnchjh3lKsN9oGw6XaQ2iTO1Zi5n+a+Zwt9l31et8eEAOwJirK3wHlU592LaH5x0vpk0LTPB7trg40oJIHIWqnPWR0ICjprGAhmHXFKz+xPy4Q+AjM6haSU20M5Dw5IIAGU/rTmvhNvAQwvjl40JhkdpBp01au4IQU5eottRMcgwZjbFkSPC0mIQUwuLMKlzH2yloDgFDrOYul2KXeHdAoWiNx2OwaRkHzxMi+sFlC2pcGMQUUoUn5PzFgUVwhOkEC2HJ/RnjaqLOvCCrMF7TOtEaq0OMXdBQH/v7cl8MfnNnWxzEWELpGnWZDkC2s6ZLGJDG8UOg8HucrNKRA4c/ZVVAchXwMuEhpcYBl+GbtdpUx1iCNpXGlWG6JK7GfgGhgNYYgEEjroZiLrYTJgeFZ3qh0/No/1aHLcikRtMBAa98M4ZkXCsEUgI+IluEZ055qlsrxQTGuXu55oVYBoNcQjsUl1y/DIaeesiMJ1fosEsrm/Di5hfOc2YDMfhrf0Xay76KH4FIQjsV3PmA/TDgfMLo0LaSQvWiBOBap6miPchrwgPIeAuucRvoBuiMR2k94XDdcWaT3ulhOuhrpfOEDljy1LUOEauIBEnp6Q907ciObIFhBWHFGwekkPOch33Ky2QLYTHo2xPRKIC3GIUl8Ucw94F0LJsUN5Jj5yNaYj64+IZvJlV28HCR4ZiyOBjL1dA5uJytkG0yRjQO1Pyy1YaZfB/Th6zEfOY2Wx/0e/2IVDY3EoEMRfUAwS2h2s5vH5regxp2i+zocpQbBM581vldDmYBXXdUzaoH3AUG3iGdhK5kpAaahLlPksFhZY/DlfQHjwWp8796E5VlfsN2HY9jduF8jopu3LLRXz3Ty/hTv1Sh3hRQFn8QFB9sYgLe6FaROI9W6mqAVAcKf+MFDa3QvTOS9GwCO62yxdFlPPLcl/1/LUBAwomJR34k+rpy8UOK+sk+u7k/tcCCbzefvPMffCdMwF0IvabY/8cigWtvOYw8WxyfO/O765Y1S7djMoHoGnWiiIrYPFT3sY3/UCqRpvcSluc6xAtBWRWM0FZKuIDFeOB6dNkidOidALpCokWA8mUSA4ce6l9ZVVT/ekWA8mfeplHR+AZ7hJsR5MqkC0shB9wDqsZFgPJnvy9sm9JWdHvXuS4TnZGdaDyRSIr4sMKTiynGU9GKPlH3Di50vDsQqAR8NVU76mBpivD4I+YB0adswfsWYsEJ32+oDVfcLwsYlraZJvhSEdsHpX4yzsWt45/zDPIbkEogPWialvweMmO/mf3pl7jTLE2Q1SYvWeAuk8YimPazk8CgqAk+cfgfCdec7ABTHDrOU4xVc5PLH30McjDsDX6D/PClt8hC5Q/3s6BSfVDf3MGY99sDgo7ijiWpp0JRDdBvViGrbrN/wQRcvg7hE5fhffme1qaY+uF9LVQauUPmi1jVrwsFtxMKWstIzvnFv2mY1F0LXAEx+WkkR07WJaUdvfL1DIvACeAULpbMGMJY5SBcJ4kQyScsXBlC4QRm09uUiZjdkSk55yCIIHZbmVVnoiEEbtPDkNYfCpz256DGcrBzt/wh991JOJ9z0TCOPrJD2G6xxy6tsyspUkevq8GF2g4Q4iX3EtH7n3WhfBeigOpqcWpBVVX71MVbWL4OmeMHwM/322hGc+7/mTOvomEEYHrxAs+LikIHrweLikO0v7RF8Fwvi4pCi4DvXwQTf9KoV+KwwIXy8xRD+VVDwqu75hysAEwmhrMq4+Jbdj6YI1g2YwVqOtBWAB6s3TsyDUgnc7DXT6iku6j2vAWCGQJtrtqP2zlRVKw53Ay5XH/chQTLBKIIx2Oyco0xGq+IL7rmGhMJpYJ5AmUXxSmx9qi2KxMJpYK5BWdIxSExfoDzoky1lS8KnEGqwvr9gqjCZOCKSJHt64tUM9xQczzlkVPQQwXIEA16LFedzAKYG0orafzoAM5q0Wi6OiaMVZgbQSDZzeJaHI09HC/QMq5euYAje0+8D9DVdF0cpQCOQ4h4KRe1MQ1KZ7IhoWAz8tlAURig2YGHupB3APGUMpkDjU6v0xmPlgmtLnUQhHpwDpXagp/aWEqY4DgmCXClbRykoSN0HhHtRgF8bGNuD7v23ZHlyWxQ8I7HVya0LmQgAAAABJRU5ErkJggg== \ No newline at end of file diff --git a/kinode/packages/chess/chess/src/lib.rs b/kinode/packages/chess/chess/src/lib.rs index 5a02fdfd2..a4a685a49 100644 --- a/kinode/packages/chess/chess/src/lib.rs +++ b/kinode/packages/chess/chess/src/lib.rs @@ -8,6 +8,8 @@ use serde::{Deserialize, Serialize}; use std::collections::{HashMap, HashSet}; extern crate base64; +const ICON: &str = include_str!("icon"); + // // Our "chess protocol" request/response format. We'll always serialize these // to a byte vector and send them over IPC. @@ -108,7 +110,24 @@ call_init!(initialize); fn initialize(our: Address) { // A little printout to show in terminal that the process has started. - println!("{}: started", our.package()); + println!("started"); + + // add ourselves to the homepage + Request::to(("our", "homepage", "homepage", "sys")) + .body( + serde_json::json!({ + "Add": { + "label": "Chess", + "icon": ICON, + "path": "/", // just our root + } + }) + .to_string() + .as_bytes() + .to_vec(), + ) + .send() + .unwrap(); // Serve the index.html and other UI files found in pkg/ui at the root path. // authenticated=true, local_only=false @@ -133,12 +152,12 @@ fn main_loop(our: &Address, state: &mut ChessState) { // this and surface it to the user. match await_message() { Err(send_error) => { - println!("{our}: got network error: {send_error:?}"); + println!("got network error: {send_error:?}"); continue; } Ok(message) => match handle_request(&our, &message, state) { Ok(()) => continue, - Err(e) => println!("{our}: error handling request: {:?}", e), + Err(e) => println!("error handling request: {:?}", e), }, } } @@ -189,11 +208,11 @@ fn handle_request(our: &Address, message: &Message, state: &mut ChessState) -> a None, "Service Unavailable".to_string().as_bytes().to_vec(), ); - Err(anyhow::anyhow!("chess: error handling http request: {e:?}")) + Err(anyhow::anyhow!("error handling http request: {e:?}")) } } } - 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 @@ -228,7 +247,7 @@ fn handle_chess_request( state: &mut ChessState, action: &ChessRequest, ) -> anyhow::Result<()> { - println!("chess: handling action from {source_node}: {action:?}"); + println!("handling action from {source_node}: {action:?}"); // For simplicity's sake, we'll just use the node we're playing with as the game id. // This limits us to one active game per partner. @@ -419,7 +438,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 +473,7 @@ fn handle_http_request( vec![], )); }; + if let Some(game) = state.games.get(game_id) && !game.ended { diff --git a/kinode/packages/chess/metadata.json b/kinode/packages/chess/metadata.json new file mode 100644 index 000000000..b40ba7bcd --- /dev/null +++ b/kinode/packages/chess/metadata.json @@ -0,0 +1,16 @@ +{ + "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": "" + } + }, + "external_url": "https://kinode.org", + "animation_url": "" +} \ No newline at end of file diff --git a/kinode/packages/chess/pkg/manifest.json b/kinode/packages/chess/pkg/manifest.json index b02f84ed1..e821d2719 100644 --- a/kinode/packages/chess/pkg/manifest.json +++ b/kinode/packages/chess/pkg/manifest.json @@ -5,6 +5,7 @@ "on_exit": "Restart", "request_networking": true, "request_capabilities": [ + "homepage:homepage:sys", "http_server:distro:sys", "net:distro:sys", "vfs:distro:sys" diff --git a/kinode/packages/chess/pkg/metadata.json b/kinode/packages/chess/pkg/metadata.json deleted file mode 100644 index 9d9aa6d4d..000000000 --- a/kinode/packages/chess/pkg/metadata.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "package": "chess", - "publisher": "sys", - "version": [ - 0, - 2, - 0 - ] -} \ No newline at end of file diff --git a/kinode/packages/chess/pkg/ui/assets/background-00905d19.jpg b/kinode/packages/chess/pkg/ui/assets/background-00905d19.jpg new file mode 100644 index 000000000..e40de63eb Binary files /dev/null and b/kinode/packages/chess/pkg/ui/assets/background-00905d19.jpg differ diff --git a/kinode/packages/chess/pkg/ui/assets/index-237df385.js b/kinode/packages/chess/pkg/ui/assets/index-237df385.js new file mode 100644 index 000000000..8c1e1fa5d --- /dev/null +++ b/kinode/packages/chess/pkg/ui/assets/index-237df385.js @@ -0,0 +1,87 @@ +var mh=Object.defineProperty;var vh=(e,t,n)=>t in e?mh(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ze=(e,t,n)=>(vh(e,typeof t!="symbol"?t+"":t,n),n);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(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"&&r(s)}).observe(document,{childList:!0,subtree:!0});function n(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 r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function uc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ac={exports:{}},so={},cc={exports:{}},b={};/** + * @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 Wr=Symbol.for("react.element"),yh=Symbol.for("react.portal"),Sh=Symbol.for("react.fragment"),wh=Symbol.for("react.strict_mode"),Ch=Symbol.for("react.profiler"),Eh=Symbol.for("react.provider"),kh=Symbol.for("react.context"),_h=Symbol.for("react.forward_ref"),xh=Symbol.for("react.suspense"),Oh=Symbol.for("react.memo"),Th=Symbol.for("react.lazy"),ku=Symbol.iterator;function Dh(e){return e===null||typeof e!="object"?null:(e=ku&&e[ku]||e["@@iterator"],typeof e=="function"?e:null)}var dc={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},fc=Object.assign,hc={};function Kn(e,t,n){this.props=e,this.context=t,this.refs=hc,this.updater=n||dc}Kn.prototype.isReactComponent={};Kn.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};Kn.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function pc(){}pc.prototype=Kn.prototype;function Cl(e,t,n){this.props=e,this.context=t,this.refs=hc,this.updater=n||dc}var El=Cl.prototype=new pc;El.constructor=Cl;fc(El,Kn.prototype);El.isPureReactComponent=!0;var _u=Array.isArray,gc=Object.prototype.hasOwnProperty,kl={current:null},mc={key:!0,ref:!0,__self:!0,__source:!0};function vc(e,t,n){var r,i={},o=null,s=null;if(t!=null)for(r in t.ref!==void 0&&(s=t.ref),t.key!==void 0&&(o=""+t.key),t)gc.call(t,r)&&!mc.hasOwnProperty(r)&&(i[r]=t[r]);var l=arguments.length-2;if(l===1)i.children=n;else if(1>>1,X=D[H];if(0>>1;Hi(ft,j))Gei(vn,ft)?(D[H]=vn,D[Ge]=j,H=Ge):(D[H]=ft,D[A]=j,H=A);else if(Gei(vn,j))D[H]=vn,D[Ge]=j,H=Ge;else break e}}return L}function i(D,L){var j=D.sortIndex-L.sortIndex;return j!==0?j:D.id-L.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var s=Date,l=s.now();e.unstable_now=function(){return s.now()-l}}var u=[],a=[],g=1,p=null,f=3,S=!1,m=!1,y=!1,C=typeof setTimeout=="function"?setTimeout:null,d=typeof clearTimeout=="function"?clearTimeout:null,c=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function h(D){for(var L=n(a);L!==null;){if(L.callback===null)r(a);else if(L.startTime<=D)r(a),L.sortIndex=L.expirationTime,t(u,L);else break;L=n(a)}}function w(D){if(y=!1,h(D),!m)if(n(u)!==null)m=!0,Ce(k);else{var L=n(a);L!==null&&dt(w,L.startTime-D)}}function k(D,L){m=!1,y&&(y=!1,d(T),T=-1),S=!0;var j=f;try{for(h(L),p=n(u);p!==null&&(!(p.expirationTime>L)||D&&!$());){var H=p.callback;if(typeof H=="function"){p.callback=null,f=p.priorityLevel;var X=H(p.expirationTime<=L);L=e.unstable_now(),typeof X=="function"?p.callback=X:p===n(u)&&r(u),h(L)}else r(u);p=n(u)}if(p!==null)var ot=!0;else{var A=n(a);A!==null&&dt(w,A.startTime-L),ot=!1}return ot}finally{p=null,f=j,S=!1}}var O=!1,x=null,T=-1,z=5,M=-1;function $(){return!(e.unstable_now()-MD||125H?(D.sortIndex=j,t(a,D),n(u)===null&&D===n(a)&&(y?(d(T),T=-1):y=!0,dt(w,j-H))):(D.sortIndex=X,t(u,D),m||S||(m=!0,Ce(k))),D},e.unstable_shouldYield=$,e.unstable_wrapCallback=function(D){var L=f;return function(){var j=f;f=L;try{return D.apply(this,arguments)}finally{f=j}}}})(Ec);Cc.exports=Ec;var Fh=Cc.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 kc=E,je=Fh;function _(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Es=Object.prototype.hasOwnProperty,$h=/^[: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]*$/,Ou={},Tu={};function Uh(e){return Es.call(Tu,e)?!0:Es.call(Ou,e)?!1:$h.test(e)?Tu[e]=!0:(Ou[e]=!0,!1)}function Hh(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function Wh(e,t,n,r){if(t===null||typeof t>"u"||Hh(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function we(e,t,n,r,i,o,s){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=s}var ce={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ce[e]=new we(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ce[t]=new we(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){ce[e]=new we(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ce[e]=new we(e,2,!1,e,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(e){ce[e]=new we(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){ce[e]=new we(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){ce[e]=new we(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){ce[e]=new we(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){ce[e]=new we(e,5,!1,e.toLowerCase(),null,!1,!1)});var xl=/[\-:]([a-z])/g;function Ol(e){return e[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(e){var t=e.replace(xl,Ol);ce[t]=new we(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(xl,Ol);ce[t]=new we(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(xl,Ol);ce[t]=new we(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){ce[e]=new we(e,1,!1,e.toLowerCase(),null,!1,!1)});ce.xlinkHref=new we("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){ce[e]=new we(e,1,!1,e.toLowerCase(),null,!0,!0)});function Tl(e,t,n,r){var i=ce.hasOwnProperty(t)?ce[t]:null;(i!==null?i.type!==0:r||!(2l||i[s]!==o[l]){var u=` +`+i[s].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=s&&0<=l);break}}}finally{$o=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?lr(e):""}function Bh(e){switch(e.tag){case 5:return lr(e.type);case 16:return lr("Lazy");case 13:return lr("Suspense");case 19:return lr("SuspenseList");case 0:case 2:case 15:return e=Uo(e.type,!1),e;case 11:return e=Uo(e.type.render,!1),e;case 1:return e=Uo(e.type,!0),e;default:return""}}function Os(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case En:return"Fragment";case Cn:return"Portal";case ks:return"Profiler";case Dl:return"StrictMode";case _s:return"Suspense";case xs:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Oc:return(e.displayName||"Context")+".Consumer";case xc:return(e._context.displayName||"Context")+".Provider";case Pl:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ll:return t=e.displayName||null,t!==null?t:Os(e.type)||"Memo";case Lt:t=e._payload,e=e._init;try{return Os(e(t))}catch{}}return null}function Vh(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Os(t);case 8:return t===Dl?"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 t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function Kt(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Dc(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Qh(e){var t=Dc(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(s){r=""+s,o.call(this,s)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function ni(e){e._valueTracker||(e._valueTracker=Qh(e))}function Pc(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Dc(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Mi(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ts(e,t){var n=t.checked;return Y({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Pu(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Kt(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function Lc(e,t){t=t.checked,t!=null&&Tl(e,"checked",t,!1)}function Ds(e,t){Lc(e,t);var n=Kt(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Ps(e,t.type,n):t.hasOwnProperty("defaultValue")&&Ps(e,t.type,Kt(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function Lu(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Ps(e,t,n){(t!=="number"||Mi(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var ur=Array.isArray;function jn(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=ri.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function _r(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var fr={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},Kh=["Webkit","ms","Moz","O"];Object.keys(fr).forEach(function(e){Kh.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),fr[t]=fr[e]})});function Rc(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||fr.hasOwnProperty(e)&&fr[e]?(""+t).trim():t+"px"}function Mc(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=Rc(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var qh=Y({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 Ns(e,t){if(t){if(qh[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(_(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(_(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(_(61))}if(t.style!=null&&typeof t.style!="object")throw Error(_(62))}}function js(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){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 Rs=null;function Il(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ms=null,Rn=null,Mn=null;function ju(e){if(e=Qr(e)){if(typeof Ms!="function")throw Error(_(280));var t=e.stateNode;t&&(t=fo(t),Ms(e.stateNode,e.type,t))}}function Ac(e){Rn?Mn?Mn.push(e):Mn=[e]:Rn=e}function bc(){if(Rn){var e=Rn,t=Mn;if(Mn=Rn=null,ju(e),t)for(e=0;e>>=0,e===0?32:31-(op(e)/sp|0)|0}var ii=64,oi=4194304;function ar(e){switch(e&-e){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 e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Fi(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,s=n&268435455;if(s!==0){var l=s&~i;l!==0?r=ar(l):(o&=s,o!==0&&(r=ar(o)))}else s=n&~i,s!==0?r=ar(s):o!==0&&(r=ar(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Br(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-nt(t),e[t]=n}function cp(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=pr),Hu=String.fromCharCode(32),Wu=!1;function rd(e,t){switch(e){case"keyup":return zp.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function id(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var kn=!1;function $p(e,t){switch(e){case"compositionend":return id(t);case"keypress":return t.which!==32?null:(Wu=!0,Hu);case"textInput":return e=t.data,e===Hu&&Wu?null:e;default:return null}}function Up(e,t){if(kn)return e==="compositionend"||!Fl&&rd(e,t)?(e=td(),ki=Al=At=null,kn=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Ku(n)}}function ud(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?ud(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function ad(){for(var e=window,t=Mi();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Mi(e.document)}return t}function $l(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function Yp(e){var t=ad(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&ud(n.ownerDocument.documentElement,n)){if(r!==null&&$l(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=qu(n,o);var s=qu(n,r);i&&s&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==s.node||e.focusOffset!==s.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(s.node,s.offset)):(t.setEnd(s.node,s.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,_n=null,Us=null,mr=null,Hs=!1;function Gu(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Hs||_n==null||_n!==Mi(r)||(r=_n,"selectionStart"in r&&$l(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),mr&&Lr(mr,r)||(mr=r,r=Hi(Us,"onSelect"),0Tn||(e.current=qs[Tn],qs[Tn]=null,Tn--)}function W(e,t){Tn++,qs[Tn]=e.current,e.current=t}var qt={},me=Yt(qt),xe=Yt(!1),un=qt;function $n(e,t){var n=e.type.contextTypes;if(!n)return qt;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Oe(e){return e=e.childContextTypes,e!=null}function Bi(){V(xe),V(me)}function na(e,t,n){if(me.current!==qt)throw Error(_(168));W(me,t),W(xe,n)}function yd(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(_(108,Vh(e)||"Unknown",i));return Y({},n,r)}function Vi(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||qt,un=me.current,W(me,e),W(xe,xe.current),!0}function ra(e,t,n){var r=e.stateNode;if(!r)throw Error(_(169));n?(e=yd(e,t,un),r.__reactInternalMemoizedMergedChildContext=e,V(xe),V(me),W(me,e)):V(xe),W(xe,n)}var gt=null,ho=!1,ts=!1;function Sd(e){gt===null?gt=[e]:gt.push(e)}function u0(e){ho=!0,Sd(e)}function Xt(){if(!ts&>!==null){ts=!0;var e=0,t=U;try{var n=gt;for(U=1;e>=s,i-=s,mt=1<<32-nt(t)+i|n<T?(z=x,x=null):z=x.sibling;var M=f(d,x,h[T],w);if(M===null){x===null&&(x=z);break}e&&x&&M.alternate===null&&t(d,x),c=o(M,c,T),O===null?k=M:O.sibling=M,O=M,x=z}if(T===h.length)return n(d,x),Q&&Jt(d,T),k;if(x===null){for(;TT?(z=x,x=null):z=x.sibling;var $=f(d,x,M.value,w);if($===null){x===null&&(x=z);break}e&&x&&$.alternate===null&&t(d,x),c=o($,c,T),O===null?k=$:O.sibling=$,O=$,x=z}if(M.done)return n(d,x),Q&&Jt(d,T),k;if(x===null){for(;!M.done;T++,M=h.next())M=p(d,M.value,w),M!==null&&(c=o(M,c,T),O===null?k=M:O.sibling=M,O=M);return Q&&Jt(d,T),k}for(x=r(d,x);!M.done;T++,M=h.next())M=S(x,d,T,M.value,w),M!==null&&(e&&M.alternate!==null&&x.delete(M.key===null?T:M.key),c=o(M,c,T),O===null?k=M:O.sibling=M,O=M);return e&&x.forEach(function(K){return t(d,K)}),Q&&Jt(d,T),k}function C(d,c,h,w){if(typeof h=="object"&&h!==null&&h.type===En&&h.key===null&&(h=h.props.children),typeof h=="object"&&h!==null){switch(h.$$typeof){case ti:e:{for(var k=h.key,O=c;O!==null;){if(O.key===k){if(k=h.type,k===En){if(O.tag===7){n(d,O.sibling),c=i(O,h.props.children),c.return=d,d=c;break e}}else if(O.elementType===k||typeof k=="object"&&k!==null&&k.$$typeof===Lt&&ca(k)===O.type){n(d,O.sibling),c=i(O,h.props),c.ref=tr(d,O,h),c.return=d,d=c;break e}n(d,O);break}else t(d,O);O=O.sibling}h.type===En?(c=sn(h.props.children,d.mode,w,h.key),c.return=d,d=c):(w=Ii(h.type,h.key,h.props,null,d.mode,w),w.ref=tr(d,c,h),w.return=d,d=w)}return s(d);case Cn:e:{for(O=h.key;c!==null;){if(c.key===O)if(c.tag===4&&c.stateNode.containerInfo===h.containerInfo&&c.stateNode.implementation===h.implementation){n(d,c.sibling),c=i(c,h.children||[]),c.return=d,d=c;break e}else{n(d,c);break}else t(d,c);c=c.sibling}c=as(h,d.mode,w),c.return=d,d=c}return s(d);case Lt:return O=h._init,C(d,c,O(h._payload),w)}if(ur(h))return m(d,c,h,w);if(Yn(h))return y(d,c,h,w);fi(d,h)}return typeof h=="string"&&h!==""||typeof h=="number"?(h=""+h,c!==null&&c.tag===6?(n(d,c.sibling),c=i(c,h),c.return=d,d=c):(n(d,c),c=us(h,d.mode,w),c.return=d,d=c),s(d)):n(d,c)}return C}var Hn=Td(!0),Dd=Td(!1),Kr={},ct=Yt(Kr),Rr=Yt(Kr),Mr=Yt(Kr);function rn(e){if(e===Kr)throw Error(_(174));return e}function Gl(e,t){switch(W(Mr,t),W(Rr,e),W(ct,Kr),e=t.nodeType,e){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:Is(null,"");break;default:e=e===8?t.parentNode:t,t=e.namespaceURI||null,e=e.tagName,t=Is(t,e)}V(ct),W(ct,t)}function Wn(){V(ct),V(Rr),V(Mr)}function Pd(e){rn(Mr.current);var t=rn(ct.current),n=Is(t,e.type);t!==n&&(W(Rr,e),W(ct,n))}function Yl(e){Rr.current===e&&(V(ct),V(Rr))}var q=Yt(0);function Xi(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ns=[];function Xl(){for(var e=0;en?n:4,e(!0);var r=rs.transition;rs.transition={};try{e(!1),t()}finally{U=n,rs.transition=r}}function Vd(){return Ke().memoizedState}function f0(e,t,n){var r=Bt(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Qd(e))Kd(t,n);else if(n=kd(e,t,n,r),n!==null){var i=ye();rt(n,e,r,i),qd(n,t,r)}}function h0(e,t,n){var r=Bt(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Qd(e))Kd(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var s=t.lastRenderedState,l=o(s,n);if(i.hasEagerState=!0,i.eagerState=l,it(l,s)){var u=t.interleaved;u===null?(i.next=i,Kl(t)):(i.next=u.next,u.next=i),t.interleaved=i;return}}catch{}finally{}n=kd(e,t,i,r),n!==null&&(i=ye(),rt(n,e,r,i),qd(n,t,r))}}function Qd(e){var t=e.alternate;return e===G||t!==null&&t===G}function Kd(e,t){vr=Zi=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function qd(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,jl(e,n)}}var Ji={readContext:Qe,useCallback:fe,useContext:fe,useEffect:fe,useImperativeHandle:fe,useInsertionEffect:fe,useLayoutEffect:fe,useMemo:fe,useReducer:fe,useRef:fe,useState:fe,useDebugValue:fe,useDeferredValue:fe,useTransition:fe,useMutableSource:fe,useSyncExternalStore:fe,useId:fe,unstable_isNewReconciler:!1},p0={readContext:Qe,useCallback:function(e,t){return lt().memoizedState=[e,t===void 0?null:t],e},useContext:Qe,useEffect:fa,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,Ti(4194308,4,$d.bind(null,t,e),n)},useLayoutEffect:function(e,t){return Ti(4194308,4,e,t)},useInsertionEffect:function(e,t){return Ti(4,2,e,t)},useMemo:function(e,t){var n=lt();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=lt();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=f0.bind(null,G,e),[r.memoizedState,e]},useRef:function(e){var t=lt();return e={current:e},t.memoizedState=e},useState:da,useDebugValue:nu,useDeferredValue:function(e){return lt().memoizedState=e},useTransition:function(){var e=da(!1),t=e[0];return e=d0.bind(null,e[1]),lt().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=G,i=lt();if(Q){if(n===void 0)throw Error(_(407));n=n()}else{if(n=t(),le===null)throw Error(_(349));cn&30||Nd(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,fa(Rd.bind(null,r,o,e),[e]),r.flags|=2048,zr(9,jd.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=lt(),t=le.identifierPrefix;if(Q){var n=vt,r=mt;n=(r&~(1<<32-nt(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Ar++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=s.createElement(n,{is:r.is}):(e=s.createElement(n),n==="select"&&(s=e,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):e=s.createElementNS(e,n),e[ut]=t,e[jr]=r,rf(e,t,!1,!1),t.stateNode=e;e:{switch(s=js(n,r),n){case"dialog":B("cancel",e),B("close",e),i=r;break;case"iframe":case"object":case"embed":B("load",e),i=r;break;case"video":case"audio":for(i=0;iVn&&(t.flags|=128,r=!0,nr(o,!1),t.lanes=4194304)}else{if(!r)if(e=Xi(s),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),nr(o,!0),o.tail===null&&o.tailMode==="hidden"&&!s.alternate&&!Q)return he(t),null}else 2*J()-o.renderingStartTime>Vn&&n!==1073741824&&(t.flags|=128,r=!0,nr(o,!1),t.lanes=4194304);o.isBackwards?(s.sibling=t.child,t.child=s):(n=o.last,n!==null?n.sibling=s:t.child=s,o.last=s)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=J(),t.sibling=null,n=q.current,W(q,r?n&1|2:n&1),t):(he(t),null);case 22:case 23:return uu(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?Le&1073741824&&(he(t),t.subtreeFlags&6&&(t.flags|=8192)):he(t),null;case 24:return null;case 25:return null}throw Error(_(156,t.tag))}function E0(e,t){switch(Hl(t),t.tag){case 1:return Oe(t.type)&&Bi(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Wn(),V(xe),V(me),Xl(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Yl(t),null;case 13:if(V(q),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(_(340));Un()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return V(q),null;case 4:return Wn(),null;case 10:return Ql(t.type._context),null;case 22:case 23:return uu(),null;case 24:return null;default:return null}}var pi=!1,ge=!1,k0=typeof WeakSet=="function"?WeakSet:Set,P=null;function In(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Z(e,t,r)}else n.current=null}function sl(e,t,n){try{n()}catch(r){Z(e,t,r)}}var Ca=!1;function _0(e,t){if(Ws=$i,e=ad(),$l(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var s=0,l=-1,u=-1,a=0,g=0,p=e,f=null;t:for(;;){for(var S;p!==n||i!==0&&p.nodeType!==3||(l=s+i),p!==o||r!==0&&p.nodeType!==3||(u=s+r),p.nodeType===3&&(s+=p.nodeValue.length),(S=p.firstChild)!==null;)f=p,p=S;for(;;){if(p===e)break t;if(f===n&&++a===i&&(l=s),f===o&&++g===r&&(u=s),(S=p.nextSibling)!==null)break;p=f,f=p.parentNode}p=S}n=l===-1||u===-1?null:{start:l,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Bs={focusedElem:e,selectionRange:n},$i=!1,P=t;P!==null;)if(t=P,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,P=e;else for(;P!==null;){t=P;try{var m=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var y=m.memoizedProps,C=m.memoizedState,d=t.stateNode,c=d.getSnapshotBeforeUpdate(t.elementType===t.type?y:Je(t.type,y),C);d.__reactInternalSnapshotBeforeUpdate=c}break;case 3:var h=t.stateNode.containerInfo;h.nodeType===1?h.textContent="":h.nodeType===9&&h.documentElement&&h.removeChild(h.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(_(163))}}catch(w){Z(t,t.return,w)}if(e=t.sibling,e!==null){e.return=t.return,P=e;break}P=t.return}return m=Ca,Ca=!1,m}function yr(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&sl(t,n,o)}i=i.next}while(i!==r)}}function mo(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function ll(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function lf(e){var t=e.alternate;t!==null&&(e.alternate=null,lf(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ut],delete t[jr],delete t[Ks],delete t[s0],delete t[l0])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function uf(e){return e.tag===5||e.tag===3||e.tag===4}function Ea(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||uf(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function ul(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=Wi));else if(r!==4&&(e=e.child,e!==null))for(ul(e,t,n),e=e.sibling;e!==null;)ul(e,t,n),e=e.sibling}function al(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(al(e,t,n),e=e.sibling;e!==null;)al(e,t,n),e=e.sibling}var ue=null,et=!1;function Tt(e,t,n){for(n=n.child;n!==null;)af(e,t,n),n=n.sibling}function af(e,t,n){if(at&&typeof at.onCommitFiberUnmount=="function")try{at.onCommitFiberUnmount(lo,n)}catch{}switch(n.tag){case 5:ge||In(n,t);case 6:var r=ue,i=et;ue=null,Tt(e,t,n),ue=r,et=i,ue!==null&&(et?(e=ue,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):ue.removeChild(n.stateNode));break;case 18:ue!==null&&(et?(e=ue,n=n.stateNode,e.nodeType===8?es(e.parentNode,n):e.nodeType===1&&es(e,n),Dr(e)):es(ue,n.stateNode));break;case 4:r=ue,i=et,ue=n.stateNode.containerInfo,et=!0,Tt(e,t,n),ue=r,et=i;break;case 0:case 11:case 14:case 15:if(!ge&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,s=o.destroy;o=o.tag,s!==void 0&&(o&2||o&4)&&sl(n,t,s),i=i.next}while(i!==r)}Tt(e,t,n);break;case 1:if(!ge&&(In(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Z(n,t,l)}Tt(e,t,n);break;case 21:Tt(e,t,n);break;case 22:n.mode&1?(ge=(r=ge)||n.memoizedState!==null,Tt(e,t,n),ge=r):Tt(e,t,n);break;default:Tt(e,t,n)}}function ka(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new k0),t.forEach(function(r){var i=j0.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function Ze(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=s),r&=~o}if(r=i,r=J()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*O0(r/1960))-r,10e?16:e,bt===null)var r=!1;else{if(e=bt,bt=null,no=0,F&6)throw Error(_(331));var i=F;for(F|=4,P=e.current;P!==null;){var o=P,s=o.child;if(P.flags&16){var l=o.deletions;if(l!==null){for(var u=0;uJ()-su?on(e,0):ou|=n),Te(e,t)}function vf(e,t){t===0&&(e.mode&1?(t=oi,oi<<=1,!(oi&130023424)&&(oi=4194304)):t=1);var n=ye();e=Ct(e,t),e!==null&&(Br(e,t,n),Te(e,n))}function N0(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),vf(e,n)}function j0(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(_(314))}r!==null&&r.delete(t),vf(e,n)}var yf;yf=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||xe.current)_e=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return _e=!1,w0(e,t,n);_e=!!(e.flags&131072)}else _e=!1,Q&&t.flags&1048576&&wd(t,Ki,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Di(e,t),e=t.pendingProps;var i=$n(t,me.current);bn(t,n),i=Jl(null,t,r,e,i,n);var o=eu();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Oe(r)?(o=!0,Vi(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,ql(t),i.updater=po,t.stateNode=i,i._reactInternals=t,Js(t,r,e,n),t=nl(null,t,r,!0,o,n)):(t.tag=0,Q&&o&&Ul(t),ve(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Di(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=M0(r),e=Je(r,e),i){case 0:t=tl(null,t,r,e,n);break e;case 1:t=ya(null,t,r,e,n);break e;case 11:t=ma(null,t,r,e,n);break e;case 14:t=va(null,t,r,Je(r.type,e),n);break e}throw Error(_(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Je(r,i),tl(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Je(r,i),ya(e,t,r,i,n);case 3:e:{if(ef(t),e===null)throw Error(_(387));r=t.pendingProps,o=t.memoizedState,i=o.element,_d(e,t),Yi(t,r,null,n);var s=t.memoizedState;if(r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=Bn(Error(_(423)),t),t=Sa(e,t,r,n,i);break e}else if(r!==i){i=Bn(Error(_(424)),t),t=Sa(e,t,r,n,i);break e}else for(Ie=Ut(t.stateNode.containerInfo.firstChild),Ne=t,Q=!0,tt=null,n=Dd(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Un(),r===i){t=Et(e,t,n);break e}ve(e,t,r,n)}t=t.child}return t;case 5:return Pd(t),e===null&&Ys(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,s=i.children,Vs(r,i)?s=null:o!==null&&Vs(r,o)&&(t.flags|=32),Jd(e,t),ve(e,t,s,n),t.child;case 6:return e===null&&Ys(t),null;case 13:return tf(e,t,n);case 4:return Gl(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Hn(t,null,r,n):ve(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Je(r,i),ma(e,t,r,i,n);case 7:return ve(e,t,t.pendingProps,n),t.child;case 8:return ve(e,t,t.pendingProps.children,n),t.child;case 12:return ve(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,s=i.value,W(qi,r._currentValue),r._currentValue=s,o!==null)if(it(o.value,s)){if(o.children===i.children&&!xe.current){t=Et(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var l=o.dependencies;if(l!==null){s=o.child;for(var u=l.firstContext;u!==null;){if(u.context===r){if(o.tag===1){u=yt(-1,n&-n),u.tag=2;var a=o.updateQueue;if(a!==null){a=a.shared;var g=a.pending;g===null?u.next=u:(u.next=g.next,g.next=u),a.pending=u}}o.lanes|=n,u=o.alternate,u!==null&&(u.lanes|=n),Xs(o.return,n,t),l.lanes|=n;break}u=u.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(_(341));s.lanes|=n,l=s.alternate,l!==null&&(l.lanes|=n),Xs(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}ve(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,bn(t,n),i=Qe(i),r=r(i),t.flags|=1,ve(e,t,r,n),t.child;case 14:return r=t.type,i=Je(r,t.pendingProps),i=Je(r.type,i),va(e,t,r,i,n);case 15:return Xd(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Je(r,i),Di(e,t),t.tag=1,Oe(r)?(e=!0,Vi(t)):e=!1,bn(t,n),Od(t,r,i),Js(t,r,i,n),nl(null,t,r,!0,e,n);case 19:return nf(e,t,n);case 22:return Zd(e,t,n)}throw Error(_(156,t.tag))};function Sf(e,t){return Bc(e,t)}function R0(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Be(e,t,n,r){return new R0(e,t,n,r)}function cu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function M0(e){if(typeof e=="function")return cu(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Pl)return 11;if(e===Ll)return 14}return 2}function Vt(e,t){var n=e.alternate;return n===null?(n=Be(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Ii(e,t,n,r,i,o){var s=2;if(r=e,typeof e=="function")cu(e)&&(s=1);else if(typeof e=="string")s=5;else e:switch(e){case En:return sn(n.children,i,o,t);case Dl:s=8,i|=8;break;case ks:return e=Be(12,n,t,i|2),e.elementType=ks,e.lanes=o,e;case _s:return e=Be(13,n,t,i),e.elementType=_s,e.lanes=o,e;case xs:return e=Be(19,n,t,i),e.elementType=xs,e.lanes=o,e;case Tc:return yo(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case xc:s=10;break e;case Oc:s=9;break e;case Pl:s=11;break e;case Ll:s=14;break e;case Lt:s=16,r=null;break e}throw Error(_(130,e==null?e:typeof e,""))}return t=Be(s,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function sn(e,t,n,r){return e=Be(7,e,r,t),e.lanes=n,e}function yo(e,t,n,r){return e=Be(22,e,r,t),e.elementType=Tc,e.lanes=n,e.stateNode={isHidden:!1},e}function us(e,t,n){return e=Be(6,e,null,t),e.lanes=n,e}function as(e,t,n){return t=Be(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function A0(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Wo(0),this.expirationTimes=Wo(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Wo(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function du(e,t,n,r,i,o,s,l,u){return e=new A0(e,t,n,l,u),t===1?(t=1,o===!0&&(t|=8)):t=0,o=Be(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ql(o),e}function b0(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(kf)}catch(e){console.error(e)}}kf(),wc.exports=Re;var H0=wc.exports,Ia=H0;Cs.createRoot=Ia.createRoot,Cs.hydrateRoot=Ia.hydrateRoot;/** + * @license + * Copyright (c) 2023, Jeff Hlywa (jhlywa@gmail.com) + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */const pe="w",$e="b",oe="p",pl="n",Ni="b",dr="r",Nt="q",ne="k",cs="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",Ee=-1,W0={NORMAL:"n",CAPTURE:"c",BIG_PAWN:"b",EP_CAPTURE:"e",PROMOTION:"p",KSIDE_CASTLE:"k",QSIDE_CASTLE:"q"},I={NORMAL:1,CAPTURE:2,BIG_PAWN:4,EP_CAPTURE:8,PROMOTION:16,KSIDE_CASTLE:32,QSIDE_CASTLE:64},R={a8:0,b8:1,c8:2,d8:3,e8:4,f8:5,g8:6,h8:7,a7:16,b7:17,c7:18,d7:19,e7:20,f7:21,g7:22,h7:23,a6:32,b6:33,c6:34,d6:35,e6:36,f6:37,g6:38,h6:39,a5:48,b5:49,c5:50,d5:51,e5:52,f5:53,g5:54,h5:55,a4:64,b4:65,c4:66,d4:67,e4:68,f4:69,g4:70,h4:71,a3:80,b3:81,c3:82,d3:83,e3:84,f3:85,g3:86,h3:87,a2:96,b2:97,c2:98,d2:99,e2:100,f2:101,g2:102,h2:103,a1:112,b1:113,c1:114,d1:115,e1:116,f1:117,g1:118,h1:119},ds={b:[16,32,17,15],w:[-16,-32,-17,-15]},Na={n:[-18,-33,-31,-14,18,33,31,14],b:[-17,-15,17,15],r:[-16,1,16,-1],q:[-17,-16,-15,1,17,16,15,-1],k:[-17,-16,-15,1,17,16,15,-1]},B0=[20,0,0,0,0,0,0,24,0,0,0,0,0,0,20,0,0,20,0,0,0,0,0,24,0,0,0,0,0,20,0,0,0,0,20,0,0,0,0,24,0,0,0,0,20,0,0,0,0,0,0,20,0,0,0,24,0,0,0,20,0,0,0,0,0,0,0,0,20,0,0,24,0,0,20,0,0,0,0,0,0,0,0,0,0,20,2,24,2,20,0,0,0,0,0,0,0,0,0,0,0,2,53,56,53,2,0,0,0,0,0,0,24,24,24,24,24,24,56,0,56,24,24,24,24,24,24,0,0,0,0,0,0,2,53,56,53,2,0,0,0,0,0,0,0,0,0,0,0,20,2,24,2,20,0,0,0,0,0,0,0,0,0,0,20,0,0,24,0,0,20,0,0,0,0,0,0,0,0,20,0,0,0,24,0,0,0,20,0,0,0,0,0,0,20,0,0,0,0,24,0,0,0,0,20,0,0,0,0,20,0,0,0,0,0,24,0,0,0,0,0,20,0,0,20,0,0,0,0,0,0,24,0,0,0,0,0,0,20],V0=[17,0,0,0,0,0,0,16,0,0,0,0,0,0,15,0,0,17,0,0,0,0,0,16,0,0,0,0,0,15,0,0,0,0,17,0,0,0,0,16,0,0,0,0,15,0,0,0,0,0,0,17,0,0,0,16,0,0,0,15,0,0,0,0,0,0,0,0,17,0,0,16,0,0,15,0,0,0,0,0,0,0,0,0,0,17,0,16,0,15,0,0,0,0,0,0,0,0,0,0,0,0,17,16,15,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,-1,-1,-1,-1,-1,-1,-1,0,0,0,0,0,0,0,-15,-16,-17,0,0,0,0,0,0,0,0,0,0,0,0,-15,0,-16,0,-17,0,0,0,0,0,0,0,0,0,0,-15,0,0,-16,0,0,-17,0,0,0,0,0,0,0,0,-15,0,0,0,-16,0,0,0,-17,0,0,0,0,0,0,-15,0,0,0,0,-16,0,0,0,0,-17,0,0,0,0,-15,0,0,0,0,0,-16,0,0,0,0,0,-17,0,0,-15,0,0,0,0,0,0,-16,0,0,0,0,0,0,-17],Q0={p:1,n:2,b:4,r:8,q:16,k:32},K0="pnbrqkPNBRQK",ja=[pl,Ni,dr,Nt],q0=7,G0=6,Y0=1,X0=0,vi={[ne]:I.KSIDE_CASTLE,[Nt]:I.QSIDE_CASTLE},Dt={w:[{square:R.a1,flag:I.QSIDE_CASTLE},{square:R.h1,flag:I.KSIDE_CASTLE}],b:[{square:R.a8,flag:I.QSIDE_CASTLE},{square:R.h8,flag:I.KSIDE_CASTLE}]},Z0={b:Y0,w:G0},J0=["1-0","0-1","1/2-1/2","*"];function ln(e){return e>>4}function $r(e){return e&15}function _f(e){return"0123456789".indexOf(e)!==-1}function Pe(e){const t=$r(e),n=ln(e);return"abcdefgh".substring(t,t+1)+"87654321".substring(n,n+1)}function ir(e){return e===pe?$e:pe}function eg(e){const t=e.split(/\s+/);if(t.length!==6)return{ok:!1,error:"Invalid FEN: must contain six space-delimited fields"};const n=parseInt(t[5],10);if(isNaN(n)||n<=0)return{ok:!1,error:"Invalid FEN: move number must be a positive integer"};const r=parseInt(t[4],10);if(isNaN(r)||r<0)return{ok:!1,error:"Invalid FEN: half move counter number must be a non-negative integer"};if(!/^(-|[abcdefgh][36])$/.test(t[3]))return{ok:!1,error:"Invalid FEN: en-passant square is invalid"};if(/[^kKqQ-]/.test(t[2]))return{ok:!1,error:"Invalid FEN: castling availability is invalid"};if(!/^(w|b)$/.test(t[1]))return{ok:!1,error:"Invalid FEN: side-to-move is invalid"};const i=t[0].split("/");if(i.length!==8)return{ok:!1,error:"Invalid FEN: piece data does not contain 8 '/'-delimited rows"};for(let s=0;s1)return{ok:!1,error:`Invalid FEN: too many ${s} kings`}}return Array.from(i[0]+i[7]).some(s=>s.toUpperCase()==="P")?{ok:!1,error:"Invalid FEN: some pawns are on the edge rows"}:{ok:!0}}function tg(e,t){const n=e.from,r=e.to,i=e.piece;let o=0,s=0,l=0;for(let u=0,a=t.length;u0?s>0&&l>0?Pe(n):l>0?Pe(n).charAt(1):Pe(n).charAt(0):""}function Pt(e,t,n,r,i,o=void 0,s=I.NORMAL){const l=ln(r);if(i===oe&&(l===q0||l===X0))for(let u=0;u="a"&&t<="h"?e.match(/[a-h]\d.*[a-h]\d/)?void 0:oe:(t=t.toLowerCase(),t==="o"?ne:t)}function fs(e){return e.replace(/=/,"").replace(/[+#]?[?!]*$/,"")}function Ma(e){return e.split(" ").slice(0,4).join(" ")}class ng{constructor(t=cs){ze(this,"_board",new Array(128));ze(this,"_turn",pe);ze(this,"_header",{});ze(this,"_kings",{w:Ee,b:Ee});ze(this,"_epSquare",-1);ze(this,"_halfMoves",0);ze(this,"_moveNumber",0);ze(this,"_history",[]);ze(this,"_comments",{});ze(this,"_castling",{w:0,b:0});ze(this,"_positionCounts",{});this.load(t)}clear({preserveHeaders:t=!1}={}){this._board=new Array(128),this._kings={w:Ee,b:Ee},this._turn=pe,this._castling={w:0,b:0},this._epSquare=Ee,this._halfMoves=0,this._moveNumber=1,this._history=[],this._comments={},this._header=t?this._header:{},delete this._header.SetUp,delete this._header.FEN,this._positionCounts=new Proxy({},{get:(n,r)=>r==="length"?Object.keys(n).length:(n==null?void 0:n[Ma(r)])||0,set:(n,r,i)=>{const o=Ma(r);return i===0?delete n[o]:n[o]=i,!0}})}removeHeader(t){t in this._header&&delete this._header[t]}load(t,{skipValidation:n=!1,preserveHeaders:r=!1}={}){let i=t.split(/\s+/);if(i.length>=2&&i.length<6){const l=["-","-","0","1"];t=i.concat(l.slice(-(6-i.length))).join(" ")}if(i=t.split(/\s+/),!n){const{ok:l,error:u}=eg(t);if(!l)throw new Error(u)}const o=i[0];let s=0;this.clear({preserveHeaders:r});for(let l=0;l-1&&(this._castling.w|=I.KSIDE_CASTLE),i[2].indexOf("Q")>-1&&(this._castling.w|=I.QSIDE_CASTLE),i[2].indexOf("k")>-1&&(this._castling.b|=I.KSIDE_CASTLE),i[2].indexOf("q")>-1&&(this._castling.b|=I.QSIDE_CASTLE),this._epSquare=i[3]==="-"?Ee:R[i[3]],this._halfMoves=parseInt(i[4],10),this._moveNumber=parseInt(i[5],10),this._updateSetup(t),this._positionCounts[t]++}fen(){var o,s;let t=0,n="";for(let l=R.a8;l<=R.h1;l++){if(this._board[l]){t>0&&(n+=t,t=0);const{color:u,type:a}=this._board[l];n+=u===pe?a.toUpperCase():a.toLowerCase()}else t++;l+1&136&&(t>0&&(n+=t),l!==R.h1&&(n+="/"),t=0,l+=8)}let r="";this._castling[pe]&I.KSIDE_CASTLE&&(r+="K"),this._castling[pe]&I.QSIDE_CASTLE&&(r+="Q"),this._castling[$e]&I.KSIDE_CASTLE&&(r+="k"),this._castling[$e]&I.QSIDE_CASTLE&&(r+="q"),r=r||"-";let i="-";if(this._epSquare!==Ee){const l=this._epSquare+(this._turn===pe?16:-16),u=[l+1,l-1];for(const a of u){if(a&136)continue;const g=this._turn;if(((o=this._board[a])==null?void 0:o.color)===g&&((s=this._board[a])==null?void 0:s.type)===oe){this._makeMove({color:g,from:a,to:this._epSquare,piece:oe,captured:oe,flags:I.EP_CAPTURE});const p=!this._isKingAttacked(g);if(this._undoMove(),p){i=Pe(this._epSquare);break}}}}return[n,this._turn,r,i,this._halfMoves,this._moveNumber].join(" ")}_updateSetup(t){this._history.length>0||(t!==cs?(this._header.SetUp="1",this._header.FEN=t):(delete this._header.SetUp,delete this._header.FEN))}reset(){this.load(cs)}get(t){return this._board[R[t]]||!1}put({type:t,color:n},r){return this._put({type:t,color:n},r)?(this._updateCastlingRights(),this._updateEnPassantSquare(),this._updateSetup(this.fen()),!0):!1}_put({type:t,color:n},r){if(K0.indexOf(t.toLowerCase())===-1||!(r in R))return!1;const i=R[r];if(t==ne&&!(this._kings[n]==Ee||this._kings[n]==i))return!1;const o=this._board[i];return o&&o.type===ne&&(this._kings[o.color]=Ee),this._board[i]={type:t,color:n},t===ne&&(this._kings[n]=i),!0}remove(t){const n=this.get(t);return delete this._board[R[t]],n&&n.type===ne&&(this._kings[n.color]=Ee),this._updateCastlingRights(),this._updateEnPassantSquare(),this._updateSetup(this.fen()),n}_updateCastlingRights(){var r,i,o,s,l,u,a,g,p,f,S,m;const t=((r=this._board[R.e1])==null?void 0:r.type)===ne&&((i=this._board[R.e1])==null?void 0:i.color)===pe,n=((o=this._board[R.e8])==null?void 0:o.type)===ne&&((s=this._board[R.e8])==null?void 0:s.color)===$e;(!t||((l=this._board[R.a1])==null?void 0:l.type)!==dr||((u=this._board[R.a1])==null?void 0:u.color)!==pe)&&(this._castling.w&=~I.QSIDE_CASTLE),(!t||((a=this._board[R.h1])==null?void 0:a.type)!==dr||((g=this._board[R.h1])==null?void 0:g.color)!==pe)&&(this._castling.w&=~I.KSIDE_CASTLE),(!n||((p=this._board[R.a8])==null?void 0:p.type)!==dr||((f=this._board[R.a8])==null?void 0:f.color)!==$e)&&(this._castling.b&=~I.QSIDE_CASTLE),(!n||((S=this._board[R.h8])==null?void 0:S.type)!==dr||((m=this._board[R.h8])==null?void 0:m.color)!==$e)&&(this._castling.b&=~I.KSIDE_CASTLE)}_updateEnPassantSquare(){var o,s;if(this._epSquare===Ee)return;const t=this._epSquare+(this._turn===pe?-16:16),n=this._epSquare+(this._turn===pe?16:-16),r=[n+1,n-1];if(this._board[t]!==null||this._board[this._epSquare]!==null||((o=this._board[n])==null?void 0:o.color)!==ir(this._turn)||((s=this._board[n])==null?void 0:s.type)!==oe){this._epSquare=Ee;return}const i=l=>{var u,a;return!(l&136)&&((u=this._board[l])==null?void 0:u.color)===this._turn&&((a=this._board[l])==null?void 0:a.type)===oe};r.some(i)||(this._epSquare=Ee)}_attacked(t,n){for(let r=R.a8;r<=R.h1;r++){if(r&136){r+=7;continue}if(this._board[r]===void 0||this._board[r].color!==t)continue;const i=this._board[r],o=r-n;if(o===0)continue;const s=o+119;if(B0[s]&Q0[i.type]){if(i.type===oe){if(o>0){if(i.color===pe)return!0}else if(i.color===$e)return!0;continue}if(i.type==="n"||i.type==="k")return!0;const l=V0[s];let u=r+l,a=!1;for(;u!==n;){if(this._board[u]!=null){a=!0;break}u+=l}if(!a)return!0}}return!1}_isKingAttacked(t){const n=this._kings[t];return n===-1?!1:this._attacked(ir(t),n)}isAttacked(t,n){return this._attacked(n,R[t])}isCheck(){return this._isKingAttacked(this._turn)}inCheck(){return this.isCheck()}isCheckmate(){return this.isCheck()&&this._moves().length===0}isStalemate(){return!this.isCheck()&&this._moves().length===0}isInsufficientMaterial(){const t={b:0,n:0,r:0,q:0,k:0,p:0},n=[];let r=0,i=0;for(let o=R.a8;o<=R.h1;o++){if(i=(i+1)%2,o&136){o+=7;continue}const s=this._board[o];s&&(t[s.type]=s.type in t?t[s.type]+1:1,s.type===Ni&&n.push(i),r++)}if(r===2)return!0;if(r===3&&(t[Ni]===1||t[pl]===1))return!0;if(r===t[Ni]+2){let o=0;const s=n.length;for(let l=0;l=3}isDraw(){return this._halfMoves>=100||this.isStalemate()||this.isInsufficientMaterial()||this.isThreefoldRepetition()}isGameOver(){return this.isCheckmate()||this.isStalemate()||this.isDraw()}moves({verbose:t=!1,square:n=void 0,piece:r=void 0}={}){const i=this._moves({square:n,piece:r});return t?i.map(o=>this._makePretty(o)):i.map(o=>this._moveToSan(o,i))}_moves({legal:t=!0,piece:n=void 0,square:r=void 0}={}){var S;const i=r?r.toLowerCase():void 0,o=n==null?void 0:n.toLowerCase(),s=[],l=this._turn,u=ir(l);let a=R.a8,g=R.h1,p=!1;if(i)if(i in R)a=g=R[i],p=!0;else return[];for(let m=a;m<=g;m++){if(m&136){m+=7;continue}if(!this._board[m]||this._board[m].color===u)continue;const{type:y}=this._board[m];let C;if(y===oe){if(o&&o!==y)continue;C=m+ds[l][0],this._board[C]||(Pt(s,l,m,C,oe),C=m+ds[l][1],Z0[l]===ln(m)&&!this._board[C]&&Pt(s,l,m,C,oe,void 0,I.BIG_PAWN));for(let d=2;d<4;d++)C=m+ds[l][d],!(C&136)&&(((S=this._board[C])==null?void 0:S.color)===u?Pt(s,l,m,C,oe,this._board[C].type,I.CAPTURE):C===this._epSquare&&Pt(s,l,m,C,oe,oe,I.EP_CAPTURE))}else{if(o&&o!==y)continue;for(let d=0,c=Na[y].length;d{const S=this._comments[this.fen()];if(typeof S<"u"){const m=f.length>0?" ":"";f=`${f}${m}{${S}}`}return f},s=[];for(;this._history.length>0;)s.push(this._undoMove());const l=[];let u="";for(s.length===0&&l.push(o(""));s.length>0;){u=o(u);const f=s.pop();if(!f)break;if(!this._history.length&&f.color==="b"){const S=`${this._moveNumber}. ...`;u=u?`${u} ${S}`:S}else f.color==="w"&&(u.length&&l.push(u),u=this._moveNumber+".");u=u+" "+this._moveToSan(f,this._moves({legal:!0})),this._makeMove(f)}if(u.length&&l.push(o(u)),typeof this._header.Result<"u"&&l.push(this._header.Result),n===0)return r.join("")+l.join(" ");const a=function(){return r.length>0&&r[r.length-1]===" "?(r.pop(),!0):!1},g=function(f,S){for(const m of S.split(" "))if(m){if(f+m.length>n){for(;a();)f--;r.push(t),f=0}r.push(m),f+=m.length,r.push(" "),f++}return a()&&f--,f};let p=0;for(let f=0;fn&&l[f].includes("{")){p=g(p,l[f]);continue}p+l[f].length>n&&f!==0?(r[r.length-1]===" "&&r.pop(),r.push(t),p=0):f!==0&&(r.push(" "),p++),r.push(l[f]),p+=l[f].length}return r.join("")}header(...t){for(let n=0;n0&&(w[O]=x)}return w}t=t.trim();const l=new RegExp("^(\\[((?:"+i(r)+")|.)*\\])((?:\\s*"+i(r)+"){2}|(?:\\s*"+i(r)+")*$)").exec(t),u=l&&l.length>=2?l[1]:"";this.reset();const a=o(u);let g="";for(const h in a)h.toLowerCase()==="fen"&&(g=a[h]),this.header(h,a[h]);if(!n)g&&this.load(g,{preserveHeaders:!0});else if(a.SetUp==="1"){if(!("FEN"in a))throw new Error("Invalid PGN: FEN tag must be supplied with SetUp tag");this.load(a.FEN,{preserveHeaders:!0})}function p(h){return Array.from(h).map(function(w){return w.charCodeAt(0)<128?w.charCodeAt(0).toString(16):encodeURIComponent(w).replace(/%/g,"").toLowerCase()}).join("")}function f(h){return h.length==0?"":decodeURIComponent("%"+(h.match(/.{1,2}/g)||[]).join("%"))}const S=function(h){return h=h.replace(new RegExp(i(r),"g")," "),`{${p(h.slice(1,h.length-1))}}`},m=function(h){if(h.startsWith("{")&&h.endsWith("}"))return f(h.slice(1,h.length-1))};let y=t.replace(u,"").replace(new RegExp(`({[^}]*})+?|;([^${i(r)}]*)`,"g"),function(h,w,k){return w!==void 0?S(w):" "+S(`{${k.slice(1)}}`)}).replace(new RegExp(i(r),"g")," ");const C=/(\([^()]+\))+?/g;for(;C.test(y);)y=y.replace(C,"");y=y.replace(/\d+\.(\.\.)?/g,""),y=y.replace(/\.\.\./g,""),y=y.replace(/\$\d+/g,"");let d=y.trim().split(new RegExp(/\s+/));d=d.filter(h=>h!=="");let c="";for(let h=0;h-1)c=d[h];else throw new Error(`Invalid move in PGN: ${d[h]}`);else c="",this._makeMove(k),this._positionCounts[this.fen()]++}c&&Object.keys(this._header).length&&!this._header.Result&&this.header("Result",c)}_moveToSan(t,n){let r="";if(t.flags&I.KSIDE_CASTLE)r="O-O";else if(t.flags&I.QSIDE_CASTLE)r="O-O-O";else{if(t.piece!==oe){const i=tg(t,n);r+=t.piece.toUpperCase()+i}t.flags&(I.CAPTURE|I.EP_CAPTURE)&&(t.piece===oe&&(r+=Pe(t.from)[0]),r+="x"),r+=Pe(t.to),t.promotion&&(r+="="+t.promotion.toUpperCase())}return this._makeMove(t),this.isCheck()&&(this.isCheckmate()?r+="#":r+="+"),this._undoMove(),r}_moveFromSan(t,n=!1){const r=fs(t);let i=Ra(r),o=this._moves({legal:!0,piece:i});for(let f=0,S=o.length;f0?r+=this.perft(t-1):r++),this._undoMove();return r}_makePretty(t){const{color:n,piece:r,from:i,to:o,flags:s,captured:l,promotion:u}=t;let a="";for(const S in I)I[S]&s&&(a+=W0[S]);const g=Pe(i),p=Pe(o),f={color:n,piece:r,from:g,to:p,san:this._moveToSan(t,this._moves({legal:!0})),flags:a,lan:g+p,before:this.fen(),after:""};return this._makeMove(t),f.after=this.fen(),this._undoMove(),l&&(f.captured=l),u&&(f.promotion=u,f.lan+=u),f}turn(){return this._turn}board(){const t=[];let n=[];for(let r=R.a8;r<=R.h1;r++)this._board[r]==null?n.push(null):n.push({square:Pe(r),type:this._board[r].type,color:this._board[r].color}),r+1&136&&(t.push(n),n=[],r+=8);return t}squareColor(t){if(t in R){const n=R[t];return(ln(n)+$r(n))%2===0?"light":"dark"}return null}history({verbose:t=!1}={}){const n=[],r=[];for(;this._history.length>0;)n.push(this._undoMove());for(;;){const i=n.pop();if(!i)break;t?r.push(this._makePretty(i)):r.push(this._moveToSan(i,this._moves())),this._makeMove(i)}return r}_pruneComments(){const t=[],n={},r=i=>{i in this._comments&&(n[i]=this._comments[i])};for(;this._history.length>0;)t.push(this._undoMove());for(r(this.fen());;){const i=t.pop();if(!i)break;this._makeMove(i),r(this.fen())}this._comments=n}getComment(){return this._comments[this.fen()]}setComment(t){this._comments[this.fen()]=t.replace("{","[").replace("}","]")}deleteComment(){const t=this._comments[this.fen()];return delete this._comments[this.fen()],t}getComments(){return this._pruneComments(),Object.keys(this._comments).map(t=>({fen:t,comment:this._comments[t]}))}deleteComments(){return this._pruneComments(),Object.keys(this._comments).map(t=>{const n=this._comments[t];return delete this._comments[t],{fen:t,comment:n}})}setCastlingRights(t,n){for(const i of[ne,Nt])n[i]!==void 0&&(n[i]?this._castling[t]|=vi[i]:this._castling[t]&=~vi[i]);this._updateCastlingRights();const r=this.getCastlingRights(t);return(n[ne]===void 0||n[ne]===r[ne])&&(n[Nt]===void 0||n[Nt]===r[Nt])}getCastlingRights(t){return{[ne]:(this._castling[t]&vi[ne])!==0,[Nt]:(this._castling[t]&vi[Nt])!==0}}moveNumber(){return this._moveNumber}}function rg(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i"u"&&(n=t,t=void 0),typeof n<"u"){if(typeof n!="function")throw new Error(Fe(1));return n(Of)(e,t)}if(typeof e!="function")throw new Error(Fe(2));var i=e,o=t,s=[],l=s,u=!1;function a(){l===s&&(l=s.slice())}function g(){if(u)throw new Error(Fe(3));return o}function p(y){if(typeof y!="function")throw new Error(Fe(4));if(u)throw new Error(Fe(5));var C=!0;return a(),l.push(y),function(){if(C){if(u)throw new Error(Fe(6));C=!1,a();var c=l.indexOf(y);l.splice(c,1),s=null}}}function f(y){if(!ig(y))throw new Error(Fe(7));if(typeof y.type>"u")throw new Error(Fe(8));if(u)throw new Error(Fe(9));try{u=!0,o=i(o,y)}finally{u=!1}for(var C=s=l,d=0;dr&&r[i]?r[i]:n||null,e)}function lg(e,t){return e.filter(n=>n!==t)}function Tf(e){return typeof e=="object"}function ug(e,t){const n=new Map,r=o=>{n.set(o,n.has(o)?n.get(o)+1:1)};e.forEach(r),t.forEach(r);const i=[];return n.forEach((o,s)=>{o===1&&i.push(s)}),i}function ag(e,t){return e.filter(n=>t.indexOf(n)>-1)}const gu="dnd-core/INIT_COORDS",ko="dnd-core/BEGIN_DRAG",mu="dnd-core/PUBLISH_DRAG_SOURCE",_o="dnd-core/HOVER",xo="dnd-core/DROP",Oo="dnd-core/END_DRAG";function za(e,t){return{type:gu,payload:{sourceClientOffset:t||null,clientOffset:e||null}}}const cg={type:gu,payload:{clientOffset:null,sourceClientOffset:null}};function dg(e){return function(n=[],r={publishSource:!0}){const{publishSource:i=!0,clientOffset:o,getSourceClientOffset:s}=r,l=e.getMonitor(),u=e.getRegistry();e.dispatch(za(o)),fg(n,l,u);const a=gg(n,l);if(a==null){e.dispatch(cg);return}let g=null;if(o){if(!s)throw new Error("getSourceClientOffset must be defined");hg(s),g=s(a)}e.dispatch(za(o,g));const f=u.getSource(a).beginDrag(l,a);if(f==null)return;pg(f),u.pinSource(a);const S=u.getSourceType(a);return{type:ko,payload:{itemType:S,item:f,sourceId:a,clientOffset:o||null,sourceClientOffset:g||null,isSourcePublic:!!i}}}}function fg(e,t,n){N(!t.isDragging(),"Cannot call beginDrag while dragging."),e.forEach(function(r){N(n.getSource(r),"Expected sourceIds to be registered.")})}function hg(e){N(typeof e=="function","When clientOffset is provided, getSourceClientOffset must be a function.")}function pg(e){N(Tf(e),"Item must be an object.")}function gg(e,t){let n=null;for(let r=e.length-1;r>=0;r--)if(t.canDragSource(e[r])){n=e[r];break}return n}function mg(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vg(e){for(var t=1;t{const u=wg(s,l,i,r),a={type:xo,payload:{dropResult:vg({},n,u)}};e.dispatch(a)})}}function Sg(e){N(e.isDragging(),"Cannot call drop while not dragging."),N(!e.didDrop(),"Cannot call drop twice during one drag operation.")}function wg(e,t,n,r){const i=n.getTarget(e);let o=i?i.drop(r,e):void 0;return Cg(o),typeof o>"u"&&(o=t===0?{}:r.getDropResult()),o}function Cg(e){N(typeof e>"u"||Tf(e),"Drop result must either be an object or undefined.")}function Eg(e){const t=e.getTargetIds().filter(e.canDropOnTarget,e);return t.reverse(),t}function kg(e){return function(){const n=e.getMonitor(),r=e.getRegistry();_g(n);const i=n.getSourceId();return i!=null&&(r.getSource(i,!0).endDrag(n,i),r.unpinSource()),{type:Oo}}}function _g(e){N(e.isDragging(),"Cannot call endDrag while not dragging.")}function gl(e,t){return t===null?e===null:Array.isArray(e)?e.some(n=>n===t):e===t}function xg(e){return function(n,{clientOffset:r}={}){Og(n);const i=n.slice(0),o=e.getMonitor(),s=e.getRegistry(),l=o.getItemType();return Dg(i,s,l),Tg(i,o,s),Pg(i,o,s),{type:_o,payload:{targetIds:i,clientOffset:r||null}}}}function Og(e){N(Array.isArray(e),"Expected targetIds to be an array.")}function Tg(e,t,n){N(t.isDragging(),"Cannot call hover while not dragging."),N(!t.didDrop(),"Cannot call hover after drop.");for(let r=0;r=0;r--){const i=e[r],o=t.getTargetType(i);gl(o,n)||e.splice(r,1)}}function Pg(e,t,n){e.forEach(function(r){n.getTarget(r).hover(t,r)})}function Lg(e){return function(){if(e.getMonitor().isDragging())return{type:mu}}}function Ig(e){return{beginDrag:dg(e),publishDragSource:Lg(e),hover:xg(e),drop:yg(e),endDrag:kg(e)}}class Ng{receiveBackend(t){this.backend=t}getMonitor(){return this.monitor}getBackend(){return this.backend}getRegistry(){return this.monitor.registry}getActions(){const t=this,{dispatch:n}=this.store;function r(o){return(...s)=>{const l=o.apply(t,s);typeof l<"u"&&n(l)}}const i=Ig(this);return Object.keys(i).reduce((o,s)=>{const l=i[s];return o[s]=r(l),o},{})}dispatch(t){this.store.dispatch(t)}constructor(t,n){this.isSetUp=!1,this.handleRefCountChange=()=>{const r=this.store.getState().refCount>0;this.backend&&(r&&!this.isSetUp?(this.backend.setup(),this.isSetUp=!0):!r&&this.isSetUp&&(this.backend.teardown(),this.isSetUp=!1))},this.store=t,this.monitor=n,t.subscribe(this.handleRefCountChange)}}function jg(e,t){return{x:e.x+t.x,y:e.y+t.y}}function Df(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Rg(e){const{clientOffset:t,initialClientOffset:n,initialSourceClientOffset:r}=e;return!t||!n||!r?null:Df(jg(t,r),n)}function Mg(e){const{clientOffset:t,initialClientOffset:n}=e;return!t||!n?null:Df(t,n)}const Cr=[],vu=[];Cr.__IS_NONE__=!0;vu.__IS_ALL__=!0;function Ag(e,t){return e===Cr?!1:e===vu||typeof t>"u"?!0:ag(t,e).length>0}class bg{subscribeToStateChange(t,n={}){const{handlerIds:r}=n;N(typeof t=="function","listener must be a function."),N(typeof r>"u"||Array.isArray(r),"handlerIds, when specified, must be an array of strings.");let i=this.store.getState().stateId;const o=()=>{const s=this.store.getState(),l=s.stateId;try{l===i||l===i+1&&!Ag(s.dirtyHandlerIds,r)||t()}finally{i=l}};return this.store.subscribe(o)}subscribeToOffsetChange(t){N(typeof t=="function","listener must be a function.");let n=this.store.getState().dragOffset;const r=()=>{const i=this.store.getState().dragOffset;i!==n&&(n=i,t())};return this.store.subscribe(r)}canDragSource(t){if(!t)return!1;const n=this.registry.getSource(t);return N(n,`Expected to find a valid source. sourceId=${t}`),this.isDragging()?!1:n.canDrag(this,t)}canDropOnTarget(t){if(!t)return!1;const n=this.registry.getTarget(t);if(N(n,`Expected to find a valid target. targetId=${t}`),!this.isDragging()||this.didDrop())return!1;const r=this.registry.getTargetType(t),i=this.getItemType();return gl(r,i)&&n.canDrop(this,t)}isDragging(){return!!this.getItemType()}isDraggingSource(t){if(!t)return!1;const n=this.registry.getSource(t,!0);if(N(n,`Expected to find a valid source. sourceId=${t}`),!this.isDragging()||!this.isSourcePublic())return!1;const r=this.registry.getSourceType(t),i=this.getItemType();return r!==i?!1:n.isDragging(this,t)}isOverTarget(t,n={shallow:!1}){if(!t)return!1;const{shallow:r}=n;if(!this.isDragging())return!1;const i=this.registry.getTargetType(t),o=this.getItemType();if(o&&!gl(i,o))return!1;const s=this.getTargetIds();if(!s.length)return!1;const l=s.indexOf(t);return r?l===s.length-1:l>-1}getItemType(){return this.store.getState().dragOperation.itemType}getItem(){return this.store.getState().dragOperation.item}getSourceId(){return this.store.getState().dragOperation.sourceId}getTargetIds(){return this.store.getState().dragOperation.targetIds}getDropResult(){return this.store.getState().dragOperation.dropResult}didDrop(){return this.store.getState().dragOperation.didDrop}isSourcePublic(){return!!this.store.getState().dragOperation.isSourcePublic}getInitialClientOffset(){return this.store.getState().dragOffset.initialClientOffset}getInitialSourceClientOffset(){return this.store.getState().dragOffset.initialSourceClientOffset}getClientOffset(){return this.store.getState().dragOffset.clientOffset}getSourceClientOffset(){return Rg(this.store.getState().dragOffset)}getDifferenceFromInitialOffset(){return Mg(this.store.getState().dragOffset)}constructor(t,n){this.store=t,this.registry=n}}const Fa=typeof global<"u"?global:self,Pf=Fa.MutationObserver||Fa.WebKitMutationObserver;function Lf(e){return function(){const n=setTimeout(i,0),r=setInterval(i,50);function i(){clearTimeout(n),clearInterval(r),e()}}}function zg(e){let t=1;const n=new Pf(e),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){t=-t,r.data=t}}const Fg=typeof Pf=="function"?zg:Lf;class $g{enqueueTask(t){const{queue:n,requestFlush:r}=this;n.length||(r(),this.flushing=!0),n[n.length]=t}constructor(){this.queue=[],this.pendingErrors=[],this.flushing=!1,this.index=0,this.capacity=1024,this.flush=()=>{const{queue:t}=this;for(;this.indexthis.capacity){for(let r=0,i=t.length-this.index;r{this.pendingErrors.push(t),this.requestErrorThrow()},this.requestFlush=Fg(this.flush),this.requestErrorThrow=Lf(()=>{if(this.pendingErrors.length)throw this.pendingErrors.shift()})}}class Ug{call(){try{this.task&&this.task()}catch(t){this.onError(t)}finally{this.task=null,this.release(this)}}constructor(t,n){this.onError=t,this.release=n,this.task=null}}class Hg{create(t){const n=this.freeTasks,r=n.length?n.pop():new Ug(this.onError,i=>n[n.length]=i);return r.task=t,r}constructor(t){this.onError=t,this.freeTasks=[]}}const If=new $g,Wg=new Hg(If.registerPendingError);function Bg(e){If.enqueueTask(Wg.create(e))}const yu="dnd-core/ADD_SOURCE",Su="dnd-core/ADD_TARGET",wu="dnd-core/REMOVE_SOURCE",To="dnd-core/REMOVE_TARGET";function Vg(e){return{type:yu,payload:{sourceId:e}}}function Qg(e){return{type:Su,payload:{targetId:e}}}function Kg(e){return{type:wu,payload:{sourceId:e}}}function qg(e){return{type:To,payload:{targetId:e}}}function Gg(e){N(typeof e.canDrag=="function","Expected canDrag to be a function."),N(typeof e.beginDrag=="function","Expected beginDrag to be a function."),N(typeof e.endDrag=="function","Expected endDrag to be a function.")}function Yg(e){N(typeof e.canDrop=="function","Expected canDrop to be a function."),N(typeof e.hover=="function","Expected hover to be a function."),N(typeof e.drop=="function","Expected beginDrag to be a function.")}function ml(e,t){if(t&&Array.isArray(e)){e.forEach(n=>ml(n,!1));return}N(typeof e=="string"||typeof e=="symbol",t?"Type can only be a string, a symbol, or an array of either.":"Type can only be a string or a symbol.")}var We;(function(e){e.SOURCE="SOURCE",e.TARGET="TARGET"})(We||(We={}));let Xg=0;function Zg(){return Xg++}function Jg(e){const t=Zg().toString();switch(e){case We.SOURCE:return`S${t}`;case We.TARGET:return`T${t}`;default:throw new Error(`Unknown Handler Role: ${e}`)}}function $a(e){switch(e[0]){case"S":return We.SOURCE;case"T":return We.TARGET;default:throw new Error(`Cannot parse handler ID: ${e}`)}}function Ua(e,t){const n=e.entries();let r=!1;do{const{done:i,value:[,o]}=n.next();if(o===t)return!0;r=!!i}while(!r);return!1}class e1{addSource(t,n){ml(t),Gg(n);const r=this.addHandler(We.SOURCE,t,n);return this.store.dispatch(Vg(r)),r}addTarget(t,n){ml(t,!0),Yg(n);const r=this.addHandler(We.TARGET,t,n);return this.store.dispatch(Qg(r)),r}containsHandler(t){return Ua(this.dragSources,t)||Ua(this.dropTargets,t)}getSource(t,n=!1){return N(this.isSourceId(t),"Expected a valid source ID."),n&&t===this.pinnedSourceId?this.pinnedSource:this.dragSources.get(t)}getTarget(t){return N(this.isTargetId(t),"Expected a valid target ID."),this.dropTargets.get(t)}getSourceType(t){return N(this.isSourceId(t),"Expected a valid source ID."),this.types.get(t)}getTargetType(t){return N(this.isTargetId(t),"Expected a valid target ID."),this.types.get(t)}isSourceId(t){return $a(t)===We.SOURCE}isTargetId(t){return $a(t)===We.TARGET}removeSource(t){N(this.getSource(t),"Expected an existing source."),this.store.dispatch(Kg(t)),Bg(()=>{this.dragSources.delete(t),this.types.delete(t)})}removeTarget(t){N(this.getTarget(t),"Expected an existing target."),this.store.dispatch(qg(t)),this.dropTargets.delete(t),this.types.delete(t)}pinSource(t){const n=this.getSource(t);N(n,"Expected an existing source."),this.pinnedSourceId=t,this.pinnedSource=n}unpinSource(){N(this.pinnedSource,"No source is pinned at the time."),this.pinnedSourceId=null,this.pinnedSource=null}addHandler(t,n,r){const i=Jg(t);return this.types.set(i,n),t===We.SOURCE?this.dragSources.set(i,r):t===We.TARGET&&this.dropTargets.set(i,r),i}constructor(t){this.types=new Map,this.dragSources=new Map,this.dropTargets=new Map,this.pinnedSourceId=null,this.pinnedSource=null,this.store=t}}const t1=(e,t)=>e===t;function n1(e,t){return!e&&!t?!0:!e||!t?!1:e.x===t.x&&e.y===t.y}function r1(e,t,n=t1){if(e.length!==t.length)return!1;for(let r=0;r0||!r1(n,r)))return Cr;const s=r[r.length-1],l=n[n.length-1];return s!==l&&(s&&i.push(s),l&&i.push(l)),i}function o1(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s1(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function S1(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o=0)&&(n[i]=e[i]);return n}let Wa=0;const ji=Symbol.for("__REACT_DND_CONTEXT_INSTANCE__");var w1=E.memo(function(t){var{children:n}=t,r=y1(t,["children"]);const[i,o]=C1(r);return E.useEffect(()=>{if(o){const s=Nf();return++Wa,()=>{--Wa===0&&(s[ji]=null)}}},[]),v.jsx(xf.Provider,{value:i,children:n})});function C1(e){if("manager"in e)return[{dragDropManager:e.manager},!1];const t=E1(e.backend,e.context,e.options,e.debugMode),n=!e.context;return[t,n]}function E1(e,t=Nf(),n,r){const i=t;return i[ji]||(i[ji]={dragDropManager:m1(e,t,n,r)}),i[ji]}function Nf(){return typeof global<"u"?global:window}var k1=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,i,o;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(o=Object.keys(t),r=o.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;i--!==0;){var s=o[i];if(!e(t[s],n[s]))return!1}return!0}return t!==t&&n!==n};const hn=typeof window<"u"?E.useLayoutEffect:E.useEffect;function jf(e,t,n){const[r,i]=E.useState(()=>t(e)),o=E.useCallback(()=>{const s=t(e);k1(r,s)||(i(s),n&&n())},[r,e,n]);return hn(o),[r,o]}function _1(e,t,n){const[r,i]=jf(e,t,n);return hn(function(){const s=e.getHandlerId();if(s!=null)return e.subscribeToStateChange(i,{handlerIds:[s]})},[e,i]),r}function Rf(e,t,n){return _1(t,e||(()=>({})),()=>n.reconnect())}function Mf(e,t){const n=[...t||[]];return t==null&&typeof e!="function"&&n.push(e),E.useMemo(()=>typeof e=="function"?e():e,n)}function x1(e){return E.useMemo(()=>e.hooks.dragSource(),[e])}function O1(e){return E.useMemo(()=>e.hooks.dragPreview(),[e])}let ps=!1,gs=!1;class T1{receiveHandlerId(t){this.sourceId=t}getHandlerId(){return this.sourceId}canDrag(){N(!ps,"You may not call monitor.canDrag() inside your canDrag() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return ps=!0,this.internalMonitor.canDragSource(this.sourceId)}finally{ps=!1}}isDragging(){if(!this.sourceId)return!1;N(!gs,"You may not call monitor.isDragging() inside your isDragging() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drag-source-monitor");try{return gs=!0,this.internalMonitor.isDraggingSource(this.sourceId)}finally{gs=!1}}subscribeToStateChange(t,n){return this.internalMonitor.subscribeToStateChange(t,n)}isDraggingSource(t){return this.internalMonitor.isDraggingSource(t)}isOverTarget(t,n){return this.internalMonitor.isOverTarget(t,n)}getTargetIds(){return this.internalMonitor.getTargetIds()}isSourcePublic(){return this.internalMonitor.isSourcePublic()}getSourceId(){return this.internalMonitor.getSourceId()}subscribeToOffsetChange(t){return this.internalMonitor.subscribeToOffsetChange(t)}canDragSource(t){return this.internalMonitor.canDragSource(t)}canDropOnTarget(t){return this.internalMonitor.canDropOnTarget(t)}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.sourceId=null,this.internalMonitor=t.getMonitor()}}let ms=!1;class D1{receiveHandlerId(t){this.targetId=t}getHandlerId(){return this.targetId}subscribeToStateChange(t,n){return this.internalMonitor.subscribeToStateChange(t,n)}canDrop(){if(!this.targetId)return!1;N(!ms,"You may not call monitor.canDrop() inside your canDrop() implementation. Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor");try{return ms=!0,this.internalMonitor.canDropOnTarget(this.targetId)}finally{ms=!1}}isOver(t){return this.targetId?this.internalMonitor.isOverTarget(this.targetId,t):!1}getItemType(){return this.internalMonitor.getItemType()}getItem(){return this.internalMonitor.getItem()}getDropResult(){return this.internalMonitor.getDropResult()}didDrop(){return this.internalMonitor.didDrop()}getInitialClientOffset(){return this.internalMonitor.getInitialClientOffset()}getInitialSourceClientOffset(){return this.internalMonitor.getInitialSourceClientOffset()}getSourceClientOffset(){return this.internalMonitor.getSourceClientOffset()}getClientOffset(){return this.internalMonitor.getClientOffset()}getDifferenceFromInitialOffset(){return this.internalMonitor.getDifferenceFromInitialOffset()}constructor(t){this.targetId=null,this.internalMonitor=t.getMonitor()}}function P1(e,t,n){const r=n.getRegistry(),i=r.addTarget(e,t);return[i,()=>r.removeTarget(i)]}function L1(e,t,n){const r=n.getRegistry(),i=r.addSource(e,t);return[i,()=>r.removeSource(i)]}function vl(e,t,n,r){let i=n?n.call(r,e,t):void 0;if(i!==void 0)return!!i;if(e===t)return!0;if(typeof e!="object"||!e||typeof t!="object"||!t)return!1;const o=Object.keys(e),s=Object.keys(t);if(o.length!==s.length)return!1;const l=Object.prototype.hasOwnProperty.bind(t);for(let u=0;u, or turn it into a drag source or a drop target itself.`)}function N1(e){return(t=null,n=null)=>{if(!E.isValidElement(t)){const o=t;return e(o,n),o}const r=t;return I1(r),j1(r,n?o=>e(o,n):e)}}function Af(e){const t={};return Object.keys(e).forEach(n=>{const r=e[n];if(n.endsWith("Ref"))t[n]=e[n];else{const i=N1(r);t[n]=()=>i}}),t}function Ba(e,t){typeof e=="function"?e(t):e.current=t}function j1(e,t){const n=e.ref;return N(typeof n!="string","Cannot connect React DnD to an element with an existing string ref. Please convert it to use a callback ref instead, or wrap it into a or
. Read more: https://reactjs.org/docs/refs-and-the-dom.html#callback-refs"),n?E.cloneElement(e,{ref:r=>{Ba(n,r),Ba(t,r)}}):E.cloneElement(e,{ref:t})}class R1{receiveHandlerId(t){this.handlerId!==t&&(this.handlerId=t,this.reconnect())}get connectTarget(){return this.dragSource}get dragSourceOptions(){return this.dragSourceOptionsInternal}set dragSourceOptions(t){this.dragSourceOptionsInternal=t}get dragPreviewOptions(){return this.dragPreviewOptionsInternal}set dragPreviewOptions(t){this.dragPreviewOptionsInternal=t}reconnect(){const t=this.reconnectDragSource();this.reconnectDragPreview(t)}reconnectDragSource(){const t=this.dragSource,n=this.didHandlerIdChange()||this.didConnectedDragSourceChange()||this.didDragSourceOptionsChange();return n&&this.disconnectDragSource(),this.handlerId?t?(n&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragSource=t,this.lastConnectedDragSourceOptions=this.dragSourceOptions,this.dragSourceUnsubscribe=this.backend.connectDragSource(this.handlerId,t,this.dragSourceOptions)),n):(this.lastConnectedDragSource=t,n):n}reconnectDragPreview(t=!1){const n=this.dragPreview,r=t||this.didHandlerIdChange()||this.didConnectedDragPreviewChange()||this.didDragPreviewOptionsChange();if(r&&this.disconnectDragPreview(),!!this.handlerId){if(!n){this.lastConnectedDragPreview=n;return}r&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDragPreview=n,this.lastConnectedDragPreviewOptions=this.dragPreviewOptions,this.dragPreviewUnsubscribe=this.backend.connectDragPreview(this.handlerId,n,this.dragPreviewOptions))}}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didConnectedDragSourceChange(){return this.lastConnectedDragSource!==this.dragSource}didConnectedDragPreviewChange(){return this.lastConnectedDragPreview!==this.dragPreview}didDragSourceOptionsChange(){return!vl(this.lastConnectedDragSourceOptions,this.dragSourceOptions)}didDragPreviewOptionsChange(){return!vl(this.lastConnectedDragPreviewOptions,this.dragPreviewOptions)}disconnectDragSource(){this.dragSourceUnsubscribe&&(this.dragSourceUnsubscribe(),this.dragSourceUnsubscribe=void 0)}disconnectDragPreview(){this.dragPreviewUnsubscribe&&(this.dragPreviewUnsubscribe(),this.dragPreviewUnsubscribe=void 0,this.dragPreviewNode=null,this.dragPreviewRef=null)}get dragSource(){return this.dragSourceNode||this.dragSourceRef&&this.dragSourceRef.current}get dragPreview(){return this.dragPreviewNode||this.dragPreviewRef&&this.dragPreviewRef.current}clearDragSource(){this.dragSourceNode=null,this.dragSourceRef=null}clearDragPreview(){this.dragPreviewNode=null,this.dragPreviewRef=null}constructor(t){this.hooks=Af({dragSource:(n,r)=>{this.clearDragSource(),this.dragSourceOptions=r||null,yl(n)?this.dragSourceRef=n:this.dragSourceNode=n,this.reconnectDragSource()},dragPreview:(n,r)=>{this.clearDragPreview(),this.dragPreviewOptions=r||null,yl(n)?this.dragPreviewRef=n:this.dragPreviewNode=n,this.reconnectDragPreview()}}),this.handlerId=null,this.dragSourceRef=null,this.dragSourceOptionsInternal=null,this.dragPreviewRef=null,this.dragPreviewOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDragSource=null,this.lastConnectedDragSourceOptions=null,this.lastConnectedDragPreview=null,this.lastConnectedDragPreviewOptions=null,this.backend=t}}class M1{get connectTarget(){return this.dropTarget}reconnect(){const t=this.didHandlerIdChange()||this.didDropTargetChange()||this.didOptionsChange();t&&this.disconnectDropTarget();const n=this.dropTarget;if(this.handlerId){if(!n){this.lastConnectedDropTarget=n;return}t&&(this.lastConnectedHandlerId=this.handlerId,this.lastConnectedDropTarget=n,this.lastConnectedDropTargetOptions=this.dropTargetOptions,this.unsubscribeDropTarget=this.backend.connectDropTarget(this.handlerId,n,this.dropTargetOptions))}}receiveHandlerId(t){t!==this.handlerId&&(this.handlerId=t,this.reconnect())}get dropTargetOptions(){return this.dropTargetOptionsInternal}set dropTargetOptions(t){this.dropTargetOptionsInternal=t}didHandlerIdChange(){return this.lastConnectedHandlerId!==this.handlerId}didDropTargetChange(){return this.lastConnectedDropTarget!==this.dropTarget}didOptionsChange(){return!vl(this.lastConnectedDropTargetOptions,this.dropTargetOptions)}disconnectDropTarget(){this.unsubscribeDropTarget&&(this.unsubscribeDropTarget(),this.unsubscribeDropTarget=void 0)}get dropTarget(){return this.dropTargetNode||this.dropTargetRef&&this.dropTargetRef.current}clearDropTarget(){this.dropTargetRef=null,this.dropTargetNode=null}constructor(t){this.hooks=Af({dropTarget:(n,r)=>{this.clearDropTarget(),this.dropTargetOptions=r,yl(n)?this.dropTargetRef=n:this.dropTargetNode=n,this.reconnect()}}),this.handlerId=null,this.dropTargetRef=null,this.dropTargetOptionsInternal=null,this.lastConnectedHandlerId=null,this.lastConnectedDropTarget=null,this.lastConnectedDropTargetOptions=null,this.backend=t}}function mn(){const{dragDropManager:e}=E.useContext(xf);return N(e!=null,"Expected drag drop context"),e}function A1(e,t){const n=mn(),r=E.useMemo(()=>new R1(n.getBackend()),[n]);return hn(()=>(r.dragSourceOptions=e||null,r.reconnect(),()=>r.disconnectDragSource()),[r,e]),hn(()=>(r.dragPreviewOptions=t||null,r.reconnect(),()=>r.disconnectDragPreview()),[r,t]),r}function b1(){const e=mn();return E.useMemo(()=>new T1(e),[e])}class z1{beginDrag(){const t=this.spec,n=this.monitor;let r=null;return typeof t.item=="object"?r=t.item:typeof t.item=="function"?r=t.item(n):r={},r??null}canDrag(){const t=this.spec,n=this.monitor;return typeof t.canDrag=="boolean"?t.canDrag:typeof t.canDrag=="function"?t.canDrag(n):!0}isDragging(t,n){const r=this.spec,i=this.monitor,{isDragging:o}=r;return o?o(i):n===t.getSourceId()}endDrag(){const t=this.spec,n=this.monitor,r=this.connector,{end:i}=t;i&&i(n.getItem(),n),r.reconnect()}constructor(t,n,r){this.spec=t,this.monitor=n,this.connector=r}}function F1(e,t,n){const r=E.useMemo(()=>new z1(e,t,n),[t,n]);return E.useEffect(()=>{r.spec=e},[e]),r}function $1(e){return E.useMemo(()=>{const t=e.type;return N(t!=null,"spec.type must be defined"),t},[e])}function U1(e,t,n){const r=mn(),i=F1(e,t,n),o=$1(e);hn(function(){if(o!=null){const[l,u]=L1(o,i,r);return t.receiveHandlerId(l),n.receiveHandlerId(l),u}},[r,t,n,i,o])}function H1(e,t){const n=Mf(e,t);N(!n.begin,"useDrag::spec.begin was deprecated in v14. Replace spec.begin() with spec.item(). (see more here - https://react-dnd.github.io/react-dnd/docs/api/use-drag)");const r=b1(),i=A1(n.options,n.previewOptions);return U1(n,r,i),[Rf(n.collect,r,i),x1(i),O1(i)]}function W1(e){const n=mn().getMonitor(),[r,i]=jf(n,e);return E.useEffect(()=>n.subscribeToOffsetChange(i)),E.useEffect(()=>n.subscribeToStateChange(i)),r}function B1(e){return E.useMemo(()=>e.hooks.dropTarget(),[e])}function V1(e){const t=mn(),n=E.useMemo(()=>new M1(t.getBackend()),[t]);return hn(()=>(n.dropTargetOptions=e||null,n.reconnect(),()=>n.disconnectDropTarget()),[e]),n}function Q1(){const e=mn();return E.useMemo(()=>new D1(e),[e])}function K1(e){const{accept:t}=e;return E.useMemo(()=>(N(e.accept!=null,"accept must be defined"),Array.isArray(t)?t:[t]),[t])}class q1{canDrop(){const t=this.spec,n=this.monitor;return t.canDrop?t.canDrop(n.getItem(),n):!0}hover(){const t=this.spec,n=this.monitor;t.hover&&t.hover(n.getItem(),n)}drop(){const t=this.spec,n=this.monitor;if(t.drop)return t.drop(n.getItem(),n)}constructor(t,n){this.spec=t,this.monitor=n}}function G1(e,t){const n=E.useMemo(()=>new q1(e,t),[t]);return E.useEffect(()=>{n.spec=e},[e]),n}function Y1(e,t,n){const r=mn(),i=G1(e,t),o=K1(e);hn(function(){const[l,u]=P1(o,i,r);return t.receiveHandlerId(l),n.receiveHandlerId(l),u},[r,t,i,n,o.map(s=>s.toString()).join("|")])}function X1(e,t){const n=Mf(e,t),r=Q1(),i=V1(n.options);return Y1(n,r,i),[Rf(n.collect,r,i),B1(i)]}function bf(e){let t=null;return()=>(t==null&&(t=e()),t)}function Z1(e,t){return e.filter(n=>n!==t)}function J1(e,t){const n=new Set,r=o=>n.add(o);e.forEach(r),t.forEach(r);const i=[];return n.forEach(o=>i.push(o)),i}class em{enter(t){const n=this.entered.length,r=i=>this.isNodeInDocument(i)&&(!i.contains||i.contains(t));return this.entered=J1(this.entered.filter(r),[t]),n===0&&this.entered.length>0}leave(t){const n=this.entered.length;return this.entered=Z1(this.entered.filter(this.isNodeInDocument),t),n>0&&this.entered.length===0}reset(){this.entered=[]}constructor(t){this.entered=[],this.isNodeInDocument=t}}class tm{initializeExposedProperties(){Object.keys(this.config.exposeProperties).forEach(t=>{Object.defineProperty(this.item,t,{configurable:!0,enumerable:!0,get(){return console.warn(`Browser doesn't allow reading "${t}" until the drop event.`),null}})})}loadDataTransfer(t){if(t){const n={};Object.keys(this.config.exposeProperties).forEach(r=>{const i=this.config.exposeProperties[r];i!=null&&(n[r]={value:i(t,this.config.matchesTypes),configurable:!0,enumerable:!0})}),Object.defineProperties(this.item,n)}}canDrag(){return!0}beginDrag(){return this.item}isDragging(t,n){return n===t.getSourceId()}endDrag(){}constructor(t){this.config=t,this.item={},this.initializeExposedProperties()}}const zf="__NATIVE_FILE__",Ff="__NATIVE_URL__",$f="__NATIVE_TEXT__",Uf="__NATIVE_HTML__";var Va=Object.freeze({__proto__:null,FILE:zf,HTML:Uf,TEXT:$f,URL:Ff});function vs(e,t,n){const r=t.reduce((i,o)=>i||e.getData(o),"");return r??n}const Sl={[zf]:{exposeProperties:{files:e=>Array.prototype.slice.call(e.files),items:e=>e.items,dataTransfer:e=>e},matchesTypes:["Files"]},[Uf]:{exposeProperties:{html:(e,t)=>vs(e,t,""),dataTransfer:e=>e},matchesTypes:["Html","text/html"]},[Ff]:{exposeProperties:{urls:(e,t)=>vs(e,t,"").split(` +`),dataTransfer:e=>e},matchesTypes:["Url","text/uri-list"]},[$f]:{exposeProperties:{text:(e,t)=>vs(e,t,""),dataTransfer:e=>e},matchesTypes:["Text","text/plain"]}};function nm(e,t){const n=Sl[e];if(!n)throw new Error(`native type ${e} has no configuration`);const r=new tm(n);return r.loadDataTransfer(t),r}function ys(e){if(!e)return null;const t=Array.prototype.slice.call(e.types||[]);return Object.keys(Sl).filter(n=>{const r=Sl[n];return r!=null&&r.matchesTypes?r.matchesTypes.some(i=>t.indexOf(i)>-1):!1})[0]||null}const rm=bf(()=>/firefox/i.test(navigator.userAgent)),Hf=bf(()=>!!window.safari);class Qa{interpolate(t){const{xs:n,ys:r,c1s:i,c2s:o,c3s:s}=this;let l=n.length-1;if(t===n[l])return r[l];let u=0,a=s.length-1,g;for(;u<=a;){g=Math.floor(.5*(u+a));const S=n[g];if(St)a=g-1;else return r[g]}l=Math.max(0,a);const p=t-n[l],f=p*p;return r[l]+i[l]*p+o[l]*f+s[l]*p*f}constructor(t,n){const{length:r}=t,i=[];for(let S=0;St[S]{let O=new Qa([0,.5,1],[u.y,u.y/g*m,u.y+m-g]).interpolate(f);return Hf()&&o&&(O+=(window.devicePixelRatio-1)*m),O},C=()=>new Qa([0,.5,1],[u.x,u.x/a*S,u.x+S-a]).interpolate(p),{offsetX:d,offsetY:c}=i,h=d===0||d,w=c===0||c;return{x:h?d:C(),y:w?c:y()}}let um=class{get window(){if(this.globalContext)return this.globalContext;if(typeof window<"u")return window}get document(){var t;return!((t=this.globalContext)===null||t===void 0)&&t.document?this.globalContext.document:this.window?this.window.document:void 0}get rootElement(){var t;return((t=this.optionsArgs)===null||t===void 0?void 0:t.rootElement)||this.window}constructor(t,n){this.ownerDocument=null,this.globalContext=t,this.optionsArgs=n}};function am(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ka(e){for(var t=1;t{this.sourcePreviewNodes.delete(t),this.sourcePreviewNodeOptions.delete(t)}}connectDragSource(t,n,r){this.sourceNodes.set(t,n),this.sourceNodeOptions.set(t,r);const i=s=>this.handleDragStart(s,t),o=s=>this.handleSelectStart(s);return n.setAttribute("draggable","true"),n.addEventListener("dragstart",i),n.addEventListener("selectstart",o),()=>{this.sourceNodes.delete(t),this.sourceNodeOptions.delete(t),n.removeEventListener("dragstart",i),n.removeEventListener("selectstart",o),n.setAttribute("draggable","false")}}connectDropTarget(t,n){const r=s=>this.handleDragEnter(s,t),i=s=>this.handleDragOver(s,t),o=s=>this.handleDrop(s,t);return n.addEventListener("dragenter",r),n.addEventListener("dragover",i),n.addEventListener("drop",o),()=>{n.removeEventListener("dragenter",r),n.removeEventListener("dragover",i),n.removeEventListener("drop",o)}}addEventListeners(t){t.addEventListener&&(t.addEventListener("dragstart",this.handleTopDragStart),t.addEventListener("dragstart",this.handleTopDragStartCapture,!0),t.addEventListener("dragend",this.handleTopDragEndCapture,!0),t.addEventListener("dragenter",this.handleTopDragEnter),t.addEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.addEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.addEventListener("dragover",this.handleTopDragOver),t.addEventListener("dragover",this.handleTopDragOverCapture,!0),t.addEventListener("drop",this.handleTopDrop),t.addEventListener("drop",this.handleTopDropCapture,!0))}removeEventListeners(t){t.removeEventListener&&(t.removeEventListener("dragstart",this.handleTopDragStart),t.removeEventListener("dragstart",this.handleTopDragStartCapture,!0),t.removeEventListener("dragend",this.handleTopDragEndCapture,!0),t.removeEventListener("dragenter",this.handleTopDragEnter),t.removeEventListener("dragenter",this.handleTopDragEnterCapture,!0),t.removeEventListener("dragleave",this.handleTopDragLeaveCapture,!0),t.removeEventListener("dragover",this.handleTopDragOver),t.removeEventListener("dragover",this.handleTopDragOverCapture,!0),t.removeEventListener("drop",this.handleTopDrop),t.removeEventListener("drop",this.handleTopDropCapture,!0))}getCurrentSourceNodeOptions(){const t=this.monitor.getSourceId(),n=this.sourceNodeOptions.get(t);return Ka({dropEffect:this.altKeyPressed?"copy":"move"},n||{})}getCurrentDropEffect(){return this.isDraggingNativeItem()?"copy":this.getCurrentSourceNodeOptions().dropEffect}getCurrentSourcePreviewNodeOptions(){const t=this.monitor.getSourceId(),n=this.sourcePreviewNodeOptions.get(t);return Ka({anchorX:.5,anchorY:.5,captureDraggingState:!1},n||{})}isDraggingNativeItem(){const t=this.monitor.getItemType();return Object.keys(Va).some(n=>Va[n]===t)}beginDragNativeItem(t,n){this.clearCurrentDragSourceNode(),this.currentNativeSource=nm(t,n),this.currentNativeHandle=this.registry.addSource(t,this.currentNativeSource),this.actions.beginDrag([this.currentNativeHandle])}setCurrentDragSourceNode(t){this.clearCurrentDragSourceNode(),this.currentDragSourceNode=t;const n=1e3;this.mouseMoveTimeoutTimer=setTimeout(()=>{var r;return(r=this.rootElement)===null||r===void 0?void 0:r.addEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)},n)}clearCurrentDragSourceNode(){if(this.currentDragSourceNode){if(this.currentDragSourceNode=null,this.rootElement){var t;(t=this.window)===null||t===void 0||t.clearTimeout(this.mouseMoveTimeoutTimer||void 0),this.rootElement.removeEventListener("mousemove",this.endDragIfSourceWasRemovedFromDOM,!0)}return this.mouseMoveTimeoutTimer=null,!0}return!1}handleDragStart(t,n){t.defaultPrevented||(this.dragStartSourceIds||(this.dragStartSourceIds=[]),this.dragStartSourceIds.unshift(n))}handleDragEnter(t,n){this.dragEnterTargetIds.unshift(n)}handleDragOver(t,n){this.dragOverTargetIds===null&&(this.dragOverTargetIds=[]),this.dragOverTargetIds.unshift(n)}handleDrop(t,n){this.dropTargetIds.unshift(n)}constructor(t,n,r){this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.sourceNodes=new Map,this.sourceNodeOptions=new Map,this.dragStartSourceIds=null,this.dropTargetIds=[],this.dragEnterTargetIds=[],this.currentNativeSource=null,this.currentNativeHandle=null,this.currentDragSourceNode=null,this.altKeyPressed=!1,this.mouseMoveTimeoutTimer=null,this.asyncEndDragFrameId=null,this.dragOverTargetIds=null,this.lastClientOffset=null,this.hoverRafId=null,this.getSourceClientOffset=i=>{const o=this.sourceNodes.get(i);return o&&Wf(o)||null},this.endDragNativeItem=()=>{this.isDraggingNativeItem()&&(this.actions.endDrag(),this.currentNativeHandle&&this.registry.removeSource(this.currentNativeHandle),this.currentNativeHandle=null,this.currentNativeSource=null)},this.isNodeInDocument=i=>!!(i&&this.document&&this.document.body&&this.document.body.contains(i)),this.endDragIfSourceWasRemovedFromDOM=()=>{const i=this.currentDragSourceNode;i==null||this.isNodeInDocument(i)||(this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover())},this.scheduleHover=i=>{this.hoverRafId===null&&typeof requestAnimationFrame<"u"&&(this.hoverRafId=requestAnimationFrame(()=>{this.monitor.isDragging()&&this.actions.hover(i||[],{clientOffset:this.lastClientOffset}),this.hoverRafId=null}))},this.cancelHover=()=>{this.hoverRafId!==null&&typeof cancelAnimationFrame<"u"&&(cancelAnimationFrame(this.hoverRafId),this.hoverRafId=null)},this.handleTopDragStartCapture=()=>{this.clearCurrentDragSourceNode(),this.dragStartSourceIds=[]},this.handleTopDragStart=i=>{if(i.defaultPrevented)return;const{dragStartSourceIds:o}=this;this.dragStartSourceIds=null;const s=yi(i);this.monitor.isDragging()&&(this.actions.endDrag(),this.cancelHover()),this.actions.beginDrag(o||[],{publishSource:!1,getSourceClientOffset:this.getSourceClientOffset,clientOffset:s});const{dataTransfer:l}=i,u=ys(l);if(this.monitor.isDragging()){if(l&&typeof l.setDragImage=="function"){const g=this.monitor.getSourceId(),p=this.sourceNodes.get(g),f=this.sourcePreviewNodes.get(g)||p;if(f){const{anchorX:S,anchorY:m,offsetX:y,offsetY:C}=this.getCurrentSourcePreviewNodeOptions(),h=lm(p,f,s,{anchorX:S,anchorY:m},{offsetX:y,offsetY:C});l.setDragImage(f,h.x,h.y)}}try{l==null||l.setData("application/json",{})}catch{}this.setCurrentDragSourceNode(i.target);const{captureDraggingState:a}=this.getCurrentSourcePreviewNodeOptions();a?this.actions.publishDragSource():setTimeout(()=>this.actions.publishDragSource(),0)}else if(u)this.beginDragNativeItem(u);else{if(l&&!l.types&&(i.target&&!i.target.hasAttribute||!i.target.hasAttribute("draggable")))return;i.preventDefault()}},this.handleTopDragEndCapture=()=>{this.clearCurrentDragSourceNode()&&this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleTopDragEnterCapture=i=>{if(this.dragEnterTargetIds=[],this.isDraggingNativeItem()){var o;(o=this.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}if(!this.enterLeaveCounter.enter(i.target)||this.monitor.isDragging())return;const{dataTransfer:l}=i,u=ys(l);u&&this.beginDragNativeItem(u,l)},this.handleTopDragEnter=i=>{const{dragEnterTargetIds:o}=this;if(this.dragEnterTargetIds=[],!this.monitor.isDragging())return;this.altKeyPressed=i.altKey,o.length>0&&this.actions.hover(o,{clientOffset:yi(i)}),o.some(l=>this.monitor.canDropOnTarget(l))&&(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=this.getCurrentDropEffect()))},this.handleTopDragOverCapture=i=>{if(this.dragOverTargetIds=[],this.isDraggingNativeItem()){var o;(o=this.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}},this.handleTopDragOver=i=>{const{dragOverTargetIds:o}=this;if(this.dragOverTargetIds=[],!this.monitor.isDragging()){i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none");return}this.altKeyPressed=i.altKey,this.lastClientOffset=yi(i),this.scheduleHover(o),(o||[]).some(l=>this.monitor.canDropOnTarget(l))?(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect=this.getCurrentDropEffect())):this.isDraggingNativeItem()?i.preventDefault():(i.preventDefault(),i.dataTransfer&&(i.dataTransfer.dropEffect="none"))},this.handleTopDragLeaveCapture=i=>{this.isDraggingNativeItem()&&i.preventDefault(),this.enterLeaveCounter.leave(i.target)&&(this.isDraggingNativeItem()&&setTimeout(()=>this.endDragNativeItem(),0),this.cancelHover())},this.handleTopDropCapture=i=>{if(this.dropTargetIds=[],this.isDraggingNativeItem()){var o;i.preventDefault(),(o=this.currentNativeSource)===null||o===void 0||o.loadDataTransfer(i.dataTransfer)}else ys(i.dataTransfer)&&i.preventDefault();this.enterLeaveCounter.reset()},this.handleTopDrop=i=>{const{dropTargetIds:o}=this;this.dropTargetIds=[],this.actions.hover(o,{clientOffset:yi(i)}),this.actions.drop({dropEffect:this.getCurrentDropEffect()}),this.isDraggingNativeItem()?this.endDragNativeItem():this.monitor.isDragging()&&this.actions.endDrag(),this.cancelHover()},this.handleSelectStart=i=>{const o=i.target;typeof o.dragDrop=="function"&&(o.tagName==="INPUT"||o.tagName==="SELECT"||o.tagName==="TEXTAREA"||o.isContentEditable||(i.preventDefault(),o.dragDrop()))},this.options=new um(n,r),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.registry=t.getRegistry(),this.enterLeaveCounter=new em(this.isNodeInDocument)}}let Si;function dm(){return Si||(Si=new Image,Si.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="),Si}const fm=function(t,n,r){return new cm(t,n,r)};var Qt;(function(e){e.mouse="mouse",e.touch="touch",e.keyboard="keyboard"})(Qt||(Qt={}));class hm{get delay(){var t;return(t=this.args.delay)!==null&&t!==void 0?t:0}get scrollAngleRanges(){return this.args.scrollAngleRanges}get getDropTargetElementsAtPoint(){return this.args.getDropTargetElementsAtPoint}get ignoreContextMenu(){var t;return(t=this.args.ignoreContextMenu)!==null&&t!==void 0?t:!1}get enableHoverOutsideTarget(){var t;return(t=this.args.enableHoverOutsideTarget)!==null&&t!==void 0?t:!1}get enableKeyboardEvents(){var t;return(t=this.args.enableKeyboardEvents)!==null&&t!==void 0?t:!1}get enableMouseEvents(){var t;return(t=this.args.enableMouseEvents)!==null&&t!==void 0?t:!1}get enableTouchEvents(){var t;return(t=this.args.enableTouchEvents)!==null&&t!==void 0?t:!0}get touchSlop(){return this.args.touchSlop||0}get delayTouchStart(){var t,n,r,i;return(i=(r=(t=this.args)===null||t===void 0?void 0:t.delayTouchStart)!==null&&r!==void 0?r:(n=this.args)===null||n===void 0?void 0:n.delay)!==null&&i!==void 0?i:0}get delayMouseStart(){var t,n,r,i;return(i=(r=(t=this.args)===null||t===void 0?void 0:t.delayMouseStart)!==null&&r!==void 0?r:(n=this.args)===null||n===void 0?void 0:n.delay)!==null&&i!==void 0?i:0}get window(){if(this.context&&this.context.window)return this.context.window;if(typeof window<"u")return window}get document(){var t;if(!((t=this.context)===null||t===void 0)&&t.document)return this.context.document;if(this.window)return this.window.document}get rootElement(){var t;return((t=this.args)===null||t===void 0?void 0:t.rootElement)||this.document}constructor(t,n){this.args=t,this.context=n}}function pm(e,t,n,r){return Math.sqrt(Math.pow(Math.abs(n-e),2)+Math.pow(Math.abs(r-t),2))}function gm(e,t,n,r,i){if(!i)return!1;const o=Math.atan2(r-t,n-e)*180/Math.PI+180;for(let s=0;s=l.start)&&(l.end==null||o<=l.end))return!0}return!1}const mm={Left:1,Right:2,Center:4},vm={Left:0,Center:1,Right:2};function Ss(e){return e.button===void 0||e.button===vm.Left}function ym(e){return e.buttons===void 0||(e.buttons&mm.Left)===0}function Bf(e){return!!e.targetTouches}const Sm=1;function wm(e){const t=e.nodeType===Sm?e:e.parentElement;if(!t)return;const{top:n,left:r}=t.getBoundingClientRect();return{x:r,y:n}}function Cm(e,t){if(e.targetTouches.length===1)return oo(e.targetTouches[0]);if(t&&e.touches.length===1&&e.touches[0].target===t.target)return oo(e.touches[0])}function oo(e,t){return Bf(e)?Cm(e,t):{x:e.clientX,y:e.clientY}}const qa=(()=>{let e=!1;try{addEventListener("test",()=>{},Object.defineProperty({},"passive",{get(){return e=!0,!0}}))}catch{}return e})(),or={[Qt.mouse]:{start:"mousedown",move:"mousemove",end:"mouseup",contextmenu:"contextmenu"},[Qt.touch]:{start:"touchstart",move:"touchmove",end:"touchend"},[Qt.keyboard]:{keydown:"keydown"}};class Er{profile(){var t;return{sourceNodes:this.sourceNodes.size,sourcePreviewNodes:this.sourcePreviewNodes.size,sourcePreviewNodeOptions:this.sourcePreviewNodeOptions.size,targetNodes:this.targetNodes.size,dragOverTargetIds:((t=this.dragOverTargetIds)===null||t===void 0?void 0:t.length)||0}}get document(){return this.options.document}setup(){const t=this.options.rootElement;t&&(N(!Er.isSetUp,"Cannot have two Touch backends at the same time."),Er.isSetUp=!0,this.addEventListener(t,"start",this.getTopMoveStartHandler()),this.addEventListener(t,"start",this.handleTopMoveStartCapture,!0),this.addEventListener(t,"move",this.handleTopMove),this.addEventListener(t,"move",this.handleTopMoveCapture,!0),this.addEventListener(t,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.addEventListener(t,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.addEventListener(t,"keydown",this.handleCancelOnEscape,!0))}teardown(){const t=this.options.rootElement;t&&(Er.isSetUp=!1,this._mouseClientOffset={},this.removeEventListener(t,"start",this.handleTopMoveStartCapture,!0),this.removeEventListener(t,"start",this.handleTopMoveStart),this.removeEventListener(t,"move",this.handleTopMoveCapture,!0),this.removeEventListener(t,"move",this.handleTopMove),this.removeEventListener(t,"end",this.handleTopMoveEndCapture,!0),this.options.enableMouseEvents&&!this.options.ignoreContextMenu&&this.removeEventListener(t,"contextmenu",this.handleTopMoveEndCapture),this.options.enableKeyboardEvents&&this.removeEventListener(t,"keydown",this.handleCancelOnEscape,!0),this.uninstallSourceNodeRemovalObserver())}addEventListener(t,n,r,i=!1){const o=qa?{capture:i,passive:!1}:i;this.listenerTypes.forEach(function(s){const l=or[s][n];l&&t.addEventListener(l,r,o)})}removeEventListener(t,n,r,i=!1){const o=qa?{capture:i,passive:!1}:i;this.listenerTypes.forEach(function(s){const l=or[s][n];l&&t.removeEventListener(l,r,o)})}connectDragSource(t,n){const r=this.handleMoveStart.bind(this,t);return this.sourceNodes.set(t,n),this.addEventListener(n,"start",r),()=>{this.sourceNodes.delete(t),this.removeEventListener(n,"start",r)}}connectDragPreview(t,n,r){return this.sourcePreviewNodeOptions.set(t,r),this.sourcePreviewNodes.set(t,n),()=>{this.sourcePreviewNodes.delete(t),this.sourcePreviewNodeOptions.delete(t)}}connectDropTarget(t,n){const r=this.options.rootElement;if(!this.document||!r)return()=>{};const i=o=>{if(!this.document||!r||!this.monitor.isDragging())return;let s;switch(o.type){case or.mouse.move:s={x:o.clientX,y:o.clientY};break;case or.touch.move:var l,u;s={x:((l=o.touches[0])===null||l===void 0?void 0:l.clientX)||0,y:((u=o.touches[0])===null||u===void 0?void 0:u.clientY)||0};break}const a=s!=null?this.document.elementFromPoint(s.x,s.y):void 0,g=a&&n.contains(a);if(a===n||g)return this.handleMove(o,t)};return this.addEventListener(this.document.body,"move",i),this.targetNodes.set(t,n),()=>{this.document&&(this.targetNodes.delete(t),this.removeEventListener(this.document.body,"move",i))}}getTopMoveStartHandler(){return!this.options.delayTouchStart&&!this.options.delayMouseStart?this.handleTopMoveStart:this.handleTopMoveStartDelay}installSourceNodeRemovalObserver(t){this.uninstallSourceNodeRemovalObserver(),this.draggedSourceNode=t,this.draggedSourceNodeRemovalObserver=new MutationObserver(()=>{t&&!t.parentElement&&(this.resurrectSourceNode(),this.uninstallSourceNodeRemovalObserver())}),!(!t||!t.parentElement)&&this.draggedSourceNodeRemovalObserver.observe(t.parentElement,{childList:!0})}resurrectSourceNode(){this.document&&this.draggedSourceNode&&(this.draggedSourceNode.style.display="none",this.draggedSourceNode.removeAttribute("data-reactid"),this.document.body.appendChild(this.draggedSourceNode))}uninstallSourceNodeRemovalObserver(){this.draggedSourceNodeRemovalObserver&&this.draggedSourceNodeRemovalObserver.disconnect(),this.draggedSourceNodeRemovalObserver=void 0,this.draggedSourceNode=void 0}constructor(t,n,r){this.getSourceClientOffset=i=>{const o=this.sourceNodes.get(i);return o&&wm(o)},this.handleTopMoveStartCapture=i=>{Ss(i)&&(this.moveStartSourceIds=[])},this.handleMoveStart=i=>{Array.isArray(this.moveStartSourceIds)&&this.moveStartSourceIds.unshift(i)},this.handleTopMoveStart=i=>{if(!Ss(i))return;const o=oo(i);o&&(Bf(i)&&(this.lastTargetTouchFallback=i.targetTouches[0]),this._mouseClientOffset=o),this.waitingForDelay=!1},this.handleTopMoveStartDelay=i=>{if(!Ss(i))return;const o=i.type===or.touch.start?this.options.delayTouchStart:this.options.delayMouseStart;this.timeout=setTimeout(this.handleTopMoveStart.bind(this,i),o),this.waitingForDelay=!0},this.handleTopMoveCapture=()=>{this.dragOverTargetIds=[]},this.handleMove=(i,o)=>{this.dragOverTargetIds&&this.dragOverTargetIds.unshift(o)},this.handleTopMove=i=>{if(this.timeout&&clearTimeout(this.timeout),!this.document||this.waitingForDelay)return;const{moveStartSourceIds:o,dragOverTargetIds:s}=this,l=this.options.enableHoverOutsideTarget,u=oo(i,this.lastTargetTouchFallback);if(!u)return;if(this._isScrolling||!this.monitor.isDragging()&&gm(this._mouseClientOffset.x||0,this._mouseClientOffset.y||0,u.x,u.y,this.options.scrollAngleRanges)){this._isScrolling=!0;return}if(!this.monitor.isDragging()&&this._mouseClientOffset.hasOwnProperty("x")&&o&&pm(this._mouseClientOffset.x||0,this._mouseClientOffset.y||0,u.x,u.y)>(this.options.touchSlop?this.options.touchSlop:0)&&(this.moveStartSourceIds=void 0,this.actions.beginDrag(o,{clientOffset:this._mouseClientOffset,getSourceClientOffset:this.getSourceClientOffset,publishSource:!1})),!this.monitor.isDragging())return;const a=this.sourceNodes.get(this.monitor.getSourceId());this.installSourceNodeRemovalObserver(a),this.actions.publishDragSource(),i.cancelable&&i.preventDefault();const g=(s||[]).map(m=>this.targetNodes.get(m)).filter(m=>!!m),p=this.options.getDropTargetElementsAtPoint?this.options.getDropTargetElementsAtPoint(u.x,u.y,g):this.document.elementsFromPoint(u.x,u.y),f=[];for(const m in p){if(!p.hasOwnProperty(m))continue;let y=p[m];for(y!=null&&f.push(y);y;)y=y.parentElement,y&&f.indexOf(y)===-1&&f.push(y)}const S=f.filter(m=>g.indexOf(m)>-1).map(m=>this._getDropTargetId(m)).filter(m=>!!m).filter((m,y,C)=>C.indexOf(m)===y);if(l)for(const m in this.targetNodes){const y=this.targetNodes.get(m);if(a&&y&&y.contains(a)&&S.indexOf(m)===-1){S.unshift(m);break}}S.reverse(),this.actions.hover(S,{clientOffset:u})},this._getDropTargetId=i=>{const o=this.targetNodes.keys();let s=o.next();for(;s.done===!1;){const l=s.value;if(i===this.targetNodes.get(l))return l;s=o.next()}},this.handleTopMoveEndCapture=i=>{if(this._isScrolling=!1,this.lastTargetTouchFallback=void 0,!!ym(i)){if(!this.monitor.isDragging()||this.monitor.didDrop()){this.moveStartSourceIds=void 0;return}i.cancelable&&i.preventDefault(),this._mouseClientOffset={},this.uninstallSourceNodeRemovalObserver(),this.actions.drop(),this.actions.endDrag()}},this.handleCancelOnEscape=i=>{i.key==="Escape"&&this.monitor.isDragging()&&(this._mouseClientOffset={},this.uninstallSourceNodeRemovalObserver(),this.actions.endDrag())},this.options=new hm(r,n),this.actions=t.getActions(),this.monitor=t.getMonitor(),this.sourceNodes=new Map,this.sourcePreviewNodes=new Map,this.sourcePreviewNodeOptions=new Map,this.targetNodes=new Map,this.listenerTypes=[],this._mouseClientOffset={},this._isScrolling=!1,this.options.enableMouseEvents&&this.listenerTypes.push(Qt.mouse),this.options.enableTouchEvents&&this.listenerTypes.push(Qt.touch),this.options.enableKeyboardEvents&&this.listenerTypes.push(Qt.keyboard)}}const Em=function(t,n={},r={}){return new Er(t,n,r)},Ur="abcdefgh".split(""),Ri={a8:"bR",b8:"bN",c8:"bB",d8:"bQ",e8:"bK",f8:"bB",g8:"bN",h8:"bR",a7:"bP",b7:"bP",c7:"bP",d7:"bP",e7:"bP",f7:"bP",g7:"bP",h7:"bP",a2:"wP",b2:"wP",c2:"wP",d2:"wP",e2:"wP",f2:"wP",g2:"wP",h2:"wP",a1:"wR",b1:"wN",c1:"wB",d1:"wQ",e1:"wK",f1:"wB",g1:"wN",h1:"wR"},km={a:0,b:1,c:2,d:3,e:4,f:5,g:6,h:7},_m={a:7,b:6,c:5,d:4,e:3,f:2,g:1,h:0},xm=[7,6,5,4,3,2,1,0],Om=[0,1,2,3,4,5,6,7],Ga={wP:v.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:v.jsx("path",{d:"m 22.5,9 c -2.21,0 -4,1.79 -4,4 0,0.89 0.29,1.71 0.78,2.38 C 17.33,16.5 16,18.59 16,21 c 0,2.03 0.94,3.84 2.41,5.03 C 15.41,27.09 11,31.58 11,39.5 H 34 C 34,31.58 29.59,27.09 26.59,26.03 28.06,24.84 29,23.03 29,21 29,18.59 27.67,16.5 25.72,15.38 26.21,14.71 26.5,13.89 26.5,13 c 0,-2.21 -1.79,-4 -4,-4 z",style:{opacity:"1",fill:"#ffffff",fillOpacity:"1",fillRule:"nonzero",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}})})),wR:v.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:v.jsxs("g",Object.assign({style:{opacity:"1",fill:"#ffffff",fillOpacity:"1",fillRule:"evenodd",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[v.jsx("path",{d:"M 9,39 L 36,39 L 36,36 L 9,36 L 9,39 z ",style:{strokeLinecap:"butt"}}),v.jsx("path",{d:"M 12,36 L 12,32 L 33,32 L 33,36 L 12,36 z ",style:{strokeLinecap:"butt"}}),v.jsx("path",{d:"M 11,14 L 11,9 L 15,9 L 15,11 L 20,11 L 20,9 L 25,9 L 25,11 L 30,11 L 30,9 L 34,9 L 34,14",style:{strokeLinecap:"butt"}}),v.jsx("path",{d:"M 34,14 L 31,17 L 14,17 L 11,14"}),v.jsx("path",{d:"M 31,17 L 31,29.5 L 14,29.5 L 14,17",style:{strokeLinecap:"butt",strokeLinejoin:"miter"}}),v.jsx("path",{d:"M 31,29.5 L 32.5,32 L 12.5,32 L 14,29.5"}),v.jsx("path",{d:"M 11,14 L 34,14",style:{fill:"none",stroke:"#000000",strokeLinejoin:"miter"}})]}))})),wN:v.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:v.jsxs("g",Object.assign({style:{opacity:"1",fill:"none",fillOpacity:"1",fillRule:"evenodd",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[v.jsx("path",{d:"M 22,10 C 32.5,11 38.5,18 38,39 L 15,39 C 15,30 25,32.5 23,18",style:{fill:"#ffffff",stroke:"#000000"}}),v.jsx("path",{d:"M 24,18 C 24.38,20.91 18.45,25.37 16,27 C 13,29 13.18,31.34 11,31 C 9.958,30.06 12.41,27.96 11,28 C 10,28 11.19,29.23 10,30 C 9,30 5.997,31 6,26 C 6,24 12,14 12,14 C 12,14 13.89,12.1 14,10.5 C 13.27,9.506 13.5,8.5 13.5,7.5 C 14.5,6.5 16.5,10 16.5,10 L 18.5,10 C 18.5,10 19.28,8.008 21,7 C 22,7 22,10 22,10",style:{fill:"#ffffff",stroke:"#000000"}}),v.jsx("path",{d:"M 9.5 25.5 A 0.5 0.5 0 1 1 8.5,25.5 A 0.5 0.5 0 1 1 9.5 25.5 z",style:{fill:"#000000",stroke:"#000000"}}),v.jsx("path",{d:"M 15 15.5 A 0.5 1.5 0 1 1 14,15.5 A 0.5 1.5 0 1 1 15 15.5 z",transform:"matrix(0.866,0.5,-0.5,0.866,9.693,-5.173)",style:{fill:"#000000",stroke:"#000000"}})]}))})),wB:v.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:v.jsxs("g",Object.assign({style:{opacity:"1",fill:"none",fillRule:"evenodd",fillOpacity:"1",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[v.jsxs("g",Object.assign({style:{fill:"#ffffff",stroke:"#000000",strokeLinecap:"butt"}},{children:[v.jsx("path",{d:"M 9,36 C 12.39,35.03 19.11,36.43 22.5,34 C 25.89,36.43 32.61,35.03 36,36 C 36,36 37.65,36.54 39,38 C 38.32,38.97 37.35,38.99 36,38.5 C 32.61,37.53 25.89,38.96 22.5,37.5 C 19.11,38.96 12.39,37.53 9,38.5 C 7.65,38.99 6.68,38.97 6,38 C 7.35,36.54 9,36 9,36 z"}),v.jsx("path",{d:"M 15,32 C 17.5,34.5 27.5,34.5 30,32 C 30.5,30.5 30,30 30,30 C 30,27.5 27.5,26 27.5,26 C 33,24.5 33.5,14.5 22.5,10.5 C 11.5,14.5 12,24.5 17.5,26 C 17.5,26 15,27.5 15,30 C 15,30 14.5,30.5 15,32 z"}),v.jsx("path",{d:"M 25 8 A 2.5 2.5 0 1 1 20,8 A 2.5 2.5 0 1 1 25 8 z"})]})),v.jsx("path",{d:"M 17.5,26 L 27.5,26 M 15,30 L 30,30 M 22.5,15.5 L 22.5,20.5 M 20,18 L 25,18",style:{fill:"none",stroke:"#000000",strokeLinejoin:"miter"}})]}))})),wQ:v.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:v.jsxs("g",Object.assign({style:{fill:"#ffffff",stroke:"#000000",strokeWidth:"1.5",strokeLinejoin:"round"}},{children:[v.jsx("path",{d:"M 9,26 C 17.5,24.5 30,24.5 36,26 L 38.5,13.5 L 31,25 L 30.7,10.9 L 25.5,24.5 L 22.5,10 L 19.5,24.5 L 14.3,10.9 L 14,25 L 6.5,13.5 L 9,26 z"}),v.jsx("path",{d:"M 9,26 C 9,28 10.5,28 11.5,30 C 12.5,31.5 12.5,31 12,33.5 C 10.5,34.5 11,36 11,36 C 9.5,37.5 11,38.5 11,38.5 C 17.5,39.5 27.5,39.5 34,38.5 C 34,38.5 35.5,37.5 34,36 C 34,36 34.5,34.5 33,33.5 C 32.5,31 32.5,31.5 33.5,30 C 34.5,28 36,28 36,26 C 27.5,24.5 17.5,24.5 9,26 z"}),v.jsx("path",{d:"M 11.5,30 C 15,29 30,29 33.5,30",style:{fill:"none"}}),v.jsx("path",{d:"M 12,33.5 C 18,32.5 27,32.5 33,33.5",style:{fill:"none"}}),v.jsx("circle",{cx:"6",cy:"12",r:"2"}),v.jsx("circle",{cx:"14",cy:"9",r:"2"}),v.jsx("circle",{cx:"22.5",cy:"8",r:"2"}),v.jsx("circle",{cx:"31",cy:"9",r:"2"}),v.jsx("circle",{cx:"39",cy:"12",r:"2"})]}))})),wK:v.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:v.jsxs("g",Object.assign({style:{fill:"none",fillOpacity:"1",fillRule:"evenodd",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[v.jsx("path",{d:"M 22.5,11.63 L 22.5,6",style:{fill:"none",stroke:"#000000",strokeLinejoin:"miter"}}),v.jsx("path",{d:"M 20,8 L 25,8",style:{fill:"none",stroke:"#000000",strokeLinejoin:"miter"}}),v.jsx("path",{d:"M 22.5,25 C 22.5,25 27,17.5 25.5,14.5 C 25.5,14.5 24.5,12 22.5,12 C 20.5,12 19.5,14.5 19.5,14.5 C 18,17.5 22.5,25 22.5,25",style:{fill:"#ffffff",stroke:"#000000",strokeLinecap:"butt",strokeLinejoin:"miter"}}),v.jsx("path",{d:"M 12.5,37 C 18,40.5 27,40.5 32.5,37 L 32.5,30 C 32.5,30 41.5,25.5 38.5,19.5 C 34.5,13 25,16 22.5,23.5 L 22.5,27 L 22.5,23.5 C 20,16 10.5,13 6.5,19.5 C 3.5,25.5 12.5,30 12.5,30 L 12.5,37",style:{fill:"#ffffff",stroke:"#000000"}}),v.jsx("path",{d:"M 12.5,30 C 18,27 27,27 32.5,30",style:{fill:"none",stroke:"#000000"}}),v.jsx("path",{d:"M 12.5,33.5 C 18,30.5 27,30.5 32.5,33.5",style:{fill:"none",stroke:"#000000"}}),v.jsx("path",{d:"M 12.5,37 C 18,34 27,34 32.5,37",style:{fill:"none",stroke:"#000000"}})]}))})),bP:v.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:v.jsx("path",{d:"m 22.5,9 c -2.21,0 -4,1.79 -4,4 0,0.89 0.29,1.71 0.78,2.38 C 17.33,16.5 16,18.59 16,21 c 0,2.03 0.94,3.84 2.41,5.03 C 15.41,27.09 11,31.58 11,39.5 H 34 C 34,31.58 29.59,27.09 26.59,26.03 28.06,24.84 29,23.03 29,21 29,18.59 27.67,16.5 25.72,15.38 26.21,14.71 26.5,13.89 26.5,13 c 0,-2.21 -1.79,-4 -4,-4 z",style:{opacity:"1",fill:"#000000",fillOpacity:"1",fillRule:"nonzero",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"miter",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}})})),bR:v.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:v.jsxs("g",Object.assign({style:{opacity:"1",fill:"#000000",fillOpacity:"1",fillRule:"evenodd",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[v.jsx("path",{d:"M 9,39 L 36,39 L 36,36 L 9,36 L 9,39 z ",style:{strokeLinecap:"butt"}}),v.jsx("path",{d:"M 12.5,32 L 14,29.5 L 31,29.5 L 32.5,32 L 12.5,32 z ",style:{strokeLinecap:"butt"}}),v.jsx("path",{d:"M 12,36 L 12,32 L 33,32 L 33,36 L 12,36 z ",style:{strokeLinecap:"butt"}}),v.jsx("path",{d:"M 14,29.5 L 14,16.5 L 31,16.5 L 31,29.5 L 14,29.5 z ",style:{strokeLinecap:"butt",strokeLinejoin:"miter"}}),v.jsx("path",{d:"M 14,16.5 L 11,14 L 34,14 L 31,16.5 L 14,16.5 z ",style:{strokeLinecap:"butt"}}),v.jsx("path",{d:"M 11,14 L 11,9 L 15,9 L 15,11 L 20,11 L 20,9 L 25,9 L 25,11 L 30,11 L 30,9 L 34,9 L 34,14 L 11,14 z ",style:{strokeLinecap:"butt"}}),v.jsx("path",{d:"M 12,35.5 L 33,35.5 L 33,35.5",style:{fill:"none",stroke:"#ffffff",strokeWidth:"1",strokeLinejoin:"miter"}}),v.jsx("path",{d:"M 13,31.5 L 32,31.5",style:{fill:"none",stroke:"#ffffff",strokeWidth:"1",strokeLinejoin:"miter"}}),v.jsx("path",{d:"M 14,29.5 L 31,29.5",style:{fill:"none",stroke:"#ffffff",strokeWidth:"1",strokeLinejoin:"miter"}}),v.jsx("path",{d:"M 14,16.5 L 31,16.5",style:{fill:"none",stroke:"#ffffff",strokeWidth:"1",strokeLinejoin:"miter"}}),v.jsx("path",{d:"M 11,14 L 34,14",style:{fill:"none",stroke:"#ffffff",strokeWidth:"1",strokeLinejoin:"miter"}})]}))})),bN:v.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:v.jsxs("g",Object.assign({style:{opacity:"1",fill:"none",fillOpacity:"1",fillRule:"evenodd",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[v.jsx("path",{d:"M 22,10 C 32.5,11 38.5,18 38,39 L 15,39 C 15,30 25,32.5 23,18",style:{fill:"#000000",stroke:"#000000"}}),v.jsx("path",{d:"M 24,18 C 24.38,20.91 18.45,25.37 16,27 C 13,29 13.18,31.34 11,31 C 9.958,30.06 12.41,27.96 11,28 C 10,28 11.19,29.23 10,30 C 9,30 5.997,31 6,26 C 6,24 12,14 12,14 C 12,14 13.89,12.1 14,10.5 C 13.27,9.506 13.5,8.5 13.5,7.5 C 14.5,6.5 16.5,10 16.5,10 L 18.5,10 C 18.5,10 19.28,8.008 21,7 C 22,7 22,10 22,10",style:{fill:"#000000",stroke:"#000000"}}),v.jsx("path",{d:"M 9.5 25.5 A 0.5 0.5 0 1 1 8.5,25.5 A 0.5 0.5 0 1 1 9.5 25.5 z",style:{fill:"#ffffff",stroke:"#ffffff"}}),v.jsx("path",{d:"M 15 15.5 A 0.5 1.5 0 1 1 14,15.5 A 0.5 1.5 0 1 1 15 15.5 z",transform:"matrix(0.866,0.5,-0.5,0.866,9.693,-5.173)",style:{fill:"#ffffff",stroke:"#ffffff"}}),v.jsx("path",{d:"M 24.55,10.4 L 24.1,11.85 L 24.6,12 C 27.75,13 30.25,14.49 32.5,18.75 C 34.75,23.01 35.75,29.06 35.25,39 L 35.2,39.5 L 37.45,39.5 L 37.5,39 C 38,28.94 36.62,22.15 34.25,17.66 C 31.88,13.17 28.46,11.02 25.06,10.5 L 24.55,10.4 z ",style:{fill:"#ffffff",stroke:"none"}})]}))})),bB:v.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:v.jsxs("g",Object.assign({style:{opacity:"1",fill:"none",fillRule:"evenodd",fillOpacity:"1",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[v.jsxs("g",Object.assign({style:{fill:"#000000",stroke:"#000000",strokeLinecap:"butt"}},{children:[v.jsx("path",{d:"M 9,36 C 12.39,35.03 19.11,36.43 22.5,34 C 25.89,36.43 32.61,35.03 36,36 C 36,36 37.65,36.54 39,38 C 38.32,38.97 37.35,38.99 36,38.5 C 32.61,37.53 25.89,38.96 22.5,37.5 C 19.11,38.96 12.39,37.53 9,38.5 C 7.65,38.99 6.68,38.97 6,38 C 7.35,36.54 9,36 9,36 z"}),v.jsx("path",{d:"M 15,32 C 17.5,34.5 27.5,34.5 30,32 C 30.5,30.5 30,30 30,30 C 30,27.5 27.5,26 27.5,26 C 33,24.5 33.5,14.5 22.5,10.5 C 11.5,14.5 12,24.5 17.5,26 C 17.5,26 15,27.5 15,30 C 15,30 14.5,30.5 15,32 z"}),v.jsx("path",{d:"M 25 8 A 2.5 2.5 0 1 1 20,8 A 2.5 2.5 0 1 1 25 8 z"})]})),v.jsx("path",{d:"M 17.5,26 L 27.5,26 M 15,30 L 30,30 M 22.5,15.5 L 22.5,20.5 M 20,18 L 25,18",style:{fill:"none",stroke:"#ffffff",strokeLinejoin:"miter"}})]}))})),bQ:v.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:v.jsxs("g",Object.assign({style:{fill:"#000000",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}},{children:[v.jsx("path",{d:"M 9,26 C 17.5,24.5 30,24.5 36,26 L 38.5,13.5 L 31,25 L 30.7,10.9 L 25.5,24.5 L 22.5,10 L 19.5,24.5 L 14.3,10.9 L 14,25 L 6.5,13.5 L 9,26 z",style:{strokeLinecap:"butt",fill:"#000000"}}),v.jsx("path",{d:"m 9,26 c 0,2 1.5,2 2.5,4 1,1.5 1,1 0.5,3.5 -1.5,1 -1,2.5 -1,2.5 -1.5,1.5 0,2.5 0,2.5 6.5,1 16.5,1 23,0 0,0 1.5,-1 0,-2.5 0,0 0.5,-1.5 -1,-2.5 -0.5,-2.5 -0.5,-2 0.5,-3.5 1,-2 2.5,-2 2.5,-4 -8.5,-1.5 -18.5,-1.5 -27,0 z"}),v.jsx("path",{d:"M 11.5,30 C 15,29 30,29 33.5,30"}),v.jsx("path",{d:"m 12,33.5 c 6,-1 15,-1 21,0"}),v.jsx("circle",{cx:"6",cy:"12",r:"2"}),v.jsx("circle",{cx:"14",cy:"9",r:"2"}),v.jsx("circle",{cx:"22.5",cy:"8",r:"2"}),v.jsx("circle",{cx:"31",cy:"9",r:"2"}),v.jsx("circle",{cx:"39",cy:"12",r:"2"}),v.jsx("path",{d:"M 11,38.5 A 35,35 1 0 0 34,38.5",style:{fill:"none",stroke:"#000000",strokeLinecap:"butt"}}),v.jsxs("g",Object.assign({style:{fill:"none",stroke:"#ffffff"}},{children:[v.jsx("path",{d:"M 11,29 A 35,35 1 0 1 34,29"}),v.jsx("path",{d:"M 12.5,31.5 L 32.5,31.5"}),v.jsx("path",{d:"M 11.5,34.5 A 35,35 1 0 0 33.5,34.5"}),v.jsx("path",{d:"M 10.5,37.5 A 35,35 1 0 0 34.5,37.5"})]}))]}))})),bK:v.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",width:"45",height:"45"},{children:v.jsxs("g",Object.assign({style:{fill:"none",fillOpacity:"1",fillRule:"evenodd",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",strokeMiterlimit:"4",strokeDasharray:"none",strokeOpacity:"1"}},{children:[v.jsx("path",{d:"M 22.5,11.63 L 22.5,6",style:{fill:"none",stroke:"#000000",strokeLinejoin:"miter"},id:"path6570"}),v.jsx("path",{d:"M 22.5,25 C 22.5,25 27,17.5 25.5,14.5 C 25.5,14.5 24.5,12 22.5,12 C 20.5,12 19.5,14.5 19.5,14.5 C 18,17.5 22.5,25 22.5,25",style:{fill:"#000000",fillOpacity:"1",strokeLinecap:"butt",strokeLinejoin:"miter"}}),v.jsx("path",{d:"M 12.5,37 C 18,40.5 27,40.5 32.5,37 L 32.5,30 C 32.5,30 41.5,25.5 38.5,19.5 C 34.5,13 25,16 22.5,23.5 L 22.5,27 L 22.5,23.5 C 20,16 10.5,13 6.5,19.5 C 3.5,25.5 12.5,30 12.5,30 L 12.5,37",style:{fill:"#000000",stroke:"#000000"}}),v.jsx("path",{d:"M 20,8 L 25,8",style:{fill:"none",stroke:"#000000",strokeLinejoin:"miter"}}),v.jsx("path",{d:"M 32,29.5 C 32,29.5 40.5,25.5 38.03,19.85 C 34.15,14 25,18 22.5,24.5 L 22.5,26.6 L 22.5,24.5 C 20,18 10.85,14 6.97,19.85 C 4.5,25.5 13,29.5 13,29.5",style:{fill:"none",stroke:"#ffffff"}}),v.jsx("path",{d:"M 12.5,30 C 18,27 27,27 32.5,30 M 12.5,33.5 C 18,30.5 27,30.5 32.5,33.5 M 12.5,37 C 18,34 27,34 32.5,37",style:{fill:"none",stroke:"#ffffff"}})]}))}))};function wl(e,t,n){const r=t/8,i=e==="white"?km:_m,o=e==="white"?xm:Om,s=i[n[0]]*r+r/2,l=o[parseInt(n[1],10)-1]*r+r/2;return{x:s,y:l}}function Ya(e){let t=!1;return Object.keys(Ri).forEach(n=>{e[n]!==Ri[n]&&(t=!0)}),Object.keys(e).forEach(n=>{Ri[n]!==e[n]&&(t=!0)}),t}function Tm(e,t){const n={removed:{},added:{}};return Object.keys(e).forEach(r=>{t[r]!==e[r]&&(n.removed[r]=e[r])}),Object.keys(t).forEach(r=>{e[r]!==t[r]&&(n.added[r]=t[r])}),n}function Xa(e){return e==="start"?Ri:typeof e=="string"?Dm(e):e}function Dm(e){if(!Pm(e))return{};e=e.replace(/ .+$/,"");const t=e.split("/"),n={};let r=8;for(let i=0;i<8;i++){const o=t[i].split("");let s=0;for(let l=0;l{const[i,o]=E.useState([]),[s,l]=E.useState([]),[u,a]=E.useState();E.useEffect(()=>{Array.isArray(e)&&o(e==null?void 0:e.filter(m=>m[0]!==m[1]))},[e]),E.useEffect(()=>{n==null||n(s)},[s]);function g(){l([]),a(void 0)}const p=(m,y)=>{t&&a([m,y,r])},f=[...s,...i];return{arrows:f,newArrow:u,clearArrows:g,drawNewArrow:p,setArrows:l,onArrowDrawEnd:(m,y)=>{if(m===y||!t)return;let C;const d=[m,y,r];f.every(([h,w])=>!(h===m&&w===y))?C=[...s,d]:C=s.filter(([h,w])=>!(h===m&&w===y)),a(void 0),l(C)}}},Vf=E.createContext({}),_t=()=>E.useContext(Vf),jm=E.forwardRef(({allowDragOutsideBoard:e=!0,animationDuration:t=300,areArrowsAllowed:n=!0,arePiecesDraggable:r=!0,arePremovesAllowed:i=!1,autoPromoteToQueen:o=!1,boardOrientation:s="white",boardWidth:l,children:u,clearPremovesOnRightClick:a=!0,customArrows:g,customArrowColor:p="rgb(255,170,0)",customBoardStyle:f,customDarkSquareStyle:S={backgroundColor:"#B58863"},customDropSquareStyle:m={boxShadow:"inset 0 0 1px 6px rgba(255,255,255,0.75)"},customLightSquareStyle:y={backgroundColor:"#F0D9B5"},customPieces:C,customPremoveDarkSquareStyle:d={backgroundColor:"#A42323"},customPremoveLightSquareStyle:c={backgroundColor:"#BD2828"},customSquare:h="div",customSquareStyles:w,dropOffBoardAction:k="snapback",id:O=0,isDraggablePiece:x=()=>!0,getPositionObject:T=()=>{},onArrowsChange:z=()=>{},onDragOverSquare:M=()=>{},onMouseOutSquare:$=()=>{},onMouseOverSquare:K=()=>{},onPieceClick:Ae=()=>{},onPieceDragBegin:be=()=>{},onPieceDragEnd:qe=()=>{},onPieceDrop:Ce=()=>!0,onPromotionCheck:dt=(Zt,xt,qr)=>(qr==="wP"&&Zt[1]==="7"&&xt[1]==="8"||qr==="bP"&&Zt[1]==="2"&&xt[1]==="1")&&Math.abs(Zt.charCodeAt(0)-xt.charCodeAt(0))<=1,onPromotionPieceSelect:D,onSquareClick:L=()=>{},onSquareRightClick:j=()=>{},position:H="start",promotionDialogVariant:X="default",promotionToSquare:ot=null,showBoardNotation:A=!0,showPromotionDialog:ft=!1,snapToCursor:Ge=!0},vn)=>{const[Zt,xt]=E.useState(Xa(H)),[qr,Zf]=E.useState({removed:{},added:{}}),[Po,yn]=E.useState(void 0),[Jf,Lo]=E.useState(ft&&!o),[eh,Cu]=E.useState(null),[th,Io]=E.useState(ot),[Eu,No]=E.useState([]),Ot=E.useRef(Eu),[jo,Gr]=E.useState(),[nh,rh]=E.useState(Object.assign(Object.assign({},Ga),C)),[ih,Yr]=E.useState(!1),[Ro,oh]=E.useState(),[Xr,Zr]=E.useState(!1);E.useImperativeHandle(vn,()=>({clearPremoves(ee=!0){Jr(ee)}})),E.useEffect(()=>{rh(Object.assign(Object.assign({},Ga),C))},[C]),E.useEffect(()=>{Lo(ft),Io(ot)},[ot,ft]),E.useEffect(()=>{var ee,de,Ye;bo();const De=Xa(H),ht=Tm(Zt,De),Xe=((ee=Object.keys(ht.added))===null||ee===void 0?void 0:ee.length)<=2?(Ye=(de=Object.entries(ht.added))===null||de===void 0?void 0:de[0])===null||Ye===void 0?void 0:Ye[1][0]:void 0;if(Xr)xt(De),Zr(!1),i&&Ao(Xe),Ro&&clearTimeout(Ro);else if(ih)xt(De),Zr(!1),i&&Ao(Xe);else{Ya(De)&&Po!==void 0?yn(Xe):Ya(De)?yn(void 0):yn("b"),Zf(ht),Zr(!0);const gh=setTimeout(()=>{xt(De),Zr(!1),i&&Ao(Xe)},t);oh(gh)}return Yr(!1),T(De),Mo(),()=>{clearTimeout(Ro)}},[H]);const{arrows:sh,newArrow:lh,clearArrows:Mo,drawNewArrow:uh,onArrowDrawEnd:ah}=Nm(g,n,z,p);function ch(ee,de,Ye,De){if(ee===de)return;if(Mo(),i&&Xr||i&&(Po===Ye[0]||Ot.current.filter(Xe=>Xe.piece[0]===Ye[0]).length>0)){const Xe=[...Ot.current];Xe.push({sourceSq:ee,targetSq:de,piece:Ye}),Ot.current=Xe,No([...Xe]),bo();return}if(!i&&Xr)return;const ht=Object.assign({},Zt);Yr(!!De),yn(Ye[0]),Ce.length?Ce(ee,de,Ye)||(Jr(),Yr(!1)):(k==="trash"&&!de&&delete ht[ee],delete ht[ee],ht[de]=Ye,xt(ht)),bo(),T(ht)}function Ao(ee){if(Ot.current.length===0)return;const de=Ot.current[0];if(de.piece[0]!==void 0&&de.piece[0]!==ee&&Ce.length)if(yn(de.piece[0]),Yr(!0),Ce(de.sourceSq,de.targetSq,de.piece)){const De=[...Ot.current];De.shift(),Ot.current=De,No([...De])}else Jr()}function Jr(ee=!0){ee&&yn(void 0),Ot.current=[],No([])}function bo(){Cu(null),Io(null),Lo(!1)}function dh(ee){Gr(ee)}function fh(ee){if(jo){if(jo===ee){Gr(void 0),a&&Jr(!1),j(ee);return}}else Gr(void 0)}function hh(){Gr(void 0)}const ph={animationDuration:t,arePiecesDraggable:r,arePremovesAllowed:i,boardOrientation:s,boardWidth:l,customArrowColor:p,customBoardStyle:f,customDarkSquareStyle:S,customDropSquareStyle:m,customLightSquareStyle:y,customPremoveDarkSquareStyle:d,customPremoveLightSquareStyle:c,customSquare:h,customSquareStyles:w,id:O,isDraggablePiece:x,onDragOverSquare:M,onMouseOutSquare:$,onMouseOverSquare:K,onPieceClick:Ae,onPieceDragBegin:be,onPieceDragEnd:qe,onPieceDrop:Ce,onPromotionCheck:dt,onPromotionPieceSelect:D,onSquareClick:L,showBoardNotation:A,snapToCursor:Ge,promotionDialogVariant:X,allowDragOutsideBoard:e,arrows:sh,newArrow:lh,onArrowDrawEnd:ah,chessPieces:nh,clearArrows:Mo,drawNewArrow:uh,clearCurrentRightClickDown:hh,currentPosition:Zt,handleSetPosition:ch,isWaitingForAnimation:Xr,lastPieceColour:Po,onRightClickDown:dh,onRightClickUp:fh,positionDifferences:qr,promoteFromSquare:eh,promoteToSquare:th,premoves:Eu,setPromoteFromSquare:Cu,setPromoteToSquare:Io,setShowPromoteDialog:Lo,showPromoteDialog:Jf,autoPromoteToQueen:o,currentRightClickDown:jo};return v.jsx(Vf.Provider,Object.assign({value:ph},{children:u}))});function Rm({row:e,col:t}){const{boardOrientation:n,boardWidth:r,customDarkSquareStyle:i,customLightSquareStyle:o}=_t(),s=o.backgroundColor,l=i.backgroundColor,u=t===0,a=e===7,g=u&&a;function p(){return n==="white"?8-e:e+1}function f(){return n==="black"?Ur[7-t]:Ur[t]}function S(){return v.jsxs(v.Fragment,{children:[v.jsx("div",Object.assign({style:Object.assign(Object.assign({zIndex:3,position:"absolute"},{color:s}),Ja(r))},{children:p()})),v.jsx("div",Object.assign({style:Object.assign(Object.assign({zIndex:3,position:"absolute"},{color:s}),Za(r))},{children:f()}))]})}function m(){return v.jsx("div",Object.assign({style:Object.assign(Object.assign({userSelect:"none",zIndex:3,position:"absolute"},{color:t%2!==0?l:s}),Za(r))},{children:f()}))}function y(){return v.jsx("div",Object.assign({style:Object.assign(Object.assign({userSelect:"none",zIndex:3,position:"absolute"},n==="black"?{color:e%2===0?l:s}:{color:e%2===0?l:s}),Ja(r))},{children:p()}))}return g?S():a?m():u?y():null}const Za=e=>({alignSelf:"flex-end",paddingLeft:e/8-e/48,fontSize:e/48}),Ja=e=>({alignSelf:"flex-start",paddingRight:e/8-e/48,fontSize:e/48});function ec({isPremovedPiece:e=!1,piece:t,square:n,squares:r}){const{animationDuration:i,arePiecesDraggable:o,arePremovesAllowed:s,boardWidth:l,boardOrientation:u,chessPieces:a,currentPosition:g,id:p,isDraggablePiece:f,isWaitingForAnimation:S,onPieceClick:m,onPieceDragBegin:y,onPieceDragEnd:C,positionDifferences:d,premoves:c,onPromotionCheck:h}=_t(),[w,k]=E.useState({opacity:1,zIndex:5,touchAction:"none",cursor:o&&f({piece:t,sourceSquare:n})?"-webkit-grab":"default"}),[{canDrag:O,isDragging:x},T,z]=H1(()=>({type:"piece",item:()=>(y(t,n),{piece:t,square:n,id:p}),end:()=>C(t,n),collect:$=>({canDrag:f({piece:t,sourceSquare:n}),isDragging:!!$.isDragging()})}),[t,n,g,p]);z(dm(),{captureDraggingState:!0}),E.useEffect(()=>{k($=>Object.assign(Object.assign({},$),{opacity:x?0:1}))},[x]),E.useEffect(()=>{if(!s)return;let $=!1;!e&&c.find(K=>K.targetSq===n)&&($=!0),c.find(K=>K.sourceSq===n&&K.piece===t)&&($=!0),k(K=>Object.assign(Object.assign({},K),{display:$?"none":"unset"}))},[g,c]),E.useEffect(()=>{var $;const K=($=d.removed)===null||$===void 0?void 0:$[n];if(!d.added||!K)return;const Ae=Object.entries(d.added).find(([be,qe])=>qe===K||h(n,be,K));if(S&&K&&Ae&&!e){const be=n,qe=Ae[0];if(be&&qe){const Ce=l/8;k(dt=>Object.assign(Object.assign({},dt),{transform:`translate(${(u==="black"?-1:1)*(qe.charCodeAt(0)-be.charCodeAt(0))*Ce}px, ${(u==="black"?-1:1)*(Number(be[1])-Number(qe[1]))*Ce}px)`,transition:`transform ${i}ms`,zIndex:6}))}}},[d]),E.useEffect(()=>{const{sourceSq:$}=M();$&&k(K=>Object.assign(Object.assign({},K),{transform:"translate(0px, 0px)",transition:"transform 0ms"}))},[g]),E.useEffect(()=>{k($=>Object.assign(Object.assign({},$),{cursor:o&&f({piece:t,sourceSquare:n})?"-webkit-grab":"default"}))},[n,g,o]);function M(){return{sourceSq:r[n]}}return v.jsx("div",Object.assign({ref:o&&O?T:null,onClick:()=>m(t),"data-piece":t,style:w},{children:typeof a[t]=="function"?a[t]({squareWidth:l/8,isDragging:x,square:n}):v.jsx("svg",Object.assign({viewBox:"1 1 43 43",width:l/8,height:l/8},{children:v.jsx("g",{children:a[t]})}))}))}function Mm({square:e,squareColor:t,setSquares:n,squareHasPremove:r,children:i}){const o=E.useRef(null),{autoPromoteToQueen:s,boardWidth:l,boardOrientation:u,clearArrows:a,currentPosition:g,currentRightClickDown:p,customBoardStyle:f,customDarkSquareStyle:S,customDropSquareStyle:m,customLightSquareStyle:y,customPremoveDarkSquareStyle:C,customPremoveLightSquareStyle:d,customSquare:c,customSquareStyles:h,drawNewArrow:w,handleSetPosition:k,isWaitingForAnimation:O,lastPieceColour:x,onArrowDrawEnd:T,onDragOverSquare:z,onMouseOutSquare:M,onMouseOverSquare:$,onPieceDrop:K,onPromotionCheck:Ae,onRightClickDown:be,onRightClickUp:qe,onSquareClick:Ce,setPromoteFromSquare:dt,setPromoteToSquare:D,setShowPromoteDialog:L}=_t(),[{isOver:j},H]=X1(()=>({accept:"piece",drop:X,collect:A=>({isOver:!!A.isOver()})}),[e,g,K,O,x]);function X(A){Ae(A.square,e,A.piece)?s?k(A.square,e,A.piece[0]==="w"?"wQ":"bQ"):(dt(A.square),D(e),L(!0)):k(A.square,e,A.piece,!0)}E.useEffect(()=>{if(o.current){const{x:A,y:ft}=o.current.getBoundingClientRect();n(Ge=>Object.assign(Object.assign({},Ge),{[e]:{x:A,y:ft}}))}},[l,u]);const ot=Object.assign(Object.assign(Object.assign(Object.assign({},Am(e,u,f)),t==="black"?S:y),r&&(t==="black"?C:d)),j&&m);return v.jsx("div",Object.assign({ref:H,style:ot,"data-square-color":t,"data-square":e,onMouseOver:A=>{A.buttons===2&&p&&w(p,e),!(A.relatedTarget&&A.currentTarget.contains(A.relatedTarget))&&$(e)},onMouseOut:A=>{A.relatedTarget&&A.currentTarget.contains(A.relatedTarget)||M(e)},onMouseDown:A=>{A.button===2&&be(e)},onMouseUp:A=>{A.button===2&&(p&&T(p,e),qe(e))},onDragEnter:()=>z(e),onClick:()=>{Ce(e),a()},onContextMenu:A=>{A.preventDefault()}},{children:typeof c=="string"?v.jsx(c,Object.assign({ref:o,style:Object.assign(Object.assign(Object.assign({},nc(l)),tc),!r&&(h==null?void 0:h[e]))},{children:i})):v.jsx(c,Object.assign({ref:o,square:e,squareColor:t,style:Object.assign(Object.assign(Object.assign({},nc(l)),tc),!r&&(h==null?void 0:h[e]))},{children:i}))}))}const tc={display:"flex",justifyContent:"center"},nc=e=>({width:e/8,height:e/8}),Am=(e,t,n)=>n!=null&&n.borderRadius?e==="a1"?t==="white"?{borderBottomLeftRadius:n.borderRadius}:{borderTopRightRadius:n.borderRadius}:e==="a8"?t==="white"?{borderTopLeftRadius:n.borderRadius}:{borderBottomRightRadius:n.borderRadius}:e==="h1"?t==="white"?{borderBottomRightRadius:n.borderRadius}:{borderTopLeftRadius:n.borderRadius}:e==="h8"?t==="white"?{borderTopRightRadius:n.borderRadius}:{borderBottomLeftRadius:n.borderRadius}:{}:{};function bm(){const[e,t]=E.useState({}),{boardOrientation:n,boardWidth:r,currentPosition:i,id:o,premoves:s,showBoardNotation:l}=_t();return v.jsx("div",Object.assign({"data-boardid":o},{children:[...Array(8)].map((u,a)=>v.jsx("div",Object.assign({style:{display:"flex",flexWrap:"nowrap",width:r}},{children:[...Array(8)].map((g,p)=>{const f=n==="black"?Ur[7-p]+(a+1):Ur[p]+(8-a),S=p%2===a%2?"white":"black",m=s.find(C=>C.sourceSq===f||C.targetSq===f),y=s.find(C=>C.targetSq===f);return v.jsxs(Mm,Object.assign({square:f,squareColor:S,setSquares:t,squareHasPremove:!!m},{children:[i[f]&&v.jsx(ec,{piece:i[f],square:f,squares:e}),y&&v.jsx(ec,{isPremovedPiece:!0,piece:y.piece,square:f,squares:e}),l&&v.jsx(Rm,{row:a,col:p})]}),`${p}${a}`)})}),a.toString()))}))}const zm=()=>{const{arrows:e,newArrow:t,boardOrientation:n,boardWidth:r,customArrowColor:i}=_t(),o=[...e,t].filter(Boolean);return v.jsx("svg",Object.assign({width:r,height:r,style:{position:"absolute",top:"0",left:"0",pointerEvents:"none",zIndex:"10"}},{children:o.map((s,l)=>{const[u,a,g]=s;if(u===a)return null;const p=wl(n,r,u),f=wl(n,r,a);let S=r/32;const m=l===e.length;e.some(h=>h[0]!==u&&h[1]===a)&&!m&&(S=r/16);const y=f.x-p.x,C=f.y-p.y,d=Math.hypot(C,y),c={x:p.x+y*(d-S)/d,y:p.y+C*(d-S)/d};return v.jsxs(E.Fragment,{children:[v.jsx("marker",Object.assign({id:`arrowhead-${l}`,markerWidth:"2",markerHeight:"2.5",refX:"1.25",refY:"1.25",orient:"auto"},{children:v.jsx("polygon",{points:"0.3 0, 2 1.25, 0.3 2.5",fill:g??i})})),v.jsx("line",{x1:p.x,y1:p.y,x2:c.x,y2:c.y,opacity:m?"0.5":"0.65",stroke:g??i,strokeWidth:m?.9*r/40:r/40,markerEnd:`url(#arrowhead-${l})`})]},`${u}-${a}${m?"-active":""}`)})}))};function Fm({option:e}){const[t,n]=E.useState(!1),{boardWidth:r,chessPieces:i,customDarkSquareStyle:o,customLightSquareStyle:s,handleSetPosition:l,onPromotionPieceSelect:u,promoteFromSquare:a,promoteToSquare:g,promotionDialogVariant:p}=_t(),f=()=>{switch(e[1]){case"Q":return o.backgroundColor;case"R":return s.backgroundColor;case"N":return p==="default"?s.backgroundColor:o.backgroundColor;case"B":return p==="default"?o.backgroundColor:s.backgroundColor}};return v.jsx("div",Object.assign({onClick:()=>{u!=null&&u.length?u(e):l(a,g,e,!0)},onMouseOver:()=>n(!0),onMouseOut:()=>n(!1),"data-piece":e,style:{cursor:"pointer",backgroundColor:t?f():`${f()}aa`,borderRadius:"4px",transition:"all 0.1s ease-out"}},{children:typeof i[e]=="function"?v.jsx("div",Object.assign({style:{transition:"all 0.1s ease-out",transform:t?"scale(1)":"scale(0.85)"}},{children:i[e]({squareWidth:r/8,isDragging:!1})})):v.jsx("svg",Object.assign({viewBox:"1 1 43 43",width:r/8,height:r/8,style:{transition:"all 0.1s ease-out",transform:t?"scale(1)":"scale(0.85)"}},{children:v.jsx("g",{children:i[e]})}))}))}function $m(){const{boardOrientation:e,boardWidth:t,promotionDialogVariant:n,promoteToSquare:r}=_t(),i=(r==null?void 0:r[1])==="1"?"b":"w",o=[`${i??"w"}Q`,`${i??"w"}R`,`${i??"w"}N`,`${i??"w"}B`],s={default:{display:"grid",gridTemplateColumns:"1fr 1fr",transform:`translate(${-t/8}px, ${-t/8}px)`},vertical:{transform:`translate(${-t/16}px, ${-t/16}px)`},modal:{display:"flex",justifyContent:"center",alignItems:"center",transform:`translate(0px, ${3*t/8}px)`,width:"100%",height:`${t/4}px`,top:0,backgroundColor:"white",left:0}},l=wl(e,t,r||"a8");return v.jsx("div",Object.assign({style:Object.assign({position:"absolute",top:`${l==null?void 0:l.y}px`,left:`${l==null?void 0:l.x}px`,zIndex:1e3},s[n]),title:"Choose promotion piece"},{children:o.map(u=>v.jsx(Fm,{option:u},u))}))}const Um={whiteKing:v.jsx("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",version:"1.1",style:{shapeRendering:"geometricPrecision",textRendering:"geometricPrecision",imageRendering:"crisp-edges"},viewBox:"0 0 4210 12970",x:"0px",y:"0px",fillRule:"evenodd",clipRule:"evenodd",width:"250",height:"250"},{children:v.jsx("g",{children:v.jsx("path",{style:{fill:"black",fillRule:"nonzero"},d:"M2105 0c169,0 286,160 249,315l200 0c-172,266 -231,479 -256,792 315,-24 530,-86 792,-255l0 897c-265,-171 -479,-231 -792,-256 18,234 75,495 185,682l339 0c233,0 369,269 225,456l545 0 -595 1916c130,94 158,275 59,402 465,0 416,568 51,568l-334 0 465 2867 332 0c250,0 381,306 199,485 162,63 273,220 273,399l0 633 168 0 0 475c-1403,0 -2807,0 -4210,0l0 -475 167 0 0 -633c0,-179 112,-336 274,-399 -181,-178 -52,-485 199,-485l332 0 465 -2867 -335 0c-353,0 -418,-568 51,-568 -98,-127 -70,-308 59,-402l-594 -1916c181,0 363,0 545,0 -144,-187 -9,-456 225,-456l339 0c110,-187 167,-448 185,-682 -315,25 -530,87 -793,256l0 -897c266,171 480,231 793,255 -25,-315 -87,-529 -256,-792l199 0c-36,-155 81,-315 250,-315zm-1994 10012l0 253 3988 0 0 -253c-1330,0 -2659,0 -3988,0zm484 -1060c-174,0 -316,142 -316,316l0 633 3652 0 0 -633c0,-174 -142,-316 -316,-316 -1007,0 -2013,0 -3020,0zm45 -457c-230,0 -225,345 0,345l2930 0c230,0 225,-345 0,-345 -977,0 -1953,0 -2930,0zm2020 -2978l-1111 0 -465 2867 2041 0 -465 -2867zm-1558 -456c-229,0 -224,345 0,345 669,0 1337,0 2005,0 230,0 225,-345 0,-345 -668,0 -1336,0 -2005,0zm1730 -457l-1454 0c-229,0 -224,345 0,345l1454 0c229,0 224,-345 0,-345zm-2064 -1862l544 1751c529,0 1057,0 1586,0l544 -1751c-892,0 -1783,0 -2674,0zm1085 -567l504 0c-126,-247 -163,-526 -177,-800 273,15 553,52 800,177l0 -504c-247,126 -527,163 -800,177 14,-273 51,-552 177,-799 -168,0 -336,0 -504,0 125,247 162,526 177,799 -274,-14 -553,-51 -800,-177l0 504c247,-125 527,-162 800,-177 -15,274 -52,553 -177,800zm969 111l-1434 0c-230,0 -225,345 0,345l1434 0c230,0 225,-345 0,-345zm-717 -2175c-105,0 -175,109 -133,204l266 0c42,-96 -30,-205 -133,-204z"})})}))};function Hm({children:e}){try{return v.jsx(v.Fragment,{children:e})}catch(t){return console.log(t),v.jsx(Qf,{showError:!0})}}function Qf({showError:e=!1}){return v.jsxs("div",Object.assign({style:{display:"flex",justifyContent:"center",alignItems:"center",flexDirection:"column"}},{children:[v.jsx("div",Object.assign({style:{width:250,height:250,transform:"rotate(90deg)"}},{children:Um.whiteKing})),e&&v.jsx("h1",{children:"Something went wrong"})]}))}function Wm(){const e=E.useRef(null),{boardWidth:t,clearCurrentRightClickDown:n,onPromotionPieceSelect:r,setShowPromoteDialog:i,showPromoteDialog:o,customBoardStyle:s}=_t();return E.useEffect(()=>{function l(u){e.current&&!e.current.contains(u.target)&&n()}return document.addEventListener("mouseup",l),()=>{document.removeEventListener("mouseup",l)}},[]),t?v.jsx("div",Object.assign({style:{perspective:"1000px"}},{children:v.jsxs("div",Object.assign({ref:e,style:Object.assign(Object.assign({position:"relative"},Bm(t)),s)},{children:[v.jsx(bm,{}),v.jsx(zm,{}),o&&v.jsxs(v.Fragment,{children:[v.jsx("div",{onClick:()=>{i(!1),r==null||r()},style:{position:"absolute",top:"0",left:"0",zIndex:"100",backgroundColor:"rgba(22,21,18,.7)",width:t,height:t}}),v.jsx($m,{})]})]}))})):v.jsx(Qf,{})}const Bm=e=>({cursor:"default",height:e,width:e});function Vm({boardContainer:e}){const{boardWidth:t,chessPieces:n,id:r,snapToCursor:i,allowDragOutsideBoard:o}=_t(),s=W1(f=>({item:f.getItem(),clientOffset:f.getClientOffset(),sourceClientOffset:f.getSourceClientOffset(),isDragging:f.isDragging()})),{isDragging:l,item:u,clientOffset:a,sourceClientOffset:g}=s,p=E.useCallback((f,S)=>{if(!f||!S)return{display:"none"};let{x:m,y}=i?f:S;const C=t/8/2;if(i&&(m-=C,y-=C),!o){const{left:c,top:h}=e,w=c-C,k=h-C,O=c+t-C,x=h+t-C;m=Math.max(w,Math.min(m,O)),y=Math.max(k,Math.min(y,x))}const d=`translate(${m}px, ${y}px)`;return{transform:d,WebkitTransform:d,touchAction:"none"}},[t,o,i,e]);return l&&u.id===r?v.jsx("div",Object.assign({style:{position:"fixed",pointerEvents:"none",zIndex:10,left:0,top:0}},{children:v.jsx("div",Object.assign({style:p(a,g)},{children:typeof n[u.piece]=="function"?n[u.piece]({squareWidth:t/8,isDragging:!0}):v.jsx("svg",Object.assign({viewBox:"1 1 43 43",width:t/8,height:t/8},{children:v.jsx("g",{children:n[u.piece]})}))}))})):null}const Qm=E.forwardRef((e,t)=>{const{customDndBackend:n,customDndBackendOptions:r}=e,i=rg(e,["customDndBackend","customDndBackendOptions"]),[o,s]=E.useState(),[l,u]=E.useState(!1),[a,g]=E.useState(!1),[p,f]=E.useState(e.boardWidth),S=E.useRef(null),m=E.useRef(null),[y,C]=E.useState({left:0,top:0}),d=E.useMemo(()=>{var h;return(h=S.current)===null||h===void 0?void 0:h.getBoundingClientRect()},[S.current]);E.useEffect(()=>{C({left:d!=null&&d.left?d==null?void 0:d.left:0,top:d!=null&&d.top?d==null?void 0:d.top:0})},[d]),E.useEffect(()=>{g("ontouchstart"in window),u(!0),s(window)},[]),E.useEffect(()=>{var h;if(e.boardWidth===void 0&&(!((h=S.current)===null||h===void 0)&&h.offsetWidth)){const w=new ResizeObserver(()=>{var k;f((k=S.current)===null||k===void 0?void 0:k.offsetWidth)});return w.observe(S.current),()=>{w.disconnect()}}},[S.current,o]);const c=n||(a?Em:fm);return l&&o?v.jsx(Hm,{children:v.jsxs("div",Object.assign({ref:m,style:{display:"flex",flexDirection:"column",width:"100%"}},{children:[v.jsx("div",{ref:S,style:{width:"100%"}}),v.jsx(w1,Object.assign({backend:c,context:o,options:n?r:void 0},{children:p&&v.jsxs(jm,Object.assign({boardWidth:p},i,{ref:t},{children:[v.jsx(Vm,{boardContainer:y}),v.jsx(Wm,{})]}))}))]}))}):null});var rc=globalThis&&globalThis.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function l(g){try{a(r.next(g))}catch(p){s(p)}}function u(g){try{a(r.throw(g))}catch(p){s(p)}}function a(g){g.done?o(g.value):i(g.value).then(l,u)}a((r=r.apply(e,t||[])).next())})};const Km=e=>{const[t,n,r]=e.split(":");return{process_name:t,package_name:n,publisher_node:r}};function sr(e){const t=document.cookie.split(";");for(let n=0;nnull,onOpen:s=()=>null,onClose:l=()=>null,onError:u=()=>null}){this._encrypt=a=>null,this._decrypt=a=>{},this.send=({data:a})=>{sr(`kinode-auth_${this.nodeId}`),sr(`kinode-ws-auth_${this.nodeId}`),this._ws.send(ic(a))},this.fetchJson=(a,g)=>rc(this,void 0,void 0,function*(){return console.log("Fetching JSON:",a),yield(yield fetch(a,g)).json()}),this._secret=void 0,this.processId=Km(n),this.channelId=r,this.nodeId=t,this._ws=new WebSocket(i),this._ws.onmessage=a=>rc(this,void 0,void 0,function*(){o(a.data,this)}),this._ws.onopen=a=>{console.log(`${t}`,sr(`kinode-auth_${t}`),sr(`kinode-ws-auth_${t}`)),this._ws.send(ic({auth_token:sr(`kinode-auth_${t}`),target_process:n,encrypted:!1})),s(a,this)},this._ws.onclose=l,this._ws.onerror=u}}const oc=e=>{let t;const n=new Set,r=(u,a)=>{const g=typeof u=="function"?u(t):u;if(!Object.is(g,t)){const p=t;t=a??(typeof g!="object"||g===null)?g:Object.assign({},t,g),n.forEach(f=>f(t,p))}},i=()=>t,l={setState:r,getState:i,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{n.clear()}};return t=e(r,i,l),l},Gm=e=>e?oc(e):oc;var Kf={exports:{}},qf={},Gf={exports:{}},Yf={};/** + * @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 Qn=E;function Ym(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Xm=typeof Object.is=="function"?Object.is:Ym,Zm=Qn.useState,Jm=Qn.useEffect,ev=Qn.useLayoutEffect,tv=Qn.useDebugValue;function nv(e,t){var n=t(),r=Zm({inst:{value:n,getSnapshot:t}}),i=r[0].inst,o=r[1];return ev(function(){i.value=n,i.getSnapshot=t,ws(i)&&o({inst:i})},[e,n,t]),Jm(function(){return ws(i)&&o({inst:i}),e(function(){ws(i)&&o({inst:i})})},[e]),tv(n),n}function ws(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Xm(e,n)}catch{return!0}}function rv(e,t){return t()}var iv=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?rv:nv;Yf.useSyncExternalStore=Qn.useSyncExternalStore!==void 0?Qn.useSyncExternalStore:iv;Gf.exports=Yf;var ov=Gf.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 Do=E,sv=ov;function lv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var uv=typeof Object.is=="function"?Object.is:lv,av=sv.useSyncExternalStore,cv=Do.useRef,dv=Do.useEffect,fv=Do.useMemo,hv=Do.useDebugValue;qf.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=cv(null);if(o.current===null){var s={hasValue:!1,value:null};o.current=s}else s=o.current;o=fv(function(){function u(S){if(!a){if(a=!0,g=S,S=r(S),i!==void 0&&s.hasValue){var m=s.value;if(i(m,S))return p=m}return p=S}if(m=p,uv(g,S))return m;var y=r(S);return i!==void 0&&i(m,y)?m:(g=S,p=y)}var a=!1,g,p,f=n===void 0?null:n;return[function(){return u(t())},f===null?void 0:function(){return u(f())}]},[t,n,r,i]);var l=av(e,o[0],o[1]);return dv(function(){s.hasValue=!0,s.value=l},[l]),hv(l),l};Kf.exports=qf;var pv=Kf.exports;const gv=uc(pv),{useDebugValue:mv}=yc,{useSyncExternalStoreWithSelector:vv}=gv;function yv(e,t=e.getState,n){const r=vv(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return mv(r),r}const sc=e=>{const t=typeof e=="function"?Gm(e):e,n=(r,i)=>yv(t,r,i);return Object.assign(n,t),n},Sv=e=>e?sc(e):sc;function Xf(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var o;const s=u=>u===null?null:JSON.parse(u,t==null?void 0:t.reviver),l=(o=n.getItem(i))!=null?o:null;return l instanceof Promise?l.then(s):s(l)},setItem:(i,o)=>n.setItem(i,JSON.stringify(o,t==null?void 0:t.replacer)),removeItem:i=>n.removeItem(i)}}const Hr=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return Hr(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return Hr(r)(n)}}}},wv=(e,t)=>(n,r,i)=>{let o={getStorage:()=>localStorage,serialize:JSON.stringify,deserialize:JSON.parse,partialize:C=>C,version:0,merge:(C,d)=>({...d,...C}),...t},s=!1;const l=new Set,u=new Set;let a;try{a=o.getStorage()}catch{}if(!a)return e((...C)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...C)},r,i);const g=Hr(o.serialize),p=()=>{const C=o.partialize({...r()});let d;const c=g({state:C,version:o.version}).then(h=>a.setItem(o.name,h)).catch(h=>{d=h});if(d)throw d;return c},f=i.setState;i.setState=(C,d)=>{f(C,d),p()};const S=e((...C)=>{n(...C),p()},r,i);let m;const y=()=>{var C;if(!a)return;s=!1,l.forEach(c=>c(r()));const d=((C=o.onRehydrateStorage)==null?void 0:C.call(o,r()))||void 0;return Hr(a.getItem.bind(a))(o.name).then(c=>{if(c)return o.deserialize(c)}).then(c=>{if(c)if(typeof c.version=="number"&&c.version!==o.version){if(o.migrate)return o.migrate(c.state,c.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return c.state}).then(c=>{var h;return m=o.merge(c,(h=r())!=null?h:S),n(m,!0),p()}).then(()=>{d==null||d(m,void 0),s=!0,u.forEach(c=>c(m))}).catch(c=>{d==null||d(void 0,c)})};return i.persist={setOptions:C=>{o={...o,...C},C.getStorage&&(a=C.getStorage())},clearStorage:()=>{a==null||a.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>y(),hasHydrated:()=>s,onHydrate:C=>(l.add(C),()=>{l.delete(C)}),onFinishHydration:C=>(u.add(C),()=>{u.delete(C)})},y(),m||S},Cv=(e,t)=>(n,r,i)=>{let o={storage:Xf(()=>localStorage),partialize:y=>y,version:0,merge:(y,C)=>({...C,...y}),...t},s=!1;const l=new Set,u=new Set;let a=o.storage;if(!a)return e((...y)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...y)},r,i);const g=()=>{const y=o.partialize({...r()});return a.setItem(o.name,{state:y,version:o.version})},p=i.setState;i.setState=(y,C)=>{p(y,C),g()};const f=e((...y)=>{n(...y),g()},r,i);let S;const m=()=>{var y,C;if(!a)return;s=!1,l.forEach(c=>{var h;return c((h=r())!=null?h:f)});const d=((C=o.onRehydrateStorage)==null?void 0:C.call(o,(y=r())!=null?y:f))||void 0;return Hr(a.getItem.bind(a))(o.name).then(c=>{if(c)if(typeof c.version=="number"&&c.version!==o.version){if(o.migrate)return o.migrate(c.state,c.version);console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return c.state}).then(c=>{var h;return S=o.merge(c,(h=r())!=null?h:f),n(S,!0),g()}).then(()=>{d==null||d(S,void 0),S=r(),s=!0,u.forEach(c=>c(S))}).catch(c=>{d==null||d(void 0,c)})};return i.persist={setOptions:y=>{o={...o,...y},y.storage&&(a=y.storage)},clearStorage:()=>{a==null||a.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>m(),hasHydrated:()=>s,onHydrate:y=>(l.add(y),()=>{l.delete(y)}),onFinishHydration:y=>(u.add(y),()=>{u.delete(y)})},o.skipHydration||m(),S||f},Ev=(e,t)=>"getStorage"in t||"serialize"in t||"deserialize"in t?wv(e,t):Cv(e,t),kv=Ev,_v=Sv()(kv((e,t)=>({games:{},handleWsMessage:n=>{if(typeof n=="string")try{const{kind:r,data:i}=JSON.parse(n);r==="game_update"&&e({games:{...t().games,[i.id]:i}})}catch(r){console.error("Error parsing WebSocket message",r)}else{const r=new FileReader;r.onload=function(i){var o;if(typeof((o=i==null?void 0:i.target)==null?void 0:o.result)=="string")try{const{kind:s,data:l}=JSON.parse(i.target.result);s==="game_update"&&e({games:{...t().games,[l.id]:l}})}catch(s){console.error("Error parsing WebSocket message",s)}},r.readAsText(n)}},set:e}),{name:"chess",storage:Xf(()=>localStorage)}));const Mt="/chess:chess:sys";window.our&&(window.our.process=Mt==null?void 0:Mt.replace("/",""));const lc=(e,t)=>(e.turns||0)%2===0?t===e.white:t===e.black,xv=void 0;function Ov(){const{games:e,handleWsMessage:t,set:n}=_v(),[r,i]=E.useState("new"),[o,s]=E.useState(""),l=E.useRef(null),[u,a]=E.useState(560-20),g=new ResizeObserver(d=>{for(let c of d)a(Math.min(c.contentRect.width,c.contentRect.height)-16)});l.current&&g.observe(l.current);const p=E.useMemo(()=>e[r]?{...e[r],game:new ng(e[r].board)}:void 0,[e,r]),f=E.useMemo(()=>((p==null?void 0:p.turns)||0)%2===0?`${p==null?void 0:p.white} (white)`:`${p==null?void 0:p.black} (black)`,[p]);E.useEffect(()=>{new qm({uri:xv,nodeId:window.our.node,processId:window.our.process,onMessage:t}),fetch(`${Mt}/games`).then(d=>d.json()).then(d=>{n({games:d})}).catch(console.error)},[]);const S=E.useCallback(async d=>{d.preventDefault();try{const c=await fetch(`${Mt}/games`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:o})}).then(w=>{if(w.status===409)throw e[o]?i(o):alert("Game already exists, please refresh the page and select it."),new Error("Game already exists");if(w.status===503)throw alert(`${o} may be offline, please confirm it is online and try again.`),new Error("Player offline");if(w.status===400)throw alert("Please enter a valid player ID"),new Error("Invalid player ID");if(w.status>399)throw alert("There was an error creating the game. Please try again."),new Error("Error creating game");return w.json()}),h={...e};h[c.id]=c,n({games:h}),i(o),s("")}catch(c){console.error(c)}},[e,o,s,n]),m=E.useCallback((d,c)=>{if(!p||!lc(p,window.our.node))return!1;const h={from:d,to:c,promotion:"q"},w={...p};if(w.game.move(h)===null)return!1;w.board=w.game.fen();const O={...e};return O[p.id]=w,n({games:O}),fetch(`${Mt}/games`,{method:"PUT",body:JSON.stringify({id:p.id,move:d+c})}).then(x=>x.json()).then(x=>{const T={...e};T[p.id]=x,n({games:T})}).catch(x=>{console.error(x),alert("There was an error making your move. Please try again");const T={...e},z={...p};z.game.undo(),T[p.id]=z,n({games:T})}),!0},[p,e,n]),y=E.useCallback(d=>{d.preventDefault(),d.stopPropagation(),p&&window.confirm("Are you sure you want to resign this game?")&&fetch(`${Mt}/games?id=${p.id}`,{method:"DELETE"}).then(c=>c.json()).then(c=>{const h={...e};h[p.id]=c,n({games:h})}).catch(c=>{console.error(c),alert("There was an error resigning the game. Please try again")})},[p]),C=E.useCallback(async d=>{if(d.preventDefault(),d.stopPropagation(),!!p)try{const c=await fetch(`${Mt}/games`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:p.id})}).then(w=>w.json()),h={...e};h[c.id]=c,n({games:h})}catch(c){console.error(c),alert("You could not create the game. Please make sure your current game with this player (if any) has ended and try again.")}},[p]);return v.jsx("div",{className:"flex flex-col justify-center items-center",style:{height:"100%"},children:v.jsxs("div",{className:"flex flex-col justify-center",style:{maxHeight:"100vh",maxWidth:"800px",height:"100%",width:"100%",position:"relative"},children:[v.jsxs("a",{href:"/",className:"absolute top-6 left-0 ml-2",style:{fontSize:24},onClick:d=>{d.preventDefault(),window.history.back()},children:[v.jsx("span",{style:{fontSize:18,marginBottom:4},children:"◀"})," Back"]}),v.jsxs("h4",{className:"m-4 row justify-center",children:["Chess by",v.jsxs("svg",{width:"180",height:"20",viewBox:"0 0 580 72",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[v.jsxs("g",{"clip-path":"url(#clip0_6_641)",children:[v.jsx("path",{d:"M0.824922 1.07031L0.794922 70.0703H14.7949L14.8049 1.07031H0.824922Z",fill:"#FFF5D9"}),v.jsx("path",{d:"M16.5947 36.8803L41.2547 1.07031H58.2447L33.1647 36.8803L61.2447 70.0703H42.9947L16.5947 36.8803Z",fill:"#FFF5D9"}),v.jsx("path",{d:"M119.885 1.07031H105.765V70.0703H119.885V1.07031Z",fill:"#FFF5D9"}),v.jsx("path",{d:"M173.185 1.07031V70.0703H186.775V26.8303L224.045 70.0703H234.825V1.07031H221.325V45.6803L183.445 1.07031H173.185Z",fill:"#FFF5D9"}),v.jsx("path",{d:"M342.465 8.86C333.025 0.15 321.645 0 318.535 0C315.475 0 303.575 0.22 294.005 9.52C283.845 19.4 283.805 32.24 283.795 35.66C283.785 39.3 283.895 49.03 290.805 57.99C300.855 71.02 316.695 71.31 318.535 71.32C321.375 71.32 334.185 71 343.965 60.66C353.065 51.04 353.265 39.4 353.275 35.66C353.275 32.49 353.305 18.86 342.455 8.86H342.465ZM318.435 58.01C307.095 58.01 297.895 47.95 297.895 35.54C297.895 23.13 307.085 13.07 318.435 13.07C329.785 13.07 338.975 23.13 338.975 35.54C338.975 47.95 329.785 58.01 318.435 58.01Z",fill:"#FFF5D9"}),v.jsx("path",{d:"M450.495 12.0802C444.975 5.46023 437.135 0.990234 427.955 0.990234C417.555 0.990234 405.295 1.07023 402.295 1.07023V69.9802C405.285 69.9802 417.555 70.0602 427.955 70.0602C445.525 70.0602 458.445 53.4102 459.065 36.8602C459.395 28.0102 456.185 18.9002 450.495 12.0802ZM440.085 49.9502C436.895 53.8702 432.705 56.6902 427.665 57.5602C424.025 58.1902 420.095 57.8302 416.405 57.8302C416.405 50.4002 416.405 42.9802 416.405 35.5502V13.2202C423.795 13.2202 430.525 12.7002 436.605 17.6002C440.275 20.5602 442.925 24.7102 444.165 29.2402C444.525 30.5402 444.765 31.8802 444.875 33.2302C445.395 39.3702 443.995 45.1402 440.085 49.9502Z",fill:"#FFF5D9"}),v.jsx("path",{d:"M508.135 0.990234V70.0602H552.715V57.9302H522.035V40.4202H547.125V28.0702H521.995V13.3202H552.715V0.990234H508.135Z",fill:"#FFF5D9"}),v.jsx("path",{d:"M574.835 66.0398H572.745L571.015 63.0698H569.845V66.0398H567.805V57.5498H571.765C572.845 57.5498 573.865 57.9298 574.425 58.9398C575.205 60.3698 574.665 62.3798 573.105 63.0298C573.725 64.1198 574.225 64.9498 574.845 66.0398H574.835ZM570.375 61.0798H570.845C571.335 61.0798 572.365 61.0798 572.365 60.2898C572.365 59.5598 571.335 59.5598 570.845 59.5598H570.375V61.0798Z",fill:"#FFF5D9"}),v.jsx("path",{d:"M570.964 69.0002C574.913 69.0002 578.114 65.799 578.114 61.8502C578.114 57.9014 574.913 54.7002 570.964 54.7002C567.016 54.7002 563.814 57.9014 563.814 61.8502C563.814 65.799 567.016 69.0002 570.964 69.0002Z",stroke:"#FFF5D9","stroke-width":"2.2",strokeMiterlimit:"10"})]}),v.jsx("defs",{children:v.jsx("clipPath",{id:"clip0_6_641",children:v.jsx("rect",{width:"578.41",height:"71.32",fill:"white",transform:"translate(0.794922)"})})})]})]}),v.jsxs("div",{className:"flex flex-row justify-between items-center",style:{height:"100%"},children:[Object.keys(e).length>0&&v.jsxs("div",{className:"flex flex-col games items-center",style:{width:"25%",height:"100%",gap:"1em",padding:"1em"},children:[v.jsx("h4",{className:"m-2",children:"Games"}),v.jsx("button",{className:"small",style:{width:"100%"},onClick:()=>i("new"),children:"New"}),v.jsx("div",{className:"flex flex-col overflow-scroll",style:{width:"100%"},children:Object.values(e).map(d=>v.jsx("div",{onClick:()=>i(d==null?void 0:d.id),className:`game-entry ${r!==(d==null?void 0:d.id)&&lc(d,window.our.node)?"is-turn":""} ${r===(d==null?void 0:d.id)?"selected":""} ${d!=null&&d.ended?"ended":""}`,children:d==null?void 0:d.id},d==null?void 0:d.id))})]}),v.jsx("div",{className:"flex flex-col justify-center items-center game",style:{width:Object.keys(e).length>0?"calc(75% - 16px)":"100%",height:"100%"},ref:l,children:r==="new"||!p?v.jsxs(v.Fragment,{children:[v.jsx("h3",{children:"Start New Game"}),v.jsx("h5",{className:"mb-8 orange-text",children:"(game creator will be white)"}),v.jsxs("form",{onSubmit:S,className:"flex flex-col justify-center mb-40",style:{maxWidth:400},children:[v.jsx("label",{className:"mb-2",style:{alignSelf:"flex-start",fontWeight:"600"},children:"Player ID"}),v.jsx("input",{className:"border rounded p-2 mb-2",style:{minWidth:300},type:"text",placeholder:"Player ID",value:o,onChange:d=>s(d.target.value)}),v.jsx("button",{type:"submit",children:"Start Game"})]})]}):v.jsxs(v.Fragment,{children:[v.jsxs("div",{className:"flex flex-row justify-between items-center w-full px-4 pb-2 gap-4",children:[v.jsx("h4",{children:r}),v.jsx("h5",{children:p!=null&&p.ended?"Game Ended":`Turn: ${f}`}),p!=null&&p.ended?v.jsx("button",{className:"small mt-2",onClick:C,children:"Rematch"}):v.jsx("button",{className:"small mt-2",onClick:y,children:"Resign"})]}),v.jsx("div",{children:v.jsx(Qm,{boardWidth:u-16,position:p==null?void 0:p.game.fen(),onPieceDrop:m,boardOrientation:(p==null?void 0:p.white)===window.our.node?"white":"black"})})]})})]})]})})}Cs.createRoot(document.getElementById("root")).render(v.jsx(yc.StrictMode,{children:v.jsx(Ov,{})})); diff --git a/kinode/packages/chess/pkg/ui/assets/index-383827d3.css b/kinode/packages/chess/pkg/ui/assets/index-383827d3.css new file mode 100644 index 000000000..016c7a615 --- /dev/null +++ b/kinode/packages/chess/pkg/ui/assets/index-383827d3.css @@ -0,0 +1 @@ +#root{max-width:1280px;margin:0 auto;text-align:center;width:100%;height:100%}.logo{height:6em;padding:1.5em;will-change:filter;transition:filter .3s}.logo:hover{filter:drop-shadow(0 0 2em #646cffaa)}.logo.react:hover{filter:drop-shadow(0 0 2em #61dafbaa)}@keyframes logo-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media (prefers-reduced-motion: no-preference){a:nth-of-type(2) .logo{animation:logo-spin infinite 20s linear}}.card{padding:2em}.read-the-docs{color:#888}.game,.games{background-color:var(--input-background);border-radius:1em}.orange-text{color:var(--orange-medium)}button.small{padding:.25em .5em;font-size:1em;border-radius:.5em;width:100px}@keyframes colorChange{0%,to{background-color:var(--text-dark)}50%{background-color:var(--orange-light)}}.game-entry{width:100%;cursor:pointer;color:#fff;background-color:var(--orange-medium);padding:.5em;border-radius:.25em}.game-entry.is-turn{animation:colorChange 3s infinite}.game-entry.is-turn:hover{animation:none}.game-entry.selected{background-color:var(--orange-light)}.game-entry.is-ended{background-color:#d3d3d3;color:gray}.game-entry:hover{background-color:var(--orange-light)}*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.absolute{position:absolute}.relative{position:relative}.left-0{left:0}.top-6{top:1.5rem}.m-2{margin:.5rem}.m-4{margin:1rem}.mb-2{margin-bottom:.5rem}.mb-40{margin-bottom:10rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.mt-2{margin-top:.5rem}.flex{display:flex}.w-full{width:100%}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-4{gap:1rem}.overflow-scroll{overflow:scroll}.rounded{border-radius:.25rem}.border{border-width:1px}.p-2{padding:.5rem}.px-4{padding-left:1rem;padding-right:1rem}.pb-2{padding-bottom:.5rem}:root{--text-light: #FFF5D9;--text-dark: #22211F;--text-orange: #FF7533;--orange-light: #F36822;--orange-medium: #F35422;--orange-burnt: #E25F35;--medium-gray: 7E7E7E;--gray-button: rgba(253, 245, 220, .25);--input-background: rgba(243, 84, 34, .25)}body{margin:0;padding:2em;font-size:16px;background-color:var(--gray-button);color:var(--text-light);font-weight:400;background:url(/chess:chess:sys/assets/background-00905d19.jpg) no-repeat center center fixed;background-size:cover;height:100vh;width:100vw;overflow-y:scroll}body,h1,h2,h3,h4,h5,h6,p,a,button,input{font-family:Barlow Condensed,sans-serif}h1,h2,h3,h4,h5,h6{line-height:1.5em;font-weight:500;margin:0}h1{font-size:64px}h2{font-size:48px}h3{font-size:36px}h4{font-size:24px}h5{font-size:20px}h6{font-size:16px}.col{display:flex;flex-direction:column;align-items:center}.row{display:flex;flex-direction:row;align-items:center}input{all:unset}input[type=text],input[type=password],input[type=checkbox]{padding:1em;border:1px solid var(--orange-medium);border-radius:8px;box-sizing:border-box;font-size:1em;background-color:var(--input-background);color:var(--text-light)}input[type=text],input[type=password]{width:100%}input[type=checkbox]{padding:.25em .8em;cursor:pointer}input[type=checkbox]:checked{background-color:var(--orange-medium)}.checkmark{position:absolute;left:4px;font-size:24px;top:-5px;cursor:pointer}::-moz-placeholder{color:var(--text-light)}::placeholder{color:var(--text-light)}::-moz-placeholder::-moz-placeholder{color:var(--text-light)}::-moz-placeholder::placeholder{color:var(--text-light)}::-ms-input-placeholder{color:var(--text-light)}label{font-size:20px}button,[type=button],[type=reset],[type=submit]{width:100%;padding:.75em 1em;margin:0;font-weight:500;border-width:1px;border-style:solid;border-color:var(--orange-medium);border-radius:8px;background:var(--orange-medium);box-sizing:border-box;cursor:pointer;font-size:1.125em;transition:all .1s;box-shadow:0 1px 2px var(--orange-light);color:var(--text-light)}button.alt{background-color:var(--text-light);color:var(--text-dark);border-color:var(--text-light);box-shadow:0 1px 2px var(--text-light)}button:hover{opacity:.9;box-shadow:none}button:disabled{background-color:var(--medium-gray);border:1px solid var(--medium-gray);box-shadow:0 1px 2px var(--medium-gray);opacity:.7;cursor:not-allowed} diff --git a/kinode/packages/chess/pkg/ui/assets/index-645e8b8f.css b/kinode/packages/chess/pkg/ui/assets/index-645e8b8f.css deleted file mode 100644 index 397577a77..000000000 --- a/kinode/packages/chess/pkg/ui/assets/index-645e8b8f.css +++ /dev/null @@ -1 +0,0 @@ -#root{max-width:1280px;margin:0 auto;text-align:center;width:100%}.logo{height:6em;padding:1.5em;will-change:filter;transition:filter .3s}.logo:hover{filter:drop-shadow(0 0 2em #646cffaa)}.logo.react:hover{filter:drop-shadow(0 0 2em #61dafbaa)}@keyframes logo-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media (prefers-reduced-motion: no-preference){a:nth-of-type(2) .logo{animation:logo-spin infinite 20s linear}}.card{padding:2em}.read-the-docs{color:#888}*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,[type=button],[type=reset],[type=submit]{-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.absolute{position:absolute}.relative{position:relative}.left-0{left:0}.top-6{top:1.5rem}.m-2{margin:.5rem}.m-4{margin:1rem}.mb-2{margin-bottom:.5rem}.mb-40{margin-bottom:10rem}.flex{display:flex}.h-screen{height:100vh}.w-full{width:100%}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.overflow-scroll{overflow:scroll}.rounded{border-radius:.25rem}.border{border-width:1px}.border-r{border-right-width:1px}.p-2{padding:.5rem}.px-4{padding-left:1rem;padding-right:1rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.pb-2{padding-bottom:.5rem}.font-bold{font-weight:700}:root{font-family:Inter,system-ui,Avenir,Helvetica,Arial,sans-serif;line-height:1.5;font-weight:400;color-scheme:light dark;color:#ffffffde;background-color:#242424;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-text-size-adjust:100%;width:100%;--k-red: #a30101;--k-darkred: #4d0c0c;--k-lightred: #dd0207;--k-petal: #e94f33;--k-lightpetal: #f0907f;--k-yellow: #e6b95e;--k-beige: #e5c4a1;--k-green: #0f6f4c;--k-darkgreen: #29322f;--k-lightgreen: #a0a271;--k-mediumgreen: #424031;--k-black: #281b13}a{font-weight:500;color:#646cff;text-decoration:inherit}a:hover{color:#535bf2}body{margin:0;display:flex;min-width:320px;min-height:100vh;color:#fff;background-color:var(--k-green)}button,[type=submit],[type=button]{padding:.6em 1.2em;font-size:1em;font-weight:500;font-family:inherit;background-color:var(--k-yellow);cursor:pointer;transition:border-color .25s}button:hover{background-color:var(--k-petal)}button:focus,button:focus-visible{outline:4px auto -webkit-focus-ring-color}h1,h2,h3,h4,h5,h6{font-weight:600}h1{font-size:3em}h2{font-size:2em}h3{font-size:1.5em}h4{font-size:1.25em}h5{font-size:1em}@keyframes colorChange{0%,to{background-color:var(--k-yellow)}50%{background-color:var(--k-red)}}.game-entry{width:calc(100% - 1em);cursor:pointer;color:#fff;background-color:var(--k-red);padding:.5em;border-radius:.25em}.game-entry.is-turn{animation:colorChange 3s infinite}.game-entry.is-turn:hover{animation:none}.game-entry.selected{background-color:var(--k-petal)}.game-entry.is-ended{background-color:#d3d3d3;color:gray}.game-entry:hover{background-color:var(--k-petal)} diff --git a/kinode/packages/chess/pkg/ui/assets/index-bc4be585.js b/kinode/packages/chess/pkg/ui/assets/index-bc4be585.js deleted file mode 100644 index ee4520de2..000000000 --- a/kinode/packages/chess/pkg/ui/assets/index-bc4be585.js +++ /dev/null @@ -1,117 +0,0 @@ -var mh = Object.defineProperty; var vh = (e, t, n) => t in e ? mh(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var ze = (e, t, n) => (vh(e, typeof t != "symbol" ? t + "" : t, n), n); (function () { const t = document.createElement("link").relList; if (t && t.supports && t.supports("modulepreload")) return; for (const i of document.querySelectorAll('link[rel="modulepreload"]')) r(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" && r(s) }).observe(document, { childList: !0, subtree: !0 }); function n(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 r(i) { if (i.ep) return; i.ep = !0; const o = n(i); fetch(i.href, o) } })(); function uc(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e } var ac = { exports: {} }, so = {}, cc = { exports: {} }, b = {};/** - * @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 Wr = Symbol.for("react.element"), yh = Symbol.for("react.portal"), Sh = Symbol.for("react.fragment"), wh = Symbol.for("react.strict_mode"), Eh = Symbol.for("react.profiler"), Ch = Symbol.for("react.provider"), kh = Symbol.for("react.context"), _h = Symbol.for("react.forward_ref"), xh = Symbol.for("react.suspense"), Oh = Symbol.for("react.memo"), Th = Symbol.for("react.lazy"), ku = Symbol.iterator; function Dh(e) { return e === null || typeof e != "object" ? null : (e = ku && e[ku] || e["@@iterator"], typeof e == "function" ? e : null) } var dc = { isMounted: function () { return !1 }, enqueueForceUpdate: function () { }, enqueueReplaceState: function () { }, enqueueSetState: function () { } }, fc = Object.assign, hc = {}; function Kn(e, t, n) { this.props = e, this.context = t, this.refs = hc, this.updater = n || dc } Kn.prototype.isReactComponent = {}; Kn.prototype.setState = function (e, t) { if (typeof e != "object" && typeof e != "function" && e != 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, e, t, "setState") }; Kn.prototype.forceUpdate = function (e) { this.updater.enqueueForceUpdate(this, e, "forceUpdate") }; function pc() { } pc.prototype = Kn.prototype; function El(e, t, n) { this.props = e, this.context = t, this.refs = hc, this.updater = n || dc } var Cl = El.prototype = new pc; Cl.constructor = El; fc(Cl, Kn.prototype); Cl.isPureReactComponent = !0; var _u = Array.isArray, gc = Object.prototype.hasOwnProperty, kl = { current: null }, mc = { key: !0, ref: !0, __self: !0, __source: !0 }; function vc(e, t, n) { var r, i = {}, o = null, s = null; if (t != null) for (r in t.ref !== void 0 && (s = t.ref), t.key !== void 0 && (o = "" + t.key), t) gc.call(t, r) && !mc.hasOwnProperty(r) && (i[r] = t[r]); var l = arguments.length - 2; if (l === 1) i.children = n; else if (1 < l) { for (var u = Array(l), a = 0; a < l; a++)u[a] = arguments[a + 2]; i.children = u } if (e && e.defaultProps) for (r in l = e.defaultProps, l) i[r] === void 0 && (i[r] = l[r]); return { $$typeof: Wr, type: e, key: o, ref: s, props: i, _owner: kl.current } } function Ph(e, t) { return { $$typeof: Wr, type: e.type, key: t, ref: e.ref, props: e.props, _owner: e._owner } } function _l(e) { return typeof e == "object" && e !== null && e.$$typeof === Wr } function Nh(e) { var t = { "=": "=0", ":": "=2" }; return "$" + e.replace(/[=:]/g, function (n) { return t[n] }) } var xu = /\/+/g; function zo(e, t) { return typeof e == "object" && e !== null && e.key != null ? Nh("" + e.key) : t.toString(36) } function wi(e, t, n, r, i) { var o = typeof e; (o === "undefined" || o === "boolean") && (e = null); var s = !1; if (e === null) s = !0; else switch (o) { case "string": case "number": s = !0; break; case "object": switch (e.$$typeof) { case Wr: case yh: s = !0 } }if (s) return s = e, i = i(s), e = r === "" ? "." + zo(s, 0) : r, _u(i) ? (n = "", e != null && (n = e.replace(xu, "$&/") + "/"), wi(i, t, n, "", function (a) { return a })) : i != null && (_l(i) && (i = Ph(i, n + (!i.key || s && s.key === i.key ? "" : ("" + i.key).replace(xu, "$&/") + "/") + e)), t.push(i)), 1; if (s = 0, r = r === "" ? "." : r + ":", _u(e)) for (var l = 0; l < e.length; l++) { o = e[l]; var u = r + zo(o, l); s += wi(o, t, n, u, i) } else if (u = Dh(e), typeof u == "function") for (e = u.call(e), l = 0; !(o = e.next()).done;)o = o.value, u = r + zo(o, l++), s += wi(o, t, n, u, i); else if (o === "object") throw t = String(e), Error("Objects are not valid as a React child (found: " + (t === "[object Object]" ? "object with keys {" + Object.keys(e).join(", ") + "}" : t) + "). If you meant to render a collection of children, use an array instead."); return s } function ei(e, t, n) { if (e == null) return e; var r = [], i = 0; return wi(e, r, "", "", function (o) { return t.call(n, o, i++) }), r } function Ih(e) { if (e._status === -1) { var t = e._result; t = t(), t.then(function (n) { (e._status === 0 || e._status === -1) && (e._status = 1, e._result = n) }, function (n) { (e._status === 0 || e._status === -1) && (e._status = 2, e._result = n) }), e._status === -1 && (e._status = 0, e._result = t) } if (e._status === 1) return e._result.default; throw e._result } var Se = { current: null }, Ei = { transition: null }, Lh = { ReactCurrentDispatcher: Se, ReactCurrentBatchConfig: Ei, ReactCurrentOwner: kl }; b.Children = { map: ei, forEach: function (e, t, n) { ei(e, function () { t.apply(this, arguments) }, n) }, count: function (e) { var t = 0; return ei(e, function () { t++ }), t }, toArray: function (e) { return ei(e, function (t) { return t }) || [] }, only: function (e) { if (!_l(e)) throw Error("React.Children.only expected to receive a single React element child."); return e } }; b.Component = Kn; b.Fragment = Sh; b.Profiler = Eh; b.PureComponent = El; b.StrictMode = wh; b.Suspense = xh; b.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Lh; b.cloneElement = function (e, t, n) { if (e == null) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + e + "."); var r = fc({}, e.props), i = e.key, o = e.ref, s = e._owner; if (t != null) { if (t.ref !== void 0 && (o = t.ref, s = kl.current), t.key !== void 0 && (i = "" + t.key), e.type && e.type.defaultProps) var l = e.type.defaultProps; for (u in t) gc.call(t, u) && !mc.hasOwnProperty(u) && (r[u] = t[u] === void 0 && l !== void 0 ? l[u] : t[u]) } var u = arguments.length - 2; if (u === 1) r.children = n; else if (1 < u) { l = Array(u); for (var a = 0; a < u; a++)l[a] = arguments[a + 2]; r.children = l } return { $$typeof: Wr, type: e.type, key: i, ref: o, props: r, _owner: s } }; b.createContext = function (e) { return e = { $$typeof: kh, _currentValue: e, _currentValue2: e, _threadCount: 0, Provider: null, Consumer: null, _defaultValue: null, _globalName: null }, e.Provider = { $$typeof: Ch, _context: e }, e.Consumer = e }; b.createElement = vc; b.createFactory = function (e) { var t = vc.bind(null, e); return t.type = e, t }; b.createRef = function () { return { current: null } }; b.forwardRef = function (e) { return { $$typeof: _h, render: e } }; b.isValidElement = _l; b.lazy = function (e) { return { $$typeof: Th, _payload: { _status: -1, _result: e }, _init: Ih } }; b.memo = function (e, t) { return { $$typeof: Oh, type: e, compare: t === void 0 ? null : t } }; b.startTransition = function (e) { var t = Ei.transition; Ei.transition = {}; try { e() } finally { Ei.transition = t } }; b.unstable_act = function () { throw Error("act(...) is not supported in production builds of React.") }; b.useCallback = function (e, t) { return Se.current.useCallback(e, t) }; b.useContext = function (e) { return Se.current.useContext(e) }; b.useDebugValue = function () { }; b.useDeferredValue = function (e) { return Se.current.useDeferredValue(e) }; b.useEffect = function (e, t) { return Se.current.useEffect(e, t) }; b.useId = function () { return Se.current.useId() }; b.useImperativeHandle = function (e, t, n) { return Se.current.useImperativeHandle(e, t, n) }; b.useInsertionEffect = function (e, t) { return Se.current.useInsertionEffect(e, t) }; b.useLayoutEffect = function (e, t) { return Se.current.useLayoutEffect(e, t) }; b.useMemo = function (e, t) { return Se.current.useMemo(e, t) }; b.useReducer = function (e, t, n) { return Se.current.useReducer(e, t, n) }; b.useRef = function (e) { return Se.current.useRef(e) }; b.useState = function (e) { return Se.current.useState(e) }; b.useSyncExternalStore = function (e, t, n) { return Se.current.useSyncExternalStore(e, t, n) }; b.useTransition = function () { return Se.current.useTransition() }; b.version = "18.2.0"; cc.exports = b; var C = cc.exports; const yc = uc(C);/** - * @license React - * react-jsx-runtime.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 jh = C, Rh = Symbol.for("react.element"), Mh = Symbol.for("react.fragment"), Ah = Object.prototype.hasOwnProperty, bh = jh.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, zh = { key: !0, ref: !0, __self: !0, __source: !0 }; function Sc(e, t, n) { var r, i = {}, o = null, s = null; n !== void 0 && (o = "" + n), t.key !== void 0 && (o = "" + t.key), t.ref !== void 0 && (s = t.ref); for (r in t) Ah.call(t, r) && !zh.hasOwnProperty(r) && (i[r] = t[r]); if (e && e.defaultProps) for (r in t = e.defaultProps, t) i[r] === void 0 && (i[r] = t[r]); return { $$typeof: Rh, type: e, key: o, ref: s, props: i, _owner: bh.current } } so.Fragment = Mh; so.jsx = Sc; so.jsxs = Sc; ac.exports = so; var S = ac.exports, Es = {}, wc = { exports: {} }, Re = {}, Ec = { exports: {} }, Cc = {};/** - * @license React - * scheduler.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. - */(function (e) { function t(D, N) { var j = D.length; D.push(N); e: for (; 0 < j;) { var H = j - 1 >>> 1, X = D[H]; if (0 < i(X, N)) D[H] = N, D[j] = X, j = H; else break e } } function n(D) { return D.length === 0 ? null : D[0] } function r(D) { if (D.length === 0) return null; var N = D[0], j = D.pop(); if (j !== N) { D[0] = j; e: for (var H = 0, X = D.length, ot = X >>> 1; H < ot;) { var A = 2 * (H + 1) - 1, ft = D[A], Ge = A + 1, vn = D[Ge]; if (0 > i(ft, j)) Ge < X && 0 > i(vn, ft) ? (D[H] = vn, D[Ge] = j, H = Ge) : (D[H] = ft, D[A] = j, H = A); else if (Ge < X && 0 > i(vn, j)) D[H] = vn, D[Ge] = j, H = Ge; else break e } } return N } function i(D, N) { var j = D.sortIndex - N.sortIndex; return j !== 0 ? j : D.id - N.id } if (typeof performance == "object" && typeof performance.now == "function") { var o = performance; e.unstable_now = function () { return o.now() } } else { var s = Date, l = s.now(); e.unstable_now = function () { return s.now() - l } } var u = [], a = [], g = 1, p = null, f = 3, y = !1, m = !1, v = !1, E = typeof setTimeout == "function" ? setTimeout : null, d = typeof clearTimeout == "function" ? clearTimeout : null, c = typeof setImmediate < "u" ? setImmediate : null; typeof navigator < "u" && navigator.scheduling !== void 0 && navigator.scheduling.isInputPending !== void 0 && navigator.scheduling.isInputPending.bind(navigator.scheduling); function h(D) { for (var N = n(a); N !== null;) { if (N.callback === null) r(a); else if (N.startTime <= D) r(a), N.sortIndex = N.expirationTime, t(u, N); else break; N = n(a) } } function w(D) { if (v = !1, h(D), !m) if (n(u) !== null) m = !0, Ee(k); else { var N = n(a); N !== null && dt(w, N.startTime - D) } } function k(D, N) { m = !1, v && (v = !1, d(T), T = -1), y = !0; var j = f; try { for (h(N), p = n(u); p !== null && (!(p.expirationTime > N) || D && !$());) { var H = p.callback; if (typeof H == "function") { p.callback = null, f = p.priorityLevel; var X = H(p.expirationTime <= N); N = e.unstable_now(), typeof X == "function" ? p.callback = X : p === n(u) && r(u), h(N) } else r(u); p = n(u) } if (p !== null) var ot = !0; else { var A = n(a); A !== null && dt(w, A.startTime - N), ot = !1 } return ot } finally { p = null, f = j, y = !1 } } var O = !1, x = null, T = -1, z = 5, M = -1; function $() { return !(e.unstable_now() - M < z) } function K() { if (x !== null) { var D = e.unstable_now(); M = D; var N = !0; try { N = x(!0, D) } finally { N ? Ae() : (O = !1, x = null) } } else O = !1 } var Ae; if (typeof c == "function") Ae = function () { c(K) }; else if (typeof MessageChannel < "u") { var be = new MessageChannel, qe = be.port2; be.port1.onmessage = K, Ae = function () { qe.postMessage(null) } } else Ae = function () { E(K, 0) }; function Ee(D) { x = D, O || (O = !0, Ae()) } function dt(D, N) { T = E(function () { D(e.unstable_now()) }, N) } e.unstable_IdlePriority = 5, e.unstable_ImmediatePriority = 1, e.unstable_LowPriority = 4, e.unstable_NormalPriority = 3, e.unstable_Profiling = null, e.unstable_UserBlockingPriority = 2, e.unstable_cancelCallback = function (D) { D.callback = null }, e.unstable_continueExecution = function () { m || y || (m = !0, Ee(k)) }, e.unstable_forceFrameRate = function (D) { 0 > D || 125 < D ? console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported") : z = 0 < D ? Math.floor(1e3 / D) : 5 }, e.unstable_getCurrentPriorityLevel = function () { return f }, e.unstable_getFirstCallbackNode = function () { return n(u) }, e.unstable_next = function (D) { switch (f) { case 1: case 2: case 3: var N = 3; break; default: N = f }var j = f; f = N; try { return D() } finally { f = j } }, e.unstable_pauseExecution = function () { }, e.unstable_requestPaint = function () { }, e.unstable_runWithPriority = function (D, N) { switch (D) { case 1: case 2: case 3: case 4: case 5: break; default: D = 3 }var j = f; f = D; try { return N() } finally { f = j } }, e.unstable_scheduleCallback = function (D, N, j) { var H = e.unstable_now(); switch (typeof j == "object" && j !== null ? (j = j.delay, j = typeof j == "number" && 0 < j ? H + j : H) : j = H, D) { case 1: var X = -1; break; case 2: X = 250; break; case 5: X = 1073741823; break; case 4: X = 1e4; break; default: X = 5e3 }return X = j + X, D = { id: g++, callback: N, priorityLevel: D, startTime: j, expirationTime: X, sortIndex: -1 }, j > H ? (D.sortIndex = j, t(a, D), n(u) === null && D === n(a) && (v ? (d(T), T = -1) : v = !0, dt(w, j - H))) : (D.sortIndex = X, t(u, D), m || y || (m = !0, Ee(k))), D }, e.unstable_shouldYield = $, e.unstable_wrapCallback = function (D) { var N = f; return function () { var j = f; f = N; try { return D.apply(this, arguments) } finally { f = j } } } })(Cc); Ec.exports = Cc; var Fh = Ec.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 kc = C, je = Fh; function _(e) { for (var t = "https://reactjs.org/docs/error-decoder.html?invariant=" + e, n = 1; n < arguments.length; n++)t += "&args[]=" + encodeURIComponent(arguments[n]); return "Minified React error #" + e + "; visit " + t + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings." } var _c = new Set, kr = {}; function pn(e, t) { Fn(e, t), Fn(e + "Capture", t) } function Fn(e, t) { for (kr[e] = t, e = 0; e < t.length; e++)_c.add(t[e]) } var St = !(typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u"), Cs = Object.prototype.hasOwnProperty, $h = /^[: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]*$/, Ou = {}, Tu = {}; function Uh(e) { return Cs.call(Tu, e) ? !0 : Cs.call(Ou, e) ? !1 : $h.test(e) ? Tu[e] = !0 : (Ou[e] = !0, !1) } function Hh(e, t, n, r) { if (n !== null && n.type === 0) return !1; switch (typeof t) { case "function": case "symbol": return !0; case "boolean": return r ? !1 : n !== null ? !n.acceptsBooleans : (e = e.toLowerCase().slice(0, 5), e !== "data-" && e !== "aria-"); default: return !1 } } function Wh(e, t, n, r) { if (t === null || typeof t > "u" || Hh(e, t, n, r)) return !0; if (r) return !1; if (n !== null) switch (n.type) { case 3: return !t; case 4: return t === !1; case 5: return isNaN(t); case 6: return isNaN(t) || 1 > t }return !1 } function we(e, t, n, r, i, o, s) { this.acceptsBooleans = t === 2 || t === 3 || t === 4, this.attributeName = r, this.attributeNamespace = i, this.mustUseProperty = n, this.propertyName = e, this.type = t, this.sanitizeURL = o, this.removeEmptyString = s } var ce = {}; "children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function (e) { ce[e] = new we(e, 0, !1, e, null, !1, !1) });[["acceptCharset", "accept-charset"], ["className", "class"], ["htmlFor", "for"], ["httpEquiv", "http-equiv"]].forEach(function (e) { var t = e[0]; ce[t] = new we(t, 1, !1, e[1], null, !1, !1) });["contentEditable", "draggable", "spellCheck", "value"].forEach(function (e) { ce[e] = new we(e, 2, !1, e.toLowerCase(), null, !1, !1) });["autoReverse", "externalResourcesRequired", "focusable", "preserveAlpha"].forEach(function (e) { ce[e] = new we(e, 2, !1, e, 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 (e) { ce[e] = new we(e, 3, !1, e.toLowerCase(), null, !1, !1) });["checked", "multiple", "muted", "selected"].forEach(function (e) { ce[e] = new we(e, 3, !0, e, null, !1, !1) });["capture", "download"].forEach(function (e) { ce[e] = new we(e, 4, !1, e, null, !1, !1) });["cols", "rows", "size", "span"].forEach(function (e) { ce[e] = new we(e, 6, !1, e, null, !1, !1) });["rowSpan", "start"].forEach(function (e) { ce[e] = new we(e, 5, !1, e.toLowerCase(), null, !1, !1) }); var xl = /[\-:]([a-z])/g; function Ol(e) { return e[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 (e) { var t = e.replace(xl, Ol); ce[t] = new we(t, 1, !1, e, null, !1, !1) }); "xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function (e) { var t = e.replace(xl, Ol); ce[t] = new we(t, 1, !1, e, "http://www.w3.org/1999/xlink", !1, !1) });["xml:base", "xml:lang", "xml:space"].forEach(function (e) { var t = e.replace(xl, Ol); ce[t] = new we(t, 1, !1, e, "http://www.w3.org/XML/1998/namespace", !1, !1) });["tabIndex", "crossOrigin"].forEach(function (e) { ce[e] = new we(e, 1, !1, e.toLowerCase(), null, !1, !1) }); ce.xlinkHref = new we("xlinkHref", 1, !1, "xlink:href", "http://www.w3.org/1999/xlink", !0, !1);["src", "href", "action", "formAction"].forEach(function (e) { ce[e] = new we(e, 1, !1, e.toLowerCase(), null, !0, !0) }); function Tl(e, t, n, r) { var i = ce.hasOwnProperty(t) ? ce[t] : null; (i !== null ? i.type !== 0 : r || !(2 < t.length) || t[0] !== "o" && t[0] !== "O" || t[1] !== "n" && t[1] !== "N") && (Wh(t, n, i, r) && (n = null), r || i === null ? Uh(t) && (n === null ? e.removeAttribute(t) : e.setAttribute(t, "" + n)) : i.mustUseProperty ? e[i.propertyName] = n === null ? i.type === 3 ? !1 : "" : n : (t = i.attributeName, r = i.attributeNamespace, n === null ? e.removeAttribute(t) : (i = i.type, n = i === 3 || i === 4 && n === !0 ? "" : "" + n, r ? e.setAttributeNS(r, t, n) : e.setAttribute(t, n)))) } var kt = kc.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, ti = Symbol.for("react.element"), En = Symbol.for("react.portal"), Cn = Symbol.for("react.fragment"), Dl = Symbol.for("react.strict_mode"), ks = Symbol.for("react.profiler"), xc = Symbol.for("react.provider"), Oc = Symbol.for("react.context"), Pl = Symbol.for("react.forward_ref"), _s = Symbol.for("react.suspense"), xs = Symbol.for("react.suspense_list"), Nl = Symbol.for("react.memo"), Nt = Symbol.for("react.lazy"), Tc = Symbol.for("react.offscreen"), Du = Symbol.iterator; function Yn(e) { return e === null || typeof e != "object" ? null : (e = Du && e[Du] || e["@@iterator"], typeof e == "function" ? e : null) } var Y = Object.assign, Fo; function lr(e) { - if (Fo === void 0) try { throw Error() } catch (n) { var t = n.stack.trim().match(/\n( *(at )?)/); Fo = t && t[1] || "" } return ` -`+ Fo + e -} var $o = !1; function Uo(e, t) { - if (!e || $o) return ""; $o = !0; var n = Error.prepareStackTrace; Error.prepareStackTrace = void 0; try { if (t) if (t = function () { throw Error() }, Object.defineProperty(t.prototype, "props", { set: function () { throw Error() } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct(t, []) } catch (a) { var r = a } Reflect.construct(e, [], t) } else { try { t.call() } catch (a) { r = a } e.call(t.prototype) } else { try { throw Error() } catch (a) { r = a } e() } } catch (a) { - if (a && r && typeof a.stack == "string") { - for (var i = a.stack.split(` -`), o = r.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 u = ` -`+ i[s].replace(" at new ", " at "); return e.displayName && u.includes("") && (u = u.replace("", e.displayName)), u - } while (1 <= s && 0 <= l); break - } - } - } finally { $o = !1, Error.prepareStackTrace = n } return (e = e ? e.displayName || e.name : "") ? lr(e) : "" -} function Bh(e) { switch (e.tag) { case 5: return lr(e.type); case 16: return lr("Lazy"); case 13: return lr("Suspense"); case 19: return lr("SuspenseList"); case 0: case 2: case 15: return e = Uo(e.type, !1), e; case 11: return e = Uo(e.type.render, !1), e; case 1: return e = Uo(e.type, !0), e; default: return "" } } function Os(e) { if (e == null) return null; if (typeof e == "function") return e.displayName || e.name || null; if (typeof e == "string") return e; switch (e) { case Cn: return "Fragment"; case En: return "Portal"; case ks: return "Profiler"; case Dl: return "StrictMode"; case _s: return "Suspense"; case xs: return "SuspenseList" }if (typeof e == "object") switch (e.$$typeof) { case Oc: return (e.displayName || "Context") + ".Consumer"; case xc: return (e._context.displayName || "Context") + ".Provider"; case Pl: var t = e.render; return e = e.displayName, e || (e = t.displayName || t.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e; case Nl: return t = e.displayName || null, t !== null ? t : Os(e.type) || "Memo"; case Nt: t = e._payload, e = e._init; try { return Os(e(t)) } catch { } }return null } function Vh(e) { var t = e.type; switch (e.tag) { case 24: return "Cache"; case 9: return (t.displayName || "Context") + ".Consumer"; case 10: return (t._context.displayName || "Context") + ".Provider"; case 18: return "DehydratedFragment"; case 11: return e = t.render, e = e.displayName || e.name || "", t.displayName || (e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"); case 7: return "Fragment"; case 5: return t; case 4: return "Portal"; case 3: return "Root"; case 6: return "Text"; case 16: return Os(t); case 8: return t === Dl ? "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 t == "function") return t.displayName || t.name || null; if (typeof t == "string") return t }return null } function Kt(e) { switch (typeof e) { case "boolean": case "number": case "string": case "undefined": return e; case "object": return e; default: return "" } } function Dc(e) { var t = e.type; return (e = e.nodeName) && e.toLowerCase() === "input" && (t === "checkbox" || t === "radio") } function Qh(e) { var t = Dc(e) ? "checked" : "value", n = Object.getOwnPropertyDescriptor(e.constructor.prototype, t), r = "" + e[t]; if (!e.hasOwnProperty(t) && typeof n < "u" && typeof n.get == "function" && typeof n.set == "function") { var i = n.get, o = n.set; return Object.defineProperty(e, t, { configurable: !0, get: function () { return i.call(this) }, set: function (s) { r = "" + s, o.call(this, s) } }), Object.defineProperty(e, t, { enumerable: n.enumerable }), { getValue: function () { return r }, setValue: function (s) { r = "" + s }, stopTracking: function () { e._valueTracker = null, delete e[t] } } } } function ni(e) { e._valueTracker || (e._valueTracker = Qh(e)) } function Pc(e) { if (!e) return !1; var t = e._valueTracker; if (!t) return !0; var n = t.getValue(), r = ""; return e && (r = Dc(e) ? e.checked ? "true" : "false" : e.value), e = r, e !== n ? (t.setValue(e), !0) : !1 } function Mi(e) { if (e = e || (typeof document < "u" ? document : void 0), typeof e > "u") return null; try { return e.activeElement || e.body } catch { return e.body } } function Ts(e, t) { var n = t.checked; return Y({}, t, { defaultChecked: void 0, defaultValue: void 0, value: void 0, checked: n ?? e._wrapperState.initialChecked }) } function Pu(e, t) { var n = t.defaultValue == null ? "" : t.defaultValue, r = t.checked != null ? t.checked : t.defaultChecked; n = Kt(t.value != null ? t.value : n), e._wrapperState = { initialChecked: r, initialValue: n, controlled: t.type === "checkbox" || t.type === "radio" ? t.checked != null : t.value != null } } function Nc(e, t) { t = t.checked, t != null && Tl(e, "checked", t, !1) } function Ds(e, t) { Nc(e, t); var n = Kt(t.value), r = t.type; if (n != null) r === "number" ? (n === 0 && e.value === "" || e.value != n) && (e.value = "" + n) : e.value !== "" + n && (e.value = "" + n); else if (r === "submit" || r === "reset") { e.removeAttribute("value"); return } t.hasOwnProperty("value") ? Ps(e, t.type, n) : t.hasOwnProperty("defaultValue") && Ps(e, t.type, Kt(t.defaultValue)), t.checked == null && t.defaultChecked != null && (e.defaultChecked = !!t.defaultChecked) } function Nu(e, t, n) { if (t.hasOwnProperty("value") || t.hasOwnProperty("defaultValue")) { var r = t.type; if (!(r !== "submit" && r !== "reset" || t.value !== void 0 && t.value !== null)) return; t = "" + e._wrapperState.initialValue, n || t === e.value || (e.value = t), e.defaultValue = t } n = e.name, n !== "" && (e.name = ""), e.defaultChecked = !!e._wrapperState.initialChecked, n !== "" && (e.name = n) } function Ps(e, t, n) { (t !== "number" || Mi(e.ownerDocument) !== e) && (n == null ? e.defaultValue = "" + e._wrapperState.initialValue : e.defaultValue !== "" + n && (e.defaultValue = "" + n)) } var ur = Array.isArray; function jn(e, t, n, r) { if (e = e.options, t) { t = {}; for (var i = 0; i < n.length; i++)t["$" + n[i]] = !0; for (n = 0; n < e.length; n++)i = t.hasOwnProperty("$" + e[n].value), e[n].selected !== i && (e[n].selected = i), i && r && (e[n].defaultSelected = !0) } else { for (n = "" + Kt(n), t = null, i = 0; i < e.length; i++) { if (e[i].value === n) { e[i].selected = !0, r && (e[i].defaultSelected = !0); return } t !== null || e[i].disabled || (t = e[i]) } t !== null && (t.selected = !0) } } function Ns(e, t) { if (t.dangerouslySetInnerHTML != null) throw Error(_(91)); return Y({}, t, { value: void 0, defaultValue: void 0, children: "" + e._wrapperState.initialValue }) } function Iu(e, t) { var n = t.value; if (n == null) { if (n = t.children, t = t.defaultValue, n != null) { if (t != null) throw Error(_(92)); if (ur(n)) { if (1 < n.length) throw Error(_(93)); n = n[0] } t = n } t == null && (t = ""), n = t } e._wrapperState = { initialValue: Kt(n) } } function Ic(e, t) { var n = Kt(t.value), r = Kt(t.defaultValue); n != null && (n = "" + n, n !== e.value && (e.value = n), t.defaultValue == null && e.defaultValue !== n && (e.defaultValue = n)), r != null && (e.defaultValue = "" + r) } function Lu(e) { var t = e.textContent; t === e._wrapperState.initialValue && t !== "" && t !== null && (e.value = t) } function Lc(e) { switch (e) { case "svg": return "http://www.w3.org/2000/svg"; case "math": return "http://www.w3.org/1998/Math/MathML"; default: return "http://www.w3.org/1999/xhtml" } } function Is(e, t) { return e == null || e === "http://www.w3.org/1999/xhtml" ? Lc(t) : e === "http://www.w3.org/2000/svg" && t === "foreignObject" ? "http://www.w3.org/1999/xhtml" : e } var ri, jc = function (e) { return typeof MSApp < "u" && MSApp.execUnsafeLocalFunction ? function (t, n, r, i) { MSApp.execUnsafeLocalFunction(function () { return e(t, n, r, i) }) } : e }(function (e, t) { if (e.namespaceURI !== "http://www.w3.org/2000/svg" || "innerHTML" in e) e.innerHTML = t; else { for (ri = ri || document.createElement("div"), ri.innerHTML = "" + t.valueOf().toString() + "", t = ri.firstChild; e.firstChild;)e.removeChild(e.firstChild); for (; t.firstChild;)e.appendChild(t.firstChild) } }); function _r(e, t) { if (t) { var n = e.firstChild; if (n && n === e.lastChild && n.nodeType === 3) { n.nodeValue = t; return } } e.textContent = t } var fr = { 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 }, Kh = ["Webkit", "ms", "Moz", "O"]; Object.keys(fr).forEach(function (e) { Kh.forEach(function (t) { t = t + e.charAt(0).toUpperCase() + e.substring(1), fr[t] = fr[e] }) }); function Rc(e, t, n) { return t == null || typeof t == "boolean" || t === "" ? "" : n || typeof t != "number" || t === 0 || fr.hasOwnProperty(e) && fr[e] ? ("" + t).trim() : t + "px" } function Mc(e, t) { e = e.style; for (var n in t) if (t.hasOwnProperty(n)) { var r = n.indexOf("--") === 0, i = Rc(n, t[n], r); n === "float" && (n = "cssFloat"), r ? e.setProperty(n, i) : e[n] = i } } var qh = Y({ 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 Ls(e, t) { if (t) { if (qh[e] && (t.children != null || t.dangerouslySetInnerHTML != null)) throw Error(_(137, e)); if (t.dangerouslySetInnerHTML != null) { if (t.children != null) throw Error(_(60)); if (typeof t.dangerouslySetInnerHTML != "object" || !("__html" in t.dangerouslySetInnerHTML)) throw Error(_(61)) } if (t.style != null && typeof t.style != "object") throw Error(_(62)) } } function js(e, t) { if (e.indexOf("-") === -1) return typeof t.is == "string"; switch (e) { 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 Rs = null; function Il(e) { return e = e.target || e.srcElement || window, e.correspondingUseElement && (e = e.correspondingUseElement), e.nodeType === 3 ? e.parentNode : e } var Ms = null, Rn = null, Mn = null; function ju(e) { if (e = Qr(e)) { if (typeof Ms != "function") throw Error(_(280)); var t = e.stateNode; t && (t = fo(t), Ms(e.stateNode, e.type, t)) } } function Ac(e) { Rn ? Mn ? Mn.push(e) : Mn = [e] : Rn = e } function bc() { if (Rn) { var e = Rn, t = Mn; if (Mn = Rn = null, ju(e), t) for (e = 0; e < t.length; e++)ju(t[e]) } } function zc(e, t) { return e(t) } function Fc() { } var Ho = !1; function $c(e, t, n) { if (Ho) return e(t, n); Ho = !0; try { return zc(e, t, n) } finally { Ho = !1, (Rn !== null || Mn !== null) && (Fc(), bc()) } } function xr(e, t) { var n = e.stateNode; if (n === null) return null; var r = fo(n); if (r === null) return null; n = r[t]; e: switch (t) { case "onClick": case "onClickCapture": case "onDoubleClick": case "onDoubleClickCapture": case "onMouseDown": case "onMouseDownCapture": case "onMouseMove": case "onMouseMoveCapture": case "onMouseUp": case "onMouseUpCapture": case "onMouseEnter": (r = !r.disabled) || (e = e.type, r = !(e === "button" || e === "input" || e === "select" || e === "textarea")), e = !r; break e; default: e = !1 }if (e) return null; if (n && typeof n != "function") throw Error(_(231, t, typeof n)); return n } var As = !1; if (St) try { var Xn = {}; Object.defineProperty(Xn, "passive", { get: function () { As = !0 } }), window.addEventListener("test", Xn, Xn), window.removeEventListener("test", Xn, Xn) } catch { As = !1 } function Gh(e, t, n, r, i, o, s, l, u) { var a = Array.prototype.slice.call(arguments, 3); try { t.apply(n, a) } catch (g) { this.onError(g) } } var hr = !1, Ai = null, bi = !1, bs = null, Yh = { onError: function (e) { hr = !0, Ai = e } }; function Xh(e, t, n, r, i, o, s, l, u) { hr = !1, Ai = null, Gh.apply(Yh, arguments) } function Jh(e, t, n, r, i, o, s, l, u) { if (Xh.apply(this, arguments), hr) { if (hr) { var a = Ai; hr = !1, Ai = null } else throw Error(_(198)); bi || (bi = !0, bs = a) } } function gn(e) { var t = e, n = e; if (e.alternate) for (; t.return;)t = t.return; else { e = t; do t = e, t.flags & 4098 && (n = t.return), e = t.return; while (e) } return t.tag === 3 ? n : null } function Uc(e) { if (e.tag === 13) { var t = e.memoizedState; if (t === null && (e = e.alternate, e !== null && (t = e.memoizedState)), t !== null) return t.dehydrated } return null } function Ru(e) { if (gn(e) !== e) throw Error(_(188)) } function Zh(e) { var t = e.alternate; if (!t) { if (t = gn(e), t === null) throw Error(_(188)); return t !== e ? null : e } for (var n = e, r = t; ;) { var i = n.return; if (i === null) break; var o = i.alternate; if (o === null) { if (r = i.return, r !== null) { n = r; continue } break } if (i.child === o.child) { for (o = i.child; o;) { if (o === n) return Ru(i), e; if (o === r) return Ru(i), t; o = o.sibling } throw Error(_(188)) } if (n.return !== r.return) n = i, r = o; else { for (var s = !1, l = i.child; l;) { if (l === n) { s = !0, n = i, r = o; break } if (l === r) { s = !0, r = i, n = o; break } l = l.sibling } if (!s) { for (l = o.child; l;) { if (l === n) { s = !0, n = o, r = i; break } if (l === r) { s = !0, r = o, n = i; break } l = l.sibling } if (!s) throw Error(_(189)) } } if (n.alternate !== r) throw Error(_(190)) } if (n.tag !== 3) throw Error(_(188)); return n.stateNode.current === n ? e : t } function Hc(e) { return e = Zh(e), e !== null ? Wc(e) : null } function Wc(e) { if (e.tag === 5 || e.tag === 6) return e; for (e = e.child; e !== null;) { var t = Wc(e); if (t !== null) return t; e = e.sibling } return null } var Bc = je.unstable_scheduleCallback, Mu = je.unstable_cancelCallback, ep = je.unstable_shouldYield, tp = je.unstable_requestPaint, Z = je.unstable_now, np = je.unstable_getCurrentPriorityLevel, Ll = je.unstable_ImmediatePriority, Vc = je.unstable_UserBlockingPriority, zi = je.unstable_NormalPriority, rp = je.unstable_LowPriority, Qc = je.unstable_IdlePriority, lo = null, at = null; function ip(e) { if (at && typeof at.onCommitFiberRoot == "function") try { at.onCommitFiberRoot(lo, e, void 0, (e.current.flags & 128) === 128) } catch { } } var nt = Math.clz32 ? Math.clz32 : lp, op = Math.log, sp = Math.LN2; function lp(e) { return e >>>= 0, e === 0 ? 32 : 31 - (op(e) / sp | 0) | 0 } var ii = 64, oi = 4194304; function ar(e) { switch (e & -e) { 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 e & 4194240; case 4194304: case 8388608: case 16777216: case 33554432: case 67108864: return e & 130023424; case 134217728: return 134217728; case 268435456: return 268435456; case 536870912: return 536870912; case 1073741824: return 1073741824; default: return e } } function Fi(e, t) { var n = e.pendingLanes; if (n === 0) return 0; var r = 0, i = e.suspendedLanes, o = e.pingedLanes, s = n & 268435455; if (s !== 0) { var l = s & ~i; l !== 0 ? r = ar(l) : (o &= s, o !== 0 && (r = ar(o))) } else s = n & ~i, s !== 0 ? r = ar(s) : o !== 0 && (r = ar(o)); if (r === 0) return 0; if (t !== 0 && t !== r && !(t & i) && (i = r & -r, o = t & -t, i >= o || i === 16 && (o & 4194240) !== 0)) return t; if (r & 4 && (r |= n & 16), t = e.entangledLanes, t !== 0) for (e = e.entanglements, t &= r; 0 < t;)n = 31 - nt(t), i = 1 << n, r |= e[n], t &= ~i; return r } function up(e, t) { switch (e) { case 1: case 2: case 4: return t + 250; case 8: case 16: case 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 + 5e3; case 4194304: case 8388608: case 16777216: case 33554432: case 67108864: return -1; case 134217728: case 268435456: case 536870912: case 1073741824: return -1; default: return -1 } } function ap(e, t) { for (var n = e.suspendedLanes, r = e.pingedLanes, i = e.expirationTimes, o = e.pendingLanes; 0 < o;) { var s = 31 - nt(o), l = 1 << s, u = i[s]; u === -1 ? (!(l & n) || l & r) && (i[s] = up(l, t)) : u <= t && (e.expiredLanes |= l), o &= ~l } } function zs(e) { return e = e.pendingLanes & -1073741825, e !== 0 ? e : e & 1073741824 ? 1073741824 : 0 } function Kc() { var e = ii; return ii <<= 1, !(ii & 4194240) && (ii = 64), e } function Wo(e) { for (var t = [], n = 0; 31 > n; n++)t.push(e); return t } function Br(e, t, n) { e.pendingLanes |= t, t !== 536870912 && (e.suspendedLanes = 0, e.pingedLanes = 0), e = e.eventTimes, t = 31 - nt(t), e[t] = n } function cp(e, t) { var n = e.pendingLanes & ~t; e.pendingLanes = t, e.suspendedLanes = 0, e.pingedLanes = 0, e.expiredLanes &= t, e.mutableReadLanes &= t, e.entangledLanes &= t, t = e.entanglements; var r = e.eventTimes; for (e = e.expirationTimes; 0 < n;) { var i = 31 - nt(n), o = 1 << i; t[i] = 0, r[i] = -1, e[i] = -1, n &= ~o } } function jl(e, t) { var n = e.entangledLanes |= t; for (e = e.entanglements; n;) { var r = 31 - nt(n), i = 1 << r; i & t | e[r] & t && (e[r] |= t), n &= ~i } } var U = 0; function qc(e) { return e &= -e, 1 < e ? 4 < e ? e & 268435455 ? 16 : 536870912 : 4 : 1 } var Gc, Rl, Yc, Xc, Jc, Fs = !1, si = [], zt = null, Ft = null, $t = null, Or = new Map, Tr = new Map, jt = [], dp = "mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" "); function Au(e, t) { switch (e) { case "focusin": case "focusout": zt = null; break; case "dragenter": case "dragleave": Ft = null; break; case "mouseover": case "mouseout": $t = null; break; case "pointerover": case "pointerout": Or.delete(t.pointerId); break; case "gotpointercapture": case "lostpointercapture": Tr.delete(t.pointerId) } } function Jn(e, t, n, r, i, o) { return e === null || e.nativeEvent !== o ? (e = { blockedOn: t, domEventName: n, eventSystemFlags: r, nativeEvent: o, targetContainers: [i] }, t !== null && (t = Qr(t), t !== null && Rl(t)), e) : (e.eventSystemFlags |= r, t = e.targetContainers, i !== null && t.indexOf(i) === -1 && t.push(i), e) } function fp(e, t, n, r, i) { switch (t) { case "focusin": return zt = Jn(zt, e, t, n, r, i), !0; case "dragenter": return Ft = Jn(Ft, e, t, n, r, i), !0; case "mouseover": return $t = Jn($t, e, t, n, r, i), !0; case "pointerover": var o = i.pointerId; return Or.set(o, Jn(Or.get(o) || null, e, t, n, r, i)), !0; case "gotpointercapture": return o = i.pointerId, Tr.set(o, Jn(Tr.get(o) || null, e, t, n, r, i)), !0 }return !1 } function Zc(e) { var t = tn(e.target); if (t !== null) { var n = gn(t); if (n !== null) { if (t = n.tag, t === 13) { if (t = Uc(n), t !== null) { e.blockedOn = t, Jc(e.priority, function () { Yc(n) }); return } } else if (t === 3 && n.stateNode.current.memoizedState.isDehydrated) { e.blockedOn = n.tag === 3 ? n.stateNode.containerInfo : null; return } } } e.blockedOn = null } function Ci(e) { if (e.blockedOn !== null) return !1; for (var t = e.targetContainers; 0 < t.length;) { var n = $s(e.domEventName, e.eventSystemFlags, t[0], e.nativeEvent); if (n === null) { n = e.nativeEvent; var r = new n.constructor(n.type, n); Rs = r, n.target.dispatchEvent(r), Rs = null } else return t = Qr(n), t !== null && Rl(t), e.blockedOn = n, !1; t.shift() } return !0 } function bu(e, t, n) { Ci(e) && n.delete(t) } function hp() { Fs = !1, zt !== null && Ci(zt) && (zt = null), Ft !== null && Ci(Ft) && (Ft = null), $t !== null && Ci($t) && ($t = null), Or.forEach(bu), Tr.forEach(bu) } function Zn(e, t) { e.blockedOn === t && (e.blockedOn = null, Fs || (Fs = !0, je.unstable_scheduleCallback(je.unstable_NormalPriority, hp))) } function Dr(e) { function t(i) { return Zn(i, e) } if (0 < si.length) { Zn(si[0], e); for (var n = 1; n < si.length; n++) { var r = si[n]; r.blockedOn === e && (r.blockedOn = null) } } for (zt !== null && Zn(zt, e), Ft !== null && Zn(Ft, e), $t !== null && Zn($t, e), Or.forEach(t), Tr.forEach(t), n = 0; n < jt.length; n++)r = jt[n], r.blockedOn === e && (r.blockedOn = null); for (; 0 < jt.length && (n = jt[0], n.blockedOn === null);)Zc(n), n.blockedOn === null && jt.shift() } var An = kt.ReactCurrentBatchConfig, $i = !0; function pp(e, t, n, r) { var i = U, o = An.transition; An.transition = null; try { U = 1, Ml(e, t, n, r) } finally { U = i, An.transition = o } } function gp(e, t, n, r) { var i = U, o = An.transition; An.transition = null; try { U = 4, Ml(e, t, n, r) } finally { U = i, An.transition = o } } function Ml(e, t, n, r) { if ($i) { var i = $s(e, t, n, r); if (i === null) Zo(e, t, r, Ui, n), Au(e, r); else if (fp(i, e, t, n, r)) r.stopPropagation(); else if (Au(e, r), t & 4 && -1 < dp.indexOf(e)) { for (; i !== null;) { var o = Qr(i); if (o !== null && Gc(o), o = $s(e, t, n, r), o === null && Zo(e, t, r, Ui, n), o === i) break; i = o } i !== null && r.stopPropagation() } else Zo(e, t, r, null, n) } } var Ui = null; function $s(e, t, n, r) { if (Ui = null, e = Il(r), e = tn(e), e !== null) if (t = gn(e), t === null) e = null; else if (n = t.tag, n === 13) { if (e = Uc(t), e !== null) return e; e = null } else if (n === 3) { if (t.stateNode.current.memoizedState.isDehydrated) return t.tag === 3 ? t.stateNode.containerInfo : null; e = null } else t !== e && (e = null); return Ui = e, null } function ed(e) { switch (e) { case "cancel": case "click": case "close": case "contextmenu": case "copy": case "cut": case "auxclick": case "dblclick": case "dragend": case "dragstart": case "drop": case "focusin": case "focusout": case "input": case "invalid": case "keydown": case "keypress": case "keyup": case "mousedown": case "mouseup": case "paste": case "pause": case "play": case "pointercancel": case "pointerdown": case "pointerup": case "ratechange": case "reset": case "resize": case "seeked": case "submit": case "touchcancel": case "touchend": case "touchstart": case "volumechange": case "change": case "selectionchange": case "textInput": case "compositionstart": case "compositionend": case "compositionupdate": case "beforeblur": case "afterblur": case "beforeinput": case "blur": case "fullscreenchange": case "focus": case "hashchange": case "popstate": case "select": case "selectstart": return 1; case "drag": case "dragenter": case "dragexit": case "dragleave": case "dragover": case "mousemove": case "mouseout": case "mouseover": case "pointermove": case "pointerout": case "pointerover": case "scroll": case "toggle": case "touchmove": case "wheel": case "mouseenter": case "mouseleave": case "pointerenter": case "pointerleave": return 4; case "message": switch (np()) { case Ll: return 1; case Vc: return 4; case zi: case rp: return 16; case Qc: return 536870912; default: return 16 }default: return 16 } } var At = null, Al = null, ki = null; function td() { if (ki) return ki; var e, t = Al, n = t.length, r, i = "value" in At ? At.value : At.textContent, o = i.length; for (e = 0; e < n && t[e] === i[e]; e++); var s = n - e; for (r = 1; r <= s && t[n - r] === i[o - r]; r++); return ki = i.slice(e, 1 < r ? 1 - r : void 0) } function _i(e) { var t = e.keyCode; return "charCode" in e ? (e = e.charCode, e === 0 && t === 13 && (e = 13)) : e = t, e === 10 && (e = 13), 32 <= e || e === 13 ? e : 0 } function li() { return !0 } function zu() { return !1 } function Me(e) { function t(n, r, i, o, s) { this._reactName = n, this._targetInst = i, this.type = r, this.nativeEvent = o, this.target = s, this.currentTarget = null; for (var l in e) e.hasOwnProperty(l) && (n = e[l], this[l] = n ? n(o) : o[l]); return this.isDefaultPrevented = (o.defaultPrevented != null ? o.defaultPrevented : o.returnValue === !1) ? li : zu, this.isPropagationStopped = zu, this } return Y(t.prototype, { preventDefault: function () { this.defaultPrevented = !0; var n = this.nativeEvent; n && (n.preventDefault ? n.preventDefault() : typeof n.returnValue != "unknown" && (n.returnValue = !1), this.isDefaultPrevented = li) }, stopPropagation: function () { var n = this.nativeEvent; n && (n.stopPropagation ? n.stopPropagation() : typeof n.cancelBubble != "unknown" && (n.cancelBubble = !0), this.isPropagationStopped = li) }, persist: function () { }, isPersistent: li }), t } var qn = { eventPhase: 0, bubbles: 0, cancelable: 0, timeStamp: function (e) { return e.timeStamp || Date.now() }, defaultPrevented: 0, isTrusted: 0 }, bl = Me(qn), Vr = Y({}, qn, { view: 0, detail: 0 }), mp = Me(Vr), Bo, Vo, er, uo = Y({}, Vr, { screenX: 0, screenY: 0, clientX: 0, clientY: 0, pageX: 0, pageY: 0, ctrlKey: 0, shiftKey: 0, altKey: 0, metaKey: 0, getModifierState: zl, button: 0, buttons: 0, relatedTarget: function (e) { return e.relatedTarget === void 0 ? e.fromElement === e.srcElement ? e.toElement : e.fromElement : e.relatedTarget }, movementX: function (e) { return "movementX" in e ? e.movementX : (e !== er && (er && e.type === "mousemove" ? (Bo = e.screenX - er.screenX, Vo = e.screenY - er.screenY) : Vo = Bo = 0, er = e), Bo) }, movementY: function (e) { return "movementY" in e ? e.movementY : Vo } }), Fu = Me(uo), vp = Y({}, uo, { dataTransfer: 0 }), yp = Me(vp), Sp = Y({}, Vr, { relatedTarget: 0 }), Qo = Me(Sp), wp = Y({}, qn, { animationName: 0, elapsedTime: 0, pseudoElement: 0 }), Ep = Me(wp), Cp = Y({}, qn, { clipboardData: function (e) { return "clipboardData" in e ? e.clipboardData : window.clipboardData } }), kp = Me(Cp), _p = Y({}, qn, { data: 0 }), $u = Me(_p), xp = { Esc: "Escape", Spacebar: " ", Left: "ArrowLeft", Up: "ArrowUp", Right: "ArrowRight", Down: "ArrowDown", Del: "Delete", Win: "OS", Menu: "ContextMenu", Apps: "ContextMenu", Scroll: "ScrollLock", MozPrintableKey: "Unidentified" }, Op = { 8: "Backspace", 9: "Tab", 12: "Clear", 13: "Enter", 16: "Shift", 17: "Control", 18: "Alt", 19: "Pause", 20: "CapsLock", 27: "Escape", 32: " ", 33: "PageUp", 34: "PageDown", 35: "End", 36: "Home", 37: "ArrowLeft", 38: "ArrowUp", 39: "ArrowRight", 40: "ArrowDown", 45: "Insert", 46: "Delete", 112: "F1", 113: "F2", 114: "F3", 115: "F4", 116: "F5", 117: "F6", 118: "F7", 119: "F8", 120: "F9", 121: "F10", 122: "F11", 123: "F12", 144: "NumLock", 145: "ScrollLock", 224: "Meta" }, Tp = { Alt: "altKey", Control: "ctrlKey", Meta: "metaKey", Shift: "shiftKey" }; function Dp(e) { var t = this.nativeEvent; return t.getModifierState ? t.getModifierState(e) : (e = Tp[e]) ? !!t[e] : !1 } function zl() { return Dp } var Pp = Y({}, Vr, { key: function (e) { if (e.key) { var t = xp[e.key] || e.key; if (t !== "Unidentified") return t } return e.type === "keypress" ? (e = _i(e), e === 13 ? "Enter" : String.fromCharCode(e)) : e.type === "keydown" || e.type === "keyup" ? Op[e.keyCode] || "Unidentified" : "" }, code: 0, location: 0, ctrlKey: 0, shiftKey: 0, altKey: 0, metaKey: 0, repeat: 0, locale: 0, getModifierState: zl, charCode: function (e) { return e.type === "keypress" ? _i(e) : 0 }, keyCode: function (e) { return e.type === "keydown" || e.type === "keyup" ? e.keyCode : 0 }, which: function (e) { return e.type === "keypress" ? _i(e) : e.type === "keydown" || e.type === "keyup" ? e.keyCode : 0 } }), Np = Me(Pp), Ip = Y({}, uo, { pointerId: 0, width: 0, height: 0, pressure: 0, tangentialPressure: 0, tiltX: 0, tiltY: 0, twist: 0, pointerType: 0, isPrimary: 0 }), Uu = Me(Ip), Lp = Y({}, Vr, { touches: 0, targetTouches: 0, changedTouches: 0, altKey: 0, metaKey: 0, ctrlKey: 0, shiftKey: 0, getModifierState: zl }), jp = Me(Lp), Rp = Y({}, qn, { propertyName: 0, elapsedTime: 0, pseudoElement: 0 }), Mp = Me(Rp), Ap = Y({}, uo, { deltaX: function (e) { return "deltaX" in e ? e.deltaX : "wheelDeltaX" in e ? -e.wheelDeltaX : 0 }, deltaY: function (e) { return "deltaY" in e ? e.deltaY : "wheelDeltaY" in e ? -e.wheelDeltaY : "wheelDelta" in e ? -e.wheelDelta : 0 }, deltaZ: 0, deltaMode: 0 }), bp = Me(Ap), zp = [9, 13, 27, 32], Fl = St && "CompositionEvent" in window, pr = null; St && "documentMode" in document && (pr = document.documentMode); var Fp = St && "TextEvent" in window && !pr, nd = St && (!Fl || pr && 8 < pr && 11 >= pr), Hu = String.fromCharCode(32), Wu = !1; function rd(e, t) { switch (e) { case "keyup": return zp.indexOf(t.keyCode) !== -1; case "keydown": return t.keyCode !== 229; case "keypress": case "mousedown": case "focusout": return !0; default: return !1 } } function id(e) { return e = e.detail, typeof e == "object" && "data" in e ? e.data : null } var kn = !1; function $p(e, t) { switch (e) { case "compositionend": return id(t); case "keypress": return t.which !== 32 ? null : (Wu = !0, Hu); case "textInput": return e = t.data, e === Hu && Wu ? null : e; default: return null } } function Up(e, t) { if (kn) return e === "compositionend" || !Fl && rd(e, t) ? (e = td(), ki = Al = At = null, kn = !1, e) : null; switch (e) { case "paste": return null; case "keypress": if (!(t.ctrlKey || t.altKey || t.metaKey) || t.ctrlKey && t.altKey) { if (t.char && 1 < t.char.length) return t.char; if (t.which) return String.fromCharCode(t.which) } return null; case "compositionend": return nd && t.locale !== "ko" ? null : t.data; default: return null } } var Hp = { color: !0, date: !0, datetime: !0, "datetime-local": !0, email: !0, month: !0, number: !0, password: !0, range: !0, search: !0, tel: !0, text: !0, time: !0, url: !0, week: !0 }; function Bu(e) { var t = e && e.nodeName && e.nodeName.toLowerCase(); return t === "input" ? !!Hp[e.type] : t === "textarea" } function od(e, t, n, r) { Ac(r), t = Hi(t, "onChange"), 0 < t.length && (n = new bl("onChange", "change", null, n, r), e.push({ event: n, listeners: t })) } var gr = null, Pr = null; function Wp(e) { md(e, 0) } function ao(e) { var t = On(e); if (Pc(t)) return e } function Bp(e, t) { if (e === "change") return t } var sd = !1; if (St) { var Ko; if (St) { var qo = "oninput" in document; if (!qo) { var Vu = document.createElement("div"); Vu.setAttribute("oninput", "return;"), qo = typeof Vu.oninput == "function" } Ko = qo } else Ko = !1; sd = Ko && (!document.documentMode || 9 < document.documentMode) } function Qu() { gr && (gr.detachEvent("onpropertychange", ld), Pr = gr = null) } function ld(e) { if (e.propertyName === "value" && ao(Pr)) { var t = []; od(t, Pr, e, Il(e)), $c(Wp, t) } } function Vp(e, t, n) { e === "focusin" ? (Qu(), gr = t, Pr = n, gr.attachEvent("onpropertychange", ld)) : e === "focusout" && Qu() } function Qp(e) { if (e === "selectionchange" || e === "keyup" || e === "keydown") return ao(Pr) } function Kp(e, t) { if (e === "click") return ao(t) } function qp(e, t) { if (e === "input" || e === "change") return ao(t) } function Gp(e, t) { return e === t && (e !== 0 || 1 / e === 1 / t) || e !== e && t !== t } var it = typeof Object.is == "function" ? Object.is : Gp; function Nr(e, t) { if (it(e, t)) return !0; if (typeof e != "object" || e === null || typeof t != "object" || t === null) return !1; var n = Object.keys(e), r = Object.keys(t); if (n.length !== r.length) return !1; for (r = 0; r < n.length; r++) { var i = n[r]; if (!Cs.call(t, i) || !it(e[i], t[i])) return !1 } return !0 } function Ku(e) { for (; e && e.firstChild;)e = e.firstChild; return e } function qu(e, t) { var n = Ku(e); e = 0; for (var r; n;) { if (n.nodeType === 3) { if (r = e + n.textContent.length, e <= t && r >= t) return { node: n, offset: t - e }; e = r } e: { for (; n;) { if (n.nextSibling) { n = n.nextSibling; break e } n = n.parentNode } n = void 0 } n = Ku(n) } } function ud(e, t) { return e && t ? e === t ? !0 : e && e.nodeType === 3 ? !1 : t && t.nodeType === 3 ? ud(e, t.parentNode) : "contains" in e ? e.contains(t) : e.compareDocumentPosition ? !!(e.compareDocumentPosition(t) & 16) : !1 : !1 } function ad() { for (var e = window, t = Mi(); t instanceof e.HTMLIFrameElement;) { try { var n = typeof t.contentWindow.location.href == "string" } catch { n = !1 } if (n) e = t.contentWindow; else break; t = Mi(e.document) } return t } function $l(e) { var t = e && e.nodeName && e.nodeName.toLowerCase(); return t && (t === "input" && (e.type === "text" || e.type === "search" || e.type === "tel" || e.type === "url" || e.type === "password") || t === "textarea" || e.contentEditable === "true") } function Yp(e) { var t = ad(), n = e.focusedElem, r = e.selectionRange; if (t !== n && n && n.ownerDocument && ud(n.ownerDocument.documentElement, n)) { if (r !== null && $l(n)) { if (t = r.start, e = r.end, e === void 0 && (e = t), "selectionStart" in n) n.selectionStart = t, n.selectionEnd = Math.min(e, n.value.length); else if (e = (t = n.ownerDocument || document) && t.defaultView || window, e.getSelection) { e = e.getSelection(); var i = n.textContent.length, o = Math.min(r.start, i); r = r.end === void 0 ? o : Math.min(r.end, i), !e.extend && o > r && (i = r, r = o, o = i), i = qu(n, o); var s = qu(n, r); i && s && (e.rangeCount !== 1 || e.anchorNode !== i.node || e.anchorOffset !== i.offset || e.focusNode !== s.node || e.focusOffset !== s.offset) && (t = t.createRange(), t.setStart(i.node, i.offset), e.removeAllRanges(), o > r ? (e.addRange(t), e.extend(s.node, s.offset)) : (t.setEnd(s.node, s.offset), e.addRange(t))) } } for (t = [], e = n; e = e.parentNode;)e.nodeType === 1 && t.push({ element: e, left: e.scrollLeft, top: e.scrollTop }); for (typeof n.focus == "function" && n.focus(), n = 0; n < t.length; n++)e = t[n], e.element.scrollLeft = e.left, e.element.scrollTop = e.top } } var Xp = St && "documentMode" in document && 11 >= document.documentMode, _n = null, Us = null, mr = null, Hs = !1; function Gu(e, t, n) { var r = n.window === n ? n.document : n.nodeType === 9 ? n : n.ownerDocument; Hs || _n == null || _n !== Mi(r) || (r = _n, "selectionStart" in r && $l(r) ? r = { start: r.selectionStart, end: r.selectionEnd } : (r = (r.ownerDocument && r.ownerDocument.defaultView || window).getSelection(), r = { anchorNode: r.anchorNode, anchorOffset: r.anchorOffset, focusNode: r.focusNode, focusOffset: r.focusOffset }), mr && Nr(mr, r) || (mr = r, r = Hi(Us, "onSelect"), 0 < r.length && (t = new bl("onSelect", "select", null, t, n), e.push({ event: t, listeners: r }), t.target = _n))) } function ui(e, t) { var n = {}; return n[e.toLowerCase()] = t.toLowerCase(), n["Webkit" + e] = "webkit" + t, n["Moz" + e] = "moz" + t, n } var xn = { animationend: ui("Animation", "AnimationEnd"), animationiteration: ui("Animation", "AnimationIteration"), animationstart: ui("Animation", "AnimationStart"), transitionend: ui("Transition", "TransitionEnd") }, Go = {}, cd = {}; St && (cd = document.createElement("div").style, "AnimationEvent" in window || (delete xn.animationend.animation, delete xn.animationiteration.animation, delete xn.animationstart.animation), "TransitionEvent" in window || delete xn.transitionend.transition); function co(e) { if (Go[e]) return Go[e]; if (!xn[e]) return e; var t = xn[e], n; for (n in t) if (t.hasOwnProperty(n) && n in cd) return Go[e] = t[n]; return e } var dd = co("animationend"), fd = co("animationiteration"), hd = co("animationstart"), pd = co("transitionend"), gd = new Map, Yu = "abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" "); function Gt(e, t) { gd.set(e, t), pn(t, [e]) } for (var Yo = 0; Yo < Yu.length; Yo++) { var Xo = Yu[Yo], Jp = Xo.toLowerCase(), Zp = Xo[0].toUpperCase() + Xo.slice(1); Gt(Jp, "on" + Zp) } Gt(dd, "onAnimationEnd"); Gt(fd, "onAnimationIteration"); Gt(hd, "onAnimationStart"); Gt("dblclick", "onDoubleClick"); Gt("focusin", "onFocus"); Gt("focusout", "onBlur"); Gt(pd, "onTransitionEnd"); Fn("onMouseEnter", ["mouseout", "mouseover"]); Fn("onMouseLeave", ["mouseout", "mouseover"]); Fn("onPointerEnter", ["pointerout", "pointerover"]); Fn("onPointerLeave", ["pointerout", "pointerover"]); pn("onChange", "change click focusin focusout input keydown keyup selectionchange".split(" ")); pn("onSelect", "focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")); pn("onBeforeInput", ["compositionend", "keypress", "textInput", "paste"]); pn("onCompositionEnd", "compositionend focusout keydown keypress keyup mousedown".split(" ")); pn("onCompositionStart", "compositionstart focusout keydown keypress keyup mousedown".split(" ")); pn("onCompositionUpdate", "compositionupdate focusout keydown keypress keyup mousedown".split(" ")); var cr = "abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "), eg = new Set("cancel close invalid load scroll toggle".split(" ").concat(cr)); function Xu(e, t, n) { var r = e.type || "unknown-event"; e.currentTarget = n, Jh(r, t, void 0, e), e.currentTarget = null } function md(e, t) { t = (t & 4) !== 0; for (var n = 0; n < e.length; n++) { var r = e[n], i = r.event; r = r.listeners; e: { var o = void 0; if (t) for (var s = r.length - 1; 0 <= s; s--) { var l = r[s], u = l.instance, a = l.currentTarget; if (l = l.listener, u !== o && i.isPropagationStopped()) break e; Xu(i, l, a), o = u } else for (s = 0; s < r.length; s++) { if (l = r[s], u = l.instance, a = l.currentTarget, l = l.listener, u !== o && i.isPropagationStopped()) break e; Xu(i, l, a), o = u } } } if (bi) throw e = bs, bi = !1, bs = null, e } function B(e, t) { var n = t[Ks]; n === void 0 && (n = t[Ks] = new Set); var r = e + "__bubble"; n.has(r) || (vd(t, e, 2, !1), n.add(r)) } function Jo(e, t, n) { var r = 0; t && (r |= 4), vd(n, e, r, t) } var ai = "_reactListening" + Math.random().toString(36).slice(2); function Ir(e) { if (!e[ai]) { e[ai] = !0, _c.forEach(function (n) { n !== "selectionchange" && (eg.has(n) || Jo(n, !1, e), Jo(n, !0, e)) }); var t = e.nodeType === 9 ? e : e.ownerDocument; t === null || t[ai] || (t[ai] = !0, Jo("selectionchange", !1, t)) } } function vd(e, t, n, r) { switch (ed(t)) { case 1: var i = pp; break; case 4: i = gp; break; default: i = Ml }n = i.bind(null, t, n, e), i = void 0, !As || t !== "touchstart" && t !== "touchmove" && t !== "wheel" || (i = !0), r ? i !== void 0 ? e.addEventListener(t, n, { capture: !0, passive: i }) : e.addEventListener(t, n, !0) : i !== void 0 ? e.addEventListener(t, n, { passive: i }) : e.addEventListener(t, n, !1) } function Zo(e, t, n, r, i) { var o = r; if (!(t & 1) && !(t & 2) && r !== null) e: for (; ;) { if (r === null) return; var s = r.tag; if (s === 3 || s === 4) { var l = r.stateNode.containerInfo; if (l === i || l.nodeType === 8 && l.parentNode === i) break; if (s === 4) for (s = r.return; s !== null;) { var u = s.tag; if ((u === 3 || u === 4) && (u = s.stateNode.containerInfo, u === i || u.nodeType === 8 && u.parentNode === i)) return; s = s.return } for (; l !== null;) { if (s = tn(l), s === null) return; if (u = s.tag, u === 5 || u === 6) { r = o = s; continue e } l = l.parentNode } } r = r.return } $c(function () { var a = o, g = Il(n), p = []; e: { var f = gd.get(e); if (f !== void 0) { var y = bl, m = e; switch (e) { case "keypress": if (_i(n) === 0) break e; case "keydown": case "keyup": y = Np; break; case "focusin": m = "focus", y = Qo; break; case "focusout": m = "blur", y = Qo; break; case "beforeblur": case "afterblur": y = Qo; break; case "click": if (n.button === 2) break e; case "auxclick": case "dblclick": case "mousedown": case "mousemove": case "mouseup": case "mouseout": case "mouseover": case "contextmenu": y = Fu; break; case "drag": case "dragend": case "dragenter": case "dragexit": case "dragleave": case "dragover": case "dragstart": case "drop": y = yp; break; case "touchcancel": case "touchend": case "touchmove": case "touchstart": y = jp; break; case dd: case fd: case hd: y = Ep; break; case pd: y = Mp; break; case "scroll": y = mp; break; case "wheel": y = bp; break; case "copy": case "cut": case "paste": y = kp; break; case "gotpointercapture": case "lostpointercapture": case "pointercancel": case "pointerdown": case "pointermove": case "pointerout": case "pointerover": case "pointerup": y = Uu }var v = (t & 4) !== 0, E = !v && e === "scroll", d = v ? f !== null ? f + "Capture" : null : f; v = []; for (var c = a, h; c !== null;) { h = c; var w = h.stateNode; if (h.tag === 5 && w !== null && (h = w, d !== null && (w = xr(c, d), w != null && v.push(Lr(c, w, h)))), E) break; c = c.return } 0 < v.length && (f = new y(f, m, null, n, g), p.push({ event: f, listeners: v })) } } if (!(t & 7)) { e: { if (f = e === "mouseover" || e === "pointerover", y = e === "mouseout" || e === "pointerout", f && n !== Rs && (m = n.relatedTarget || n.fromElement) && (tn(m) || m[wt])) break e; if ((y || f) && (f = g.window === g ? g : (f = g.ownerDocument) ? f.defaultView || f.parentWindow : window, y ? (m = n.relatedTarget || n.toElement, y = a, m = m ? tn(m) : null, m !== null && (E = gn(m), m !== E || m.tag !== 5 && m.tag !== 6) && (m = null)) : (y = null, m = a), y !== m)) { if (v = Fu, w = "onMouseLeave", d = "onMouseEnter", c = "mouse", (e === "pointerout" || e === "pointerover") && (v = Uu, w = "onPointerLeave", d = "onPointerEnter", c = "pointer"), E = y == null ? f : On(y), h = m == null ? f : On(m), f = new v(w, c + "leave", y, n, g), f.target = E, f.relatedTarget = h, w = null, tn(g) === a && (v = new v(d, c + "enter", m, n, g), v.target = h, v.relatedTarget = E, w = v), E = w, y && m) t: { for (v = y, d = m, c = 0, h = v; h; h = Sn(h))c++; for (h = 0, w = d; w; w = Sn(w))h++; for (; 0 < c - h;)v = Sn(v), c--; for (; 0 < h - c;)d = Sn(d), h--; for (; c--;) { if (v === d || d !== null && v === d.alternate) break t; v = Sn(v), d = Sn(d) } v = null } else v = null; y !== null && Ju(p, f, y, v, !1), m !== null && E !== null && Ju(p, E, m, v, !0) } } e: { if (f = a ? On(a) : window, y = f.nodeName && f.nodeName.toLowerCase(), y === "select" || y === "input" && f.type === "file") var k = Bp; else if (Bu(f)) if (sd) k = qp; else { k = Qp; var O = Vp } else (y = f.nodeName) && y.toLowerCase() === "input" && (f.type === "checkbox" || f.type === "radio") && (k = Kp); if (k && (k = k(e, a))) { od(p, k, n, g); break e } O && O(e, f, a), e === "focusout" && (O = f._wrapperState) && O.controlled && f.type === "number" && Ps(f, "number", f.value) } switch (O = a ? On(a) : window, e) { case "focusin": (Bu(O) || O.contentEditable === "true") && (_n = O, Us = a, mr = null); break; case "focusout": mr = Us = _n = null; break; case "mousedown": Hs = !0; break; case "contextmenu": case "mouseup": case "dragend": Hs = !1, Gu(p, n, g); break; case "selectionchange": if (Xp) break; case "keydown": case "keyup": Gu(p, n, g) }var x; if (Fl) e: { switch (e) { case "compositionstart": var T = "onCompositionStart"; break e; case "compositionend": T = "onCompositionEnd"; break e; case "compositionupdate": T = "onCompositionUpdate"; break e }T = void 0 } else kn ? rd(e, n) && (T = "onCompositionEnd") : e === "keydown" && n.keyCode === 229 && (T = "onCompositionStart"); T && (nd && n.locale !== "ko" && (kn || T !== "onCompositionStart" ? T === "onCompositionEnd" && kn && (x = td()) : (At = g, Al = "value" in At ? At.value : At.textContent, kn = !0)), O = Hi(a, T), 0 < O.length && (T = new $u(T, e, null, n, g), p.push({ event: T, listeners: O }), x ? T.data = x : (x = id(n), x !== null && (T.data = x)))), (x = Fp ? $p(e, n) : Up(e, n)) && (a = Hi(a, "onBeforeInput"), 0 < a.length && (g = new $u("onBeforeInput", "beforeinput", null, n, g), p.push({ event: g, listeners: a }), g.data = x)) } md(p, t) }) } function Lr(e, t, n) { return { instance: e, listener: t, currentTarget: n } } function Hi(e, t) { for (var n = t + "Capture", r = []; e !== null;) { var i = e, o = i.stateNode; i.tag === 5 && o !== null && (i = o, o = xr(e, n), o != null && r.unshift(Lr(e, o, i)), o = xr(e, t), o != null && r.push(Lr(e, o, i))), e = e.return } return r } function Sn(e) { if (e === null) return null; do e = e.return; while (e && e.tag !== 5); return e || null } function Ju(e, t, n, r, i) { for (var o = t._reactName, s = []; n !== null && n !== r;) { var l = n, u = l.alternate, a = l.stateNode; if (u !== null && u === r) break; l.tag === 5 && a !== null && (l = a, i ? (u = xr(n, o), u != null && s.unshift(Lr(n, u, l))) : i || (u = xr(n, o), u != null && s.push(Lr(n, u, l)))), n = n.return } s.length !== 0 && e.push({ event: t, listeners: s }) } var tg = /\r\n?/g, ng = /\u0000|\uFFFD/g; function Zu(e) { - return (typeof e == "string" ? e : "" + e).replace(tg, ` -`).replace(ng, "") -} function ci(e, t, n) { if (t = Zu(t), Zu(e) !== t && n) throw Error(_(425)) } function Wi() { } var Ws = null, Bs = null; function Vs(e, t) { return e === "textarea" || e === "noscript" || typeof t.children == "string" || typeof t.children == "number" || typeof t.dangerouslySetInnerHTML == "object" && t.dangerouslySetInnerHTML !== null && t.dangerouslySetInnerHTML.__html != null } var Qs = typeof setTimeout == "function" ? setTimeout : void 0, rg = typeof clearTimeout == "function" ? clearTimeout : void 0, ea = typeof Promise == "function" ? Promise : void 0, ig = typeof queueMicrotask == "function" ? queueMicrotask : typeof ea < "u" ? function (e) { return ea.resolve(null).then(e).catch(og) } : Qs; function og(e) { setTimeout(function () { throw e }) } function es(e, t) { var n = t, r = 0; do { var i = n.nextSibling; if (e.removeChild(n), i && i.nodeType === 8) if (n = i.data, n === "/$") { if (r === 0) { e.removeChild(i), Dr(t); return } r-- } else n !== "$" && n !== "$?" && n !== "$!" || r++; n = i } while (n); Dr(t) } function Ut(e) { for (; e != null; e = e.nextSibling) { var t = e.nodeType; if (t === 1 || t === 3) break; if (t === 8) { if (t = e.data, t === "$" || t === "$!" || t === "$?") break; if (t === "/$") return null } } return e } function ta(e) { e = e.previousSibling; for (var t = 0; e;) { if (e.nodeType === 8) { var n = e.data; if (n === "$" || n === "$!" || n === "$?") { if (t === 0) return e; t-- } else n === "/$" && t++ } e = e.previousSibling } return null } var Gn = Math.random().toString(36).slice(2), ut = "__reactFiber$" + Gn, jr = "__reactProps$" + Gn, wt = "__reactContainer$" + Gn, Ks = "__reactEvents$" + Gn, sg = "__reactListeners$" + Gn, lg = "__reactHandles$" + Gn; function tn(e) { var t = e[ut]; if (t) return t; for (var n = e.parentNode; n;) { if (t = n[wt] || n[ut]) { if (n = t.alternate, t.child !== null || n !== null && n.child !== null) for (e = ta(e); e !== null;) { if (n = e[ut]) return n; e = ta(e) } return t } e = n, n = e.parentNode } return null } function Qr(e) { return e = e[ut] || e[wt], !e || e.tag !== 5 && e.tag !== 6 && e.tag !== 13 && e.tag !== 3 ? null : e } function On(e) { if (e.tag === 5 || e.tag === 6) return e.stateNode; throw Error(_(33)) } function fo(e) { return e[jr] || null } var qs = [], Tn = -1; function Yt(e) { return { current: e } } function V(e) { 0 > Tn || (e.current = qs[Tn], qs[Tn] = null, Tn--) } function W(e, t) { Tn++, qs[Tn] = e.current, e.current = t } var qt = {}, me = Yt(qt), xe = Yt(!1), un = qt; function $n(e, t) { var n = e.type.contextTypes; if (!n) return qt; var r = e.stateNode; if (r && r.__reactInternalMemoizedUnmaskedChildContext === t) return r.__reactInternalMemoizedMaskedChildContext; var i = {}, o; for (o in n) i[o] = t[o]; return r && (e = e.stateNode, e.__reactInternalMemoizedUnmaskedChildContext = t, e.__reactInternalMemoizedMaskedChildContext = i), i } function Oe(e) { return e = e.childContextTypes, e != null } function Bi() { V(xe), V(me) } function na(e, t, n) { if (me.current !== qt) throw Error(_(168)); W(me, t), W(xe, n) } function yd(e, t, n) { var r = e.stateNode; if (t = t.childContextTypes, typeof r.getChildContext != "function") return n; r = r.getChildContext(); for (var i in r) if (!(i in t)) throw Error(_(108, Vh(e) || "Unknown", i)); return Y({}, n, r) } function Vi(e) { return e = (e = e.stateNode) && e.__reactInternalMemoizedMergedChildContext || qt, un = me.current, W(me, e), W(xe, xe.current), !0 } function ra(e, t, n) { var r = e.stateNode; if (!r) throw Error(_(169)); n ? (e = yd(e, t, un), r.__reactInternalMemoizedMergedChildContext = e, V(xe), V(me), W(me, e)) : V(xe), W(xe, n) } var gt = null, ho = !1, ts = !1; function Sd(e) { gt === null ? gt = [e] : gt.push(e) } function ug(e) { ho = !0, Sd(e) } function Xt() { if (!ts && gt !== null) { ts = !0; var e = 0, t = U; try { var n = gt; for (U = 1; e < n.length; e++) { var r = n[e]; do r = r(!0); while (r !== null) } gt = null, ho = !1 } catch (i) { throw gt !== null && (gt = gt.slice(e + 1)), Bc(Ll, Xt), i } finally { U = t, ts = !1 } } return null } var Dn = [], Pn = 0, Qi = null, Ki = 0, Ue = [], He = 0, an = null, mt = 1, vt = ""; function Zt(e, t) { Dn[Pn++] = Ki, Dn[Pn++] = Qi, Qi = e, Ki = t } function wd(e, t, n) { Ue[He++] = mt, Ue[He++] = vt, Ue[He++] = an, an = e; var r = mt; e = vt; var i = 32 - nt(r) - 1; r &= ~(1 << i), n += 1; var o = 32 - nt(t) + i; if (30 < o) { var s = i - i % 5; o = (r & (1 << s) - 1).toString(32), r >>= s, i -= s, mt = 1 << 32 - nt(t) + i | n << i | r, vt = o + e } else mt = 1 << o | n << i | r, vt = e } function Ul(e) { e.return !== null && (Zt(e, 1), wd(e, 1, 0)) } function Hl(e) { for (; e === Qi;)Qi = Dn[--Pn], Dn[Pn] = null, Ki = Dn[--Pn], Dn[Pn] = null; for (; e === an;)an = Ue[--He], Ue[He] = null, vt = Ue[--He], Ue[He] = null, mt = Ue[--He], Ue[He] = null } var Le = null, Ie = null, Q = !1, tt = null; function Ed(e, t) { var n = Be(5, null, null, 0); n.elementType = "DELETED", n.stateNode = t, n.return = e, t = e.deletions, t === null ? (e.deletions = [n], e.flags |= 16) : t.push(n) } function ia(e, t) { switch (e.tag) { case 5: var n = e.type; return t = t.nodeType !== 1 || n.toLowerCase() !== t.nodeName.toLowerCase() ? null : t, t !== null ? (e.stateNode = t, Le = e, Ie = Ut(t.firstChild), !0) : !1; case 6: return t = e.pendingProps === "" || t.nodeType !== 3 ? null : t, t !== null ? (e.stateNode = t, Le = e, Ie = null, !0) : !1; case 13: return t = t.nodeType !== 8 ? null : t, t !== null ? (n = an !== null ? { id: mt, overflow: vt } : null, e.memoizedState = { dehydrated: t, treeContext: n, retryLane: 1073741824 }, n = Be(18, null, null, 0), n.stateNode = t, n.return = e, e.child = n, Le = e, Ie = null, !0) : !1; default: return !1 } } function Gs(e) { return (e.mode & 1) !== 0 && (e.flags & 128) === 0 } function Ys(e) { if (Q) { var t = Ie; if (t) { var n = t; if (!ia(e, t)) { if (Gs(e)) throw Error(_(418)); t = Ut(n.nextSibling); var r = Le; t && ia(e, t) ? Ed(r, n) : (e.flags = e.flags & -4097 | 2, Q = !1, Le = e) } } else { if (Gs(e)) throw Error(_(418)); e.flags = e.flags & -4097 | 2, Q = !1, Le = e } } } function oa(e) { for (e = e.return; e !== null && e.tag !== 5 && e.tag !== 3 && e.tag !== 13;)e = e.return; Le = e } function di(e) { if (e !== Le) return !1; if (!Q) return oa(e), Q = !0, !1; var t; if ((t = e.tag !== 3) && !(t = e.tag !== 5) && (t = e.type, t = t !== "head" && t !== "body" && !Vs(e.type, e.memoizedProps)), t && (t = Ie)) { if (Gs(e)) throw Cd(), Error(_(418)); for (; t;)Ed(e, t), t = Ut(t.nextSibling) } if (oa(e), e.tag === 13) { if (e = e.memoizedState, e = e !== null ? e.dehydrated : null, !e) throw Error(_(317)); e: { for (e = e.nextSibling, t = 0; e;) { if (e.nodeType === 8) { var n = e.data; if (n === "/$") { if (t === 0) { Ie = Ut(e.nextSibling); break e } t-- } else n !== "$" && n !== "$!" && n !== "$?" || t++ } e = e.nextSibling } Ie = null } } else Ie = Le ? Ut(e.stateNode.nextSibling) : null; return !0 } function Cd() { for (var e = Ie; e;)e = Ut(e.nextSibling) } function Un() { Ie = Le = null, Q = !1 } function Wl(e) { tt === null ? tt = [e] : tt.push(e) } var ag = kt.ReactCurrentBatchConfig; function Ze(e, t) { if (e && e.defaultProps) { t = Y({}, t), e = e.defaultProps; for (var n in e) t[n] === void 0 && (t[n] = e[n]); return t } return t } var qi = Yt(null), Gi = null, Nn = null, Bl = null; function Vl() { Bl = Nn = Gi = null } function Ql(e) { var t = qi.current; V(qi), e._currentValue = t } function Xs(e, t, n) { for (; e !== null;) { var r = e.alternate; if ((e.childLanes & t) !== t ? (e.childLanes |= t, r !== null && (r.childLanes |= t)) : r !== null && (r.childLanes & t) !== t && (r.childLanes |= t), e === n) break; e = e.return } } function bn(e, t) { Gi = e, Bl = Nn = null, e = e.dependencies, e !== null && e.firstContext !== null && (e.lanes & t && (_e = !0), e.firstContext = null) } function Qe(e) { var t = e._currentValue; if (Bl !== e) if (e = { context: e, memoizedValue: t, next: null }, Nn === null) { if (Gi === null) throw Error(_(308)); Nn = e, Gi.dependencies = { lanes: 0, firstContext: e } } else Nn = Nn.next = e; return t } var nn = null; function Kl(e) { nn === null ? nn = [e] : nn.push(e) } function kd(e, t, n, r) { var i = t.interleaved; return i === null ? (n.next = n, Kl(t)) : (n.next = i.next, i.next = n), t.interleaved = n, Et(e, r) } function Et(e, t) { e.lanes |= t; var n = e.alternate; for (n !== null && (n.lanes |= t), n = e, e = e.return; e !== null;)e.childLanes |= t, n = e.alternate, n !== null && (n.childLanes |= t), n = e, e = e.return; return n.tag === 3 ? n.stateNode : null } var It = !1; function ql(e) { e.updateQueue = { baseState: e.memoizedState, firstBaseUpdate: null, lastBaseUpdate: null, shared: { pending: null, interleaved: null, lanes: 0 }, effects: null } } function _d(e, t) { e = e.updateQueue, t.updateQueue === e && (t.updateQueue = { baseState: e.baseState, firstBaseUpdate: e.firstBaseUpdate, lastBaseUpdate: e.lastBaseUpdate, shared: e.shared, effects: e.effects }) } function yt(e, t) { return { eventTime: e, lane: t, tag: 0, payload: null, callback: null, next: null } } function Ht(e, t, n) { var r = e.updateQueue; if (r === null) return null; if (r = r.shared, F & 2) { var i = r.pending; return i === null ? t.next = t : (t.next = i.next, i.next = t), r.pending = t, Et(e, n) } return i = r.interleaved, i === null ? (t.next = t, Kl(r)) : (t.next = i.next, i.next = t), r.interleaved = t, Et(e, n) } function xi(e, t, n) { if (t = t.updateQueue, t !== null && (t = t.shared, (n & 4194240) !== 0)) { var r = t.lanes; r &= e.pendingLanes, n |= r, t.lanes = n, jl(e, n) } } function sa(e, t) { var n = e.updateQueue, r = e.alternate; if (r !== null && (r = r.updateQueue, n === r)) { var i = null, o = null; if (n = n.firstBaseUpdate, n !== null) { do { var s = { eventTime: n.eventTime, lane: n.lane, tag: n.tag, payload: n.payload, callback: n.callback, next: null }; o === null ? i = o = s : o = o.next = s, n = n.next } while (n !== null); o === null ? i = o = t : o = o.next = t } else i = o = t; n = { baseState: r.baseState, firstBaseUpdate: i, lastBaseUpdate: o, shared: r.shared, effects: r.effects }, e.updateQueue = n; return } e = n.lastBaseUpdate, e === null ? n.firstBaseUpdate = t : e.next = t, n.lastBaseUpdate = t } function Yi(e, t, n, r) { var i = e.updateQueue; It = !1; var o = i.firstBaseUpdate, s = i.lastBaseUpdate, l = i.shared.pending; if (l !== null) { i.shared.pending = null; var u = l, a = u.next; u.next = null, s === null ? o = a : s.next = a, s = u; var g = e.alternate; g !== null && (g = g.updateQueue, l = g.lastBaseUpdate, l !== s && (l === null ? g.firstBaseUpdate = a : l.next = a, g.lastBaseUpdate = u)) } if (o !== null) { var p = i.baseState; s = 0, g = a = u = null, l = o; do { var f = l.lane, y = l.eventTime; if ((r & f) === f) { g !== null && (g = g.next = { eventTime: y, lane: 0, tag: l.tag, payload: l.payload, callback: l.callback, next: null }); e: { var m = e, v = l; switch (f = t, y = n, v.tag) { case 1: if (m = v.payload, typeof m == "function") { p = m.call(y, p, f); break e } p = m; break e; case 3: m.flags = m.flags & -65537 | 128; case 0: if (m = v.payload, f = typeof m == "function" ? m.call(y, p, f) : m, f == null) break e; p = Y({}, p, f); break e; case 2: It = !0 } } l.callback !== null && l.lane !== 0 && (e.flags |= 64, f = i.effects, f === null ? i.effects = [l] : f.push(l)) } else y = { eventTime: y, lane: f, tag: l.tag, payload: l.payload, callback: l.callback, next: null }, g === null ? (a = g = y, u = p) : g = g.next = y, s |= f; if (l = l.next, l === null) { if (l = i.shared.pending, l === null) break; f = l, l = f.next, f.next = null, i.lastBaseUpdate = f, i.shared.pending = null } } while (1); if (g === null && (u = p), i.baseState = u, i.firstBaseUpdate = a, i.lastBaseUpdate = g, t = i.shared.interleaved, t !== null) { i = t; do s |= i.lane, i = i.next; while (i !== t) } else o === null && (i.shared.lanes = 0); dn |= s, e.lanes = s, e.memoizedState = p } } function la(e, t, n) { if (e = t.effects, t.effects = null, e !== null) for (t = 0; t < e.length; t++) { var r = e[t], i = r.callback; if (i !== null) { if (r.callback = null, r = n, typeof i != "function") throw Error(_(191, i)); i.call(r) } } } var xd = new kc.Component().refs; function Js(e, t, n, r) { t = e.memoizedState, n = n(r, t), n = n == null ? t : Y({}, t, n), e.memoizedState = n, e.lanes === 0 && (e.updateQueue.baseState = n) } var po = { isMounted: function (e) { return (e = e._reactInternals) ? gn(e) === e : !1 }, enqueueSetState: function (e, t, n) { e = e._reactInternals; var r = ye(), i = Bt(e), o = yt(r, i); o.payload = t, n != null && (o.callback = n), t = Ht(e, o, i), t !== null && (rt(t, e, i, r), xi(t, e, i)) }, enqueueReplaceState: function (e, t, n) { e = e._reactInternals; var r = ye(), i = Bt(e), o = yt(r, i); o.tag = 1, o.payload = t, n != null && (o.callback = n), t = Ht(e, o, i), t !== null && (rt(t, e, i, r), xi(t, e, i)) }, enqueueForceUpdate: function (e, t) { e = e._reactInternals; var n = ye(), r = Bt(e), i = yt(n, r); i.tag = 2, t != null && (i.callback = t), t = Ht(e, i, r), t !== null && (rt(t, e, r, n), xi(t, e, r)) } }; function ua(e, t, n, r, i, o, s) { return e = e.stateNode, typeof e.shouldComponentUpdate == "function" ? e.shouldComponentUpdate(r, o, s) : t.prototype && t.prototype.isPureReactComponent ? !Nr(n, r) || !Nr(i, o) : !0 } function Od(e, t, n) { var r = !1, i = qt, o = t.contextType; return typeof o == "object" && o !== null ? o = Qe(o) : (i = Oe(t) ? un : me.current, r = t.contextTypes, o = (r = r != null) ? $n(e, i) : qt), t = new t(n, o), e.memoizedState = t.state !== null && t.state !== void 0 ? t.state : null, t.updater = po, e.stateNode = t, t._reactInternals = e, r && (e = e.stateNode, e.__reactInternalMemoizedUnmaskedChildContext = i, e.__reactInternalMemoizedMaskedChildContext = o), t } function aa(e, t, n, r) { e = t.state, typeof t.componentWillReceiveProps == "function" && t.componentWillReceiveProps(n, r), typeof t.UNSAFE_componentWillReceiveProps == "function" && t.UNSAFE_componentWillReceiveProps(n, r), t.state !== e && po.enqueueReplaceState(t, t.state, null) } function Zs(e, t, n, r) { var i = e.stateNode; i.props = n, i.state = e.memoizedState, i.refs = xd, ql(e); var o = t.contextType; typeof o == "object" && o !== null ? i.context = Qe(o) : (o = Oe(t) ? un : me.current, i.context = $n(e, o)), i.state = e.memoizedState, o = t.getDerivedStateFromProps, typeof o == "function" && (Js(e, t, o, n), i.state = e.memoizedState), typeof t.getDerivedStateFromProps == "function" || typeof i.getSnapshotBeforeUpdate == "function" || typeof i.UNSAFE_componentWillMount != "function" && typeof i.componentWillMount != "function" || (t = i.state, typeof i.componentWillMount == "function" && i.componentWillMount(), typeof i.UNSAFE_componentWillMount == "function" && i.UNSAFE_componentWillMount(), t !== i.state && po.enqueueReplaceState(i, i.state, null), Yi(e, n, i, r), i.state = e.memoizedState), typeof i.componentDidMount == "function" && (e.flags |= 4194308) } function tr(e, t, n) { if (e = n.ref, e !== null && typeof e != "function" && typeof e != "object") { if (n._owner) { if (n = n._owner, n) { if (n.tag !== 1) throw Error(_(309)); var r = n.stateNode } if (!r) throw Error(_(147, e)); var i = r, o = "" + e; return t !== null && t.ref !== null && typeof t.ref == "function" && t.ref._stringRef === o ? t.ref : (t = function (s) { var l = i.refs; l === xd && (l = i.refs = {}), s === null ? delete l[o] : l[o] = s }, t._stringRef = o, t) } if (typeof e != "string") throw Error(_(284)); if (!n._owner) throw Error(_(290, e)) } return e } function fi(e, t) { throw e = Object.prototype.toString.call(t), Error(_(31, e === "[object Object]" ? "object with keys {" + Object.keys(t).join(", ") + "}" : e)) } function ca(e) { var t = e._init; return t(e._payload) } function Td(e) { function t(d, c) { if (e) { var h = d.deletions; h === null ? (d.deletions = [c], d.flags |= 16) : h.push(c) } } function n(d, c) { if (!e) return null; for (; c !== null;)t(d, c), c = c.sibling; return null } function r(d, c) { for (d = new Map; c !== null;)c.key !== null ? d.set(c.key, c) : d.set(c.index, c), c = c.sibling; return d } function i(d, c) { return d = Vt(d, c), d.index = 0, d.sibling = null, d } function o(d, c, h) { return d.index = h, e ? (h = d.alternate, h !== null ? (h = h.index, h < c ? (d.flags |= 2, c) : h) : (d.flags |= 2, c)) : (d.flags |= 1048576, c) } function s(d) { return e && d.alternate === null && (d.flags |= 2), d } function l(d, c, h, w) { return c === null || c.tag !== 6 ? (c = us(h, d.mode, w), c.return = d, c) : (c = i(c, h), c.return = d, c) } function u(d, c, h, w) { var k = h.type; return k === Cn ? g(d, c, h.props.children, w, h.key) : c !== null && (c.elementType === k || typeof k == "object" && k !== null && k.$$typeof === Nt && ca(k) === c.type) ? (w = i(c, h.props), w.ref = tr(d, c, h), w.return = d, w) : (w = Ii(h.type, h.key, h.props, null, d.mode, w), w.ref = tr(d, c, h), w.return = d, w) } function a(d, c, h, w) { return c === null || c.tag !== 4 || c.stateNode.containerInfo !== h.containerInfo || c.stateNode.implementation !== h.implementation ? (c = as(h, d.mode, w), c.return = d, c) : (c = i(c, h.children || []), c.return = d, c) } function g(d, c, h, w, k) { return c === null || c.tag !== 7 ? (c = sn(h, d.mode, w, k), c.return = d, c) : (c = i(c, h), c.return = d, c) } function p(d, c, h) { if (typeof c == "string" && c !== "" || typeof c == "number") return c = us("" + c, d.mode, h), c.return = d, c; if (typeof c == "object" && c !== null) { switch (c.$$typeof) { case ti: return h = Ii(c.type, c.key, c.props, null, d.mode, h), h.ref = tr(d, null, c), h.return = d, h; case En: return c = as(c, d.mode, h), c.return = d, c; case Nt: var w = c._init; return p(d, w(c._payload), h) }if (ur(c) || Yn(c)) return c = sn(c, d.mode, h, null), c.return = d, c; fi(d, c) } return null } function f(d, c, h, w) { var k = c !== null ? c.key : null; if (typeof h == "string" && h !== "" || typeof h == "number") return k !== null ? null : l(d, c, "" + h, w); if (typeof h == "object" && h !== null) { switch (h.$$typeof) { case ti: return h.key === k ? u(d, c, h, w) : null; case En: return h.key === k ? a(d, c, h, w) : null; case Nt: return k = h._init, f(d, c, k(h._payload), w) }if (ur(h) || Yn(h)) return k !== null ? null : g(d, c, h, w, null); fi(d, h) } return null } function y(d, c, h, w, k) { if (typeof w == "string" && w !== "" || typeof w == "number") return d = d.get(h) || null, l(c, d, "" + w, k); if (typeof w == "object" && w !== null) { switch (w.$$typeof) { case ti: return d = d.get(w.key === null ? h : w.key) || null, u(c, d, w, k); case En: return d = d.get(w.key === null ? h : w.key) || null, a(c, d, w, k); case Nt: var O = w._init; return y(d, c, h, O(w._payload), k) }if (ur(w) || Yn(w)) return d = d.get(h) || null, g(c, d, w, k, null); fi(c, w) } return null } function m(d, c, h, w) { for (var k = null, O = null, x = c, T = c = 0, z = null; x !== null && T < h.length; T++) { x.index > T ? (z = x, x = null) : z = x.sibling; var M = f(d, x, h[T], w); if (M === null) { x === null && (x = z); break } e && x && M.alternate === null && t(d, x), c = o(M, c, T), O === null ? k = M : O.sibling = M, O = M, x = z } if (T === h.length) return n(d, x), Q && Zt(d, T), k; if (x === null) { for (; T < h.length; T++)x = p(d, h[T], w), x !== null && (c = o(x, c, T), O === null ? k = x : O.sibling = x, O = x); return Q && Zt(d, T), k } for (x = r(d, x); T < h.length; T++)z = y(x, d, T, h[T], w), z !== null && (e && z.alternate !== null && x.delete(z.key === null ? T : z.key), c = o(z, c, T), O === null ? k = z : O.sibling = z, O = z); return e && x.forEach(function ($) { return t(d, $) }), Q && Zt(d, T), k } function v(d, c, h, w) { var k = Yn(h); if (typeof k != "function") throw Error(_(150)); if (h = k.call(h), h == null) throw Error(_(151)); for (var O = k = null, x = c, T = c = 0, z = null, M = h.next(); x !== null && !M.done; T++, M = h.next()) { x.index > T ? (z = x, x = null) : z = x.sibling; var $ = f(d, x, M.value, w); if ($ === null) { x === null && (x = z); break } e && x && $.alternate === null && t(d, x), c = o($, c, T), O === null ? k = $ : O.sibling = $, O = $, x = z } if (M.done) return n(d, x), Q && Zt(d, T), k; if (x === null) { for (; !M.done; T++, M = h.next())M = p(d, M.value, w), M !== null && (c = o(M, c, T), O === null ? k = M : O.sibling = M, O = M); return Q && Zt(d, T), k } for (x = r(d, x); !M.done; T++, M = h.next())M = y(x, d, T, M.value, w), M !== null && (e && M.alternate !== null && x.delete(M.key === null ? T : M.key), c = o(M, c, T), O === null ? k = M : O.sibling = M, O = M); return e && x.forEach(function (K) { return t(d, K) }), Q && Zt(d, T), k } function E(d, c, h, w) { if (typeof h == "object" && h !== null && h.type === Cn && h.key === null && (h = h.props.children), typeof h == "object" && h !== null) { switch (h.$$typeof) { case ti: e: { for (var k = h.key, O = c; O !== null;) { if (O.key === k) { if (k = h.type, k === Cn) { if (O.tag === 7) { n(d, O.sibling), c = i(O, h.props.children), c.return = d, d = c; break e } } else if (O.elementType === k || typeof k == "object" && k !== null && k.$$typeof === Nt && ca(k) === O.type) { n(d, O.sibling), c = i(O, h.props), c.ref = tr(d, O, h), c.return = d, d = c; break e } n(d, O); break } else t(d, O); O = O.sibling } h.type === Cn ? (c = sn(h.props.children, d.mode, w, h.key), c.return = d, d = c) : (w = Ii(h.type, h.key, h.props, null, d.mode, w), w.ref = tr(d, c, h), w.return = d, d = w) } return s(d); case En: e: { for (O = h.key; c !== null;) { if (c.key === O) if (c.tag === 4 && c.stateNode.containerInfo === h.containerInfo && c.stateNode.implementation === h.implementation) { n(d, c.sibling), c = i(c, h.children || []), c.return = d, d = c; break e } else { n(d, c); break } else t(d, c); c = c.sibling } c = as(h, d.mode, w), c.return = d, d = c } return s(d); case Nt: return O = h._init, E(d, c, O(h._payload), w) }if (ur(h)) return m(d, c, h, w); if (Yn(h)) return v(d, c, h, w); fi(d, h) } return typeof h == "string" && h !== "" || typeof h == "number" ? (h = "" + h, c !== null && c.tag === 6 ? (n(d, c.sibling), c = i(c, h), c.return = d, d = c) : (n(d, c), c = us(h, d.mode, w), c.return = d, d = c), s(d)) : n(d, c) } return E } var Hn = Td(!0), Dd = Td(!1), Kr = {}, ct = Yt(Kr), Rr = Yt(Kr), Mr = Yt(Kr); function rn(e) { if (e === Kr) throw Error(_(174)); return e } function Gl(e, t) { switch (W(Mr, t), W(Rr, e), W(ct, Kr), e = t.nodeType, e) { case 9: case 11: t = (t = t.documentElement) ? t.namespaceURI : Is(null, ""); break; default: e = e === 8 ? t.parentNode : t, t = e.namespaceURI || null, e = e.tagName, t = Is(t, e) }V(ct), W(ct, t) } function Wn() { V(ct), V(Rr), V(Mr) } function Pd(e) { rn(Mr.current); var t = rn(ct.current), n = Is(t, e.type); t !== n && (W(Rr, e), W(ct, n)) } function Yl(e) { Rr.current === e && (V(ct), V(Rr)) } var q = Yt(0); function Xi(e) { for (var t = e; t !== null;) { if (t.tag === 13) { var n = t.memoizedState; if (n !== null && (n = n.dehydrated, n === null || n.data === "$?" || n.data === "$!")) return t } else if (t.tag === 19 && t.memoizedProps.revealOrder !== void 0) { if (t.flags & 128) return t } else if (t.child !== null) { t.child.return = t, t = t.child; continue } if (t === e) break; for (; t.sibling === null;) { if (t.return === null || t.return === e) return null; t = t.return } t.sibling.return = t.return, t = t.sibling } return null } var ns = []; function Xl() { for (var e = 0; e < ns.length; e++)ns[e]._workInProgressVersionPrimary = null; ns.length = 0 } var Oi = kt.ReactCurrentDispatcher, rs = kt.ReactCurrentBatchConfig, cn = 0, G = null, re = null, se = null, Ji = !1, vr = !1, Ar = 0, cg = 0; function fe() { throw Error(_(321)) } function Jl(e, t) { if (t === null) return !1; for (var n = 0; n < t.length && n < e.length; n++)if (!it(e[n], t[n])) return !1; return !0 } function Zl(e, t, n, r, i, o) { if (cn = o, G = t, t.memoizedState = null, t.updateQueue = null, t.lanes = 0, Oi.current = e === null || e.memoizedState === null ? pg : gg, e = n(r, i), vr) { o = 0; do { if (vr = !1, Ar = 0, 25 <= o) throw Error(_(301)); o += 1, se = re = null, t.updateQueue = null, Oi.current = mg, e = n(r, i) } while (vr) } if (Oi.current = Zi, t = re !== null && re.next !== null, cn = 0, se = re = G = null, Ji = !1, t) throw Error(_(300)); return e } function eu() { var e = Ar !== 0; return Ar = 0, e } function lt() { var e = { memoizedState: null, baseState: null, baseQueue: null, queue: null, next: null }; return se === null ? G.memoizedState = se = e : se = se.next = e, se } function Ke() { if (re === null) { var e = G.alternate; e = e !== null ? e.memoizedState : null } else e = re.next; var t = se === null ? G.memoizedState : se.next; if (t !== null) se = t, re = e; else { if (e === null) throw Error(_(310)); re = e, e = { memoizedState: re.memoizedState, baseState: re.baseState, baseQueue: re.baseQueue, queue: re.queue, next: null }, se === null ? G.memoizedState = se = e : se = se.next = e } return se } function br(e, t) { return typeof t == "function" ? t(e) : t } function is(e) { var t = Ke(), n = t.queue; if (n === null) throw Error(_(311)); n.lastRenderedReducer = e; var r = re, i = r.baseQueue, o = n.pending; if (o !== null) { if (i !== null) { var s = i.next; i.next = o.next, o.next = s } r.baseQueue = i = o, n.pending = null } if (i !== null) { o = i.next, r = r.baseState; var l = s = null, u = null, a = o; do { var g = a.lane; if ((cn & g) === g) u !== null && (u = u.next = { lane: 0, action: a.action, hasEagerState: a.hasEagerState, eagerState: a.eagerState, next: null }), r = a.hasEagerState ? a.eagerState : e(r, a.action); else { var p = { lane: g, action: a.action, hasEagerState: a.hasEagerState, eagerState: a.eagerState, next: null }; u === null ? (l = u = p, s = r) : u = u.next = p, G.lanes |= g, dn |= g } a = a.next } while (a !== null && a !== o); u === null ? s = r : u.next = l, it(r, t.memoizedState) || (_e = !0), t.memoizedState = r, t.baseState = s, t.baseQueue = u, n.lastRenderedState = r } if (e = n.interleaved, e !== null) { i = e; do o = i.lane, G.lanes |= o, dn |= o, i = i.next; while (i !== e) } else i === null && (n.lanes = 0); return [t.memoizedState, n.dispatch] } function os(e) { var t = Ke(), n = t.queue; if (n === null) throw Error(_(311)); n.lastRenderedReducer = e; var r = n.dispatch, i = n.pending, o = t.memoizedState; if (i !== null) { n.pending = null; var s = i = i.next; do o = e(o, s.action), s = s.next; while (s !== i); it(o, t.memoizedState) || (_e = !0), t.memoizedState = o, t.baseQueue === null && (t.baseState = o), n.lastRenderedState = o } return [o, r] } function Nd() { } function Id(e, t) { var n = G, r = Ke(), i = t(), o = !it(r.memoizedState, i); if (o && (r.memoizedState = i, _e = !0), r = r.queue, tu(Rd.bind(null, n, r, e), [e]), r.getSnapshot !== t || o || se !== null && se.memoizedState.tag & 1) { if (n.flags |= 2048, zr(9, jd.bind(null, n, r, i, t), void 0, null), le === null) throw Error(_(349)); cn & 30 || Ld(n, t, i) } return i } function Ld(e, t, n) { e.flags |= 16384, e = { getSnapshot: t, value: n }, t = G.updateQueue, t === null ? (t = { lastEffect: null, stores: null }, G.updateQueue = t, t.stores = [e]) : (n = t.stores, n === null ? t.stores = [e] : n.push(e)) } function jd(e, t, n, r) { t.value = n, t.getSnapshot = r, Md(t) && Ad(e) } function Rd(e, t, n) { return n(function () { Md(t) && Ad(e) }) } function Md(e) { var t = e.getSnapshot; e = e.value; try { var n = t(); return !it(e, n) } catch { return !0 } } function Ad(e) { var t = Et(e, 1); t !== null && rt(t, e, 1, -1) } function da(e) { var t = lt(); return typeof e == "function" && (e = e()), t.memoizedState = t.baseState = e, e = { pending: null, interleaved: null, lanes: 0, dispatch: null, lastRenderedReducer: br, lastRenderedState: e }, t.queue = e, e = e.dispatch = hg.bind(null, G, e), [t.memoizedState, e] } function zr(e, t, n, r) { return e = { tag: e, create: t, destroy: n, deps: r, next: null }, t = G.updateQueue, t === null ? (t = { lastEffect: null, stores: null }, G.updateQueue = t, t.lastEffect = e.next = e) : (n = t.lastEffect, n === null ? t.lastEffect = e.next = e : (r = n.next, n.next = e, e.next = r, t.lastEffect = e)), e } function bd() { return Ke().memoizedState } function Ti(e, t, n, r) { var i = lt(); G.flags |= e, i.memoizedState = zr(1 | t, n, void 0, r === void 0 ? null : r) } function go(e, t, n, r) { var i = Ke(); r = r === void 0 ? null : r; var o = void 0; if (re !== null) { var s = re.memoizedState; if (o = s.destroy, r !== null && Jl(r, s.deps)) { i.memoizedState = zr(t, n, o, r); return } } G.flags |= e, i.memoizedState = zr(1 | t, n, o, r) } function fa(e, t) { return Ti(8390656, 8, e, t) } function tu(e, t) { return go(2048, 8, e, t) } function zd(e, t) { return go(4, 2, e, t) } function Fd(e, t) { return go(4, 4, e, t) } function $d(e, t) { if (typeof t == "function") return e = e(), t(e), function () { t(null) }; if (t != null) return e = e(), t.current = e, function () { t.current = null } } function Ud(e, t, n) { return n = n != null ? n.concat([e]) : null, go(4, 4, $d.bind(null, t, e), n) } function nu() { } function Hd(e, t) { var n = Ke(); t = t === void 0 ? null : t; var r = n.memoizedState; return r !== null && t !== null && Jl(t, r[1]) ? r[0] : (n.memoizedState = [e, t], e) } function Wd(e, t) { var n = Ke(); t = t === void 0 ? null : t; var r = n.memoizedState; return r !== null && t !== null && Jl(t, r[1]) ? r[0] : (e = e(), n.memoizedState = [e, t], e) } function Bd(e, t, n) { return cn & 21 ? (it(n, t) || (n = Kc(), G.lanes |= n, dn |= n, e.baseState = !0), t) : (e.baseState && (e.baseState = !1, _e = !0), e.memoizedState = n) } function dg(e, t) { var n = U; U = n !== 0 && 4 > n ? n : 4, e(!0); var r = rs.transition; rs.transition = {}; try { e(!1), t() } finally { U = n, rs.transition = r } } function Vd() { return Ke().memoizedState } function fg(e, t, n) { var r = Bt(e); if (n = { lane: r, action: n, hasEagerState: !1, eagerState: null, next: null }, Qd(e)) Kd(t, n); else if (n = kd(e, t, n, r), n !== null) { var i = ye(); rt(n, e, r, i), qd(n, t, r) } } function hg(e, t, n) { var r = Bt(e), i = { lane: r, action: n, hasEagerState: !1, eagerState: null, next: null }; if (Qd(e)) Kd(t, i); else { var o = e.alternate; if (e.lanes === 0 && (o === null || o.lanes === 0) && (o = t.lastRenderedReducer, o !== null)) try { var s = t.lastRenderedState, l = o(s, n); if (i.hasEagerState = !0, i.eagerState = l, it(l, s)) { var u = t.interleaved; u === null ? (i.next = i, Kl(t)) : (i.next = u.next, u.next = i), t.interleaved = i; return } } catch { } finally { } n = kd(e, t, i, r), n !== null && (i = ye(), rt(n, e, r, i), qd(n, t, r)) } } function Qd(e) { var t = e.alternate; return e === G || t !== null && t === G } function Kd(e, t) { vr = Ji = !0; var n = e.pending; n === null ? t.next = t : (t.next = n.next, n.next = t), e.pending = t } function qd(e, t, n) { if (n & 4194240) { var r = t.lanes; r &= e.pendingLanes, n |= r, t.lanes = n, jl(e, n) } } var Zi = { readContext: Qe, useCallback: fe, useContext: fe, useEffect: fe, useImperativeHandle: fe, useInsertionEffect: fe, useLayoutEffect: fe, useMemo: fe, useReducer: fe, useRef: fe, useState: fe, useDebugValue: fe, useDeferredValue: fe, useTransition: fe, useMutableSource: fe, useSyncExternalStore: fe, useId: fe, unstable_isNewReconciler: !1 }, pg = { readContext: Qe, useCallback: function (e, t) { return lt().memoizedState = [e, t === void 0 ? null : t], e }, useContext: Qe, useEffect: fa, useImperativeHandle: function (e, t, n) { return n = n != null ? n.concat([e]) : null, Ti(4194308, 4, $d.bind(null, t, e), n) }, useLayoutEffect: function (e, t) { return Ti(4194308, 4, e, t) }, useInsertionEffect: function (e, t) { return Ti(4, 2, e, t) }, useMemo: function (e, t) { var n = lt(); return t = t === void 0 ? null : t, e = e(), n.memoizedState = [e, t], e }, useReducer: function (e, t, n) { var r = lt(); return t = n !== void 0 ? n(t) : t, r.memoizedState = r.baseState = t, e = { pending: null, interleaved: null, lanes: 0, dispatch: null, lastRenderedReducer: e, lastRenderedState: t }, r.queue = e, e = e.dispatch = fg.bind(null, G, e), [r.memoizedState, e] }, useRef: function (e) { var t = lt(); return e = { current: e }, t.memoizedState = e }, useState: da, useDebugValue: nu, useDeferredValue: function (e) { return lt().memoizedState = e }, useTransition: function () { var e = da(!1), t = e[0]; return e = dg.bind(null, e[1]), lt().memoizedState = e, [t, e] }, useMutableSource: function () { }, useSyncExternalStore: function (e, t, n) { var r = G, i = lt(); if (Q) { if (n === void 0) throw Error(_(407)); n = n() } else { if (n = t(), le === null) throw Error(_(349)); cn & 30 || Ld(r, t, n) } i.memoizedState = n; var o = { value: n, getSnapshot: t }; return i.queue = o, fa(Rd.bind(null, r, o, e), [e]), r.flags |= 2048, zr(9, jd.bind(null, r, o, n, t), void 0, null), n }, useId: function () { var e = lt(), t = le.identifierPrefix; if (Q) { var n = vt, r = mt; n = (r & ~(1 << 32 - nt(r) - 1)).toString(32) + n, t = ":" + t + "R" + n, n = Ar++, 0 < n && (t += "H" + n.toString(32)), t += ":" } else n = cg++, t = ":" + t + "r" + n.toString(32) + ":"; return e.memoizedState = t }, unstable_isNewReconciler: !1 }, gg = { readContext: Qe, useCallback: Hd, useContext: Qe, useEffect: tu, useImperativeHandle: Ud, useInsertionEffect: zd, useLayoutEffect: Fd, useMemo: Wd, useReducer: is, useRef: bd, useState: function () { return is(br) }, useDebugValue: nu, useDeferredValue: function (e) { var t = Ke(); return Bd(t, re.memoizedState, e) }, useTransition: function () { var e = is(br)[0], t = Ke().memoizedState; return [e, t] }, useMutableSource: Nd, useSyncExternalStore: Id, useId: Vd, unstable_isNewReconciler: !1 }, mg = { readContext: Qe, useCallback: Hd, useContext: Qe, useEffect: tu, useImperativeHandle: Ud, useInsertionEffect: zd, useLayoutEffect: Fd, useMemo: Wd, useReducer: os, useRef: bd, useState: function () { return os(br) }, useDebugValue: nu, useDeferredValue: function (e) { var t = Ke(); return re === null ? t.memoizedState = e : Bd(t, re.memoizedState, e) }, useTransition: function () { var e = os(br)[0], t = Ke().memoizedState; return [e, t] }, useMutableSource: Nd, useSyncExternalStore: Id, useId: Vd, unstable_isNewReconciler: !1 }; function Bn(e, t) { - try { var n = "", r = t; do n += Bh(r), r = r.return; while (r); var i = n } catch (o) { - i = ` -Error generating stack: `+ o.message + ` -`+ o.stack - } return { value: e, source: t, stack: i, digest: null } -} function ss(e, t, n) { return { value: e, source: null, stack: n ?? null, digest: t ?? null } } function el(e, t) { try { console.error(t.value) } catch (n) { setTimeout(function () { throw n }) } } var vg = typeof WeakMap == "function" ? WeakMap : Map; function Gd(e, t, n) { n = yt(-1, n), n.tag = 3, n.payload = { element: null }; var r = t.value; return n.callback = function () { to || (to = !0, cl = r), el(e, t) }, n } function Yd(e, t, n) { n = yt(-1, n), n.tag = 3; var r = e.type.getDerivedStateFromError; if (typeof r == "function") { var i = t.value; n.payload = function () { return r(i) }, n.callback = function () { el(e, t) } } var o = e.stateNode; return o !== null && typeof o.componentDidCatch == "function" && (n.callback = function () { el(e, t), typeof r != "function" && (Wt === null ? Wt = new Set([this]) : Wt.add(this)); var s = t.stack; this.componentDidCatch(t.value, { componentStack: s !== null ? s : "" }) }), n } function ha(e, t, n) { var r = e.pingCache; if (r === null) { r = e.pingCache = new vg; var i = new Set; r.set(t, i) } else i = r.get(t), i === void 0 && (i = new Set, r.set(t, i)); i.has(n) || (i.add(n), e = Ig.bind(null, e, t, n), t.then(e, e)) } function pa(e) { do { var t; if ((t = e.tag === 13) && (t = e.memoizedState, t = t !== null ? t.dehydrated !== null : !0), t) return e; e = e.return } while (e !== null); return null } function ga(e, t, n, r, i) { return e.mode & 1 ? (e.flags |= 65536, e.lanes = i, e) : (e === t ? e.flags |= 65536 : (e.flags |= 128, n.flags |= 131072, n.flags &= -52805, n.tag === 1 && (n.alternate === null ? n.tag = 17 : (t = yt(-1, 1), t.tag = 2, Ht(n, t, 1))), n.lanes |= 1), e) } var yg = kt.ReactCurrentOwner, _e = !1; function ve(e, t, n, r) { t.child = e === null ? Dd(t, null, n, r) : Hn(t, e.child, n, r) } function ma(e, t, n, r, i) { n = n.render; var o = t.ref; return bn(t, i), r = Zl(e, t, n, r, o, i), n = eu(), e !== null && !_e ? (t.updateQueue = e.updateQueue, t.flags &= -2053, e.lanes &= ~i, Ct(e, t, i)) : (Q && n && Ul(t), t.flags |= 1, ve(e, t, r, i), t.child) } function va(e, t, n, r, i) { if (e === null) { var o = n.type; return typeof o == "function" && !cu(o) && o.defaultProps === void 0 && n.compare === null && n.defaultProps === void 0 ? (t.tag = 15, t.type = o, Xd(e, t, o, r, i)) : (e = Ii(n.type, null, r, t, t.mode, i), e.ref = t.ref, e.return = t, t.child = e) } if (o = e.child, !(e.lanes & i)) { var s = o.memoizedProps; if (n = n.compare, n = n !== null ? n : Nr, n(s, r) && e.ref === t.ref) return Ct(e, t, i) } return t.flags |= 1, e = Vt(o, r), e.ref = t.ref, e.return = t, t.child = e } function Xd(e, t, n, r, i) { if (e !== null) { var o = e.memoizedProps; if (Nr(o, r) && e.ref === t.ref) if (_e = !1, t.pendingProps = r = o, (e.lanes & i) !== 0) e.flags & 131072 && (_e = !0); else return t.lanes = e.lanes, Ct(e, t, i) } return tl(e, t, n, r, i) } function Jd(e, t, n) { var r = t.pendingProps, i = r.children, o = e !== null ? e.memoizedState : null; if (r.mode === "hidden") if (!(t.mode & 1)) t.memoizedState = { baseLanes: 0, cachePool: null, transitions: null }, W(Ln, Ne), Ne |= n; else { if (!(n & 1073741824)) return e = o !== null ? o.baseLanes | n : n, t.lanes = t.childLanes = 1073741824, t.memoizedState = { baseLanes: e, cachePool: null, transitions: null }, t.updateQueue = null, W(Ln, Ne), Ne |= e, null; t.memoizedState = { baseLanes: 0, cachePool: null, transitions: null }, r = o !== null ? o.baseLanes : n, W(Ln, Ne), Ne |= r } else o !== null ? (r = o.baseLanes | n, t.memoizedState = null) : r = n, W(Ln, Ne), Ne |= r; return ve(e, t, i, n), t.child } function Zd(e, t) { var n = t.ref; (e === null && n !== null || e !== null && e.ref !== n) && (t.flags |= 512, t.flags |= 2097152) } function tl(e, t, n, r, i) { var o = Oe(n) ? un : me.current; return o = $n(t, o), bn(t, i), n = Zl(e, t, n, r, o, i), r = eu(), e !== null && !_e ? (t.updateQueue = e.updateQueue, t.flags &= -2053, e.lanes &= ~i, Ct(e, t, i)) : (Q && r && Ul(t), t.flags |= 1, ve(e, t, n, i), t.child) } function ya(e, t, n, r, i) { if (Oe(n)) { var o = !0; Vi(t) } else o = !1; if (bn(t, i), t.stateNode === null) Di(e, t), Od(t, n, r), Zs(t, n, r, i), r = !0; else if (e === null) { var s = t.stateNode, l = t.memoizedProps; s.props = l; var u = s.context, a = n.contextType; typeof a == "object" && a !== null ? a = Qe(a) : (a = Oe(n) ? un : me.current, a = $n(t, a)); var g = n.getDerivedStateFromProps, p = typeof g == "function" || typeof s.getSnapshotBeforeUpdate == "function"; p || typeof s.UNSAFE_componentWillReceiveProps != "function" && typeof s.componentWillReceiveProps != "function" || (l !== r || u !== a) && aa(t, s, r, a), It = !1; var f = t.memoizedState; s.state = f, Yi(t, r, s, i), u = t.memoizedState, l !== r || f !== u || xe.current || It ? (typeof g == "function" && (Js(t, n, g, r), u = t.memoizedState), (l = It || ua(t, n, l, r, f, u, a)) ? (p || 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" && (t.flags |= 4194308)) : (typeof s.componentDidMount == "function" && (t.flags |= 4194308), t.memoizedProps = r, t.memoizedState = u), s.props = r, s.state = u, s.context = a, r = l) : (typeof s.componentDidMount == "function" && (t.flags |= 4194308), r = !1) } else { s = t.stateNode, _d(e, t), l = t.memoizedProps, a = t.type === t.elementType ? l : Ze(t.type, l), s.props = a, p = t.pendingProps, f = s.context, u = n.contextType, typeof u == "object" && u !== null ? u = Qe(u) : (u = Oe(n) ? un : me.current, u = $n(t, u)); var y = n.getDerivedStateFromProps; (g = typeof y == "function" || typeof s.getSnapshotBeforeUpdate == "function") || typeof s.UNSAFE_componentWillReceiveProps != "function" && typeof s.componentWillReceiveProps != "function" || (l !== p || f !== u) && aa(t, s, r, u), It = !1, f = t.memoizedState, s.state = f, Yi(t, r, s, i); var m = t.memoizedState; l !== p || f !== m || xe.current || It ? (typeof y == "function" && (Js(t, n, y, r), m = t.memoizedState), (a = It || ua(t, n, a, r, f, m, u) || !1) ? (g || typeof s.UNSAFE_componentWillUpdate != "function" && typeof s.componentWillUpdate != "function" || (typeof s.componentWillUpdate == "function" && s.componentWillUpdate(r, m, u), typeof s.UNSAFE_componentWillUpdate == "function" && s.UNSAFE_componentWillUpdate(r, m, u)), typeof s.componentDidUpdate == "function" && (t.flags |= 4), typeof s.getSnapshotBeforeUpdate == "function" && (t.flags |= 1024)) : (typeof s.componentDidUpdate != "function" || l === e.memoizedProps && f === e.memoizedState || (t.flags |= 4), typeof s.getSnapshotBeforeUpdate != "function" || l === e.memoizedProps && f === e.memoizedState || (t.flags |= 1024), t.memoizedProps = r, t.memoizedState = m), s.props = r, s.state = m, s.context = u, r = a) : (typeof s.componentDidUpdate != "function" || l === e.memoizedProps && f === e.memoizedState || (t.flags |= 4), typeof s.getSnapshotBeforeUpdate != "function" || l === e.memoizedProps && f === e.memoizedState || (t.flags |= 1024), r = !1) } return nl(e, t, n, r, o, i) } function nl(e, t, n, r, i, o) { Zd(e, t); var s = (t.flags & 128) !== 0; if (!r && !s) return i && ra(t, n, !1), Ct(e, t, o); r = t.stateNode, yg.current = t; var l = s && typeof n.getDerivedStateFromError != "function" ? null : r.render(); return t.flags |= 1, e !== null && s ? (t.child = Hn(t, e.child, null, o), t.child = Hn(t, null, l, o)) : ve(e, t, l, o), t.memoizedState = r.state, i && ra(t, n, !0), t.child } function ef(e) { var t = e.stateNode; t.pendingContext ? na(e, t.pendingContext, t.pendingContext !== t.context) : t.context && na(e, t.context, !1), Gl(e, t.containerInfo) } function Sa(e, t, n, r, i) { return Un(), Wl(i), t.flags |= 256, ve(e, t, n, r), t.child } var rl = { dehydrated: null, treeContext: null, retryLane: 0 }; function il(e) { return { baseLanes: e, cachePool: null, transitions: null } } function tf(e, t, n) { var r = t.pendingProps, i = q.current, o = !1, s = (t.flags & 128) !== 0, l; if ((l = s) || (l = e !== null && e.memoizedState === null ? !1 : (i & 2) !== 0), l ? (o = !0, t.flags &= -129) : (e === null || e.memoizedState !== null) && (i |= 1), W(q, i & 1), e === null) return Ys(t), e = t.memoizedState, e !== null && (e = e.dehydrated, e !== null) ? (t.mode & 1 ? e.data === "$!" ? t.lanes = 8 : t.lanes = 1073741824 : t.lanes = 1, null) : (s = r.children, e = r.fallback, o ? (r = t.mode, o = t.child, s = { mode: "hidden", children: s }, !(r & 1) && o !== null ? (o.childLanes = 0, o.pendingProps = s) : o = yo(s, r, 0, null), e = sn(e, r, n, null), o.return = t, e.return = t, o.sibling = e, t.child = o, t.child.memoizedState = il(n), t.memoizedState = rl, e) : ru(t, s)); if (i = e.memoizedState, i !== null && (l = i.dehydrated, l !== null)) return Sg(e, t, s, r, l, i, n); if (o) { o = r.fallback, s = t.mode, i = e.child, l = i.sibling; var u = { mode: "hidden", children: r.children }; return !(s & 1) && t.child !== i ? (r = t.child, r.childLanes = 0, r.pendingProps = u, t.deletions = null) : (r = Vt(i, u), r.subtreeFlags = i.subtreeFlags & 14680064), l !== null ? o = Vt(l, o) : (o = sn(o, s, n, null), o.flags |= 2), o.return = t, r.return = t, r.sibling = o, t.child = r, r = o, o = t.child, s = e.child.memoizedState, s = s === null ? il(n) : { baseLanes: s.baseLanes | n, cachePool: null, transitions: s.transitions }, o.memoizedState = s, o.childLanes = e.childLanes & ~n, t.memoizedState = rl, r } return o = e.child, e = o.sibling, r = Vt(o, { mode: "visible", children: r.children }), !(t.mode & 1) && (r.lanes = n), r.return = t, r.sibling = null, e !== null && (n = t.deletions, n === null ? (t.deletions = [e], t.flags |= 16) : n.push(e)), t.child = r, t.memoizedState = null, r } function ru(e, t) { return t = yo({ mode: "visible", children: t }, e.mode, 0, null), t.return = e, e.child = t } function hi(e, t, n, r) { return r !== null && Wl(r), Hn(t, e.child, null, n), e = ru(t, t.pendingProps.children), e.flags |= 2, t.memoizedState = null, e } function Sg(e, t, n, r, i, o, s) { if (n) return t.flags & 256 ? (t.flags &= -257, r = ss(Error(_(422))), hi(e, t, s, r)) : t.memoizedState !== null ? (t.child = e.child, t.flags |= 128, null) : (o = r.fallback, i = t.mode, r = yo({ mode: "visible", children: r.children }, i, 0, null), o = sn(o, i, s, null), o.flags |= 2, r.return = t, o.return = t, r.sibling = o, t.child = r, t.mode & 1 && Hn(t, e.child, null, s), t.child.memoizedState = il(s), t.memoizedState = rl, o); if (!(t.mode & 1)) return hi(e, t, s, null); if (i.data === "$!") { if (r = i.nextSibling && i.nextSibling.dataset, r) var l = r.dgst; return r = l, o = Error(_(419)), r = ss(o, r, void 0), hi(e, t, s, r) } if (l = (s & e.childLanes) !== 0, _e || l) { if (r = le, r !== 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 & (r.suspendedLanes | s) ? 0 : i, i !== 0 && i !== o.retryLane && (o.retryLane = i, Et(e, i), rt(r, e, i, -1)) } return au(), r = ss(Error(_(421))), hi(e, t, s, r) } return i.data === "$?" ? (t.flags |= 128, t.child = e.child, t = Lg.bind(null, e), i._reactRetry = t, null) : (e = o.treeContext, Ie = Ut(i.nextSibling), Le = t, Q = !0, tt = null, e !== null && (Ue[He++] = mt, Ue[He++] = vt, Ue[He++] = an, mt = e.id, vt = e.overflow, an = t), t = ru(t, r.children), t.flags |= 4096, t) } function wa(e, t, n) { e.lanes |= t; var r = e.alternate; r !== null && (r.lanes |= t), Xs(e.return, t, n) } function ls(e, t, n, r, i) { var o = e.memoizedState; o === null ? e.memoizedState = { isBackwards: t, rendering: null, renderingStartTime: 0, last: r, tail: n, tailMode: i } : (o.isBackwards = t, o.rendering = null, o.renderingStartTime = 0, o.last = r, o.tail = n, o.tailMode = i) } function nf(e, t, n) { var r = t.pendingProps, i = r.revealOrder, o = r.tail; if (ve(e, t, r.children, n), r = q.current, r & 2) r = r & 1 | 2, t.flags |= 128; else { if (e !== null && e.flags & 128) e: for (e = t.child; e !== null;) { if (e.tag === 13) e.memoizedState !== null && wa(e, n, t); else if (e.tag === 19) wa(e, n, t); else if (e.child !== null) { e.child.return = e, e = e.child; continue } if (e === t) break e; for (; e.sibling === null;) { if (e.return === null || e.return === t) break e; e = e.return } e.sibling.return = e.return, e = e.sibling } r &= 1 } if (W(q, r), !(t.mode & 1)) t.memoizedState = null; else switch (i) { case "forwards": for (n = t.child, i = null; n !== null;)e = n.alternate, e !== null && Xi(e) === null && (i = n), n = n.sibling; n = i, n === null ? (i = t.child, t.child = null) : (i = n.sibling, n.sibling = null), ls(t, !1, i, n, o); break; case "backwards": for (n = null, i = t.child, t.child = null; i !== null;) { if (e = i.alternate, e !== null && Xi(e) === null) { t.child = i; break } e = i.sibling, i.sibling = n, n = i, i = e } ls(t, !0, n, null, o); break; case "together": ls(t, !1, null, null, void 0); break; default: t.memoizedState = null }return t.child } function Di(e, t) { !(t.mode & 1) && e !== null && (e.alternate = null, t.alternate = null, t.flags |= 2) } function Ct(e, t, n) { if (e !== null && (t.dependencies = e.dependencies), dn |= t.lanes, !(n & t.childLanes)) return null; if (e !== null && t.child !== e.child) throw Error(_(153)); if (t.child !== null) { for (e = t.child, n = Vt(e, e.pendingProps), t.child = n, n.return = t; e.sibling !== null;)e = e.sibling, n = n.sibling = Vt(e, e.pendingProps), n.return = t; n.sibling = null } return t.child } function wg(e, t, n) { switch (t.tag) { case 3: ef(t), Un(); break; case 5: Pd(t); break; case 1: Oe(t.type) && Vi(t); break; case 4: Gl(t, t.stateNode.containerInfo); break; case 10: var r = t.type._context, i = t.memoizedProps.value; W(qi, r._currentValue), r._currentValue = i; break; case 13: if (r = t.memoizedState, r !== null) return r.dehydrated !== null ? (W(q, q.current & 1), t.flags |= 128, null) : n & t.child.childLanes ? tf(e, t, n) : (W(q, q.current & 1), e = Ct(e, t, n), e !== null ? e.sibling : null); W(q, q.current & 1); break; case 19: if (r = (n & t.childLanes) !== 0, e.flags & 128) { if (r) return nf(e, t, n); t.flags |= 128 } if (i = t.memoizedState, i !== null && (i.rendering = null, i.tail = null, i.lastEffect = null), W(q, q.current), r) break; return null; case 22: case 23: return t.lanes = 0, Jd(e, t, n) }return Ct(e, t, n) } var rf, ol, of, sf; rf = function (e, t) { for (var n = t.child; n !== null;) { if (n.tag === 5 || n.tag === 6) e.appendChild(n.stateNode); else if (n.tag !== 4 && n.child !== null) { n.child.return = n, n = n.child; continue } if (n === t) break; for (; n.sibling === null;) { if (n.return === null || n.return === t) return; n = n.return } n.sibling.return = n.return, n = n.sibling } }; ol = function () { }; of = function (e, t, n, r) { var i = e.memoizedProps; if (i !== r) { e = t.stateNode, rn(ct.current); var o = null; switch (n) { case "input": i = Ts(e, i), r = Ts(e, r), o = []; break; case "select": i = Y({}, i, { value: void 0 }), r = Y({}, r, { value: void 0 }), o = []; break; case "textarea": i = Ns(e, i), r = Ns(e, r), o = []; break; default: typeof i.onClick != "function" && typeof r.onClick == "function" && (e.onclick = Wi) }Ls(n, r); var s; n = null; for (a in i) if (!r.hasOwnProperty(a) && i.hasOwnProperty(a) && i[a] != null) if (a === "style") { var l = i[a]; for (s in l) l.hasOwnProperty(s) && (n || (n = {}), n[s] = "") } else a !== "dangerouslySetInnerHTML" && a !== "children" && a !== "suppressContentEditableWarning" && a !== "suppressHydrationWarning" && a !== "autoFocus" && (kr.hasOwnProperty(a) ? o || (o = []) : (o = o || []).push(a, null)); for (a in r) { var u = r[a]; if (l = i != null ? i[a] : void 0, r.hasOwnProperty(a) && u !== l && (u != null || l != null)) if (a === "style") if (l) { for (s in l) !l.hasOwnProperty(s) || u && u.hasOwnProperty(s) || (n || (n = {}), n[s] = ""); for (s in u) u.hasOwnProperty(s) && l[s] !== u[s] && (n || (n = {}), n[s] = u[s]) } else n || (o || (o = []), o.push(a, n)), n = u; else a === "dangerouslySetInnerHTML" ? (u = u ? u.__html : void 0, l = l ? l.__html : void 0, u != null && l !== u && (o = o || []).push(a, u)) : a === "children" ? typeof u != "string" && typeof u != "number" || (o = o || []).push(a, "" + u) : a !== "suppressContentEditableWarning" && a !== "suppressHydrationWarning" && (kr.hasOwnProperty(a) ? (u != null && a === "onScroll" && B("scroll", e), o || l === u || (o = [])) : (o = o || []).push(a, u)) } n && (o = o || []).push("style", n); var a = o; (t.updateQueue = a) && (t.flags |= 4) } }; sf = function (e, t, n, r) { n !== r && (t.flags |= 4) }; function nr(e, t) { if (!Q) switch (e.tailMode) { case "hidden": t = e.tail; for (var n = null; t !== null;)t.alternate !== null && (n = t), t = t.sibling; n === null ? e.tail = null : n.sibling = null; break; case "collapsed": n = e.tail; for (var r = null; n !== null;)n.alternate !== null && (r = n), n = n.sibling; r === null ? t || e.tail === null ? e.tail = null : e.tail.sibling = null : r.sibling = null } } function he(e) { var t = e.alternate !== null && e.alternate.child === e.child, n = 0, r = 0; if (t) for (var i = e.child; i !== null;)n |= i.lanes | i.childLanes, r |= i.subtreeFlags & 14680064, r |= i.flags & 14680064, i.return = e, i = i.sibling; else for (i = e.child; i !== null;)n |= i.lanes | i.childLanes, r |= i.subtreeFlags, r |= i.flags, i.return = e, i = i.sibling; return e.subtreeFlags |= r, e.childLanes = n, t } function Eg(e, t, n) { var r = t.pendingProps; switch (Hl(t), t.tag) { case 2: case 16: case 15: case 0: case 11: case 7: case 8: case 12: case 9: case 14: return he(t), null; case 1: return Oe(t.type) && Bi(), he(t), null; case 3: return r = t.stateNode, Wn(), V(xe), V(me), Xl(), r.pendingContext && (r.context = r.pendingContext, r.pendingContext = null), (e === null || e.child === null) && (di(t) ? t.flags |= 4 : e === null || e.memoizedState.isDehydrated && !(t.flags & 256) || (t.flags |= 1024, tt !== null && (hl(tt), tt = null))), ol(e, t), he(t), null; case 5: Yl(t); var i = rn(Mr.current); if (n = t.type, e !== null && t.stateNode != null) of(e, t, n, r, i), e.ref !== t.ref && (t.flags |= 512, t.flags |= 2097152); else { if (!r) { if (t.stateNode === null) throw Error(_(166)); return he(t), null } if (e = rn(ct.current), di(t)) { r = t.stateNode, n = t.type; var o = t.memoizedProps; switch (r[ut] = t, r[jr] = o, e = (t.mode & 1) !== 0, n) { case "dialog": B("cancel", r), B("close", r); break; case "iframe": case "object": case "embed": B("load", r); break; case "video": case "audio": for (i = 0; i < cr.length; i++)B(cr[i], r); break; case "source": B("error", r); break; case "img": case "image": case "link": B("error", r), B("load", r); break; case "details": B("toggle", r); break; case "input": Pu(r, o), B("invalid", r); break; case "select": r._wrapperState = { wasMultiple: !!o.multiple }, B("invalid", r); break; case "textarea": Iu(r, o), B("invalid", r) }Ls(n, o), i = null; for (var s in o) if (o.hasOwnProperty(s)) { var l = o[s]; s === "children" ? typeof l == "string" ? r.textContent !== l && (o.suppressHydrationWarning !== !0 && ci(r.textContent, l, e), i = ["children", l]) : typeof l == "number" && r.textContent !== "" + l && (o.suppressHydrationWarning !== !0 && ci(r.textContent, l, e), i = ["children", "" + l]) : kr.hasOwnProperty(s) && l != null && s === "onScroll" && B("scroll", r) } switch (n) { case "input": ni(r), Nu(r, o, !0); break; case "textarea": ni(r), Lu(r); break; case "select": case "option": break; default: typeof o.onClick == "function" && (r.onclick = Wi) }r = i, t.updateQueue = r, r !== null && (t.flags |= 4) } else { s = i.nodeType === 9 ? i : i.ownerDocument, e === "http://www.w3.org/1999/xhtml" && (e = Lc(n)), e === "http://www.w3.org/1999/xhtml" ? n === "script" ? (e = s.createElement("div"), e.innerHTML = " - + + + + Chess - - + +
diff --git a/kinode/packages/homepage/homepage/Cargo.toml b/kinode/packages/homepage/homepage/Cargo.toml index d402e6f87..50df8adb8 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", tag = "v0.6.0" } 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/homepage/homepage/src/chess_icon.png b/kinode/packages/homepage/homepage/src/chess_icon.png new file mode 100644 index 000000000..ea25c8d00 Binary files /dev/null and b/kinode/packages/homepage/homepage/src/chess_icon.png differ diff --git a/kinode/packages/homepage/homepage/src/favicon.svg b/kinode/packages/homepage/homepage/src/favicon.svg new file mode 100644 index 000000000..acc26f8b3 --- /dev/null +++ b/kinode/packages/homepage/homepage/src/favicon.svg @@ -0,0 +1,12 @@ + + + + + diff --git a/kinode/packages/homepage/homepage/src/home.html b/kinode/packages/homepage/homepage/src/home.html deleted file mode 100644 index 0891248a7..000000000 --- a/kinode/packages/homepage/homepage/src/home.html +++ /dev/null @@ -1,256 +0,0 @@ - - - - - ${our} - Home - - - - - - - - - - -
-
- -

${our} home

-
-

Welcome ${our}!

- -

Apps:

- App Store -
- Chess -
- - - - - \ No newline at end of file diff --git a/kinode/packages/homepage/homepage/src/index.html b/kinode/packages/homepage/homepage/src/index.html new file mode 100644 index 000000000..c3cacdd83 --- /dev/null +++ b/kinode/packages/homepage/homepage/src/index.html @@ -0,0 +1,318 @@ + + + + + ${our} - Home + + + + + + + + + + + + +
+
${our}
+
+

Welcome to

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ ${apps} +
+
+
+ + + + + + \ No newline at end of file diff --git a/kinode/packages/homepage/homepage/src/lib.rs b/kinode/packages/homepage/homepage/src/lib.rs index 9ba62b3bb..ec68c7245 100644 --- a/kinode/packages/homepage/homepage/src/lib.rs +++ b/kinode/packages/homepage/homepage/src/lib.rs @@ -1,7 +1,25 @@ #![feature(let_chains)] use kinode_process_lib::{ - await_message, http::bind_http_static_path, http::HttpServerError, println, Address, Message, + await_message, call_init, http::bind_http_static_path, http::HttpServerError, println, Address, + Message, ProcessId, }; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +/// The request format to add or remove an app from the homepage. You must have messaging +/// access to `homepage:homepage:sys` in order to perform this. Serialize using serde_json. +#[derive(Serialize, Deserialize)] +enum HomepageRequest { + /// the package and process name will come from request source. + /// the path will automatically have the process_id prepended. + /// the icon is a base64 encoded image. + Add { + label: String, + icon: String, + path: String, + }, + Remove, +} wit_bindgen::generate!({ path: "wit", @@ -11,35 +29,45 @@ wit_bindgen::generate!({ }, }); -struct Component; +const HOME_PAGE: &str = include_str!("index.html"); -const HOME_PAGE: &str = include_str!("home.html"); +const APP_TEMPLATE: &str = r#" + + +
${label}
+
"#; -impl Guest for Component { - fn init(our: String) { - let our: Address = our.parse().unwrap(); - match main(our) { - Ok(_) => {} - Err(e) => { - println!("homepage: ended with error: {:?}", e); - } - } - } -} +call_init!(main); -fn main(our: Address) -> anyhow::Result<()> { - // bind to root path on http_server (we have special dispensation to do so!) +/// bind to root path on http_server (we have special dispensation to do so!) +fn bind_index(our: &str, apps: &HashMap) { bind_http_static_path( "/", true, false, Some("text/html".to_string()), HOME_PAGE - .replace("${our}", &our.node) + .replace("${our}", our) + .replace( + "${apps}", + &apps + .values() + .map(String::as_str) + .collect::>() + .join("\n"), + ) .to_string() .as_bytes() .to_vec(), - )?; + ) + .expect("failed to bind to /"); +} + +fn main(our: Address) { + let mut apps: HashMap = HashMap::new(); + + bind_index(&our.node, &apps); bind_http_static_path( "/our", @@ -47,7 +75,8 @@ fn main(our: Address) -> anyhow::Result<()> { false, Some("text/html".to_string()), our.node.clone().as_bytes().to_vec(), - )?; + ) + .expect("failed to bind to /our"); bind_http_static_path( "/our.js", @@ -57,11 +86,12 @@ fn main(our: Address) -> anyhow::Result<()> { format!("window.our = {{}}; window.our.node = '{}';", &our.node) .as_bytes() .to_vec(), - )?; + ) + .expect("failed to bind to /our.js"); loop { let Ok(ref message) = await_message() else { - println!("homepage: got network error??"); + // we never send requests, so this will never happen continue; }; if let Message::Response { source, body, .. } = message @@ -69,12 +99,45 @@ fn main(our: Address) -> anyhow::Result<()> { { match serde_json::from_slice::>(&body) { Ok(Ok(())) => continue, - Ok(Err(e)) => println!("homepage: got error from http_server: {e}"), - Err(_e) => println!("homepage: got malformed message from http_server!"), + Ok(Err(e)) => println!("got error from http_server: {e}"), + Err(_e) => println!("got malformed message from http_server!"), } } else { - println!("homepage: got message: {message:?}"); - //println!("homepage: got message from {source:?}: {message:?}"); + // handle messages to add or remove an app from the homepage. + // they must have messaging access to us in order to perform this. + if let Ok(request) = serde_json::from_slice::(message.body()) { + match request { + HomepageRequest::Add { label, icon, path } => { + apps.insert( + message.source().process.clone(), + APP_TEMPLATE + .replace( + "${package_name}", + &format!( + "{}:{}", + message.source().package(), + message.source().publisher() + ), + ) + .replace( + "${path}", + &format!( + "{}/{}", + message.source().process, + path.strip_prefix('/').unwrap_or(&path) + ), + ) + .replace("${label}", &label) + .replace("${base64_icon}", &icon), + ); + bind_index(&our.node, &apps); + } + HomepageRequest::Remove => { + apps.remove(&message.source().process); + bind_index(&our.node, &apps); + } + } + } } } } diff --git a/kinode/packages/homepage/homepage/src/store_icon.png b/kinode/packages/homepage/homepage/src/store_icon.png new file mode 100644 index 000000000..ed3331d48 Binary files /dev/null and b/kinode/packages/homepage/homepage/src/store_icon.png differ diff --git a/kinode/packages/homepage/metadata.json b/kinode/packages/homepage/metadata.json new file mode 100644 index 000000000..de80df723 --- /dev/null +++ b/kinode/packages/homepage/metadata.json @@ -0,0 +1,16 @@ +{ + "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/homepage/pkg/metadata.json b/kinode/packages/homepage/pkg/metadata.json deleted file mode 100644 index c38f170a3..000000000 --- a/kinode/packages/homepage/pkg/metadata.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "package": "homepage", - "publisher": "sys", - "version": [ - 0, - 1, - 0 - ] -} \ No newline at end of file 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..d22396657 --- /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", tag = "v0.6.0" } +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..52c2eee0e --- /dev/null +++ b/kinode/packages/kns_indexer/get_block/src/lib.rs @@ -0,0 +1,36 @@ +use kinode_process_lib::{await_next_request_body, call_init, eth, println, Address}; + +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!("failed to get args"); + return; + }; + + // incoming args bytes are a string we parse to u64, if none provided, default to 1 + let chain_id = std::str::from_utf8(&args) + .unwrap_or("1") + .parse::() + .unwrap_or(1); + + // request timeout of 5s + let provider = eth::Provider::new(chain_id, 5); + + match provider.get_block_number() { + Ok(block_number) => { + println!("latest block number: {block_number}"); + } + Err(e) => { + println!("failed to get block number: {e:?}"); + } + } +} diff --git a/kinode/packages/kns_indexer/kns_indexer/Cargo.toml b/kinode/packages/kns_indexer/kns_indexer/Cargo.toml index 24a7e1197..28b574004 100644 --- a/kinode/packages/kns_indexer/kns_indexer/Cargo.toml +++ b/kinode/packages/kns_indexer/kns_indexer/Cargo.toml @@ -6,16 +6,15 @@ edition = "2021" [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-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.9-alpha", features = ["eth"] } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.0" } 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/kns_indexer/kns_indexer/src/lib.rs b/kinode/packages/kns_indexer/kns_indexer/src/lib.rs index 0933421f9..095537583 100644 --- a/kinode/packages/kns_indexer/kns_indexer/src/lib.rs +++ b/kinode/packages/kns_indexer/kns_indexer/src/lib.rs @@ -1,16 +1,12 @@ -use alloy_rpc_types::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, + await_message, eth, get_typed_state, 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; wit_bindgen::generate!({ @@ -23,14 +19,15 @@ wit_bindgen::generate!({ #[derive(Clone, Debug, Serialize, Deserialize)] struct State { + chain_id: u64, // what contract this state pertains to - contract_address: Option, + contract_address: String, // namehash to human readable name names: HashMap, // human readable name to most recent on-chain routing information as json // NOTE: not every namehash will have a node registered nodes: HashMap, - // last block we read from + // last block we have an update from block: u64, } @@ -48,16 +45,20 @@ pub enum IndexerRequests { NamehashToName { hash: String, block: u64 }, /// return the most recent on-chain routing information for a node name. /// returns an Option + /// set block to 0 if you just want to get the current state of the indexer NodeInfo { name: String, block: u64 }, + /// return the entire state of the indexer at the given block + /// set block to 0 if you just want to get the current state of the indexer + GetState { block: u64 }, } #[derive(Clone, Debug, Serialize, Deserialize)] -pub enum NetActions { +pub enum NetAction { KnsUpdate(KnsUpdate), KnsBatchUpdate(Vec), } -impl TryInto> for NetActions { +impl TryInto> for NetAction { type Error = anyhow::Error; fn try_into(self) -> Result, Self::Error> { Ok(rmp_serde::to_vec(&self)?) @@ -97,87 +98,140 @@ sol! { event RoutingUpdate(bytes32 indexed node, bytes32[] routers); } +fn subscribe_to_logs(eth_provider: ð::Provider, from_block: u64, filter: eth::Filter) { + loop { + match eth_provider.subscribe(1, filter.clone().from_block(from_block)) { + Ok(()) => break, + Err(_) => { + println!("failed to subscribe to chain! trying again in 5s..."); + std::thread::sleep(std::time::Duration::from_secs(5)); + continue; + } + } + } + println!("subscribed to logs successfully"); +} + struct Component; impl Guest for Component { fn init(our: String) { let our: Address = our.parse().unwrap(); - let mut state: State = State { - contract_address: None, - names: HashMap::new(), - nodes: HashMap::new(), - block: 1, - }; + // first, await a message from the kernel which will contain the + // chain ID and contract address for the KNS version we want to track. + let chain_id: u64; + let contract_address: String; + loop { + let Ok(Message::Request { source, body, .. }) = await_message() else { + continue; + }; + if source.process != "kernel:distro:sys" { + continue; + } + (chain_id, contract_address) = serde_json::from_slice(&body).unwrap(); + break; + } + println!("indexing on contract address {}", contract_address); // if we have state, load it in - match get_typed_state(|bytes| Ok(bincode::deserialize(bytes)?)) { + let state: State = match get_typed_state(|bytes| Ok(bincode::deserialize::(bytes)?)) + { Some(s) => { - state = s; + // if chain id or contract address changed from a previous run, reset state + if s.chain_id != chain_id || s.contract_address != contract_address { + println!( + "resetting state because runtime contract address or chain ID changed" + ); + State { + chain_id, + contract_address, + names: HashMap::new(), + nodes: HashMap::new(), + block: 1, + } + } else { + println!("loading in {} persisted PKI entries", s.nodes.len()); + s + } } - None => {} - } + None => State { + chain_id, + contract_address: contract_address.clone(), + names: HashMap::new(), + nodes: HashMap::new(), + block: 1, + }, + }; match main(our, state) { Ok(_) => {} Err(e) => { - println!("kns_indexer: error: {:?}", e); + println!("error: {:?}", e); } } } } fn main(our: Address, mut state: State) -> anyhow::Result<()> { - // first, await a message from the kernel which will contain the - // contract address for the KNS version we want to track. - let mut contract_address: Option = None; - loop { - let Ok(Message::Request { source, body, .. }) = await_message() else { - continue; - }; - if source.process != "kernel:distro:sys" { - continue; - } - contract_address = Some(std::str::from_utf8(&body).unwrap().to_string()); - break; - } - println!( - "kns_indexer: indexing on contract address {}", - contract_address.as_ref().unwrap() - ); - // if contract address changed from a previous run, reset state - if state.contract_address != contract_address { - state = State { - contract_address: contract_address.clone(), - names: HashMap::new(), - nodes: HashMap::new(), - block: 1, - }; - } // shove all state into net::net Request::new() .target((&our.node, "net", "distro", "sys")) - .try_body(NetActions::KnsBatchUpdate( + .try_body(NetAction::KnsBatchUpdate( state.nodes.values().cloned().collect::>(), ))? .send()?; - SubscribeLogsRequest::new(1) // subscription id 1 - .address(EthAddress::from_str(contract_address.unwrap().as_str())?) + let filter = eth::Filter::new() + .address(state.contract_address.parse::().unwrap()) .from_block(state.block - 1) + .to_block(eth::BlockNumberOrTag::Latest) .events(vec![ "NodeRegistered(bytes32,bytes)", "KeyUpdate(bytes32,bytes32)", "IpUpdate(bytes32,uint128)", "WsUpdate(bytes32,uint16)", "RoutingUpdate(bytes32,bytes32[])", - ]) + ]); + + // 60s timeout -- these calls can take a long time + // if they do time out, we try them again + let eth_provider = eth::Provider::new(state.chain_id, 60); + + // if block in state is < current_block, get logs from that part. + if state.block < eth_provider.get_block_number().unwrap_or(u64::MAX) { + loop { + match eth_provider.get_logs(&filter) { + Ok(logs) => { + for log in logs { + handle_log(&our, &mut state, &log)?; + } + break; + } + Err(_) => { + println!("failed to fetch logs! trying again in 5s..."); + std::thread::sleep(std::time::Duration::from_secs(5)); + continue; + } + } + } + } + // shove all state into net::net + Request::new() + .target((&our.node, "net", "distro", "sys")) + .try_body(NetAction::KnsBatchUpdate( + state.nodes.values().cloned().collect::>(), + ))? .send()?; + set_state(&bincode::serialize(&state)?); + + subscribe_to_logs(ð_provider, state.block - 1, filter.clone()); + let mut pending_requests: BTreeMap> = BTreeMap::new(); loop { let Ok(message) = await_message() else { - println!("kns_indexer: got network error"); + println!("got network error"); continue; }; let Message::Request { source, body, .. } = message else { @@ -187,10 +241,17 @@ 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, + ð_provider, + &mut pending_requests, + &body, + &filter, + )?; } else { let Ok(request) = serde_json::from_slice::(&body) else { - println!("kns_indexer: got invalid message"); + println!("got invalid message"); continue; }; @@ -219,6 +280,16 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> { .push(request); } } + IndexerRequests::GetState { block } => { + if block <= state.block { + Response::new().body(serde_json::to_vec(&state)?).send()?; + } else { + pending_requests + .entry(block) + .or_insert(vec![]) + .push(request); + } + } } } } @@ -227,92 +298,27 @@ fn main(our: Address, mut state: State) -> anyhow::Result<()> { fn handle_eth_message( our: &Address, state: &mut State, + eth_provider: ð::Provider, pending_requests: &mut BTreeMap>, body: &[u8], + filter: ð::Filter, ) -> anyhow::Result<()> { - let Ok(msg) = serde_json::from_slice::(body) else { - return Err(anyhow::anyhow!("kns_indexer: got invalid message")); + let Ok(eth_result) = serde_json::from_slice::(body) else { + return Err(anyhow::anyhow!("got invalid message")); }; - match msg { - EthSubEvent::Log(log) => { - state.block = log.block_number.expect("expect").to::(); - - 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 node = state - .nodes - .entry(name.to_string()) - .or_insert_with(|| KnsUpdate::new(name, &node_id.to_string())); - - 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 eth_result { + Ok(eth::EthSub { result, .. }) => { + if let eth::SubscriptionResult::Log(log) = result { + handle_log(our, state, &log)?; } } + Err(_e) => { + println!("got eth subscription error"); + subscribe_to_logs(ð_provider, state.block - 1, filter.clone()); + } } + // 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![]; @@ -332,6 +338,12 @@ fn handle_eth_message( .send() .unwrap(); } + IndexerRequests::GetState { .. } => { + Response::new() + .body(serde_json::to_vec(&state)?) + .send() + .unwrap(); + } } } blocks_to_remove.push(*block); @@ -347,12 +359,97 @@ fn handle_eth_message( Ok(()) } -fn get_name(log: &Log) -> String { +fn handle_log(our: &Address, state: &mut State, log: ð::Log) -> anyhow::Result<()> { + let node_id = 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 node = state + .nodes + .entry(name.to_string()) + .or_insert_with(|| KnsUpdate::new(name, &node_id.to_string())); + + 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 + { + Request::new() + .target((&our.node, "net", "distro", "sys")) + .try_body(NetAction::KnsUpdate(node.clone()))? + .send()?; + } + + // if new block is > 100 from last block, save state + let block = log.block_number.expect("expect").to::(); + if block > state.block + 100 { + kinode_process_lib::print_to_terminal( + 1, + &format!( + "persisting {} PKI entries at block {}", + state.nodes.len(), + block + ), + ); + state.block = block; + set_state(&bincode::serialize(state)?); + } + Ok(()) +} + +fn get_name(log: ð::Log) -> String { let decoded = NodeRegistered::abi_decode_data(&log.data, true).unwrap(); let name = match dnswire_decode(decoded.0.clone()) { Ok(n) => n, Err(_) => { - println!("kns_indexer: failed to decode name: {:?}", decoded.0); + println!("failed to decode name: {:?}", decoded.0); panic!("") } }; diff --git a/kinode/packages/kns_indexer/metadata.json b/kinode/packages/kns_indexer/metadata.json new file mode 100644 index 000000000..bc28db53d --- /dev/null +++ b/kinode/packages/kns_indexer/metadata.json @@ -0,0 +1,16 @@ +{ + "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/kns_indexer/pkg/metadata.json b/kinode/packages/kns_indexer/pkg/metadata.json deleted file mode 100644 index d02df5b8d..000000000 --- a/kinode/packages/kns_indexer/pkg/metadata.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "package": "kns_indexer", - "publisher": "sys", - "version": [ - 0, - 1, - 0 - ] -} \ No newline at end of file diff --git a/kinode/packages/kns_indexer/pkg/scripts.json b/kinode/packages/kns_indexer/pkg/scripts.json new file mode 100644 index 000000000..0fe08a0df --- /dev/null +++ b/kinode/packages/kns_indexer/pkg/scripts.json @@ -0,0 +1,24 @@ +{ + "get_block.wasm": { + "root": false, + "public": false, + "request_networking": false, + "request_capabilities": [ + "eth:distro:sys" + ], + "grant_capabilities": [ + "eth:distro:sys" + ] + }, + "state.wasm": { + "root": false, + "public": false, + "request_networking": false, + "request_capabilities": [ + "kns_indexer:kns_indexer:sys" + ], + "grant_capabilities": [ + "kns_indexer:kns_indexer:sys" + ] + } +} \ No newline at end of file diff --git a/kinode/packages/kns_indexer/state/Cargo.toml b/kinode/packages/kns_indexer/state/Cargo.toml new file mode 100644 index 000000000..4f02950e1 --- /dev/null +++ b/kinode/packages/kns_indexer/state/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "state" +version = "0.1.0" +edition = "2021" + + +[dependencies] +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.0" } +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/state/src/lib.rs b/kinode/packages/kns_indexer/state/src/lib.rs new file mode 100644 index 000000000..1755b8198 --- /dev/null +++ b/kinode/packages/kns_indexer/state/src/lib.rs @@ -0,0 +1,72 @@ +use kinode_process_lib::{call_init, println, Address, Message, Request}; +use serde::{Deserialize, Serialize}; +use std::collections::HashMap; + +wit_bindgen::generate!({ + path: "wit", + world: "process", + exports: { + world: Component, + }, +}); + +/// From main kns_indexer process +#[derive(Clone, Debug, Serialize, Deserialize)] +struct State { + chain_id: u64, + // what contract this state pertains to + contract_address: String, + // namehash to human readable name + names: HashMap, + // human readable name to most recent on-chain routing information as json + // NOTE: not every namehash will have a node registered + nodes: HashMap, + // last block we have an update from + block: u64, +} + +#[derive(Clone, Debug, Serialize, Deserialize, Default)] +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, +} + +call_init!(init); + +fn init(_our: Address) { + let Ok(Message::Response { body, .. }) = + Request::to(("our", "kns_indexer", "kns_indexer", "sys")) + .body( + serde_json::json!({ + "GetState": { + "block": 0 + } + }) + .to_string() + .as_bytes() + .to_vec(), + ) + .send_and_await_response(10) + .unwrap() + else { + println!("failed to get state from kns_indexer"); + return; + }; + let state = serde_json::from_slice::(&body).expect("failed to deserialize state"); + // can change later, but for now, just print every known node name + let mut names = state.names.values().map(AsRef::as_ref).collect::>(); + names.sort(); + println!( + "\nrunning on chain id {}\nCA: {}\n{} known nodes as of block {}\n {}", + state.chain_id, + state.contract_address, + names.len(), + state.block, + names.join("\n ") + ); +} diff --git a/kinode/packages/terminal/alias/Cargo.toml b/kinode/packages/terminal/alias/Cargo.toml index 07ecbf3a9..e378438a3 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", tag = "v0.6.0" } 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/src/lib.rs b/kinode/packages/terminal/alias/src/lib.rs index f7143ffc7..b0d150976 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", @@ -12,25 +11,33 @@ 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); fn init(_our: Address) { let Ok(args) = await_next_request_body() else { - println!("alias: failed to get args, aborting"); + println!("failed to get args"); return; }; - let line = String::from_utf8(args).unwrap_or("alias: error".into()); + let line = String::from_utf8(args).unwrap_or("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() { - println!("alias: no alias given"); + println!("no alias given"); return; } @@ -38,13 +45,11 @@ fn init(_our: Address) { let _ = Request::new() .target(("our", "terminal", "terminal", "sys")) .body( - json!(EditAliases { + serde_json::to_vec(&TerminalAction::EditAlias { alias: alias.to_string(), - process: None + process: None, }) - .to_string() - .as_bytes() - .to_vec(), + .unwrap(), ) .send(); } else { @@ -53,18 +58,16 @@ fn init(_our: Address) { let _ = Request::new() .target(("our", "terminal", "terminal", "sys")) .body( - json!(EditAliases { + serde_json::to_vec(&TerminalAction::EditAlias { alias: alias.to_string(), - process: Some(process) + process: Some(process), }) - .to_string() - .as_bytes() - .to_vec(), + .unwrap(), ) .send(); } Err(_) => { - println!("alias: invalid process id"); + println!("invalid process id"); } } } diff --git a/kinode/packages/terminal/cat/Cargo.toml b/kinode/packages/terminal/cat/Cargo.toml index 6a2ba7f52..e5e793a30 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", tag = "v0.6.0" } 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/src/lib.rs b/kinode/packages/terminal/cat/src/lib.rs index 704a51efb..cf529e671 100644 --- a/kinode/packages/terminal/cat/src/lib.rs +++ b/kinode/packages/terminal/cat/src/lib.rs @@ -1,5 +1,5 @@ use kinode_process_lib::{ - await_next_request_body, call_init, get_blob, println, vfs, Address, Request, Response, + await_next_request_body, call_init, get_blob, println, vfs, Address, Request, }; wit_bindgen::generate!({ @@ -14,15 +14,21 @@ call_init!(init); fn init(_our: Address) { let Ok(args) = await_next_request_body() else { - println!("cat: failed to get args, aborting"); + println!("failed to get args"); return; }; let Ok(file_path) = String::from_utf8(args) else { - println!("bad file path"); + println!("argument must be a single string"); 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( @@ -39,5 +45,5 @@ fn init(_our: Address) { println!("no file found at {}", file_path); return; }; - let _ = Response::new().body(blob.bytes).send(); + println!("{}", String::from_utf8(blob.bytes).unwrap()); } diff --git a/kinode/packages/terminal/echo/Cargo.toml b/kinode/packages/terminal/echo/Cargo.toml index 9695d17c9..20e182053 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", tag = "v0.6.0" } 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/src/lib.rs b/kinode/packages/terminal/echo/src/lib.rs index 6652126e2..92609f578 100644 --- a/kinode/packages/terminal/echo/src/lib.rs +++ b/kinode/packages/terminal/echo/src/lib.rs @@ -1,4 +1,4 @@ -use kinode_process_lib::{await_next_request_body, call_init, println, Address, Response}; +use kinode_process_lib::{await_next_request_body, call_init, println, Address}; wit_bindgen::generate!({ path: "wit", @@ -12,14 +12,12 @@ call_init!(init); fn init(_our: Address) { let Ok(args) = await_next_request_body() else { - println!("echo: failed to get args, aborting"); + println!("failed to get args"); return; }; - let _ = Response::new() - .body(format!( - "{}", - String::from_utf8(args).unwrap_or("echo: error".into()) - )) - .send(); + match String::from_utf8(args.clone()) { + Ok(s) => println!("{}", s), + Err(_) => println!("{:?}", args), + } } diff --git a/kinode/packages/terminal/hi/Cargo.toml b/kinode/packages/terminal/hi/Cargo.toml index a683aa047..943b49474 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", tag = "v0.6.0" } 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/src/lib.rs b/kinode/packages/terminal/hi/src/lib.rs index 71d090359..9b53a1331 100644 --- a/kinode/packages/terminal/hi/src/lib.rs +++ b/kinode/packages/terminal/hi/src/lib.rs @@ -1,5 +1,5 @@ use kinode_process_lib::{ - await_next_request_body, call_init, println, Address, Request, SendError, + await_next_request_body, call_init, println, Address, Request, SendError, SendErrorKind, }; wit_bindgen::generate!({ @@ -14,16 +14,21 @@ call_init!(init); fn init(our: Address) { let Ok(args) = await_next_request_body() else { - println!("hi: failed to get args, aborting"); + println!("failed to get args"); return; }; 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), None => { - println!("hi: invalid command, please provide a message"); + println!("invalid command, please provide a message"); return; } }; @@ -41,9 +46,13 @@ fn init(our: Address) { println!("response from {node_id}: {:?}", msg.body()); } } - Err(SendError { kind, .. }) => { - println!("hi: net error: {:?}", kind); - return; - } + Err(SendError { kind, .. }) => match kind { + SendErrorKind::Timeout => { + println!("message to {node_id} timed out"); + } + SendErrorKind::Offline => { + println!("{node_id} is offline or does not exist"); + } + }, } } diff --git a/kinode/packages/terminal/m/Cargo.toml b/kinode/packages/terminal/m/Cargo.toml index adda2ca05..ccf7d1578 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", tag = "v0.6.0" } 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/m/src/lib.rs b/kinode/packages/terminal/m/src/lib.rs index 573633387..c88a96227 100644 --- a/kinode/packages/terminal/m/src/lib.rs +++ b/kinode/packages/terminal/m/src/lib.rs @@ -1,5 +1,7 @@ use clap::{Arg, Command}; -use kinode_process_lib::{await_next_request_body, call_init, println, Address, Request, Response}; +use kinode_process_lib::{ + await_next_request_body, call_init, println, Address, Request, SendErrorKind, +}; use regex::Regex; wit_bindgen::generate!({ @@ -14,10 +16,15 @@ call_init!(init); fn init(_our: Address) { let Ok(body) = await_next_request_body() else { - println!("m: failed to get args, aborting"); + println!("failed to get args"); 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 @@ -47,12 +54,12 @@ fn init(_our: Address) { ) .try_get_matches_from(args) else { - println!("m: failed to parse args"); + println!("failed to parse args"); return; }; let Some(target) = parsed.get_one::("target") else { - println!("m: no target"); + println!("no target"); return; }; @@ -62,7 +69,7 @@ fn init(_our: Address) { }; let Some(body) = parsed.get_one::("body") else { - println!("m: no body"); + println!("no body"); return; }; @@ -70,18 +77,28 @@ fn init(_our: Address) { match parsed.get_one::("await") { Some(s) => { - println!("m: awaiting response for {}s", s); + println!("awaiting response for {s}s"); match req.send_and_await_response(*s).unwrap() { Ok(res) => { - let _ = Response::new().body(res.body()).send(); + println!("{}", String::from_utf8(res.body().to_vec()).unwrap()); } Err(e) => { - println!("m: SendError: {:?}", e.kind); + println!( + "{}", + match e.kind { + SendErrorKind::Timeout => + "target did not send Response in time, try increasing the await time", + SendErrorKind::Offline => + "failed to send message because the target is offline", + } + ); } } } None => { - let _ = req.send().unwrap(); + // still wait for a response, but don't do anything with it + // do this so caps checks don't fail + let _ = req.send_and_await_response(5).unwrap(); } } } diff --git a/kinode/packages/terminal/metadata.json b/kinode/packages/terminal/metadata.json new file mode 100644 index 000000000..20fd80124 --- /dev/null +++ b/kinode/packages/terminal/metadata.json @@ -0,0 +1,16 @@ +{ + "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/terminal/namehash_to_name/Cargo.toml b/kinode/packages/terminal/namehash_to_name/Cargo.toml new file mode 100644 index 000000000..a5b107aec --- /dev/null +++ b/kinode/packages/terminal/namehash_to_name/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "namehash_to_name" +version = "0.1.0" +edition = "2021" + + +[dependencies] +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.0" } +rmp-serde = "1.1.2" +serde = { version = "1.0", features = ["derive"] } +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/terminal/namehash_to_name/src/lib.rs b/kinode/packages/terminal/namehash_to_name/src/lib.rs new file mode 100644 index 000000000..77e29bb8d --- /dev/null +++ b/kinode/packages/terminal/namehash_to_name/src/lib.rs @@ -0,0 +1,80 @@ +use kinode_process_lib::{ + await_next_request_body, call_init, println, Address, Message, NodeId, Request, +}; +use serde::{Deserialize, Serialize}; + +wit_bindgen::generate!({ + path: "wit", + world: "process", + exports: { + world: Component, + }, +}); + +// types copied from runtime networking core + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Identity { + pub name: NodeId, + pub networking_key: String, + pub ws_routing: Option<(String, u16)>, + pub allowed_routers: Vec, +} + +/// Must be parsed from message pack vector. +/// all Get actions must be sent from local process. used for debugging +#[derive(Clone, Debug, Serialize, Deserialize)] +pub enum NetAction { + /// get a list of peers we are connected to + GetPeers, + /// get the [`Identity`] struct for a single peer + GetPeer(String), + /// get the [`NodeId`] associated with a given namehash, if any + GetName(String), + /// get a user-readable diagnostics string containing networking inforamtion + GetDiagnostics, +} + +/// For now, only sent in response to a ConnectionRequest. +/// Must be parsed from message pack vector +#[derive(Clone, Debug, Serialize, Deserialize)] +pub enum NetResponse { + Accepted(NodeId), + Rejected(NodeId), + /// response to [`NetAction::GetPeers`] + Peers(Vec), + /// response to [`NetAction::GetPeer`] + Peer(Option), + /// response to [`NetAction::GetName`] + Name(Option), + /// response to [`NetAction::GetDiagnostics`]. A user-readable string. + Diagnostics(String), +} + +call_init!(init); + +fn init(_our: Address) { + let Ok(args) = await_next_request_body() else { + println!("failed to get args"); + return; + }; + let Ok(namehash) = String::from_utf8(args) else { + println!("argument must be a string"); + return; + }; + let Ok(Ok(Message::Response { body, .. })) = Request::to(("our", "net", "distro", "sys")) + .body(rmp_serde::to_vec(&NetAction::GetName(namehash.clone())).unwrap()) + .send_and_await_response(5) + else { + println!("failed to get name from networking module"); + return; + }; + let Ok(NetResponse::Name(maybe_name)) = rmp_serde::from_slice(&body) else { + println!("got malformed response from networking module"); + return; + }; + match maybe_name { + Some(name) => println!("{namehash}: {name}"), + None => println!("no name found for {namehash}"), + } +} diff --git a/kinode/packages/terminal/net_diagnostics/Cargo.toml b/kinode/packages/terminal/net_diagnostics/Cargo.toml new file mode 100644 index 000000000..fe23b56a6 --- /dev/null +++ b/kinode/packages/terminal/net_diagnostics/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "net_diagnostics" +version = "0.1.0" +edition = "2021" + + +[dependencies] +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.0" } +rmp-serde = "1.1.2" +serde = { version = "1.0", features = ["derive"] } +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/terminal/net_diagnostics/src/lib.rs b/kinode/packages/terminal/net_diagnostics/src/lib.rs new file mode 100644 index 000000000..9079fd36b --- /dev/null +++ b/kinode/packages/terminal/net_diagnostics/src/lib.rs @@ -0,0 +1,67 @@ +use kinode_process_lib::{call_init, println, Address, Message, NodeId, Request}; +use serde::{Deserialize, Serialize}; + +wit_bindgen::generate!({ + path: "wit", + world: "process", + exports: { + world: Component, + }, +}); + +// types copied from runtime networking core + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Identity { + pub name: NodeId, + pub networking_key: String, + pub ws_routing: Option<(String, u16)>, + pub allowed_routers: Vec, +} + +/// Must be parsed from message pack vector. +/// all Get actions must be sent from local process. used for debugging +#[derive(Clone, Debug, Serialize, Deserialize)] +pub enum NetAction { + /// get a list of peers we are connected to + GetPeers, + /// get the [`Identity`] struct for a single peer + GetPeer(String), + /// get the [`NodeId`] associated with a given namehash, if any + GetName(String), + /// get a user-readable diagnostics string containing networking inforamtion + GetDiagnostics, +} + +/// For now, only sent in response to a ConnectionRequest. +/// Must be parsed from message pack vector +#[derive(Clone, Debug, Serialize, Deserialize)] +pub enum NetResponse { + Accepted(NodeId), + Rejected(NodeId), + /// response to [`NetAction::GetPeers`] + Peers(Vec), + /// response to [`NetAction::GetPeer`] + Peer(Option), + /// response to [`NetAction::GetName`] + Name(Option), + /// response to [`NetAction::GetDiagnostics`]. A user-readable string. + Diagnostics(String), +} + +call_init!(init); + +fn init(_our: Address) { + let Ok(Ok(Message::Response { body, .. })) = Request::to(("our", "net", "distro", "sys")) + .body(rmp_serde::to_vec(&NetAction::GetDiagnostics).unwrap()) + .send_and_await_response(5) + else { + println!("failed to get diagnostics from networking module"); + return; + }; + let Ok(NetResponse::Diagnostics(printout)) = rmp_serde::from_slice(&body) else { + println!("got malformed response from networking module"); + return; + }; + println!("{printout}"); +} diff --git a/kinode/packages/terminal/peer/Cargo.toml b/kinode/packages/terminal/peer/Cargo.toml new file mode 100644 index 000000000..cdfe3573b --- /dev/null +++ b/kinode/packages/terminal/peer/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "peer" +version = "0.1.0" +edition = "2021" + + +[dependencies] +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.0" } +rmp-serde = "1.1.2" +serde = { version = "1.0", features = ["derive"] } +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/terminal/peer/src/lib.rs b/kinode/packages/terminal/peer/src/lib.rs new file mode 100644 index 000000000..12cb74991 --- /dev/null +++ b/kinode/packages/terminal/peer/src/lib.rs @@ -0,0 +1,83 @@ +use kinode_process_lib::{ + await_next_request_body, call_init, println, Address, Message, NodeId, Request, +}; +use serde::{Deserialize, Serialize}; + +wit_bindgen::generate!({ + path: "wit", + world: "process", + exports: { + world: Component, + }, +}); + +// types copied from runtime networking core + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Identity { + pub name: NodeId, + pub networking_key: String, + pub ws_routing: Option<(String, u16)>, + pub allowed_routers: Vec, +} + +/// Must be parsed from message pack vector. +/// all Get actions must be sent from local process. used for debugging +#[derive(Clone, Debug, Serialize, Deserialize)] +pub enum NetAction { + /// get a list of peers we are connected to + GetPeers, + /// get the [`Identity`] struct for a single peer + GetPeer(String), + /// get the [`NodeId`] associated with a given namehash, if any + GetName(String), + /// get a user-readable diagnostics string containing networking inforamtion + GetDiagnostics, +} + +/// For now, only sent in response to a ConnectionRequest. +/// Must be parsed from message pack vector +#[derive(Clone, Debug, Serialize, Deserialize)] +pub enum NetResponse { + Accepted(NodeId), + Rejected(NodeId), + /// response to [`NetAction::GetPeers`] + Peers(Vec), + /// response to [`NetAction::GetPeer`] + Peer(Option), + /// response to [`NetAction::GetName`] + Name(Option), + /// response to [`NetAction::GetDiagnostics`]. A user-readable string. + Diagnostics(String), +} + +call_init!(init); + +fn init(_our: Address) { + let Ok(args) = await_next_request_body() else { + println!("failed to get args"); + return; + }; + let Ok(name) = String::from_utf8(args) else { + println!("argument must be a string"); + return; + }; + let Ok(Ok(Message::Response { body, .. })) = Request::to(("our", "net", "distro", "sys")) + .body(rmp_serde::to_vec(&NetAction::GetPeer(name.clone())).unwrap()) + .send_and_await_response(5) + else { + println!("failed to get response from networking module"); + return; + }; + let Ok(NetResponse::Peer(maybe_peer_id)) = rmp_serde::from_slice(&body) else { + println!("got malformed response from networking module"); + return; + }; + match maybe_peer_id { + Some(peer_id) => println!( + "peer identity for {}:\n networking key: {}\n routing: {:?}\n routers: {:?}", + peer_id.name, peer_id.networking_key, peer_id.ws_routing, peer_id.allowed_routers + ), + None => println!("no PKI entry found with name {name}"), + } +} diff --git a/kinode/packages/terminal/peers/Cargo.toml b/kinode/packages/terminal/peers/Cargo.toml new file mode 100644 index 000000000..9c741940d --- /dev/null +++ b/kinode/packages/terminal/peers/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "peers" +version = "0.1.0" +edition = "2021" + + +[dependencies] +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.0" } +rmp-serde = "1.1.2" +serde = { version = "1.0", features = ["derive"] } +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/terminal/peers/src/lib.rs b/kinode/packages/terminal/peers/src/lib.rs new file mode 100644 index 000000000..bc324e222 --- /dev/null +++ b/kinode/packages/terminal/peers/src/lib.rs @@ -0,0 +1,77 @@ +use kinode_process_lib::{call_init, println, Address, Message, NodeId, Request}; +use serde::{Deserialize, Serialize}; + +wit_bindgen::generate!({ + path: "wit", + world: "process", + exports: { + world: Component, + }, +}); + +// types copied from runtime networking core + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct Identity { + pub name: NodeId, + pub networking_key: String, + pub ws_routing: Option<(String, u16)>, + pub allowed_routers: Vec, +} + +/// Must be parsed from message pack vector. +/// all Get actions must be sent from local process. used for debugging +#[derive(Clone, Debug, Serialize, Deserialize)] +pub enum NetAction { + /// get a list of peers we are connected to + GetPeers, + /// get the [`Identity`] struct for a single peer + GetPeer(String), + /// get the [`NodeId`] associated with a given namehash, if any + GetName(String), + /// get a user-readable diagnostics string containing networking inforamtion + GetDiagnostics, +} + +/// For now, only sent in response to a ConnectionRequest. +/// Must be parsed from message pack vector +#[derive(Clone, Debug, Serialize, Deserialize)] +pub enum NetResponse { + Accepted(NodeId), + Rejected(NodeId), + /// response to [`NetAction::GetPeers`] + Peers(Vec), + /// response to [`NetAction::GetPeer`] + Peer(Option), + /// response to [`NetAction::GetName`] + Name(Option), + /// response to [`NetAction::GetDiagnostics`]. A user-readable string. + Diagnostics(String), +} + +call_init!(init); + +fn init(_our: Address) { + let Ok(Ok(Message::Response { body, .. })) = Request::to(("our", "net", "distro", "sys")) + .body(rmp_serde::to_vec(&NetAction::GetPeers).unwrap()) + .send_and_await_response(5) + else { + println!("failed to get peers from networking module"); + return; + }; + let Ok(NetResponse::Peers(identities)) = rmp_serde::from_slice(&body) else { + println!("got malformed response from networking module"); + return; + }; + let identities = identities + .iter() + .map(|peer_id| { + format!( + "{}:\n networking key: {}\n routing: {:?}\n routers: {:?}", + peer_id.name, peer_id.networking_key, peer_id.ws_routing, peer_id.allowed_routers + ) + }) + .collect::>() + .join("\n"); + println!("identities of current connected peers:\n{identities}"); +} diff --git a/kinode/packages/terminal/pkg/manifest.json b/kinode/packages/terminal/pkg/manifest.json index 7c787eb08..72003cee3 100644 --- a/kinode/packages/terminal/pkg/manifest.json +++ b/kinode/packages/terminal/pkg/manifest.json @@ -12,6 +12,12 @@ "kernel:distro:sys", "vfs:distro:sys", "eth:distro:sys", + { + "process": "eth:distro:sys", + "params": { + "root": true + } + }, "sqlite:distro:sys", "kv:distro:sys", "chess:chess:sys", diff --git a/kinode/packages/terminal/pkg/metadata.json b/kinode/packages/terminal/pkg/metadata.json deleted file mode 100644 index 9fa3ee4c0..000000000 --- a/kinode/packages/terminal/pkg/metadata.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "package": "terminal", - "publisher": "sys", - "version": [ - 0, - 1, - 0 - ] -} \ No newline at end of file diff --git a/kinode/packages/terminal/pkg/scripts.json b/kinode/packages/terminal/pkg/scripts.json index d555c90ca..6939c3733 100644 --- a/kinode/packages/terminal/pkg/scripts.json +++ b/kinode/packages/terminal/pkg/scripts.json @@ -41,6 +41,55 @@ "net:distro:sys" ] }, + "m.wasm": { + "root": true, + "public": true, + "request_networking": true + }, + "namehash_to_name.wasm": { + "root": false, + "public": false, + "request_networking": false, + "request_capabilities": [ + "net:distro:sys" + ], + "grant_capabilities": [ + "net:distro:sys" + ] + }, + "net_diagnostics.wasm": { + "root": false, + "public": false, + "request_networking": false, + "request_capabilities": [ + "net:distro:sys" + ], + "grant_capabilities": [ + "net:distro:sys" + ] + }, + "peer.wasm": { + "root": false, + "public": false, + "request_networking": false, + "request_capabilities": [ + "net:distro:sys" + ], + "grant_capabilities": [ + "net:distro:sys" + ] + }, + "peers.wasm": { + "root": false, + "public": false, + "request_networking": false, + "request_capabilities": [ + "net:distro:sys" + ], + "grant_capabilities": [ + "net:distro:sys" + ] + }, "top.wasm": { "root": false, "public": false, @@ -49,10 +98,5 @@ "kernel:distro:sys" ], "grant_capabilities": [] - }, - "m.wasm": { - "root": true, - "public": true, - "request_networking": true } } \ No newline at end of file diff --git a/kinode/packages/terminal/terminal/Cargo.toml b/kinode/packages/terminal/terminal/Cargo.toml index 6da8767c6..505b97b4f 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.5.9-alpha" } +kinode_process_lib = { git = "https://github.com/kinode-dao/process_lib", tag = "v0.6.0" } 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/terminal/src/lib.rs b/kinode/packages/terminal/terminal/src/lib.rs index 3636477f1..831eaee1e 100644 --- a/kinode/packages/terminal/terminal/src/lib.rs +++ b/kinode/packages/terminal/terminal/src/lib.rs @@ -3,9 +3,8 @@ 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}; use std::collections::{HashMap, HashSet}; @@ -18,9 +17,11 @@ wit_bindgen::generate!({ }); #[derive(Debug, Serialize, Deserialize)] -struct EditAliases { - alias: String, - process: Option, +enum TerminalAction { + EditAlias { + alias: String, + process: Option, + }, } #[derive(Serialize, Deserialize)] @@ -44,32 +45,7 @@ fn parse_command(state: &mut TerminalState, line: &str) -> anyhow::Result<()> { }, }; - let re = Regex::new(r"(.*?)\|(\d+)\s*(.*)").unwrap(); - let pipe = match re.captures(args) { - Some(caps) => { - let parsed_args = caps - .get(1) - .map_or("", |m| m.as_str()) - .trim_end() - .to_string(); - - let time_str = caps.get(2).map_or("", |m| m.as_str()); - let time: u64 = time_str.parse().unwrap_or(0); - - let pipe = caps - .get(3) - .map_or("", |m| m.as_str()) - .trim_start() - .to_string(); - - (parsed_args, Some((pipe, time))) - } - 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, args.to_string()) { Ok(_) => Ok(()), // TODO clean up process Err(e) => Err(anyhow!("failed to instantiate script: {}", e)), } @@ -86,27 +62,43 @@ impl Guest for Component { aliases: HashMap::from([ ( "alias".to_string(), - "alias:terminal:sys".parse::().unwrap(), + ProcessId::new(Some("alias"), "terminal", "sys"), ), ( "cat".to_string(), - "cat:terminal:sys".parse::().unwrap(), + ProcessId::new(Some("cat"), "terminal", "sys"), ), ( "echo".to_string(), - "echo:terminal:sys".parse::().unwrap(), + ProcessId::new(Some("echo"), "terminal", "sys"), ), ( "hi".to_string(), - "hi:terminal:sys".parse::().unwrap(), + ProcessId::new(Some("hi"), "terminal", "sys"), ), ( "m".to_string(), - "m:terminal:sys".parse::().unwrap(), + ProcessId::new(Some("m"), "terminal", "sys"), + ), + ( + "namehash_to_name".to_string(), + ProcessId::new(Some("namehash_to_name"), "terminal", "sys"), + ), + ( + "net_diagnostics".to_string(), + ProcessId::new(Some("net_diagnostics"), "terminal", "sys"), + ), + ( + "peer".to_string(), + ProcessId::new(Some("peer"), "terminal", "sys"), + ), + ( + "peers".to_string(), + ProcessId::new(Some("peers"), "terminal", "sys"), ), ( "top".to_string(), - "top:terminal:sys".parse::().unwrap(), + ProcessId::new(Some("top"), "terminal", "sys"), ), ]), }, @@ -116,7 +108,7 @@ impl Guest for Component { let (source, message) = match wit::receive() { Ok((source, message)) => (source, message), Err((error, _context)) => { - println!("terminal: net error: {:?}!", error.kind); + println!("net error: {:?}!", error.kind); continue; } }; @@ -128,35 +120,25 @@ impl Guest for Component { std::str::from_utf8(&body).unwrap_or_default(), ) { Ok(()) => continue, - Err(e) => println!("terminal: {e}"), + Err(e) => println!("{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!("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!("{e}"), + }; } - None => { - state.aliases.remove(&edit_aliases.alias); - println!("terminal: alias {} removed", edit_aliases.alias); - } - } - if let Ok(new_state) = bincode::serialize(&state) { - set_state(&new_state); - } else { - println!("terminal: failed to serialize state!"); } } else { + println!("ignoring message from: {}", source); continue; } } @@ -172,30 +154,11 @@ impl Guest for Component { } } -fn handle_run( - our: &Address, - package: &PackageId, - wasm_path: String, - args: String, - pipe: Option<(String, u64)>, -) -> anyhow::Result<()> { +fn handle_run(our: &Address, process: &ProcessId, args: String) -> anyhow::Result<()> { + let wasm_path = format!("{}.wasm", process.process()); + let package = format!("{}:{}", process.package(), process.publisher()); 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 Ok(entry) = get_entry(process) else { return Err(anyhow::anyhow!("script not in scripts.json file")); }; let wasm_path = if wasm_path.starts_with("/") { @@ -207,7 +170,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!("invalid process id!")); }; let _bytes_response = Request::new() @@ -217,13 +180,69 @@ 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.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::None, initial_capabilities: HashSet::new(), public: entry.public, })?) @@ -269,6 +288,11 @@ fn handle_run( } } } + // always give it the cap to message the terminal back + 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")), @@ -281,7 +305,7 @@ fn handle_run( } } print_to_terminal( - 1, + 2, &format!( "{}: Process {{\n wasm_bytes_handle: {},\n wit_version: {},\n on_exit: {:?},\n public: {}\n capabilities: {}\n}}", parsed_new_process_id.clone(), @@ -305,63 +329,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( @@ -372,27 +339,58 @@ fn handle_run( .target(("our", parsed_new_process_id)) .body(args.into_bytes()); - let Some(pipe) = pipe else { - req.send().unwrap(); - return Ok(()); - }; + req.send().unwrap(); - let Ok(res) = req.clone().send_and_await_response(pipe.1).unwrap() else { - return Err(anyhow::anyhow!("script timed out")); - }; + Ok(()) +} - let _ = Request::new() - .target(our) - .body( - format!( - "{} {}", - pipe.0, - String::from_utf8(res.body().to_vec()).unwrap() - ) - .into_bytes() - .to_vec(), - ) - .send()?; +fn handle_alias_change( + state: &mut TerminalState, + alias: String, + process: Option, +) -> anyhow::Result<()> { + match process { + Some(process) => { + // first check to make sure the script is actually a script + let Ok(_) = get_entry(&process) else { + return Err(anyhow!("process {} not found", process)); + }; + state.aliases.insert(alias.clone(), process.clone()); + println!("alias {} set to {}", alias, process); + } + None => { + if state.aliases.contains_key(&alias) { + state.aliases.remove(&alias); + println!("alias {} removed", alias); + } else { + println!("alias {} not found", alias); + } + } + } + set_state(&bincode::serialize(&state)?); Ok(()) } + +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()) +} diff --git a/kinode/packages/terminal/top/Cargo.toml b/kinode/packages/terminal/top/Cargo.toml index 53ed72368..128cba2d5 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", tag = "v0.6.0" } 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/src/lib.rs b/kinode/packages/terminal/top/src/lib.rs index 2bcbe25a8..479d83e4e 100644 --- a/kinode/packages/terminal/top/src/lib.rs +++ b/kinode/packages/terminal/top/src/lib.rs @@ -15,12 +15,12 @@ call_init!(init); fn init(_our: Address) { let Ok(args) = await_next_request_body() else { - println!("top: failed to get args, aborting"); + println!("failed to get args"); return; }; let Ok(proc_id) = String::from_utf8(args) else { - println!("top: failed to stringify arguments"); + println!("failed to stringify arguments"); return; }; @@ -41,8 +41,7 @@ fn init(_our: Address) { .send(); } Err(_) => { - println!("top: invalid process id"); - return; + println!("invalid process id"); } } } diff --git a/kinode/packages/tester/metadata.json b/kinode/packages/tester/metadata.json new file mode 100644 index 000000000..9bc832b3a --- /dev/null +++ b/kinode/packages/tester/metadata.json @@ -0,0 +1,16 @@ +{ + "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/packages/tester/pkg/manifest.json b/kinode/packages/tester/pkg/manifest.json index 889d00f9b..f5f7d6ea2 100644 --- a/kinode/packages/tester/pkg/manifest.json +++ b/kinode/packages/tester/pkg/manifest.json @@ -5,14 +5,17 @@ "on_exit": "Restart", "request_networking": true, "request_capabilities": [ - "net:distro:sys", "kernel:distro:sys", + "kv:distro:sys", "http_server:distro:sys", + "sqlite:distro:sys", "vfs:distro:sys" ], "grant_capabilities": [ + "kv:distro:sys", + "sqlite:distro:sys", "vfs:distro:sys" ], "public": true } -] \ No newline at end of file +] diff --git a/kinode/packages/tester/pkg/metadata.json b/kinode/packages/tester/pkg/metadata.json deleted file mode 100644 index 833592595..000000000 --- a/kinode/packages/tester/pkg/metadata.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "package": "tester", - "publisher": "sys", - "version": [ - 0, - 1, - 0 - ] -} \ No newline at end of file diff --git a/kinode/packages/tester/test_runner/Cargo.toml b/kinode/packages/tester/test_runner/Cargo.toml index 95b65d88e..85f8e1b29 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", tag = "v0.6.0" } 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/test_runner/src/lib.rs b/kinode/packages/tester/test_runner/src/lib.rs index 3adc709d5..e29d502d2 100644 --- a/kinode/packages/tester/test_runner/src/lib.rs +++ b/kinode/packages/tester/test_runner/src/lib.rs @@ -1,7 +1,7 @@ use std::str::FromStr; use kinode_process_lib::{ - await_message, our_capabilities, println, spawn, vfs, + await_message, call_init, our_capabilities, println, spawn, vfs, vfs::{DirEntry, FileType}, Address, Message, OnExit, ProcessId, Request, Response, }; @@ -48,11 +48,10 @@ fn handle_message(our: &Address) -> anyhow::Result<()> { path: dir_prefix.into(), action: vfs::VfsAction::ReadDir, })?) - .send_and_await_response(test_timeout)? - .unwrap(); + .send_and_await_response(test_timeout)??; let Message::Response { body: vfs_body, .. } = response else { - panic!("") + fail!("test_runner"); }; let vfs::VfsResponse::ReadDir(mut children) = serde_json::from_slice(&vfs_body)? @@ -61,7 +60,7 @@ fn handle_message(our: &Address) -> anyhow::Result<()> { "{:?}", serde_json::from_slice::(&vfs_body)? ); - panic!("") + fail!("test_runner"); }; for test_name in test_names { @@ -85,7 +84,7 @@ fn handle_message(our: &Address) -> anyhow::Result<()> { None => std::collections::HashMap::new(), Some(caps_index) => { children.remove(caps_index); - let file = vfs::file::open_file(&caps_file_path, false)?; + let file = vfs::file::open_file(&caps_file_path, false, None)?; let file_contents = file.read()?; serde_json::from_slice(&file_contents)? } @@ -116,7 +115,7 @@ fn handle_message(our: &Address) -> anyhow::Result<()> { Ok(child_process_id) => child_process_id, Err(e) => { println!("couldn't spawn {}: {}", test_path, e); - panic!("couldn't spawn"); // TODO + fail!("test_runner"); } }; @@ -126,11 +125,10 @@ fn handle_message(our: &Address) -> anyhow::Result<()> { process: child_process_id, }) .body(body.clone()) - .send_and_await_response(test_timeout)? - .unwrap(); + .send_and_await_response(test_timeout)??; let Message::Response { body, .. } = response else { - panic!("") + fail!("test_runner"); }; match serde_json::from_slice(&body)? { tt::TesterResponse::Pass => {} @@ -149,12 +147,11 @@ fn handle_message(our: &Address) -> anyhow::Result<()> { println!("test_runner: done running {:?}", children); Response::new() - .body(serde_json::to_vec(&tt::TesterResponse::Pass).unwrap()) - .send() - .unwrap(); + .body(serde_json::to_vec(&tt::TesterResponse::Pass)?) + .send()?; } tt::TesterRequest::KernelMessage(_) | tt::TesterRequest::GetFullMessage(_) => { - unimplemented!() + fail!("test_runner"); } } Ok(()) @@ -162,21 +159,17 @@ fn handle_message(our: &Address) -> anyhow::Result<()> { } } -struct Component; -impl Guest for Component { - fn init(our: String) { - println!("{:?}@test_runner: begin", our); - - let our: Address = our.parse().unwrap(); +call_init!(init); +fn init(our: Address) { + println!("{}: begin", our); - loop { - match handle_message(&our) { - Ok(()) => {} - Err(e) => { - println!("test_runner: error: {:?}", e); - fail!("test_runner"); - } - }; - } + loop { + match handle_message(&our) { + Ok(()) => {} + Err(e) => { + println!("test_runner: error: {:?}", e); + fail!("test_runner"); + } + }; } } diff --git a/kinode/packages/tester/tester/Cargo.toml b/kinode/packages/tester/tester/Cargo.toml index 35efeef3b..0667c8ef9 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", tag = "v0.6.0" } 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/src/lib.rs b/kinode/packages/tester/tester/src/lib.rs index 5370c46d7..a2a7ee2a0 100644 --- a/kinode/packages/tester/tester/src/lib.rs +++ b/kinode/packages/tester/tester/src/lib.rs @@ -47,7 +47,7 @@ fn handle_message( Response::new().body(body).send().unwrap(); } tt::TesterResponse::GetFullMessage(_) => { - unimplemented!() + fail!("tester"); } } Ok(()) @@ -59,7 +59,7 @@ fn handle_message( test_timeout, .. } => { - println!("tester: got Run"); + println!("got Run"); assert!(input_node_names.len() >= 1); *node_names = input_node_names.clone(); @@ -83,7 +83,7 @@ fn handle_message( Ok(child_process_id) => child_process_id, Err(e) => { println!("couldn't spawn {}: {}", child, e); - panic!("couldn't spawn"); // TODO + fail!("tester"); } }; Request::new() @@ -92,12 +92,12 @@ fn handle_message( process: child_process_id, }) .body(body) - .expects_response(test_timeout) + .expects_response(test_timeout * 2) .send()?; } } tt::TesterRequest::KernelMessage(_) | tt::TesterRequest::GetFullMessage(_) => { - unimplemented!() + fail!("tester"); } } Ok(()) @@ -107,11 +107,9 @@ fn handle_message( call_init!(init); fn init(our: Address) { - println!("tester: begin"); - let mut messages: Messages = IndexMap::new(); let mut node_names: Vec = Vec::new(); - let _ = Request::new() + match Request::new() .target(make_vfs_address(&our).unwrap()) .body( serde_json::to_vec(&vfs::VfsRequest { @@ -121,12 +119,20 @@ fn init(our: Address) { .unwrap(), ) .send_and_await_response(5) - .unwrap() - .unwrap(); + { + Err(_) => { + fail!("tester"); + } + Ok(r) => { + if r.is_err() { + fail!("tester"); + } + } + } // orchestrate tests using external scripts // -> must give drive cap to rpc - let _ = Request::new() + let sent = Request::new() .target(("our", "kernel", "distro", "sys")) .body( serde_json::to_vec(&kt::KernelCommand::GrantCapabilities { @@ -145,14 +151,17 @@ fn init(our: Address) { }) .unwrap(), ) - .send() - .unwrap(); + .send(); + if sent.is_err() { + fail!("tester"); + } loop { match handle_message(&our, &mut messages, &mut node_names) { Ok(()) => {} Err(e) => { println!("tester: error: {:?}", e,); + fail!("tester"); } }; } diff --git a/kinode/src/eth/default_providers_mainnet.json b/kinode/src/eth/default_providers_mainnet.json new file mode 100644 index 000000000..b83f72e7a --- /dev/null +++ b/kinode/src/eth/default_providers_mainnet.json @@ -0,0 +1,63 @@ +[ + { + "chain_id": 1, + "trusted": false, + "provider": { + "RpcUrl": "wss://ethereum.publicnode.com" + } + }, + { + "chain_id": 10, + "trusted": false, + "provider": { + "Node": { + "use_as_provider": true, + "kns_update": { + "name": "default-router-1.os", + "owner": "", + "node": "0xb35eb347deb896bc3fb6132a07fca1601f83462385ed11e835c24c33ba4ef73d", + "public_key": "0xb1b1cf23c89f651aac3e5fd4decb04aa177ab0ec8ce5f1d3877b90bb6f5779db", + "ip": "147.135.114.167", + "port": 9005, + "routers": [] + } + } + } + }, + { + "chain_id": 10, + "trusted": false, + "provider": { + "Node": { + "use_as_provider": true, + "kns_update": { + "name": "default-router-2.os", + "owner": "", + "node": "0xd827ae579fafa604af79fbed977e8abe048497f10885c6473dfd343a3b7b4458", + "public_key": "0xab9f1a996db3a4e1dbcd31d765daedeb3af9af4f570c0968463b5be3a7d1e992", + "ip": "147.135.114.167", + "port": 9006, + "routers": [] + } + } + } + }, + { + "chain_id": 10, + "trusted": false, + "provider": { + "Node": { + "use_as_provider": true, + "kns_update": { + "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/src/eth/default_providers_testnet.json b/kinode/src/eth/default_providers_testnet.json new file mode 100644 index 000000000..528abfd41 --- /dev/null +++ b/kinode/src/eth/default_providers_testnet.json @@ -0,0 +1,63 @@ +[ + { + "chain_id": 1, + "trusted": false, + "provider": { + "RpcUrl": "wss://ethereum.publicnode.com" + } + }, + { + "chain_id": 11155111, + "trusted": false, + "provider": { + "Node": { + "use_as_provider": true, + "kns_update": { + "name": "default-router-1.os", + "owner": "", + "node": "0xb35eb347deb896bc3fb6132a07fca1601f83462385ed11e835c24c33ba4ef73d", + "public_key": "0xb1b1cf23c89f651aac3e5fd4decb04aa177ab0ec8ce5f1d3877b90bb6f5779db", + "ip": "147.135.114.167", + "port": 9002, + "routers": [] + } + } + } + }, + { + "chain_id": 11155111, + "trusted": false, + "provider": { + "Node": { + "use_as_provider": true, + "kns_update": { + "name": "default-router-2.os", + "owner": "", + "node": "0xd827ae579fafa604af79fbed977e8abe048497f10885c6473dfd343a3b7b4458", + "public_key": "0xab9f1a996db3a4e1dbcd31d765daedeb3af9af4f570c0968463b5be3a7d1e992", + "ip": "147.135.114.167", + "port": 9003, + "routers": [] + } + } + } + }, + { + "chain_id": 11155111, + "trusted": false, + "provider": { + "Node": { + "use_as_provider": true, + "kns_update": { + "name": "default-router-3.os", + "owner": "", + "node": "0x96e36331c8f0882f2c0c46c13b15d812def04fe8606d503bc0e2be39db26486a", + "public_key": "0x536e30785e64dd0349a697285af365b5ed7c4d300010139261cfc4dbdd5b254b", + "ip": "147.135.114.167", + "port": 9004, + "routers": [] + } + } + } + } +] \ No newline at end of file diff --git a/kinode/src/eth/mod.rs b/kinode/src/eth/mod.rs index 6257bab40..d5c46574c 100644 --- a/kinode/src/eth/mod.rs +++ b/kinode/src/eth/mod.rs @@ -1,4 +1,885 @@ -#![allow(unused)] -pub mod provider; +use alloy_providers::provider::Provider; +use alloy_pubsub::PubSubFrontend; +use alloy_rpc_client::ClientBuilder; +use alloy_transport_ws::WsConnect; +use anyhow::Result; +use dashmap::DashMap; +use lib::types::core::*; +use lib::types::eth::*; +use serde::{Deserialize, Serialize}; +use std::collections::{HashMap, HashSet}; +use std::sync::Arc; +use tokio::task::JoinHandle; +use url::Url; -pub use lib::types::eth as types; +mod subscription; + +/// meta-type for all incoming requests we need to handle +#[derive(Debug, Serialize, Deserialize)] +#[serde(untagged)] +enum IncomingReq { + EthAction(EthAction), + EthConfigAction(EthConfigAction), + EthSubResult(EthSubResult), + SubKeepalive(u64), +} + +/// mapping of chain id to ordered lists of providers +type Providers = Arc>; + +#[derive(Debug)] +struct ActiveProviders { + pub urls: Vec, + pub nodes: Vec, +} + +#[derive(Debug)] +struct UrlProvider { + pub trusted: bool, + pub url: String, + pub pubsub: Option>, +} + +#[derive(Debug)] +struct NodeProvider { + pub trusted: bool, + /// semi-temporary flag to mark if this provider is currently usable + /// future updates will make this more dynamic + pub usable: bool, + pub name: String, +} + +impl ActiveProviders { + fn add_provider_config(&mut self, new: ProviderConfig) { + match new.provider { + NodeOrRpcUrl::Node { + kns_update, + use_as_provider, + } => { + self.nodes.push(NodeProvider { + trusted: new.trusted, + usable: use_as_provider, + name: kns_update.name, + }); + } + NodeOrRpcUrl::RpcUrl(url) => { + self.urls.push(UrlProvider { + trusted: new.trusted, + url, + pubsub: None, + }); + } + } + } + + fn remove_provider(&mut self, remove: &str) { + self.urls.retain(|x| x.url != remove); + self.nodes.retain(|x| x.name != remove); + } +} + +/// existing subscriptions held by local OR remote processes +type ActiveSubscriptions = Arc>>; + +type ResponseChannels = Arc>; + +#[derive(Debug)] +enum ActiveSub { + Local(JoinHandle<()>), + Remote { + provider_node: String, + handle: JoinHandle<()>, + sender: tokio::sync::mpsc::Sender, + }, +} + +impl ActiveSub { + async fn close(&self, sub_id: u64, state: &ModuleState) { + match self { + ActiveSub::Local(handle) => { + handle.abort(); + } + ActiveSub::Remote { + provider_node, + handle, + .. + } => { + // tell provider node we don't need their services anymore + kernel_message( + &state.our, + rand::random(), + Address { + node: provider_node.clone(), + process: ETH_PROCESS_ID.clone(), + }, + None, + true, + None, + EthAction::UnsubscribeLogs(sub_id), + &state.send_to_loop, + ) + .await; + handle.abort(); + } + } + } +} + +struct ModuleState { + /// the name of this node + our: Arc, + /// the home directory path + home_directory_path: String, + /// the access settings for this provider + access_settings: AccessSettings, + /// the set of providers we have available for all chains + providers: Providers, + /// the set of active subscriptions we are currently maintaining + active_subscriptions: ActiveSubscriptions, + /// the set of response channels we have open for outstanding request tasks + response_channels: ResponseChannels, + /// our sender for kernel event loop + send_to_loop: MessageSender, + /// our sender for terminal prints + print_tx: PrintSender, +} + +/// 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 is the runtime entry point +/// for the entire module. +pub async fn provider( + our: String, + home_directory_path: String, + configs: SavedConfigs, + send_to_loop: MessageSender, + mut recv_in_client: MessageReceiver, + mut net_error_recv: NetworkErrorReceiver, + caps_oracle: CapMessageSender, + print_tx: PrintSender, +) -> Result<()> { + // load access settings if they've been saved + let access_settings: AccessSettings = + match tokio::fs::read_to_string(format!("{}/.eth_access_settings", home_directory_path)) + .await + { + Ok(contents) => serde_json::from_str(&contents).unwrap(), + Err(_) => { + let access_settings = AccessSettings { + public: false, + allow: HashSet::new(), + deny: HashSet::new(), + }; + let _ = tokio::fs::write( + format!("{}/.eth_access_settings", home_directory_path), + serde_json::to_string(&access_settings).unwrap(), + ) + .await; + access_settings + } + }; + verbose_print( + &print_tx, + &format!("eth: access settings loaded: {access_settings:?}"), + ) + .await; + + let mut state = ModuleState { + our: Arc::new(our), + home_directory_path, + access_settings, + providers: Arc::new(DashMap::new()), + active_subscriptions: Arc::new(DashMap::new()), + response_channels: Arc::new(DashMap::new()), + send_to_loop, + print_tx, + }; + + // convert saved configs into data structure that we will use to route queries + for entry in configs { + let mut ap = state + .providers + .entry(entry.chain_id) + .or_insert(ActiveProviders { + urls: vec![], + nodes: vec![], + }); + ap.add_provider_config(entry); + } + + verbose_print(&state.print_tx, "eth: provider initialized").await; + + loop { + tokio::select! { + Some(wrapped_error) = net_error_recv.recv() => { + handle_network_error( + wrapped_error, + &state.active_subscriptions, + &state.response_channels, + &state.print_tx + ).await; + } + Some(km) = recv_in_client.recv() => { + let km_id = km.id; + let response_target = km.rsvp.as_ref().unwrap_or(&km.source).clone(); + if let Err(e) = handle_message( + &mut state, + km, + &caps_oracle, + ) + .await + { + error_message( + &state.our, + km_id, + response_target, + e, + &state.send_to_loop + ).await; + }; + } + } + } +} + +async fn handle_network_error( + wrapped_error: WrappedSendError, + active_subscriptions: &ActiveSubscriptions, + response_channels: &ResponseChannels, + print_tx: &PrintSender, +) { + verbose_print(&print_tx, "eth: got network error").await; + // if we hold active subscriptions for the remote node that this error refers to, + // close them here -- they will need to resubscribe + // TODO is this necessary? + if let Some(sub_map) = active_subscriptions.get(&wrapped_error.error.target) { + for (_sub_id, sub) in sub_map.iter() { + if let ActiveSub::Local(handle) = sub { + verbose_print( + &print_tx, + "eth: closing local sub in response to network error", + ) + .await; + handle.abort(); + } + } + } + // we got an error from a remote node provider -- + // forward it to response channel if it exists + if let Some(chan) = response_channels.get(&wrapped_error.id) { + // can't close channel here, as response may be an error + // and fulfill_request may wish to try other providers. + verbose_print(&print_tx, "eth: sent network error to response channel").await; + let _ = chan.send(Err(wrapped_error)).await; + } +} + +/// handle incoming requests, namely [`EthAction`] and [`EthConfigAction`]. +/// also handle responses that are passthroughs from remote provider nodes. +async fn handle_message( + state: &mut ModuleState, + km: KernelMessage, + caps_oracle: &CapMessageSender, +) -> Result<(), EthError> { + match &km.message { + Message::Response(_) => { + // map response to the correct channel + if let Some(chan) = state.response_channels.get(&km.id) { + // can't close channel here, as response may be an error + // and fulfill_request may wish to try other providers. + let _ = chan.send(Ok(km)).await; + } else { + verbose_print( + &state.print_tx, + "eth: got response but no matching channel found", + ) + .await; + } + } + Message::Request(req) => { + let timeout = req.expects_response.unwrap_or(60); + let Ok(req) = serde_json::from_slice::(&req.body) else { + return Err(EthError::MalformedRequest); + }; + match req { + IncomingReq::EthAction(eth_action) => { + return handle_eth_action(state, km, timeout, eth_action).await; + } + IncomingReq::EthConfigAction(eth_config_action) => { + kernel_message( + &state.our.clone(), + km.id, + km.rsvp.as_ref().unwrap_or(&km.source).clone(), + None, + false, + None, + handle_eth_config_action(state, caps_oracle, &km, eth_config_action).await, + &state.send_to_loop, + ) + .await; + } + IncomingReq::EthSubResult(eth_sub_result) => { + // forward this to rsvp, if we have the sub id in our active subs + let Some(rsvp) = km.rsvp else { + return Ok(()); // no rsvp, no need to forward + }; + let sub_id = match eth_sub_result { + Ok(EthSub { id, .. }) => id, + Err(EthSubError { id, .. }) => id, + }; + if let Some(sub_map) = state.active_subscriptions.get(&rsvp) { + if let Some(ActiveSub::Remote { + provider_node, + sender, + .. + }) = sub_map.get(&sub_id) + { + if provider_node == &km.source.node { + if let Ok(()) = sender.send(eth_sub_result).await { + return Ok(()); + } + } + } + } + // tell the remote provider that we don't have this sub + // so they can stop sending us updates + verbose_print( + &state.print_tx, + "eth: got eth_sub_result but no matching sub found", + ) + .await; + kernel_message( + &state.our.clone(), + km.id, + km.source.clone(), + None, + true, + None, + EthAction::UnsubscribeLogs(sub_id), + &state.send_to_loop, + ) + .await; + } + IncomingReq::SubKeepalive(sub_id) => { + // source expects that we have a local sub for them with this id + // if we do, no action required, otherwise, throw them an error. + if let Some(sub_map) = state.active_subscriptions.get(&km.source) { + if sub_map.contains_key(&sub_id) { + return Ok(()); + } + } + } + } + } + } + Ok(()) +} + +async fn handle_eth_action( + state: &mut ModuleState, + km: KernelMessage, + timeout: u64, + eth_action: EthAction, +) -> Result<(), EthError> { + // check our access settings if the request is from a remote node + if km.source.node != *state.our { + if state.access_settings.deny.contains(&km.source.node) { + verbose_print( + &state.print_tx, + "eth: got eth_action from unauthorized remote source", + ) + .await; + return Err(EthError::PermissionDenied); + } + if !state.access_settings.public { + if !state.access_settings.allow.contains(&km.source.node) { + verbose_print( + &state.print_tx, + "eth: got eth_action from unauthorized remote source", + ) + .await; + return Err(EthError::PermissionDenied); + } + } + } + + verbose_print( + &state.print_tx, + &format!("eth: handling eth_action {eth_action:?}"), + ) + .await; + + // for each incoming action, we need to assign a provider from our map + // based on the chain id. once we assign a provider, we can use it for + // this request. if the provider is not usable, cycle through options + // before returning an error. + match eth_action { + EthAction::SubscribeLogs { sub_id, .. } => { + tokio::spawn(subscription::create_new_subscription( + state.our.to_string(), + km.id, + km.source.clone(), + km.rsvp, + state.send_to_loop.clone(), + sub_id, + eth_action, + state.providers.clone(), + state.active_subscriptions.clone(), + state.response_channels.clone(), + state.print_tx.clone(), + )); + } + EthAction::UnsubscribeLogs(sub_id) => { + let mut sub_map = state + .active_subscriptions + .entry(km.source) + .or_insert(HashMap::new()); + if let Some(sub) = sub_map.remove(&sub_id) { + sub.close(sub_id, state).await; + } + } + EthAction::Request { .. } => { + let (sender, receiver) = tokio::sync::mpsc::channel(1); + state.response_channels.insert(km.id, sender); + let our = state.our.to_string(); + let send_to_loop = state.send_to_loop.clone(); + let providers = state.providers.clone(); + let response_channels = state.response_channels.clone(); + let print_tx = state.print_tx.clone(); + tokio::spawn(async move { + match tokio::time::timeout( + std::time::Duration::from_secs(timeout), + fulfill_request( + &our, + km.id, + &send_to_loop, + eth_action, + providers, + receiver, + &print_tx, + ), + ) + .await + { + Ok(response) => { + kernel_message( + &our, + km.id, + km.rsvp.unwrap_or(km.source), + None, + false, + None, + response, + &send_to_loop, + ) + .await; + } + Err(_) => { + // task timeout + error_message(&our, km.id, km.source, EthError::RpcTimeout, &send_to_loop) + .await; + } + } + response_channels.remove(&km.id); + }); + } + } + Ok(()) +} + +async fn fulfill_request( + our: &str, + km_id: u64, + send_to_loop: &MessageSender, + eth_action: EthAction, + providers: Providers, + mut remote_request_receiver: ProcessMessageReceiver, + print_tx: &PrintSender, +) -> EthResponse { + let EthAction::Request { + chain_id, + ref method, + ref params, + } = eth_action + else { + return EthResponse::Err(EthError::PermissionDenied); // will never hit + }; + let Some(method) = to_static_str(&method) else { + return EthResponse::Err(EthError::InvalidMethod(method.to_string())); + }; + let Some(mut aps) = providers.get_mut(&chain_id) else { + return EthResponse::Err(EthError::NoRpcForChain); + }; + // first, try any url providers we have for this chain, + // then if we have none or they all fail, go to node provider. + // finally, if no provider works, return an error. + for url_provider in &mut aps.urls { + let pubsub = match &url_provider.pubsub { + Some(pubsub) => pubsub, + None => { + if let Ok(()) = activate_url_provider(url_provider).await { + verbose_print(print_tx, "eth: activated a url provider").await; + url_provider.pubsub.as_ref().unwrap() + } else { + continue; + } + } + }; + let Ok(value) = pubsub.inner().prepare(method, params.clone()).await else { + // this provider failed and needs to be reset + url_provider.pubsub = None; + continue; + }; + return EthResponse::Response { value }; + } + for node_provider in &mut aps.nodes { + let response = forward_to_node_provider( + our, + km_id, + None, + node_provider, + eth_action.clone(), + send_to_loop, + &mut remote_request_receiver, + ) + .await; + if let EthResponse::Err(e) = response { + if e == EthError::RpcMalformedResponse { + node_provider.usable = false; + } + } else { + return response; + } + } + EthResponse::Err(EthError::NoRpcForChain) +} + +/// take an EthAction and send it to a node provider, then await a response. +async fn forward_to_node_provider( + our: &str, + km_id: u64, + rsvp: Option
, + node_provider: &NodeProvider, + eth_action: EthAction, + send_to_loop: &MessageSender, + receiver: &mut ProcessMessageReceiver, +) -> EthResponse { + if !node_provider.usable || node_provider.name == our { + return EthResponse::Err(EthError::PermissionDenied); + } + kernel_message( + our, + km_id, + Address { + node: node_provider.name.clone(), + process: ETH_PROCESS_ID.clone(), + }, + rsvp, + true, + Some(60), // TODO + eth_action.clone(), + &send_to_loop, + ) + .await; + let Ok(Some(Ok(response_km))) = + tokio::time::timeout(std::time::Duration::from_secs(30), receiver.recv()).await + else { + return EthResponse::Err(EthError::RpcTimeout); + }; + let Message::Response((resp, _context)) = response_km.message else { + // if we hit this, they spoofed a request with same id, ignore and possibly punish + return EthResponse::Err(EthError::RpcMalformedResponse); + }; + let Ok(eth_response) = serde_json::from_slice::(&resp.body) else { + // if we hit this, they sent a malformed response, ignore and possibly punish + return EthResponse::Err(EthError::RpcMalformedResponse); + }; + eth_response +} + +async fn handle_eth_config_action( + state: &mut ModuleState, + caps_oracle: &CapMessageSender, + km: &KernelMessage, + eth_config_action: EthConfigAction, +) -> EthConfigResponse { + if km.source.node != *state.our { + verbose_print( + &state.print_tx, + "eth: got eth_config_action from unauthorized remote source", + ) + .await; + return EthConfigResponse::PermissionDenied; + } + + // check capabilities to ensure the sender is allowed to make this request + if !check_for_root_cap(&state.our, &km.source.process, caps_oracle).await { + verbose_print( + &state.print_tx, + "eth: got eth_config_action from unauthorized local source", + ) + .await; + return EthConfigResponse::PermissionDenied; + } + + verbose_print( + &state.print_tx, + &format!("eth: handling eth_config_action {eth_config_action:?}"), + ) + .await; + + let mut save_providers = false; + + // modify our providers and access settings based on config action + match eth_config_action { + EthConfigAction::AddProvider(provider) => { + let mut aps = state + .providers + .entry(provider.chain_id) + .or_insert(ActiveProviders { + urls: vec![], + nodes: vec![], + }); + aps.add_provider_config(provider); + save_providers = true; + } + EthConfigAction::RemoveProvider((chain_id, remove)) => { + if let Some(mut aps) = state.providers.get_mut(&chain_id) { + aps.remove_provider(&remove); + save_providers = true; + } + } + EthConfigAction::SetPublic => { + state.access_settings.public = true; + } + EthConfigAction::SetPrivate => { + state.access_settings.public = false; + } + EthConfigAction::AllowNode(node) => { + state.access_settings.allow.insert(node); + } + EthConfigAction::UnallowNode(node) => { + state.access_settings.allow.remove(&node); + } + EthConfigAction::DenyNode(node) => { + state.access_settings.deny.insert(node); + } + EthConfigAction::UndenyNode(node) => { + state.access_settings.deny.remove(&node); + } + EthConfigAction::SetProviders(new_providers) => { + let new_map = DashMap::new(); + for entry in new_providers { + let mut aps = new_map.entry(entry.chain_id).or_insert(ActiveProviders { + urls: vec![], + nodes: vec![], + }); + aps.add_provider_config(entry); + } + state.providers = Arc::new(new_map); + save_providers = true; + } + EthConfigAction::GetProviders => { + return EthConfigResponse::Providers(providers_to_saved_configs(&state.providers)); + } + EthConfigAction::GetAccessSettings => { + return EthConfigResponse::AccessSettings(state.access_settings.clone()); + } + EthConfigAction::GetState => { + return EthConfigResponse::State { + active_subscriptions: state + .active_subscriptions + .iter() + .map(|e| { + ( + e.key().clone(), + e.value() + .iter() + .map(|(id, sub)| { + ( + *id, + match sub { + ActiveSub::Local(_) => None, + ActiveSub::Remote { provider_node, .. } => { + Some(provider_node.clone()) + } + }, + ) + }) + .collect(), + ) + }) + .collect(), + outstanding_requests: state.response_channels.iter().map(|e| *e.key()).collect(), + }; + } + } + // save providers and access settings to disk + let _ = tokio::fs::write( + format!("{}/.eth_access_settings", state.home_directory_path), + serde_json::to_string(&state.access_settings).unwrap(), + ) + .await; + verbose_print(&state.print_tx, "eth: saved new access settings").await; + if save_providers { + let _ = tokio::fs::write( + format!("{}/.eth_providers", state.home_directory_path), + serde_json::to_string(&providers_to_saved_configs(&state.providers)).unwrap(), + ) + .await; + verbose_print(&state.print_tx, "eth: saved new provider settings").await; + } + EthConfigResponse::Ok +} + +async fn activate_url_provider(provider: &mut UrlProvider) -> Result<()> { + match Url::parse(&provider.url)?.scheme() { + "ws" | "wss" => { + let connector = WsConnect { + url: provider.url.to_string(), + auth: None, + }; + let client = tokio::time::timeout( + std::time::Duration::from_secs(10), + ClientBuilder::default().ws(connector), + ) + .await??; + provider.pubsub = Some(Provider::new_with_client(client)); + Ok(()) + } + _ => Err(anyhow::anyhow!( + "Only `ws://` or `wss://` providers are supported." + )), + } +} + +fn providers_to_saved_configs(providers: &Providers) -> SavedConfigs { + providers + .iter() + .map(|entry| { + entry + .urls + .iter() + .map(|url_provider| ProviderConfig { + chain_id: *entry.key(), + provider: NodeOrRpcUrl::RpcUrl(url_provider.url.clone()), + trusted: url_provider.trusted, + }) + .chain(entry.nodes.iter().map(|node_provider| ProviderConfig { + chain_id: *entry.key(), + provider: NodeOrRpcUrl::Node { + kns_update: KnsUpdate { + name: node_provider.name.clone(), + owner: "".to_string(), + node: "".to_string(), + public_key: "".to_string(), + ip: "".to_string(), + port: 0, + routers: vec![], + }, + use_as_provider: node_provider.usable, + }, + trusted: node_provider.trusted, + })) + .collect::>() + }) + .flatten() + .collect() +} + +async fn check_for_root_cap( + our: &str, + process: &ProcessId, + caps_oracle: &CapMessageSender, +) -> bool { + let (send_cap_bool, recv_cap_bool) = tokio::sync::oneshot::channel(); + caps_oracle + .send(CapMessage::Has { + on: process.clone(), + cap: Capability { + issuer: Address { + node: our.to_string(), + process: ETH_PROCESS_ID.clone(), + }, + params: serde_json::to_string(&serde_json::json!({ + "root": true, + })) + .unwrap(), + }, + responder: send_cap_bool, + }) + .await + .expect("eth: capability oracle died!"); + recv_cap_bool.await.unwrap_or(false) +} + +async fn verbose_print(print_tx: &PrintSender, content: &str) { + let _ = print_tx + .send(Printout { + verbosity: 2, + content: content.to_string(), + }) + .await; +} + +async fn error_message( + our: &str, + km_id: u64, + target: Address, + error: EthError, + send_to_loop: &MessageSender, +) { + kernel_message( + our, + km_id, + target, + None, + false, + None, + EthResponse::Err(error), + send_to_loop, + ) + .await +} + +async fn kernel_message( + our: &str, + km_id: u64, + target: Address, + rsvp: Option
, + req: bool, + timeout: Option, + body: T, + send_to_loop: &MessageSender, +) { + let _ = send_to_loop + .send(KernelMessage { + id: km_id, + source: Address { + node: our.to_string(), + process: ETH_PROCESS_ID.clone(), + }, + target, + rsvp, + message: if req { + Message::Request(Request { + inherit: false, + expects_response: timeout, + body: serde_json::to_vec(&body).unwrap(), + metadata: None, + capabilities: vec![], + }) + } else { + Message::Response(( + Response { + inherit: false, + body: serde_json::to_vec(&body).unwrap(), + metadata: None, + capabilities: vec![], + }, + None, + )) + }, + lazy_load_blob: None, + }) + .await; +} diff --git a/kinode/src/eth/provider.rs b/kinode/src/eth/provider.rs deleted file mode 100644 index 571244744..000000000 --- a/kinode/src/eth/provider.rs +++ /dev/null @@ -1,189 +0,0 @@ -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; - -use lib::types::{core::*, eth::*}; - -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 -/// indexing and ETH node responsibilities. -pub async fn provider( - our: String, - rpc_url: String, - 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. - 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 = 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 mut connections = RpcConnections { - provider, - ws_provider_subscriptions: HashMap::new(), - }; - - 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()), - 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?; - } - } - } - } - Err(anyhow::anyhow!("eth: fatal: message receiver closed!")) -} - -async fn handle_request( - our: Arc, - target: &Address, - action: EthAction, - connections: &mut RpcConnections, - send_to_loop: &MessageSender, -) -> Result<(), EthError> { - match action { - EthAction::SubscribeLogs { sub_id, filter } => { - 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 handle = tokio::spawn(handle_subscription_stream( - our.clone(), - connections.provider.clone(), - filter, - target.clone(), - send_to_loop.clone(), - )); - connections.ws_provider_subscriptions.insert(sub_id, handle); - Ok(()) - } - EthAction::UnsubscribeLogs(sub_id) => { - let sub_id = (target.process.clone(), sub_id); - let handle = connections - .ws_provider_subscriptions - .remove(&sub_id) - .ok_or(EthError::SubscriptionNotFound)?; - - handle.abort(); - 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, - provider: Provider, - filter: Filter, - 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 { - 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(&EthSubEvent::Log(event)).unwrap(), - metadata: None, - capabilities: vec![], - }), - lazy_load_blob: None, - }) - .await - .unwrap(); - } - Err(EthError::SubscriptionClosed) -} diff --git a/kinode/src/eth/subscription.rs b/kinode/src/eth/subscription.rs new file mode 100644 index 000000000..8529f9969 --- /dev/null +++ b/kinode/src/eth/subscription.rs @@ -0,0 +1,358 @@ +use crate::eth::*; +use alloy_pubsub::RawSubscription; +use alloy_rpc_types::pubsub::SubscriptionResult; +use anyhow::Result; +use std::collections::HashMap; + +/// cleans itself up when the subscription is closed or fails. +pub async fn create_new_subscription( + our: String, + km_id: u64, + target: Address, + rsvp: Option
, + send_to_loop: MessageSender, + sub_id: u64, + eth_action: EthAction, + providers: Providers, + active_subscriptions: ActiveSubscriptions, + response_channels: ResponseChannels, + print_tx: PrintSender, +) { + verbose_print(&print_tx, "eth: creating new subscription").await; + match build_subscription( + &our, + km_id, + &target, + &send_to_loop, + ð_action, + &providers, + &response_channels, + &print_tx, + ) + .await + { + Ok(maybe_raw_sub) => { + // send a response to the target that the subscription was successful + kernel_message( + &our, + km_id, + target.clone(), + rsvp.clone(), + false, + None, + EthResponse::Ok, + &send_to_loop, + ) + .await; + let mut subs = active_subscriptions + .entry(target.clone()) + .or_insert(HashMap::new()); + let active_subscriptions = active_subscriptions.clone(); + match maybe_raw_sub { + Ok(rx) => { + subs.insert( + sub_id, + // this is a local sub, as in, we connect to the rpc endpt + ActiveSub::Local(tokio::spawn(async move { + // await the subscription error and kill it if so + if let Err(e) = maintain_local_subscription( + &our, + sub_id, + rx, + &target, + &rsvp, + &send_to_loop, + ) + .await + { + verbose_print( + &print_tx, + "eth: closed local subscription due to error", + ) + .await; + kernel_message( + &our, + rand::random(), + target.clone(), + rsvp, + true, + None, + EthSubResult::Err(e), + &send_to_loop, + ) + .await; + active_subscriptions.entry(target).and_modify(|sub_map| { + sub_map.remove(&km_id); + }); + } + })), + ); + } + Err((provider_node, remote_sub_id)) => { + // this is a remote sub, given by a relay node + let (sender, rx) = tokio::sync::mpsc::channel(10); + let keepalive_km_id = rand::random(); + let (keepalive_err_sender, keepalive_err_receiver) = + tokio::sync::mpsc::channel(1); + response_channels.insert(keepalive_km_id, keepalive_err_sender); + subs.insert( + remote_sub_id, + ActiveSub::Remote { + provider_node: provider_node.clone(), + handle: tokio::spawn(async move { + if let Err(e) = maintain_remote_subscription( + &our, + &provider_node, + remote_sub_id, + sub_id, + keepalive_km_id, + rx, + keepalive_err_receiver, + &target, + &send_to_loop, + ) + .await + { + verbose_print( + &print_tx, + "eth: closed subscription with provider node due to error", + ) + .await; + kernel_message( + &our, + rand::random(), + target.clone(), + None, + true, + None, + EthSubResult::Err(e), + &send_to_loop, + ) + .await; + active_subscriptions.entry(target).and_modify(|sub_map| { + sub_map.remove(&sub_id); + }); + response_channels.remove(&keepalive_km_id); + } + }), + sender, + }, + ); + } + } + } + Err(e) => { + error_message(&our, km_id, target.clone(), e, &send_to_loop).await; + } + } +} + +/// terrible abuse of result in return type, yes, sorry +async fn build_subscription( + our: &str, + km_id: u64, + target: &Address, + send_to_loop: &MessageSender, + eth_action: &EthAction, + providers: &Providers, + response_channels: &ResponseChannels, + print_tx: &PrintSender, +) -> Result, EthError> { + let EthAction::SubscribeLogs { + chain_id, + kind, + params, + .. + } = eth_action + else { + return Err(EthError::PermissionDenied); // will never hit + }; + let Some(mut aps) = providers.get_mut(&chain_id) else { + return Err(EthError::NoRpcForChain); + }; + // first, try any url providers we have for this chain, + // then if we have none or they all fail, go to node providers. + // finally, if no provider works, return an error. + for url_provider in &mut aps.urls { + let pubsub = match &url_provider.pubsub { + Some(pubsub) => pubsub, + None => { + if let Ok(()) = activate_url_provider(url_provider).await { + verbose_print(print_tx, "eth: activated a url provider").await; + url_provider.pubsub.as_ref().unwrap() + } else { + continue; + } + } + }; + let kind = serde_json::to_value(&kind).unwrap(); + let params = serde_json::to_value(¶ms).unwrap(); + if let Ok(id) = pubsub + .inner() + .prepare("eth_subscribe", [kind, params]) + .await + { + let rx = pubsub.inner().get_raw_subscription(id).await; + return Ok(Ok(rx)); + } + // this provider failed and needs to be reset + url_provider.pubsub = None; + } + // now we need a response channel + let (sender, mut response_receiver) = tokio::sync::mpsc::channel(1); + response_channels.insert(km_id, sender); + // we need to create our own unique sub id because in the remote provider node, + // all subs will be identified under our process address. + let remote_sub_id = rand::random(); + for node_provider in &mut aps.nodes { + match forward_to_node_provider( + &our, + km_id, + Some(target.clone()), + node_provider, + EthAction::SubscribeLogs { + sub_id: remote_sub_id, + chain_id: chain_id.clone(), + kind: kind.clone(), + params: params.clone(), + }, + &send_to_loop, + &mut response_receiver, + ) + .await + { + EthResponse::Ok => { + kernel_message( + &our, + km_id, + target.clone(), + None, + false, + None, + EthResponse::Ok, + &send_to_loop, + ) + .await; + response_channels.remove(&km_id); + return Ok(Err((node_provider.name.clone(), remote_sub_id))); + } + EthResponse::Response { .. } => { + // the response to a SubscribeLogs request must be an 'ok' + node_provider.usable = false; + } + EthResponse::Err(e) => { + if e == EthError::RpcMalformedResponse { + node_provider.usable = false; + } + } + } + } + return Err(EthError::NoRpcForChain); +} + +async fn maintain_local_subscription( + our: &str, + sub_id: u64, + mut rx: RawSubscription, + target: &Address, + rsvp: &Option
, + send_to_loop: &MessageSender, +) -> Result<(), EthSubError> { + while let Ok(value) = rx.recv().await { + let result: SubscriptionResult = + serde_json::from_str(value.get()).map_err(|e| EthSubError { + id: sub_id, + error: e.to_string(), + })?; + kernel_message( + our, + rand::random(), + target.clone(), + rsvp.clone(), + true, + None, + EthSubResult::Ok(EthSub { id: sub_id, result }), + &send_to_loop, + ) + .await; + } + Err(EthSubError { + id: sub_id, + error: "subscription closed unexpectedly".to_string(), + }) +} + +/// handle the subscription updates from a remote provider, +/// and also perform keepalive checks on that provider. +/// current keepalive is 30s, this can be adjusted as desired +async fn maintain_remote_subscription( + our: &str, + provider_node: &str, + remote_sub_id: u64, + sub_id: u64, + keepalive_km_id: u64, + mut rx: tokio::sync::mpsc::Receiver, + mut net_error_rx: ProcessMessageReceiver, + target: &Address, + send_to_loop: &MessageSender, +) -> Result<(), EthSubError> { + let mut interval = tokio::time::interval(tokio::time::Duration::from_secs(30)); + loop { + tokio::select! { + incoming = rx.recv() => { + match incoming { + Some(EthSubResult::Ok(upd)) => { + kernel_message( + &our, + rand::random(), + target.clone(), + None, + true, + None, + EthSubResult::Ok(EthSub { + id: sub_id, + result: upd.result, + }), + &send_to_loop, + ) + .await; + } + Some(EthSubResult::Err(e)) => { + return Err(EthSubError { + id: sub_id, + error: e.error, + }); + } + None => { + return Err(EthSubError { + id: sub_id, + error: "subscription closed unexpectedly".to_string(), + }); + + } + } + } + _ = interval.tick() => { + // perform keepalive + kernel_message( + &our, + keepalive_km_id, + Address { node: provider_node.to_string(), process: ETH_PROCESS_ID.clone() }, + None, + true, + Some(30), + IncomingReq::SubKeepalive(remote_sub_id), + &send_to_loop, + ).await; + } + incoming = net_error_rx.recv() => { + if let Some(Err(_net_error)) = incoming { + return Err(EthSubError { + id: sub_id, + error: "subscription node-provider failed keepalive".to_string(), + }); + } + } + } + } +} diff --git a/kinode/src/http/client.rs b/kinode/src/http/client.rs index ca8e86a4d..8baf81360 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; @@ -378,7 +378,7 @@ async fn handle_http_request( let _ = print_tx .send(Printout { - verbosity: 1, + verbosity: 2, content: format!("http_client: building {req_method} request to {}", req.url), }) .await; @@ -437,7 +437,7 @@ async fn handle_http_request( Ok(response) => { let _ = print_tx .send(Printout { - verbosity: 1, + verbosity: 2, content: "http_client: executed request, got response".to_string(), }) .await; @@ -478,7 +478,7 @@ async fn handle_http_request( Err(e) => { let _ = print_tx .send(Printout { - verbosity: 1, + verbosity: 2, content: "http_client: executed request but got error".to_string(), }) .await; diff --git a/kinode/src/http/server.rs b/kinode/src/http/server.rs index 0453af366..7287c0cc5 100644 --- a/kinode/src/http/server.rs +++ b/kinode/src/http/server.rs @@ -40,7 +40,8 @@ type PathBindings = Arc>>; type WsPathBindings = Arc>>; struct BoundPath { - pub app: ProcessId, + pub app: Option, // if None, path has been unbound + pub path: String, pub secure_subdomain: Option, pub authenticated: bool, pub local_only: bool, @@ -48,7 +49,7 @@ struct BoundPath { } struct BoundWsPath { - pub app: ProcessId, + pub app: Option, // if None, path has been unbound pub secure_subdomain: Option, pub authenticated: bool, pub encrypted: bool, // TODO use @@ -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"), + app: Some(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 @@ -326,7 +329,7 @@ async fn login_handler( password: "secret".to_string(), }; - match keygen::decode_keyfile(&encoded_keyfile, &info.password) { + match keygen::decode_keyfile(&encoded_keyfile, &info.password_hash) { Ok(keyfile) => { let token = match register::generate_jwt(&keyfile.jwt_secret_bytes, our.as_ref()) { Some(token) => token, @@ -381,7 +384,7 @@ async fn ws_handler( let original_path = normalize_path(path.as_str()); let _ = print_tx .send(Printout { - verbosity: 1, + verbosity: 2, content: format!("http_server: got ws request for {original_path}"), }) .await; @@ -394,10 +397,14 @@ async fn ws_handler( }; let bound_path = route.handler(); + let Some(app) = bound_path.app.clone() else { + return Err(warp::reject::not_found()); + }; + if let Some(ref subdomain) = bound_path.secure_subdomain { let _ = print_tx .send(Printout { - verbosity: 1, + verbosity: 2, content: format!( "http_server: ws request for {original_path} bound by subdomain {subdomain}" ), @@ -432,7 +439,6 @@ async fn ws_handler( return Err(warp::reject::reject()); } - let app = bound_path.app.clone(); let extension = bound_path.extension; drop(ws_path_bindings); @@ -478,7 +484,7 @@ async fn http_handler( let original_path = normalize_path(path.as_str()); let _ = print_tx .send(Printout { - verbosity: 1, + verbosity: 2, content: format!("http_server: got request for path {original_path}"), }) .await; @@ -489,7 +495,7 @@ async fn http_handler( let Ok(route) = path_bindings.recognize(&original_path) else { let _ = print_tx .send(Printout { - verbosity: 1, + verbosity: 2, content: format!("http_server: no route found for {original_path}"), }) .await; @@ -497,6 +503,10 @@ async fn http_handler( }; let bound_path = route.handler(); + let Some(app) = &bound_path.app else { + return Ok(warp::reply::with_status(vec![], StatusCode::NOT_FOUND).into_response()); + }; + if bound_path.authenticated && !auth_cookie_valid( &our, @@ -507,7 +517,7 @@ async fn http_handler( // redirect to login page so they can get an auth token let _ = print_tx .send(Printout { - verbosity: 1, + verbosity: 2, content: format!( "http_server: redirecting request from {socket_addr:?} to login page" ), @@ -529,7 +539,7 @@ async fn http_handler( if let Some(ref subdomain) = bound_path.secure_subdomain { let _ = print_tx .send(Printout { - verbosity: 1, + verbosity: 2, content: format!( "http_server: request for {original_path} bound by subdomain {subdomain}" ), @@ -575,7 +585,7 @@ async fn http_handler( // RPC functionality: if path is /rpc:distro:sys/message, // we extract message from base64 encoded bytes in data // and send it to the correct app. - let (message, is_fire_and_forget) = if bound_path.app == "rpc:distro:sys" { + let (message, is_fire_and_forget) = if app == &"rpc:distro:sys" { match handle_rpc_message(our, id, body, print_tx).await { Ok((message, is_fire_and_forget)) => (message, is_fire_and_forget), Err(e) => { @@ -584,6 +594,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(); ( KernelMessage { id, @@ -593,7 +608,7 @@ async fn http_handler( }, target: Address { node: our.to_string(), - process: bound_path.app.clone(), + process: app.clone(), }, rsvp: None, message: Message::Request(Request { @@ -607,7 +622,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(), @@ -904,7 +921,7 @@ async fn maintain_websocket( let _ = print_tx .send(Printout { - verbosity: 1, + verbosity: 2, content: format!("http_server: new websocket connection to {app} with id {channel_id}"), }) .await; @@ -986,7 +1003,7 @@ async fn maintain_websocket( } let _ = print_tx .send(Printout { - verbosity: 1, + verbosity: 2, content: format!("http_server: websocket connection {channel_id} closed"), }) .await; @@ -1125,7 +1142,7 @@ async fn handle_app_message( } let _ = print_tx .send(Printout { - verbosity: 1, + verbosity: 2, content: format!( "binding path {path} for {}, authenticated={authenticated}, local={local_only}, cached={cache}", km.source.process @@ -1137,7 +1154,8 @@ async fn handle_app_message( path_bindings.add( &normalize_path(&path), BoundPath { - app: km.source.process.clone(), + app: Some(km.source.process.clone()), + path: path.clone(), secure_subdomain: None, authenticated, local_only, @@ -1159,7 +1177,8 @@ async fn handle_app_message( path_bindings.add( &normalize_path(&path), BoundPath { - app: km.source.process.clone(), + app: Some(km.source.process.clone()), + path: path.clone(), secure_subdomain: None, authenticated, local_only, @@ -1182,7 +1201,8 @@ async fn handle_app_message( path_bindings.add( &normalize_path(&path), BoundPath { - app: km.source.process.clone(), + app: Some(km.source.process.clone()), + path: path.clone(), secure_subdomain: Some(subdomain), authenticated: true, local_only: false, @@ -1204,7 +1224,8 @@ async fn handle_app_message( path_bindings.add( &normalize_path(&path), BoundPath { - app: km.source.process.clone(), + app: Some(km.source.process.clone()), + path: path.clone(), secure_subdomain: Some(subdomain), authenticated: true, local_only: false, @@ -1213,6 +1234,27 @@ async fn handle_app_message( ); } } + HttpServerAction::Unbind { mut path } => { + let mut path_bindings = path_bindings.write().await; + if km.source.process != "homepage:homepage:sys" { + path = if path.starts_with('/') { + format!("/{}{}", km.source.process, path) + } else { + format!("/{}/{}", km.source.process, path) + }; + } + path_bindings.add( + &normalize_path(&path), + BoundPath { + app: None, + path: path.clone(), + secure_subdomain: None, + authenticated: false, + local_only: false, + static_content: None, + }, + ); + } HttpServerAction::WebSocketBind { mut path, authenticated, @@ -1228,7 +1270,7 @@ async fn handle_app_message( ws_path_bindings.add( &normalize_path(&path), BoundWsPath { - app: km.source.process.clone(), + app: Some(km.source.process.clone()), secure_subdomain: None, authenticated, encrypted, @@ -1253,7 +1295,7 @@ async fn handle_app_message( ws_path_bindings.add( &normalize_path(&path), BoundWsPath { - app: km.source.process.clone(), + app: Some(km.source.process.clone()), secure_subdomain: Some(subdomain), authenticated: true, encrypted, @@ -1261,6 +1303,24 @@ async fn handle_app_message( }, ); } + HttpServerAction::WebSocketUnbind { mut path } => { + let mut ws_path_bindings = ws_path_bindings.write().await; + path = if path.starts_with('/') { + format!("/{}{}", km.source.process, path) + } else { + format!("/{}/{}", km.source.process, path) + }; + ws_path_bindings.add( + &normalize_path(&path), + BoundWsPath { + app: None, + secure_subdomain: None, + authenticated: false, + encrypted: false, + extension: false, + }, + ); + } HttpServerAction::WebSocketOpen { .. } => { // we cannot receive these, only send them to processes send_action_response( diff --git a/kinode/src/kernel/mod.rs b/kinode/src/kernel/mod.rs index 016845fd7..f9813ec0e 100644 --- a/kinode/src/kernel/mod.rs +++ b/kinode/src/kernel/mod.rs @@ -3,6 +3,7 @@ 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; @@ -19,11 +20,6 @@ const PROCESS_CHANNEL_CAPACITY: usize = 100; const DEFAULT_WIT_VERSION: u32 = 0; -type ProcessMessageSender = - tokio::sync::mpsc::Sender>; -type ProcessMessageReceiver = - tokio::sync::mpsc::Receiver>; - #[derive(Serialize, Deserialize)] struct StartProcessMetadata { source: t::Address, @@ -38,12 +34,14 @@ type Senders = HashMap; type ProcessHandles = HashMap>>; enum ProcessSender { - Runtime(t::MessageSender), - Userspace(ProcessMessageSender), + Runtime { + sender: t::MessageSender, + net_errors: Option, + }, + Userspace(t::ProcessMessageSender), } /// 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 +74,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, @@ -86,8 +84,10 @@ 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, + home_directory_path: &str, ) { let t::Message::Request(request) = km.message else { return; @@ -273,6 +273,7 @@ async fn handle_kernel_request( }, reboot: false, }, + &home_directory_path, ) .await { @@ -334,7 +335,37 @@ 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 { + target, + capabilities, + } => { + let Some(entry) = process_map.get_mut(&target) else { + let _ = send_to_terminal + .send(t::Printout { + verbosity: 1, + content: format!( + "kernel: no such process {:?} to DropCapabilities", + target + ), + }) + .await; + return; + }; + 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 @@ -423,7 +454,7 @@ 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 let _ = senders.remove(&process_id); let process_handle = match process_handles.remove(&process_id) { Some(ph) => ph, @@ -445,7 +476,13 @@ async fn handle_kernel_request( .await; process_handle.abort(); process_map.remove(&process_id); - let _ = persist_state(&our_name, &send_to_loop, process_map).await; + caps_oracle + .send(t::CapMessage::RevokeAll { + on: process_id.clone(), + responder: tokio::sync::oneshot::channel().0, + }) + .await + .expect("event loop: fatal: sender died"); if request.expects_response.is_none() { return; } @@ -528,7 +565,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, @@ -542,6 +579,7 @@ async fn start_process( engine: &Engine, caps_oracle: t::CapMessageSender, process_metadata: &StartProcessMetadata, + home_directory_path: &str, ) -> Result<()> { let (send_to_process, recv_in_process) = mpsc::channel::>(PROCESS_CHANNEL_CAPACITY); @@ -584,6 +622,7 @@ async fn start_process( km_blob_bytes, caps_oracle, engine.clone(), + home_directory_path.to_string(), )), ); @@ -617,11 +656,12 @@ 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, 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, @@ -631,8 +671,14 @@ pub async fn kernel( mut recv_debug_in_loop: t::DebugReceiver, send_to_net: t::MessageSender, home_directory_path: String, - contract_address: String, - runtime_extensions: Vec<(t::ProcessId, t::MessageSender, bool)>, + contract_chain_and_address: (u64, String), + runtime_extensions: Vec<( + t::ProcessId, + t::MessageSender, + Option, + bool, + )>, + default_pki_entries: Vec, ) -> Result<()> { let mut config = Config::new(); config.cache_config_load_default().unwrap(); @@ -649,10 +695,19 @@ pub async fn kernel( let mut senders: Senders = HashMap::new(); senders.insert( t::ProcessId::new(Some("net"), "distro", "sys"), - ProcessSender::Runtime(send_to_net.clone()), + ProcessSender::Runtime { + sender: send_to_net.clone(), + net_errors: None, // networking module does not accept net errors sent to it + }, ); - for (process_id, sender, _) in runtime_extensions { - senders.insert(process_id, ProcessSender::Runtime(sender)); + for (process_id, sender, net_error_sender, _) in runtime_extensions { + senders.insert( + process_id, + ProcessSender::Runtime { + sender, + net_errors: net_error_sender, + }, + ); } // each running process is stored in this map @@ -746,6 +801,7 @@ pub async fn kernel( &engine, caps_oracle_sender.clone(), &metadata, + home_directory_path.as_str(), ) .await { @@ -788,6 +844,32 @@ pub async fn kernel( }) .await .expect("fatal: kernel event loop died"); + // sending hard coded pki entries into networking for bootstrapped rpc + 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(&t::NetAction::KnsBatchUpdate(default_pki_entries)) + .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. @@ -806,7 +888,7 @@ pub async fn kernel( message: t::Message::Request(t::Request { inherit: false, expects_response: None, - body: contract_address.as_bytes().to_vec(), + body: serde_json::to_vec(&contract_chain_and_address).unwrap(), metadata: None, capabilities: vec![], }), @@ -830,8 +912,8 @@ pub async fn kernel( Some(wrapped_network_error) = network_error_recv.recv() => { let _ = send_to_terminal.send( t::Printout { - verbosity: 2, - content: format!("event loop: got network error: {:?}", wrapped_network_error) + verbosity: 3, + content: format!("{wrapped_network_error:?}") } ).await; // forward the error to the relevant process @@ -839,18 +921,22 @@ pub async fn kernel( Some(ProcessSender::Userspace(sender)) => { let _ = sender.send(Err(wrapped_network_error)).await; } - Some(ProcessSender::Runtime(_sender)) => { - // TODO should runtime modules get these? no - // this will change if a runtime process ever makes - // a message directed to not-our-node + Some(ProcessSender::Runtime { net_errors, .. }) => { + if let Some(net_errors) = net_errors { + let _ = net_errors.send(wrapped_network_error).await; + } } None => { let _ = send_to_terminal .send(t::Printout { verbosity: 0, content: format!( - "event loop: don't have {} amongst registered processes (got net error for it)", + "event loop: {} failed to deliver a message {}; sender has already terminated", wrapped_network_error.source.process, + match wrapped_network_error.error.kind { + t::SendErrorKind::Timeout => "due to timeout", + t::SendErrorKind::Offline => "because the receiver is offline", + }, ) }) .await; @@ -888,7 +974,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, @@ -909,8 +995,17 @@ pub async fn kernel( .send(t::Printout { verbosity: 0, content: format!( - "event loop: don't have {} amongst registered processes (got message for it from network)", + "event loop: got {} from network for {}, but process does not exist{}", + match kernel_message.message { + t::Message::Request(_) => "Request", + t::Message::Response(_) => "Response", + }, kernel_message.target.process, + match kernel_message.message { + t::Message::Request(_) => "", + t::Message::Response(_) => + "\nhint: if you are using `m`, try awaiting the Response: `m --await 5 ...`", + } ) }) .await; @@ -944,9 +1039,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 { @@ -957,7 +1054,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, @@ -984,7 +1081,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; @@ -1004,38 +1101,32 @@ pub async fn kernel( &mut senders, &mut process_handles, &mut process_map, + &mut reverse_cap_index, caps_oracle_sender.clone(), &engine, + &home_directory_path, ).await; } else { // 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)) => { + 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, content: format!( - "event loop: don't have {:?} amongst registered processes, got message for it: {}", + "event loop: got {} from {:?} for {:?}, but target doesn't exist (perhaps it terminated): {}", + match kernel_message.message { + t::Message::Request(_) => "Request", + t::Message::Response(_) => "Response", + }, + kernel_message.source.process, kernel_message.target.process, kernel_message, ) @@ -1048,6 +1139,12 @@ pub async fn kernel( }, // capabilities oracle: handles all requests to add, drop, and check capabilities Some(cap_message) = caps_oracle_receiver.recv() => { + let _ = send_to_terminal.send( + t::Printout { + verbosity: 3, + content: format!("{cap_message:?}") + } + ).await; match cap_message { t::CapMessage::Add { on, caps, responder } => { // insert cap in process map @@ -1060,17 +1157,28 @@ 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); }, - 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); }, @@ -1092,28 +1200,36 @@ pub async fn kernel( } ); }, + t::CapMessage::RevokeAll { on, responder } => { + let Some(granter) = reverse_cap_index.get(&on) else { + let _ = persist_state(&our.name, &send_to_loop, &process_map).await; + let _ = responder.send(true); + continue; + }; + for (grantee, caps) in granter { + if let Some(entry) = process_map.get_mut(&grantee) { + for cap in caps { + 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 } => { let _ = responder.send( 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(), - 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 { - match p.capabilities.get(cap) { - None => None, - Some(sig) => Some((cap.clone(), sig.clone())) - } + p.capabilities.get(&cap).map(|sig| (cap, sig.clone())) } }).collect() }, @@ -1125,3 +1241,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, + } + } + } +} diff --git a/kinode/src/kernel/process.rs b/kinode/src/kernel/process.rs index 02d355947..66e7147ed 100644 --- a/kinode/src/kernel/process.rs +++ b/kinode/src/kernel/process.rs @@ -1,38 +1,58 @@ -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; +use tokio::fs; use tokio::task::JoinHandle; +use wasmtime::component::ResourceTable as Table; use wasmtime::component::*; use wasmtime::{Engine, Store}; -use wasmtime_wasi::preview2::{pipe::MemoryOutputPipe, Table, WasiCtx, WasiCtxBuilder, WasiView}; +use wasmtime_wasi::preview2::{ + pipe::MemoryOutputPipe, DirPerms, FilePerms, WasiCtx, WasiCtxBuilder, WasiView, +}; +use wasmtime_wasi::sync::Dir; -use lib::types::core as t; -pub use lib::wit; -pub use lib::wit::Host as StandardHost; -pub use lib::Process; +const STACK_TRACE_SIZE: usize = 5000; -// bindgen!({ -// path: "wit", -// world: "process", -// async: true, -// }); +pub struct ProcessContext { + // 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 struct ProcessState { + /// our node's networking keypair pub keypair: Arc, + /// information about ourself pub metadata: t::ProcessMetadata, - pub recv_in_process: ProcessMessageReceiver, - pub self_sender: ProcessMessageSender, + /// pipe from which we get messages from the main event loop + pub recv_in_process: t::ProcessMessageReceiver, + /// pipe to send messages to ourself (received in `recv_in_process`) + pub self_sender: t::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, + /// 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, - pub contexts: HashMap)>, + /// 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, } @@ -57,8 +77,6 @@ impl WasiView for ProcessWasi { } } -const STACK_TRACE_SIZE: usize = 5000; - pub async fn send_and_await_response( process: &mut ProcessWasi, source: Option, @@ -91,41 +109,195 @@ 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.ingest_message().await, }; 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.ingest_message().await; + 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); + } + } + } + + /// 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 /// 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(), - }; - // if request chooses to inherit context, match id to prompting_message + 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 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 - && request.expects_response.is_none() - && self.prompting_message.is_some() - { + let request_id: u64 = if request.inherit && self.prompting_message.is_some() { self.prompting_message.as_ref().unwrap().id } else { loop { @@ -136,6 +308,8 @@ 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, @@ -147,70 +321,46 @@ impl ProcessState { }, }; - 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.prompting_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 + .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") + }; + } - // 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 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 { 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(this_request), + lazy_load_blob: this_blob, }, })) .await; @@ -218,12 +368,8 @@ impl ProcessState { self.contexts.insert( request_id, ( - t::ProcessContext { - prompting_message: if self.prompting_message.is_some() { - self.prompting_message.clone() - } else { - None - }, + ProcessContext { + prompting_message: self.prompting_message.clone(), context: new_context, }, timeout_handle, @@ -231,6 +377,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.prompting_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 @@ -245,43 +419,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 { @@ -290,7 +474,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, )), @@ -299,150 +483,6 @@ impl ProcessState { .await .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 - fn kernel_message_to_process_receive( - &mut self, - res: Result, - ) -> Result<(wit::Address, wit::Message), (wit::SendError, Option)> { - let (context, km) = match res { - Ok(km) => match &km.message { - t::Message::Request(_) => { - self.last_blob = km.lazy_load_blob.clone(); - self.prompting_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 { - 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()); - (None, km) - } - } - }, - 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(), - ); - - 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)) - } - // 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::)>>(); - 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 prompting message, if any. - async fn make_response_id_target(&self) -> Option<(u64, t::Address)> { - let Some(ref prompting_message) = self.prompting_message else { - println!("need non-None prompting_message to handle Response"); - return None; - }; - Some(( - prompting_message.id, - match &prompting_message.rsvp { - None => prompting_message.source.clone(), - Some(address) => address.clone(), - }, - )) - } } /// create a specific process, and generate a task that will run it. @@ -451,11 +491,12 @@ pub async fn make_process_loop( metadata: t::ProcessMetadata, send_to_loop: t::MessageSender, send_to_terminal: t::PrintSender, - mut recv_in_process: ProcessMessageReceiver, - send_to_process: ProcessMessageSender, + mut recv_in_process: t::ProcessMessageReceiver, + send_to_process: t::ProcessMessageSender, wasm_bytes: Vec, caps_oracle: t::CapMessageSender, engine: Engine, + home_directory_path: String, ) -> Result<()> { // before process can be instantiated, need to await 'run' message from kernel let mut pre_boot_queue = Vec::>::new(); @@ -499,7 +540,37 @@ pub async fn make_process_loop( let table = Table::new(); let wasi_stderr = MemoryOutputPipe::new(STACK_TRACE_SIZE); - let wasi = WasiCtxBuilder::new().stderr(wasi_stderr.clone()).build(); + + let tmp_path = format!( + "{}/vfs/{}:{}/tmp", + home_directory_path, + metadata.our.process.package(), + metadata.our.process.publisher() + ); + + let mut wasi = WasiCtxBuilder::new(); + + // TODO make guarantees about this + if let Ok(Ok(())) = tokio::time::timeout( + std::time::Duration::from_secs(5), + fs::create_dir_all(&tmp_path), + ) + .await + { + if let Ok(wasi_tempdir) = + Dir::open_ambient_dir(tmp_path.clone(), wasmtime_wasi::sync::ambient_authority()) + { + wasi.preopened_dir( + wasi_tempdir, + DirPerms::all(), + FilePerms::all(), + tmp_path.clone(), + ) + .env("TEMP_DIR", tmp_path); + } + } + + let wasi = wasi.stderr(wasi_stderr.clone()).build(); wasmtime_wasi::preview2::command::add_to_linker(&mut linker).unwrap(); @@ -597,30 +668,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 +699,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,31 +800,44 @@ 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(()) } + +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!"); +} diff --git a/kinode/src/kernel/standard_host.rs b/kinode/src/kernel/standard_host.rs index 3e9c30f41..96b756ddd 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,10 +25,21 @@ impl StandardHost for process::ProcessWasi { // // system utils: // + + /// Print a message to the runtime terminal. Add the name of the process to the + /// beginning of the string, so user can verify source. async fn print_to_terminal(&mut self, verbosity: u8, content: String) -> Result<()> { self.process .send_to_terminal - .send(t::Printout { verbosity, content }) + .send(t::Printout { + verbosity, + content: format!( + "{}:{}: {}", + self.process.metadata.our.process.package(), + self.process.metadata.our.process.publisher(), + content + ), + }) .await .map_err(|e| anyhow::anyhow!("fatal: couldn't send to terminal: {e:?}")) } @@ -376,6 +385,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 // @@ -398,6 +408,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 diff --git a/kinode/src/keygen.rs b/kinode/src/keygen.rs index 844d7c104..bbcaff569 100644 --- a/kinode/src/keygen.rs +++ b/kinode/src/keygen.rs @@ -2,8 +2,9 @@ use aes_gcm::{ aead::{Aead, AeadCore, KeyInit, OsRng}, Aes256Gcm, Key, }; -use digest::generic_array; -use lazy_static::__Deref; +use alloy_primitives::keccak256; +use digest::generic_array::GenericArray; +use lib::types::core::Keyfile; use ring::pbkdf2; use ring::pkcs8::Document; use ring::rand::SystemRandom; @@ -11,8 +12,6 @@ use ring::signature::{self, KeyPair}; use ring::{digest as ring_digest, rand::SecureRandom}; use std::num::NonZeroU32; -use lib::types::core::Keyfile; - type DiskKey = [u8; CREDENTIAL_LEN]; pub const CREDENTIAL_LEN: usize = ring_digest::SHA256_OUTPUT_LEN; @@ -24,13 +23,12 @@ pub fn encode_keyfile( username: String, routers: Vec, networking_key: &[u8], - jwt: Vec, - file_key: Vec, + jwt: &[u8], + file_key: &[u8], ) -> Vec { let mut disk_key: DiskKey = [0u8; CREDENTIAL_LEN]; let rng = SystemRandom::new(); - let mut salt = [0u8; 32]; // generate a unique salt rng.fill(&mut salt).unwrap(); @@ -50,16 +48,16 @@ pub fn encode_keyfile( let file_nonce = Aes256Gcm::generate_nonce(&mut OsRng); let keyciphertext: Vec = cipher.encrypt(&network_nonce, networking_key).unwrap(); - let jwtciphertext: Vec = cipher.encrypt(&jwt_nonce, jwt.as_ref()).unwrap(); + let jwtciphertext: Vec = cipher.encrypt(&jwt_nonce, jwt).unwrap(); let fileciphertext: Vec = cipher.encrypt(&file_nonce, file_key.as_ref()).unwrap(); bincode::serialize(&( username.clone(), routers.clone(), salt.to_vec(), - [network_nonce.deref().to_vec(), keyciphertext].concat(), - [jwt_nonce.deref().to_vec(), jwtciphertext].concat(), - [file_nonce.deref().to_vec(), fileciphertext].concat(), + [network_nonce.to_vec(), keyciphertext].concat(), + [jwt_nonce.to_vec(), jwtciphertext].concat(), + [file_nonce.to_vec(), fileciphertext].concat(), )) .unwrap() } @@ -82,9 +80,9 @@ pub fn decode_keyfile(keyfile: &[u8], password: &str) -> Result::from_slice(&disk_key); let cipher = Aes256Gcm::new(cipher_key); - let net_nonce = generic_array::GenericArray::from_slice(&key_enc[..12]); - let jwt_nonce = generic_array::GenericArray::from_slice(&jwt_enc[..12]); - let file_nonce = generic_array::GenericArray::from_slice(&file_enc[..12]); + let net_nonce = GenericArray::from_slice(&key_enc[..12]); + let jwt_nonce = GenericArray::from_slice(&jwt_enc[..12]); + let file_nonce = GenericArray::from_slice(&file_enc[..12]); let serialized_networking_keypair: Vec = cipher .decrypt(net_nonce, &key_enc[12..]) @@ -111,13 +109,35 @@ pub fn decode_keyfile(keyfile: &[u8], password: &str) -> Result Result<(String, Vec), &'static str> { - let (username, routers, _salt, _key_enc, _jwt_enc, _file_enc) = - bincode::deserialize::<(String, Vec, Vec, Vec, Vec, Vec)>(keyfile) + let (username, routers, _salt, _key_enc, _jwt_enc) = + bincode::deserialize::<(String, Vec, Vec, Vec, Vec)>(keyfile) .map_err(|_| "failed to deserialize keyfile")?; Ok((username, routers)) } +pub fn namehash(name: &str) -> Vec { + let mut node = vec![0u8; 32]; + if name.is_empty() { + return node; + } + let mut labels: Vec<&str> = name.split(".").collect(); + labels.reverse(); + for label in labels.iter() { + node.append(&mut keccak256(label.as_bytes()).to_vec()); + node = keccak256(node.as_slice()).to_vec(); + } + node +} + +/// randomly generated key to encrypt file chunks, +pub fn generate_file_key() -> Vec { + let mut key = [0u8; 32]; + let rng = SystemRandom::new(); + rng.fill(&mut key).unwrap(); + key.to_vec() +} + /// # Returns /// a pair of (public key (encoded as a hex string), serialized key as a pkcs8 Document) pub fn generate_networking_key() -> (String, Document) { @@ -126,10 +146,3 @@ pub fn generate_networking_key() -> (String, Document) { let keys = signature::Ed25519KeyPair::from_pkcs8(doc.as_ref()).unwrap(); (hex::encode(keys.public_key().as_ref()), doc) } -/// randomly generated key to encrypt file chunks, encrypted on-disk with disk_key -pub fn generate_file_key() -> Vec { - let mut key = [0u8; 32]; - let rng = SystemRandom::new(); - rng.fill(&mut key).unwrap(); - key.to_vec() -} diff --git a/kinode/src/main.rs b/kinode/src/main.rs index 065cd4467..bd9276d25 100644 --- a/kinode/src/main.rs +++ b/kinode/src/main.rs @@ -2,16 +2,14 @@ use anyhow::Result; use clap::{arg, value_parser, Command}; +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; @@ -39,17 +37,14 @@ const SQLITE_CHANNEL_CAPACITY: usize = 1_000; const VERSION: &str = env!("CARGO_PKG_VERSION"); -/// This can and should be an environment variable / setting. It configures networking -/// such that indirect nodes always use routers, even when target is a direct node, -/// such that only their routers can ever see their physical networking details. -#[cfg(not(feature = "simulation-mode"))] -const REVEAL_IP: bool = true; +/// default routers as a eth-provider fallback +const DEFAULT_PROVIDERS_TESTNET: &str = include_str!("eth/default_providers_testnet.json"); +const DEFAULT_PROVIDERS_MAINNET: &str = include_str!("eth/default_providers_mainnet.json"); 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 +66,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() => { @@ -106,14 +101,20 @@ async fn main() { arg!(--testnet "If set, use Sepolia testnet") .default_value("false") .value_parser(value_parser!(bool)), + ) + .arg( + arg!(--verbosity "Verbosity level: higher is more verbose") + .default_value("0") + .value_parser(value_parser!(u8)), + ) + .arg( + arg!(--"reveal-ip" "If set to false, as an indirect node, always use routers to connect to other nodes.") + .default_value("true") + .value_parser(value_parser!(bool)), ); - #[cfg(not(feature = "simulation-mode"))] - let app = app.arg(arg!(--rpc "Ethereum RPC endpoint (must be wss://)").required(true)); - #[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( @@ -134,11 +135,26 @@ async fn main() { None => (8080, false), }; let on_testnet = *matches.get_one::("testnet").unwrap(); - let contract_address = if on_testnet { - register::KNS_SEPOLIA_ADDRESS + + #[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_chain_and_address: (u64, String) = if on_testnet { + (11155111, register::KNS_SEPOLIA_ADDRESS.to_string()) } else { - register::KNS_OPTIMISM_ADDRESS + (10, register::KNS_OPTIMISM_ADDRESS.to_string()) }; + let verbose_mode = *matches.get_one::("verbosity").unwrap(); // check .testnet file for true/false in order to enforce testnet mode on subsequent boots of this node match fs::read(format!("{}/.testnet", home_directory_path)).await { @@ -166,26 +182,24 @@ async fn main() { } } - #[cfg(not(feature = "simulation-mode"))] - let (rpc_url, is_detached) = (matches.get_one::("rpc").unwrap(), false); - - #[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); } println!("home at {}\r", home_directory_path); + // default eth providers/routers + let eth_provider_config: lib::eth::SavedConfigs = + match fs::read_to_string(format!("{}/.eth_providers", home_directory_path)).await { + Ok(contents) => { + println!("loaded saved eth 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(), + }, + }; + // 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); @@ -217,6 +231,8 @@ async fn main() { mpsc::channel(HTTP_CHANNEL_CAPACITY); let (eth_provider_sender, eth_provider_receiver): (MessageSender, MessageReceiver) = mpsc::channel(ETH_PROVIDER_CHANNEL_CAPACITY); + let (eth_net_error_sender, eth_net_error_receiver): (NetworkErrorSender, NetworkErrorReceiver) = + mpsc::channel(EVENT_LOOP_CHANNEL_CAPACITY); // http client performs http requests on behalf of processes let (http_client_sender, http_client_receiver): (MessageSender, MessageReceiver) = mpsc::channel(HTTP_CLIENT_CHANNEL_CAPACITY); @@ -233,9 +249,7 @@ async fn main() { { ip } else { - println!( - "\x1b[38;5;196mfailed to find public IPv4 address: booting as a routed node\x1b[0m" - ); + println!("failed to find public IPv4 address: booting as a routed node"); std::net::Ipv4Addr::LOCALHOST } }; @@ -273,27 +287,27 @@ 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, our_ip.to_string(), http_server_port, - rpc_url.clone(), on_testnet, // true if testnet mode ) .await; + #[cfg(feature = "simulation-mode")] let (our, encoded_keyfile, decoded_keyfile) = match fake_node_name { None => { 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(), http_server_port.clone(), - rpc_url.clone(), on_testnet, // true if testnet mode ) .await @@ -384,41 +398,49 @@ async fn main() { ( ProcessId::new(Some("http_server"), "distro", "sys"), http_server_sender, + None, false, ), ( ProcessId::new(Some("http_client"), "distro", "sys"), http_client_sender, + None, false, ), ( ProcessId::new(Some("timer"), "distro", "sys"), timer_service_sender, + None, true, ), ( ProcessId::new(Some("eth"), "distro", "sys"), eth_provider_sender, + Some(eth_net_error_sender), false, ), ( ProcessId::new(Some("vfs"), "distro", "sys"), vfs_message_sender, + None, false, ), ( ProcessId::new(Some("state"), "distro", "sys"), state_sender, + None, false, ), ( ProcessId::new(Some("kv"), "distro", "sys"), kv_sender, + None, false, ), ( ProcessId::new(Some("sqlite"), "distro", "sys"), sqlite_sender, + None, false, ), ]; @@ -431,7 +453,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(), @@ -445,6 +467,7 @@ async fn main() { our.clone(), networking_keypair_arc.clone(), kernel_process_map.clone(), + reverse_cap_index, caps_oracle_sender.clone(), caps_oracle_receiver, kernel_message_sender.clone(), @@ -454,8 +477,22 @@ async fn main() { kernel_debug_message_receiver, net_message_sender.clone(), home_directory_path.clone(), - contract_address.to_string(), + contract_chain_and_address.clone(), runtime_extensions, + // 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( @@ -467,8 +504,8 @@ async fn main() { print_sender.clone(), net_message_sender, net_message_receiver, - contract_address.to_string(), - REVEAL_IP, + contract_chain_and_address.1, + *matches.get_one::("reveal-ip").unwrap_or(&true), )); #[cfg(feature = "simulation-mode")] tasks.spawn(net::mock_client( @@ -524,24 +561,16 @@ async fn main() { timer_service_receiver, print_sender.clone(), )); - #[cfg(not(feature = "simulation-mode"))] - tasks.spawn(eth::provider::provider( + tasks.spawn(eth::provider( our.name.clone(), - rpc_url.clone(), + home_directory_path.clone(), + eth_provider_config, kernel_message_sender.clone(), eth_provider_receiver, + eth_net_error_receiver, + caps_oracle_sender.clone(), print_sender.clone(), )); - #[cfg(feature = "simulation-mode")] - if let Some(rpc_url) = rpc_url { - tasks.spawn(eth::provider::provider( - our.name.clone(), - rpc_url.clone(), - kernel_message_sender.clone(), - eth_provider_receiver, - print_sender.clone(), - )); - } tasks.spawn(vfs::vfs( our.name.clone(), kernel_message_sender.clone(), @@ -556,7 +585,7 @@ async fn main() { let quit_msg: String = tokio::select! { Some(Ok(res)) = tasks.join_next() => { format!( - "\x1b[38;5;196muh oh, a kernel process crashed -- this should never happen: {:?}\x1b[0m", + "uh oh, a kernel process crashed -- this should never happen: {:?}", res ) } @@ -569,6 +598,7 @@ async fn main() { print_sender.clone(), print_receiver, is_detached, + verbose_mode, ) => { match quit { Ok(_) => "graceful exit".into(), @@ -603,14 +633,14 @@ async fn main() { // abort all remaining tasks tasks.shutdown().await; - //let _ = crossterm::terminal::disable_raw_mode().unwrap(); let stdout = std::io::stdout(); let mut stdout = stdout.lock(); let _ = crossterm::execute!( stdout, crossterm::event::DisableBracketedPaste, crossterm::terminal::SetTitle(""), + crossterm::style::SetForegroundColor(crossterm::style::Color::Red), + crossterm::style::Print(format!("\r\n{quit_msg}\r\n")), + crossterm::style::ResetColor, ); - println!("\r\n\x1b[38;5;196m{}\x1b[0m", quit_msg); - return; } diff --git a/kinode/src/net/mod.rs b/kinode/src/net/mod.rs index 6e7339035..705abceda 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"))] -use crate::net::{types::*, utils::*}; +pub use crate::net::utils::*; #[cfg(not(feature = "simulation-mode"))] use lib::types::core::*; @@ -887,19 +889,20 @@ async fn handle_local_message( Message::Response((response, _context)) => { // these are received as a router, when we send ConnectionRequests // to a node we do routing for. - match rmp_serde::from_slice::(&response.body) { - Ok(NetResponses::Accepted(_)) => { + match rmp_serde::from_slice::(&response.body) { + Ok(NetResponse::Accepted(_)) => { // TODO anything here? } - Ok(NetResponses::Rejected(to)) => { + Ok(NetResponse::Rejected(to)) => { // drop from our pending map // this will drop the socket, causing initiator to see it as failed pending_passthroughs .ok_or(anyhow!("got net response as non-router"))? .remove(&(to, km.source.node)); } - Err(_) => { - // this is usually the "delivered" response to a raw message + _ => { + // this is the "delivered" response to a raw message, + // or a response to a Get that was somehow given.. ignore } } return Ok(()); @@ -907,16 +910,16 @@ async fn handle_local_message( }; if km.source.node != our.name { - if let Ok(act) = rmp_serde::from_slice::(body) { + if let Ok(act) = rmp_serde::from_slice::(body) { match act { - NetActions::KnsBatchUpdate(_) | NetActions::KnsUpdate(_) => { + NetAction::KnsBatchUpdate(_) | NetAction::KnsUpdate(_) => { // for now, we don't get these from remote. } - NetActions::ConnectionRequest(from) => { + NetAction::ConnectionRequest(from) => { // someone wants to open a passthrough with us through a router! // if we are an indirect node, and source is one of our routers, // respond by attempting to init a matching passthrough. - let res: Result = if our.allowed_routers.contains(&km.source.node) + let res: Result = if our.allowed_routers.contains(&km.source.node) { let router_id = peers .get(&km.source.node) @@ -940,9 +943,9 @@ async fn handle_local_message( print_tx, ) .await; - Ok(NetResponses::Accepted(from.clone())) + Ok(NetResponse::Accepted(from.clone())) } else { - Ok(NetResponses::Rejected(from.clone())) + Ok(NetResponse::Rejected(from.clone())) }; kernel_message_tx .send(KernelMessage { @@ -957,7 +960,7 @@ async fn handle_local_message( Response { inherit: false, body: rmp_serde::to_vec( - &res.unwrap_or(NetResponses::Rejected(from)), + &res.unwrap_or(NetResponse::Rejected(from)), )?, metadata: None, capabilities: vec![], @@ -968,6 +971,9 @@ async fn handle_local_message( }) .await?; } + _ => { + // we don't accept any other actions from remote + } } return Ok(()); }; @@ -976,14 +982,12 @@ async fn handle_local_message( parse_hello_message(our, &km, body, kernel_message_tx, print_tx).await?; Ok(()) } else { - // available commands: "peers", "pki", "names", "diagnostics" - // first parse as raw string, then deserialize to NetActions object - let mut printout = String::new(); - match rmp_serde::from_slice::(body) { - Ok(NetActions::ConnectionRequest(_)) => { + let maybe_response = match rmp_serde::from_slice::(body)? { + NetAction::ConnectionRequest(_) => { // we shouldn't receive these from ourselves. + None } - Ok(NetActions::KnsUpdate(log)) => { + NetAction::KnsUpdate(log) => { pki.insert( log.name.clone(), Identity { @@ -998,8 +1002,9 @@ async fn handle_local_message( }, ); names.insert(log.node, log.name); + None } - Ok(NetActions::KnsBatchUpdate(log_list)) => { + NetAction::KnsBatchUpdate(log_list) => { for log in log_list { pki.insert( log.name.clone(), @@ -1016,96 +1021,70 @@ async fn handle_local_message( ); names.insert(log.node, log.name); } + None + } + NetAction::GetPeers => Some(NetResponse::Peers( + peers + .iter() + .map(|p| p.identity.clone()) + .collect::>(), + )), + NetAction::GetPeer(peer_name) => { + Some(NetResponse::Peer(pki.get(&peer_name).map(|p| p.clone()))) + } + NetAction::GetName(namehash) => { + Some(NetResponse::Name(names.get(&namehash).map(|n| n.clone()))) } - _ => match std::str::from_utf8(body) { - Ok("peers") => { + NetAction::GetDiagnostics => { + let mut printout = String::new(); + printout.push_str(&format!( + "indexing from contract address {}\r\n", + contract_address + )); + printout.push_str(&format!("our Identity: {:#?}\r\n", our)); + printout.push_str("we have connections with peers:\r\n"); + for peer in peers.iter() { printout.push_str(&format!( - "{:#?}", - peers - .iter() - .map(|p| p.identity.name.clone()) - .collect::>() + " {}, routing_for={}\r\n", + peer.identity.name, peer.routing_for, )); } - Ok("pki") => { - printout.push_str(&format!("{:#?}", pki)); - } - Ok("names") => { - printout.push_str(&format!("{:#?}", names)); - } - Ok("diagnostics") => { + printout.push_str(&format!("we have {} entries in the PKI\r\n", pki.len())); + if pending_passthroughs.is_some() { printout.push_str(&format!( - "indexing from contract address {}\r\n", - contract_address + "we have {} pending passthrough connections\r\n", + pending_passthroughs.unwrap().len() )); - printout.push_str(&format!("our Identity: {:#?}\r\n", our)); - printout.push_str("we have connections with peers:\r\n"); - for peer in peers.iter() { - printout.push_str(&format!( - " {}, routing_for={}\r\n", - peer.identity.name, peer.routing_for, - )); - } - printout.push_str(&format!("we have {} entries in the PKI\r\n", pki.len())); - if pending_passthroughs.is_some() { - printout.push_str(&format!( - "we have {} pending passthrough connections\r\n", - pending_passthroughs.unwrap().len() - )); - } - if forwarding_connections.is_some() { - printout.push_str(&format!( - "we have {} open passthrough connections\r\n", - forwarding_connections.unwrap().len() - )); - } } - Ok(other) => { - // parse non-commands as a request to fetch networking data - // about a specific node name - printout.push_str(&format!("net: printing known identity for {}\r\n", other)); - match pki.get(other) { - Some(id) => { - printout.push_str(&format!("{:#?}", *id)); - } - None => { - printout.push_str("no such identity known!"); - } - } - } - _ => {} - }, - } - if !printout.is_empty() { - if let Message::Request(req) = km.message { - if req.expects_response.is_some() { - kernel_message_tx - .send(KernelMessage { - id: km.id, - source: Address { - node: our.name.clone(), - process: ProcessId::new(Some("net"), "distro", "sys"), - }, - target: km.rsvp.unwrap_or(km.source), - rsvp: None, - message: Message::Response(( - Response { - inherit: false, - body: printout.clone().into_bytes(), - metadata: None, - capabilities: vec![], - }, - None, - )), - lazy_load_blob: None, - }) - .await?; + if forwarding_connections.is_some() { + printout.push_str(&format!( + "we have {} open passthrough connections\r\n", + forwarding_connections.unwrap().len() + )); } + Some(NetResponse::Diagnostics(printout)) } - print_tx - .send(Printout { - verbosity: 0, - content: printout, + }; + if let Some(response_body) = maybe_response { + kernel_message_tx + .send(KernelMessage { + id: km.id, + source: Address { + node: our.name.clone(), + process: ProcessId::new(Some("net"), "distro", "sys"), + }, + target: km.rsvp.unwrap_or(km.source), + rsvp: None, + message: Message::Response(( + Response { + inherit: false, + body: rmp_serde::to_vec(&response_body)?, + metadata: None, + capabilities: vec![], + }, + None, + )), + lazy_load_blob: None, }) .await?; } 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/kinode/src/net/utils.rs b/kinode/src/net/utils.rs index c14036e93..5e1ef64bd 100644 --- a/kinode/src/net/utils.rs +++ b/kinode/src/net/utils.rs @@ -226,7 +226,7 @@ pub async fn create_passthrough( message: Message::Request(Request { inherit: false, expects_response: Some(5), - body: rmp_serde::to_vec(&NetActions::ConnectionRequest(from_id.name.clone()))?, + body: rmp_serde::to_vec(&NetAction::ConnectionRequest(from_id.name.clone()))?, metadata: None, capabilities: vec![], }), @@ -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-ui/build/asset-manifest.json b/kinode/src/register-ui/build/asset-manifest.json index 04a8b91fe..2f2df9c05 100644 --- a/kinode/src/register-ui/build/asset-manifest.json +++ b/kinode/src/register-ui/build/asset-manifest.json @@ -1,12 +1,15 @@ { "files": { - "main.css": "/static/css/main.74f501c5.css", - "main.js": "/static/js/main.77d268ea.js", + "main.css": "/static/css/main.a386e724.css", + "main.js": "/static/js/main.332b908d.js", "static/media/unknown.png": "/static/media/unknown.880d04d4611a45ab1001.png", - "index.html": "/index.html" + "static/media/background.jpg": "/static/media/background.01d2427cfc21fb685016.jpg", + "static/media/kinode.svg": "/static/media/kinode.86d0c1a6a4a3ca3be41616b5989d6925.svg", + "index.html": "/index.html", + "static/media/logo.svg": "/static/media/logo.45dcb752ac5b825f5e3b9299d2210f0a.svg" }, "entrypoints": [ - "static/css/main.74f501c5.css", - "static/js/main.77d268ea.js" + "static/css/main.a386e724.css", + "static/js/main.332b908d.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..c337f0071 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/css/main.74f501c5.css b/kinode/src/register-ui/build/static/css/main.74f501c5.css deleted file mode 100644 index f7aa5a8f7..000000000 --- a/kinode/src/register-ui/build/static/css/main.74f501c5.css +++ /dev/null @@ -1 +0,0 @@ -:root{--k-red:#a30101;--k-darkred:#4d0c0c;--k-lightred:#dd0207;--k-petal:#e94f33;--k-lightpetal:#f0907f;--k-yellow:#e6b95e;--k-beige:#e5c4a1;--k-green:#0f6f4c;--k-darkgreen:#29322f;--k-lightgreen:#a0a271;--k-mediumgreen:#424031;--k-black:#281b13;--medium-gray:#656565}body{background-color:#0f6f4c;background-color:var(--k-green);color:#fff;font-family:Montserrat,sans-serif;font-size:16px;margin:0;padding:0}h1,h2,h3,h4,h5,h6{line-height:1.5em}.col{flex-direction:column}.col,.row{align-items:center;display:flex}.row{flex-direction:row}input[type=password],input[type=text]{border:1px solid #ccc;border-radius:4px;font-size:1em;padding:.5em .75em}button,input[type=password],input[type=text]{box-sizing:border-box;margin-bottom:.5em;width:100%}button{background-color:#e6b95e;background-color:var(--k-yellow);border:1px solid #e6b95e;border:1px solid var(--k-yellow);border-radius:4px;box-shadow:0 1px 2px #e5c4a1;box-shadow:0 1px 2px var(--k-beige);color:#000;cursor:pointer;font-size:1.125em;margin-top:1em;padding:.75em 1em;transition:all .1s}button:hover{background-color:#e5c4a1;background-color:var(--k-beige);border:1px solid #e5c4a1;border:1px solid var(--k-beige)}button:disabled{background-color:#656565;background-color:var(--medium-gray);border:1px solid #656565;border:1px solid var(--medium-gray);box-shadow:0 1px 2px #656565;box-shadow:0 1px 2px var(--medium-gray);color:#fff;cursor:not-allowed}#signup-page{display:flex;flex:1 1;height:100%;max-width:calc(100vw - 4em);padding:2em;width:100%}.key-err{color:red;font-size:12px;margin:1em;word-break:break-all}.login-row{align-self:flex-start;margin:.5em}.label-row{align-self:flex-start;margin:.5em 0}.tooltip-container{cursor:pointer;display:inline-block;position:relative}.tooltip-button{font-size:16px;height:1em;line-height:.5em;margin-left:.5em;padding:4px 2px 0;text-align:center;width:1em}.tooltip-button,.tooltip-button.chain{border:2px solid #fff;border-radius:50%}.tooltip-button.chain{height:1.5em;margin:0 0 0 1em;padding:0;width:1.5em}.tooltip-button.chain img{height:100%;width:100%}.tooltip-content{background-color:#555;border-radius:6px;color:#fff;font-size:1rem;font-weight:500;left:50%;line-height:1.5em;margin-left:-60px;min-width:200px;opacity:0;padding:.5em;position:absolute;text-align:center;top:125%;transition:opacity .3s;visibility:hidden;z-index:1}.tooltip-content:after{border:5px solid transparent;border-bottom-color:#555;bottom:100%;content:"";left:30%;margin-left:-5px;position:absolute}.tooltip-container:hover .tooltip-content{opacity:1;visibility:visible}.sepolia{-webkit-filter:grayscale(100%);filter:grayscale(100%)}#signup-form{max-width:calc(100vw - 2em);padding:1em;width:calc(420px + 2em)}#signup-form-header{margin-bottom:1em}#signup-form-header button{max-width:calc(100vw - 2em);width:calc(420px + 2em)}#current-address{font-family:Courier New,Courier,monospace;font-size:1.25em;font-weight:600;margin-left:1em}.current-username{border:1px solid #fff;border-radius:4px;cursor:pointer;margin:1em 0;padding:.5em}.current-username:hover{background-color:#fff;border:1px solid #fff;color:#027}#connect-wallet{max-width:420px}#wallet-required-message{line-height:1.5em;max-width:500px;text-align:center}#loading h3{text-align:center}#loader{display:inline-block;height:48px;margin-top:16px;position:relative;width:48px}#loader div{-webkit-animation:loader 1.2s cubic-bezier(.5,0,.5,1) infinite;animation:loader 1.2s cubic-bezier(.5,0,.5,1) infinite;border:6px solid transparent;border-radius:50%;border-top-color:#fff;box-sizing:border-box;display:block;height:36px;margin:6px;position:absolute;width:36px}#loader div:first-child{-webkit-animation-delay:-.45s;animation-delay:-.45s}#loader div:nth-child(2){-webkit-animation-delay:-.3s;animation-delay:-.3s}#loader div:nth-child(3){-webkit-animation-delay:-.15s;animation-delay:-.15s}@-webkit-keyframes loader{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes loader{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.connect-modal{align-items:center;display:flex;justify-content:center}.connect-modal-content{background:#027;border-radius:15px;height:200px;padding:20px;position:fixed;top:120px;width:400px}.overlay-modal{background-color:hsla(0,0%,100%,.25);inset:0;position:fixed}.signup-form{max-width:400px;width:50vw}.direct-node-message{line-height:1.5em;margin-left:1em}.name-validity{color:red}.more-info-direct{cursor:pointer;margin:0 1em;text-decoration:underline}.more-info-direct:hover{color:#e5c4a1;color:var(--k-beige)}a{color:#e6b95e;color:var(--k-yellow)}a:hover{color:#e5c4a1;color:var(--k-beige)}.reset-networking{cursor:pointer;margin-left:.5em;margin-top:1em;text-decoration:underline;width:100%}.reset-networking:hover{color:#e5c4a1;color:var(--k-beige)}.name-err{color:red;line-height:1.5em;margin-bottom:1em}.chain-button{align-items:center;background-color:#fff;border-radius:2.5em;color:#e6b95e;color:var(--k-yellow);display:flex;flex-direction:row;font-family:Arial,Helvetica,sans-serif;font-weight:600;justify-content:center;margin:0;padding:.4em .25em}.chain-button:hover{background-color:#e6b95e;background-color:var(--k-yellow);color:#fff}.chain-button.monospace{font-family:Courier New,Courier,monospace}.network-icon{height:1.5em;margin-right:.5em;width:1.5em}.os{margin-left:.2em} \ No newline at end of file diff --git a/kinode/src/register-ui/build/static/css/main.a386e724.css b/kinode/src/register-ui/build/static/css/main.a386e724.css new file mode 100644 index 000000000..501dc89f1 --- /dev/null +++ b/kinode/src/register-ui/build/static/css/main.a386e724.css @@ -0,0 +1 @@ +:root{--text-light:#fff5d9;--text-dark:#22211f;--text-orange:#ff7533;--orange-light:#f36822;--orange-medium:#f35422;--medium-gray:7E7E7E;--gray-button:hsla(45,89%,93%,.25);--input-background:rgba(243,84,34,.25)}body{background-color:hsla(45,89%,93%,.25);background-color:var(--gray-button);background:url(/static/media/background.01d2427cfc21fb685016.jpg) no-repeat 50% fixed;background-size:cover;color:#fff5d9;color:var(--text-light);font-size:16px;font-weight:400;height:100vh;margin:0;overflow-y:scroll;padding:2em;width:100vw}a,body,button,h1,h2,h3,h4,h5,h6,input,p{font-family:Barlow Condensed,sans-serif}h1,h2,h3,h4,h5,h6{font-weight:500;line-height:1.5em;margin:0}h1{font-size:64px}h2{font-size:48px}h3{font-size:36px}h4{font-size:24px}h5{font-size:20px}h6{font-size:16px}.col{flex-direction:column}.col,.row{align-items:center;display:flex}.row{flex-direction:row}input{all:unset}input[type=checkbox],input[type=password],input[type=text]{background-color:rgba(243,84,34,.25);background-color:var(--input-background);border:1px solid #f35422;border:1px solid var(--orange-medium);border-radius:8px;box-sizing:border-box;color:#fff5d9;color:var(--text-light);font-size:1em;padding:1em}input[type=password],input[type=text]{width:100%}input[type=checkbox]{cursor:pointer;padding:.25em .8em}input[type=checkbox]:checked{background-color:#f35422;background-color:var(--orange-medium)}.checkmark{cursor:pointer;font-size:24px;left:4px;position:absolute;top:-5px}::-webkit-input-placeholder{color:#fff5d9;color:var(--text-light)}::placeholder{color:#fff5d9;color:var(--text-light)}::-webkit-input-placeholder::-webkit-input-placeholder{color:#fff5d9;color:var(--text-light)}::-webkit-input-placeholder::placeholder{color:#fff5d9;color:var(--text-light)}::-moz-placeholder::placeholder{color:#fff5d9;color:var(--text-light)}::-ms-input-placeholder{color:#fff5d9;color:var(--text-light)}label{font-size:20px}button{background:#f35422;background:var(--orange-medium);border:1px solid #f35422;border-color:var(--orange-medium);border-radius:8px;box-shadow:0 1px 2px #f36822;box-shadow:0 1px 2px var(--orange-light);box-sizing:border-box;color:#fff5d9;color:var(--text-light);cursor:pointer;font-size:1.125em;font-weight:500;margin:0;padding:.75em 1em;transition:all .1s;width:100%}button.alt{background-color:#fff5d9;background-color:var(--text-light);border-color:#fff5d9;border-color:var(--text-light);box-shadow:0 1px 2px #fff5d9;box-shadow:0 1px 2px var(--text-light);color:#22211f;color:var(--text-dark)}button:hover{box-shadow:none;opacity:.9}button:disabled{background-color:70000000E7E;background-color:var(--medium-gray);border:70000000e7e solid;border:1px solid var(--medium-gray);box-shadow:0 1px 2px 70000000E7E;box-shadow:0 1px 2px var(--medium-gray);cursor:not-allowed;opacity:.7}#signup-page{display:flex;flex:1 1;justify-content:center;padding-bottom:2em}.key-err{color:red;font-size:20px;margin-top:.5em;text-align:center;word-break:break-all}.label-row,.login-row{align-self:flex-start}.label-row{margin:.5em 0}.tooltip-container{cursor:pointer;display:inline-block;position:relative}.tooltip-button{font-size:16px;height:1em;line-height:.5em;margin-left:.5em;padding:4px 2px 0;text-align:center;width:1em}.tooltip-button,.tooltip-button.chain{border:2px solid #fff;border-radius:50%}.tooltip-button.chain{height:1.5em;margin:0 0 0 1em;padding:0;width:1.5em}.tooltip-button.chain img{height:100%;width:100%}.tooltip-content{background-color:#555;border-radius:6px;color:#fff;font-size:1rem;font-weight:500;left:50%;line-height:1.5em;margin-left:-60px;min-width:200px;opacity:0;padding:.5em;position:absolute;text-align:center;top:125%;transition:opacity .3s;visibility:hidden;z-index:1}.tooltip-content.left{left:auto;right:0}.tooltip-content:after{border:5px solid transparent;border-bottom-color:#555;bottom:100%;content:"";left:30%;margin-left:-5px;position:absolute}.tooltip-container:hover .tooltip-content{opacity:1;visibility:visible}.sepolia{-webkit-filter:grayscale(100%);filter:grayscale(100%)}#signup-form{gap:32px;max-width:calc(100vw - 2em);padding:1em;width:calc(420px + 2em)}#signup-form-header{margin-bottom:1em}#signup-form-header button{max-width:calc(100vw - 2em);width:calc(420px + 2em)}#current-address{font-family:Courier New,Courier,monospace;font-size:1.25em;font-weight:600;margin-left:1em}.current-username{border:1px solid #fff;border-radius:4px;cursor:pointer;margin:1em 0;padding:.5em}.current-username:hover{background-color:#fff;border:1px solid #fff;color:#027}#connect-wallet{max-width:420px}#wallet-required-message{line-height:1.5em;max-width:500px;text-align:center}#loading h3{text-align:center}#loader{display:inline-block;height:48px;margin-top:16px;position:relative;width:48px}#loader div{-webkit-animation:loader 1.2s cubic-bezier(.5,0,.5,1) infinite;animation:loader 1.2s cubic-bezier(.5,0,.5,1) infinite;border:6px solid transparent;border-radius:50%;border-top-color:#fff;box-sizing:border-box;display:block;height:36px;margin:6px;position:absolute;width:36px}#loader div:first-child{-webkit-animation-delay:-.45s;animation-delay:-.45s}#loader div:nth-child(2){-webkit-animation-delay:-.3s;animation-delay:-.3s}#loader div:nth-child(3){-webkit-animation-delay:-.15s;animation-delay:-.15s}@-webkit-keyframes loader{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes loader{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}.connect-modal{align-items:center;display:flex;justify-content:center}.connect-modal-content{background:#027;border-radius:15px;height:200px;padding:20px;position:fixed;top:120px;width:400px}.overlay-modal{background-color:hsla(0,0%,100%,.25);inset:0;position:fixed}.signup-form{max-width:400px;width:50vw}.direct-node-message{line-height:1.5em;margin-left:2em}.name-validity{color:red}.more-info-direct{cursor:pointer;margin:0 1em;text-decoration:underline}.more-info-direct:hover{color:#f36822;color:var(--orange-light)}a{color:#f35422;color:var(--orange-medium);text-decoration:none}a:hover{color:#f36822;color:var(--orange-light)}.reset-networking{cursor:pointer;font-size:1.25em;margin-left:.5em;margin-top:1em;text-decoration:underline;width:100%}.reset-networking:hover{color:#f36822;color:var(--orange-light)}.name-err{color:red;line-height:1.5em;margin-bottom:1em}.chain-button{align-items:center;background-color:hsla(45,89%,93%,.25);background-color:var(--gray-button);border:none;border-radius:2.5em;box-shadow:none;color:#fff5d9;color:var(--text-light);display:flex;flex-direction:row;font-family:Barlow Condensed,sans-serif;font-weight:300;justify-content:center;margin:0;padding:.4em .25em}.chain-button:hover{opacity:.9}.chain-button.monospace{font-family:Courier New,Courier,monospace}.network-icon{height:1.5em;margin-right:.5em;width:1.5em}.os{margin-left:.2em} \ No newline at end of file diff --git a/kinode/src/register-ui/build/static/js/main.332b908d.js b/kinode/src/register-ui/build/static/js/main.332b908d.js new file mode 100644 index 000000000..aba1fafa1 --- /dev/null +++ b/kinode/src/register-ui/build/static/js/main.332b908d.js @@ -0,0 +1,2 @@ +/*! For license information please see main.332b908d.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 L},$:function(){return B}});var n=r(5671),a=r(3144),i=r(2009),o=r(4812),s=r(2735),u=r(773),c=r(62),l=r(136),f=r(9388),d=r(8552),h=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,a.Z)(r,[{key:"defaultValue",value:function(){return"0x0000000000000000000000000000000000000000"}},{key:"encode",value:function(e,t){try{t=(0,d.getAddress)(t)}catch(r){this._throwError(r.message,t)}return e.writeValue(t)}},{key:"decode",value:function(e){return(0,d.getAddress)((0,i.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 a;return(0,n.Z)(this,r),(a=t.call(this,e.name,e.type,void 0,e.dynamic)).coder=e,a}return(0,a.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),b=new s.Logger(u.i);function y(e,t,r){var n=null;if(Array.isArray(r))n=r;else if(r&&"object"===typeof r){var a={};n=t.map((function(e){var t=e.localName;return t||b.throwError("cannot encode object for signature with missing names",s.Logger.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),a[t]&&b.throwError("cannot encode object for signature with duplicate names",s.Logger.errors.INVALID_ARGUMENT,{argument:"values",coder:e,value:r}),a[t]=!0,r[t]}))}else b.throwArgumentError("invalid tuple value","tuple",r);t.length!==n.length&&b.throwArgumentError("types/value length mismatch","tuple",r);var i=new c.QV(e.wordSize),o=new c.QV(e.wordSize),u=[];t.forEach((function(e,t){var r=n[t];if(e.dynamic){var a=o.length;e.encode(o,r);var s=i.writeUpdatableValue();u.push((function(e){s(e+a)}))}else e.encode(i,r)})),u.forEach((function(e){e(i.length)}));var l=e.appendWriter(i);return l+=e.appendWriter(o)}function m(e,t){var r=[],n=e.subReader(0);t.forEach((function(t){var a=null;if(t.dynamic){var i=e.readValue(),o=n.subReader(i.toNumber());try{a=t.decode(o)}catch(u){if(u.code===s.Logger.errors.BUFFER_OVERRUN)throw u;(a=u).baseType=t.name,a.name=t.localName,a.type=t.type}}else try{a=t.decode(e)}catch(u){if(u.code===s.Logger.errors.BUFFER_OVERRUN)throw u;(a=u).baseType=t.name,a.name=t.localName,a.type=t.type}void 0!=a&&r.push(a)}));var a=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===a[n]&&("length"===n&&(n="_length"),null==r[n])){var i=r[t];i instanceof Error?Object.defineProperty(r,n,{enumerable:!0,get:function(){throw i}}):r[n]=i}}));for(var i=function(){var e=r[o];e instanceof Error&&Object.defineProperty(r,o,{enumerable:!0,get:function(){throw e}})},o=0;o=0?a:"")+"]",u=-1===a||e.dynamic;return(o=t.call(this,"array",s,i,u)).coder=e,o.length=a,o}return(0,a.Z)(r,[{key:"defaultValue",value:function(){for(var e=this.coder.defaultValue(),t=[],r=0;re._data.length&&b.throwError("insufficient data length",s.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 T(n/8,"int"===r[1],e.name)}if(r=e.type.match(I)){var a=parseInt(r[1]);return(0===a||a>32)&&U.throwArgumentError("invalid bytes length","param",e),new E(a,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 N(r,"_").defaultValue()}},{key:"encode",value:function(e,t){var r=this;e.length!==t.length&&U.throwError("types/values length mismatch",s.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))})),a=new N(n,"_"),i=this._getWriter();return a.encode(i,t),i.data}},{key:"decode",value:function(e,t,r){var n=this,a=e.map((function(e){return n._getCoder(M._R.from(e))}));return new N(a,"_").decode(this._getReader((0,i.arrayify)(t),r))}}]),e}(),B=new L},62:function(e,t,r){"use strict";r.d(t,{BR:function(){return f},Ej:function(){return p},QV:function(){return h},XI:function(){return d}});var n=r(5671),a=r(3144),i=r(2009),o=r(9560),s=r(4812),u=r(2735),c=r(773),l=new u.Logger(c.i);function f(e){var t=[];return function e(r,n){if(Array.isArray(n))for(var a in n){var i=r.slice();i.push(a);try{e(i,n[a])}catch(o){t.push({path:i,error:o})}}}([],e),t}var d=function(){function e(t,r,a,i){(0,n.Z)(this,e),this.name=t,this.type=r,this.localName=a,this.dynamic=i}return(0,a.Z)(e,[{key:"_throwError",value:function(e,t){l.throwArgumentError(e,this.localName,t)}}]),e}(),h=function(){function e(t){(0,n.Z)(this,e),(0,s.defineReadOnly)(this,"wordSize",t||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(t)}return(0,a.Z)(e,[{key:"data",get:function(){return(0,i.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,i.concat)(e._data))}},{key:"writeBytes",value:function(e){var t=(0,i.arrayify)(e),r=t.length%this.wordSize;return r&&(t=(0,i.concat)([t,this._padding.slice(r)])),this._writeData(t)}},{key:"_getValue",value:function(e){var t=(0,i.arrayify)(o.O$.from(e));return t.length>this.wordSize&&l.throwError("value out-of-bounds",u.Logger.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=(0,i.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,a,o){(0,n.Z)(this,e),(0,s.defineReadOnly)(this,"_data",(0,i.arrayify)(t)),(0,s.defineReadOnly)(this,"wordSize",r||32),(0,s.defineReadOnly)(this,"_coerceFunc",a),(0,s.defineReadOnly)(this,"allowLoose",o),this._offset=0}return(0,a.Z)(e,[{key:"data",get:function(){return(0,i.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",u.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 P},QV:function(){return x},Xg:function(){return _},YW:function(){return C},_R:function(){return g},pc:function(){return m}});var n=r(136),a=r(9388),i=r(5671),o=r(3144),s=r(9560),u=r(4812),c=r(2735),l=r(773),f=new c.Logger(l.i),d={},h={calldata:!0,memory:!0,storage:!0},p={calldata:!0,memory:!0};function b(e,t){if("bytes"===e||"string"===e){if(h[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&p[t])return!0;return(h[t]||"payable"===t)&&f.throwArgumentError("invalid modifier","name",t),!1}function y(e,t){for(var r in t)(0,u.defineReadOnly)(e,r,t[r])}var m=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),v=new RegExp(/^(.*)\[([0-9]*)\]$/),g=function(){function e(t,r){(0,i.Z)(this,e),t!==d&&f.throwError("use fromString",c.Logger.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),y(this,r);var n=this.type.match(v);y(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=m.sighash),m[e]||f.throwArgumentError("invalid format type","format",e),e===m.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!==m.sighash&&(r+=this.type),r+="("+this.components.map((function(t){return t.format(e)})).join(e===m.full?", ":",")+")"):r+=this.type,e!==m.sighash&&(!0===this.indexed&&(r+=" indexed"),e===m.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(d,{name:t.name||null,type:O(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 a(e){var r={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(r.indexed=!1),r}e=e.replace(/\s/g," ");for(var i={type:"",name:"",state:{allowType:!0}},o=i,s=0;s2&&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=s.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,a.Z)(r);function r(){return(0,i.Z)(this,r),t.apply(this,arguments)}return(0,o.Z)(r,[{key:"format",value:function(e){if(e||(e=m.sighash),m[e]||f.throwArgumentError("invalid format type","format",e),e===m.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===m.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===m.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(g.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?s.O$.from(e.gas):null};return new r(d,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,a.Z)(r);function r(){return(0,i.Z)(this,r),t.apply(this,arguments)}return(0,o.Z)(r,[{key:"format",value:function(e){if(e||(e=m.sighash),m[e]||f.throwArgumentError("invalid format type","format",e),e===m.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!==m.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((function(t){return t.format(e)})).join(e===m.full?", ":",")+") ",e!==m.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(g.fromObject):[],outputs:e.outputs?e.outputs.map(g.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?s.O$.from(e.gas):null};return new r(d,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 a=n[0].match(U);if(a||f.throwArgumentError("invalid function signature","value",e),t.name=a[1].trim(),t.name&&M(t.name),t.inputs=w(a[2],!1),E(a[3].trim(),t),n.length>1){var i=n[1].match(U);""==i[1].trim()&&""==i[3].trim()||f.throwArgumentError("unexpected tokens","value",e),t.outputs=w(i[2],!1)}else t.outputs=[];return r.fromObject(t)}},{key:"isFunctionFragment",value:function(e){return e&&e._isFragment&&"function"===e.type}}]),r}(_);function T(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 P=function(e){(0,n.Z)(r,e);var t=(0,a.Z)(r);function r(){return(0,i.Z)(this,r),t.apply(this,arguments)}return(0,o.Z)(r,[{key:"format",value:function(e){if(e||(e=m.sighash),m[e]||f.throwArgumentError("invalid format type","format",e),e===m.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!==m.sighash&&(t+="error "),(t+=this.name+"("+this.inputs.map((function(t){return t.format(e)})).join(e===m.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(g.fromObject):[]};return T(new r(d,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),T(r.fromObject(t))}},{key:"isErrorFragment",value:function(e){return e&&e._isFragment&&"error"===e.type}}]),r}(k);function O(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}var N=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function M(e){return e&&e.match(N)||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 a.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 i.Hk},Interface:function(){return i.vU},LogDescription:function(){return i.CC},ParamType:function(){return n._R},TransactionDescription:function(){return i.vk},checkResultErrors:function(){return o.BR},defaultAbiCoder:function(){return a.$}});var n=r(7550),a=r(6388),i=r(9456),o=r(62)},9456:function(e,t,r){"use strict";r.d(t,{CC:function(){return v},Hk:function(){return k},vU:function(){return E},vk:function(){return g}});var n=r(3144),a=r(5671),i=r(136),o=r(9388),s=r(8552),u=r(9560),c=r(2009),l=r(3358),f=r(1291),d=r(4812),h=r(6388),p=r(7550),b=r(2735),y=r(773),m=new b.Logger(y.i),v=function(e){(0,i.Z)(r,e);var t=(0,o.Z)(r);function r(){return(0,a.Z)(this,r),t.apply(this,arguments)}return(0,n.Z)(r)}(d.Description),g=function(e){(0,i.Z)(r,e);var t=(0,o.Z)(r);function r(){return(0,a.Z)(this,r),t.apply(this,arguments)}return(0,n.Z)(r)}(d.Description),w=function(e){(0,i.Z)(r,e);var t=(0,o.Z)(r);function r(){return(0,a.Z)(this,r),t.apply(this,arguments)}return(0,n.Z)(r)}(d.Description),k=function(e){(0,i.Z)(r,e);var t=(0,o.Z)(r);function r(){return(0,a.Z)(this,r),t.apply(this,arguments)}return(0,n.Z)(r,null,[{key:"isIndexed",value:function(e){return!(!e||!e._isIndexed)}}]),r}(d.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,a.Z)(this,e);var n=[];n="string"===typeof t?JSON.parse(t):t,(0,d.defineReadOnly)(this,"fragments",n.map((function(e){return p.HY.from(e)})).filter((function(e){return null!=e}))),(0,d.defineReadOnly)(this,"_abiCoder",(0,d.getStatic)(this instanceof e?this.constructor:void 0,"getAbiCoder")()),(0,d.defineReadOnly)(this,"functions",{}),(0,d.defineReadOnly)(this,"errors",{}),(0,d.defineReadOnly)(this,"events",{}),(0,d.defineReadOnly)(this,"structs",{}),this.fragments.forEach((function(e){var t=null;switch(e.type){case"constructor":return r.deploy?void m.warn("duplicate definition - constructor"):void(0,d.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]?m.warn("duplicate definition - "+n):t[n]=e})),this.deploy||(0,d.defineReadOnly)(this,"deploy",p.Xg.from({payable:!1,type:"constructor"})),(0,d.defineReadOnly)(this,"_isInterface",!0)}return(0,n.Z)(e,[{key:"format",value:function(e){e||(e=p.pc.full),e===p.pc.sighash&&m.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];m.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?m.throwArgumentError("no matching function","name",r):n.length>1&&m.throwArgumentError("multiple matching functions","name",r),this.functions[n[0]]}var a=this.functions[p.YW.fromString(e).format()];return a||m.throwArgumentError("no matching function","signature",e),a}},{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];m.throwArgumentError("no matching event","topichash",t)}if(-1===e.indexOf("(")){var n=e.trim(),a=Object.keys(this.events).filter((function(e){return e.split("(")[0]===n}));return 0===a.length?m.throwArgumentError("no matching event","name",n):a.length>1&&m.throwArgumentError("multiple matching events","name",n),this.events[a[0]]}var i=this.events[p.QV.fromString(e).format()];return i||m.throwArgumentError("no matching event","signature",e),i}},{key:"getError",value:function(e){if((0,c.isHexString)(e)){var t=(0,d.getStatic)(this.constructor,"getSighash");for(var r in this.errors){if(e===t(this.errors[r]))return this.errors[r]}m.throwArgumentError("no matching error","sighash",e)}if(-1===e.indexOf("(")){var n=e.trim(),a=Object.keys(this.errors).filter((function(e){return e.split("(")[0]===n}));return 0===a.length?m.throwArgumentError("no matching error","name",n):a.length>1&&m.throwArgumentError("multiple matching errors","name",n),this.errors[a[0]]}var i=this.errors[p.YW.fromString(e).format()];return i||m.throwArgumentError("no matching error","signature",e),i}},{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,d.getStatic)(this.constructor,"getSighash")(e)}},{key:"getEventTopic",value:function(e){return"string"===typeof e&&(e=this.getEvent(e)),(0,d.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)&&m.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)&&m.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,a="",i=null,o=null,s=null;switch(r.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,r)}catch(f){}break;case 4:var u=(0,c.hexlify)(r.slice(0,4)),l=x[u];if(l)i=this._abiCoder.decode(l.inputs,r.slice(4)),o=l.name,s=l.signature,l.reason&&(n=i[0]),"Error"===o?a="; VM Exception while processing transaction: reverted with reason string ".concat(JSON.stringify(i[0])):"Panic"===o&&(a="; VM Exception while processing transaction: reverted with panic code ".concat(i[0]));else try{var f=this.getError(u);i=this._abiCoder.decode(f.inputs,r.slice(4)),o=f.name,s=f.format()}catch(f){}}return m.throwError("call revert exception"+a,b.Logger.errors.CALL_EXCEPTION,{method:e.format(),data:(0,c.hexlify)(t),errorArgs:i,errorName:o,errorSignature:s,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&&m.throwError("too many arguments for "+e.format(),b.Logger.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});var n=[];e.anonymous||n.push(this.getEventTopic(e));var a=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=u.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 i=e.inputs[r];i.indexed?null==t?n.push(null):"array"===i.baseType||"tuple"===i.baseType?m.throwArgumentError("filtering with tuples or arrays not supported","contract."+i.name,t):Array.isArray(t)?n.push(t.map((function(e){return a(i,e)}))):n.push(a(i,t)):null!=t&&m.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+i.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=[],a=[],i=[];return e.anonymous||n.push(this.getEventTopic(e)),t.length!==e.inputs.length&&m.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach((function(e,o){var s=t[o];if(e.indexed)if("string"===e.type)n.push((0,l.id)(s));else if("bytes"===e.type)n.push((0,f.keccak256)(s));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");n.push(r._abiCoder.encode([e.type],[s]))}else a.push(e),i.push(s)})),{data:this._abiCoder.encode(a,i),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||m.throwError("fragment/topic mismatch",b.Logger.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:n,value:r[0]}),r=r.slice(1)}var a=[],i=[],o=[];e.inputs.forEach((function(e,t){e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(a.push(p._R.fromObject({type:"bytes32",name:e.name})),o.push(!0)):(a.push(e),o.push(!1)):(i.push(e),o.push(!1))}));var s=null!=r?this._abiCoder.decode(a,(0,c.concat)(r)):null,u=this._abiCoder.decode(i,t,!0),l=[],f=0,d=0;e.inputs.forEach((function(e,t){if(e.indexed)if(null==s)l[t]=new k({_isIndexed:!0,hash:null});else if(o[t])l[t]=new k({_isIndexed:!0,hash:s[d++]});else try{l[t]=s[d++]}catch(n){l[t]=n}else try{l[t]=u[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 h=function(e){var t=l[e];t instanceof Error&&Object.defineProperty(l,e,{enumerable:!0,get:function(){throw A("index ".concat(e),t)}})},y=0;y=0)throw e;return d.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]&&d.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||d.throwError("missing provider",l.Logger.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}}],[{key:"isSigner",value:function(e){return!(!e||!e._isSigner)}}]),e}(),y=function(e){(0,a.Z)(r,e);var t=(0,i.Z)(r);function r(e,a){var i;return(0,s.Z)(this,r),i=t.call(this),(0,c.defineReadOnly)((0,n.Z)(i),"address",e),(0,c.defineReadOnly)((0,n.Z)(i),"provider",a||null),i}return(0,u.Z)(r,[{key:"getAddress",value:function(){return Promise.resolve(this.address)}},{key:"_fail",value:function(e,t){return Promise.resolve().then((function(){d.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}(b)},8552:function(e,t,r){"use strict";r.r(t),r.d(t,{getAddress:function(){return b},getContractAddress:function(){return v},getCreate2Address:function(){return g},getIcapAddress:function(){return m},isAddress:function(){return y}});var n=r(2009),a=r(9560),i=r(1291),o=r(807),s=new(r(2735).Logger)("address/5.7.0");function u(e){(0,n.isHexString)(e,20)||s.throwArgumentError("invalid address","address",e);for(var t=(e=e.toLowerCase()).substring(2).split(""),r=new Uint8Array(40),a=0;a<40;a++)r[a]=t[a].charCodeAt(0);for(var o=(0,n.arrayify)((0,i.keccak256)(r)),u=0;u<40;u+=2)o[u>>1]>>4>=8&&(t[u]=t[u].toUpperCase()),(15&o[u>>1])>=8&&(t[u+1]=t[u+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 d,h=Math.floor((d=9007199254740991,Math.log10?Math.log10(d):Math.log(d)/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>=h;){var r=t.substring(0,h);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 b(e){var t=null;if("string"!==typeof e&&s.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=u(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&s.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)&&s.throwArgumentError("bad icap checksum","address",e),t=(0,a.g$)(e.substring(4));t.length<40;)t="0"+t;t=u("0x"+t)}else s.throwArgumentError("invalid address","address",e);return t}function y(e){try{return b(e),!0}catch(t){}return!1}function m(e){for(var t=(0,a.t2)(b(e).substring(2)).toUpperCase();t.length<30;)t="0"+t;return"XE"+p("XE00"+t)+t}function v(e){var t=null;try{t=b(e.from)}catch(u){s.throwArgumentError("missing from address","transaction",e)}var r=(0,n.stripZeros)((0,n.arrayify)(a.O$.from(e.nonce).toHexString()));return b((0,n.hexDataSlice)((0,i.keccak256)((0,o.encode)([t,r])),12))}function g(e,t,r){return 32!==(0,n.hexDataLength)(t)&&s.throwArgumentError("salt must be 32 bytes","salt",t),32!==(0,n.hexDataLength)(r)&&s.throwArgumentError("initCodeHash must be 32 bytes","initCodeHash",r),b((0,n.hexDataSlice)((0,i.keccak256)((0,n.concat)(["0xff",b(e),t,r])),12))}},8853:function(e,t,r){"use strict";r.d(t,{J:function(){return a},c:function(){return i}});var n=r(2009);function a(e){e=atob(e);for(var t=[],r=0;r0;)r.push(a%this.base),a=a/this.base|0}for(var s="",u=0;0===t[u]&&u=0;--c)s+=this.alphabet[r[c]];return s}},{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(;a>0;)t.push(255&a),a>>=8}for(var s=0;e[s]===this._leader&&s0&&(10===arguments[0]?b||(b=!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()",u.Logger.errors.UNEXPECTED_ARGUMENT,{}):f.throwError("BigNumber.toString does not accept parameters",u.Logger.errors.UNEXPECTED_ARGUMENT,{})),g(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(d,m(t)):t.match(/^-?[0-9]+$/)?new e(d,m(new l(t))):f.throwArgumentError("invalid BigNumber string","value",t);if("number"===typeof t)return t%1&&w("underflow","BigNumber.from",t),(t>=h||t<=-h)&&w("overflow","BigNumber.from",t),e.from(String(t));var r=t;if("bigint"===typeof r)return e.from(r.toString());if((0,s.isBytes)(r))return e.from((0,s.hexlify)(r));if(r)if(r.toHexString){var n=r.toHexString();if("string"===typeof n)return e.from(n)}else{var a=r._hex;if(null==a&&"BigNumber"===r.type&&(a=r.hex),"string"===typeof a&&((0,s.isHexString)(a)||"-"===a[0]&&(0,s.isHexString)(a.substring(1))))return e.from(a)}return f.throwArgumentError("invalid BigNumber value","value",t)}},{key:"isBigNumber",value:function(e){return!(!e||!e._isBigNumber)}}]),e}();function m(e){if("string"!==typeof e)return m(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&f.throwArgumentError("invalid hex","value",e),"0x00"===(e=m(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 v(e){return y.from(m(e))}function g(e){var t=y.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,u.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 v},hexDataLength:function(){return y},hexDataSlice:function(){return m},hexStripZeros:function(){return w},hexValue:function(){return g},hexZeroPad:function(){return k},hexlify:function(){return b},isBytes:function(){return u},isBytesLike:function(){return o},isHexString:function(){return h},joinSignature:function(){return A},splitSignature:function(){return x},stripZeros:function(){return f},zeroPad:function(){return d}});var n=new(r(2735).Logger)("bytes/5.7.0");function a(e){return!!e.toHexString}function i(e){return e.slice||(e.slice=function(){var t=Array.prototype.slice.call(arguments);return i(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function o(e){return h(e)&&!(e.length%2)||u(e)}function s(e){return"number"===typeof e&&e==e&&e%1===0}function u(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"===typeof e)return!1;if(!s(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),i(new Uint8Array(r))}if(t.allowMissingPrefix&&"string"===typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),a(e)&&(e=e.toHexString()),h(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 s=[],c=0;ct&&n.throwArgumentError("value out of range","value",arguments[0]);var r=new Uint8Array(t);return r.set(e,t-e.length),i(r)}function h(e,t){return!("string"!==typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}var p="0123456789abcdef";function b(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),a(e))return e.toHexString();if(h(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(u(e)){for(var i="0x",o=0;o>4]+p[15&s]}return i}return n.throwArgumentError("invalid hexlify value","value",e)}function y(e){if("string"!==typeof e)e=b(e);else if(!h(e)||e.length%2)return null;return(e.length-2)/2}function m(e,t,r){return"string"!==typeof e?e=b(e):(!h(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 v(e){var t="0x";return e.forEach((function(e){t+=b(e).substring(2)})),t}function g(e){var t=w(b(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function w(e){"string"!==typeof e&&(e=b(e)),h(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=b(r.slice(0,32)),t.s=b(r.slice(32,64))):65===r.length?(t.r=b(r.slice(0,32)),t.s=b(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=b(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 a=d(c(t._vs),32);t._vs=b(a);var i=a[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=i:t.recoveryParam!==i&&n.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),a[0]&=127;var s=b(a);null==t.s?t.s=s:t.s!==s&&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 u=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==u&&n.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&h(t.r)?t.r=k(t.r,32):n.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&h(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=b(l);t._vs&&(h(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 b(l([(e=x(e)).r,e.s,e.recoveryParam?"0x1c":"0x1b"]))}},6321:function(e,t,r){"use strict";r.d(t,{Bz:function(){return s},_Y:function(){return i},fh:function(){return o},tL:function(){return a}});var n=r(9560),a=n.O$.from(-1),i=n.O$.from(0),o=n.O$.from(1),s=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 i}});var n=r(1291),a=r(1953);function i(e){return(0,n.keccak256)((0,a.Y0)(e))}},5843:function(e,t,r){"use strict";r.r(t),r.d(t,{_TypedDataEncoder:function(){return o.E},dnsEncode:function(){return a.Kn},ensNormalize:function(){return a.w3},hashMessage:function(){return i.r},id:function(){return n.id},isValidName:function(){return a.r1},messagePrefix:function(){return i.B},namehash:function(){return a.VM}});var n=r(3358),a=r(8565),i=r(8836),o=r(6454)},8836:function(e,t,r){"use strict";r.d(t,{B:function(){return o},r:function(){return s}});var n=r(2009),a=r(1291),i=r(1953),o="\x19Ethereum Signed Message:\n";function s(e){return"string"===typeof e&&(e=(0,i.Y0)(e)),(0,a.keccak256)((0,n.concat)([(0,i.Y0)(o),(0,i.Y0)(String(e.length)),e]))}},8565:function(e,t,r){"use strict";r.d(t,{Kn:function(){return j},w3:function(){return R},r1:function(){return L},VM:function(){return B}});var n=r(2009),a=r(1953),i=r(1291),o=r(2735),s=r(2069),u=r(3433),c=r(7762);function l(e,t){null==t&&(t=1);var r=[],n=r.forEach;return function e(t,a){n.call(t,(function(t){a>0&&Array.isArray(t)?e(t,a-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(),a=1,i=[0,1],o=1;o>--c&1}for(var d=Math.pow(2,31),h=d>>>1,p=h>>1,b=d-1,y=0,m=0;m<31;m++)y=y<<1|f();for(var v=[],g=0,w=d;;){for(var k=Math.floor(((y-g+1)*a-1)/w),x=0,A=n;A-x>1;){var E=x+A>>>1;k>>1|f(),S=S<<1^h,_=(_^h)<<1|h|1;g=S,w=1+_-S}var C=n-4;return v.map((function(t){switch(t-C){case 3:return C+65792+(e[u++]<<16|e[u++]<<8|e[u++]);case 2:return C+256+(e[u++]<<8|e[u++]);case 1:return C+e[u++];default:return t-1}}))}(e))}function d(e){return 1&e?~e>>1:e>>1}function h(e,t){for(var r=Array(e),n=0,a=-1;n>=1),check:2==i}}()}(g),E=45,S=95;function _(e){return(0,a.XL)(e)}function C(e){return e.filter((function(e){return 65039!=e}))}function T(e){var t,r=(0,c.Z)(e.split("."));try{for(r.s();!(t=r.n()).done;){var n=t.value,a=_(n);try{for(var i=a.lastIndexOf(S)-1;i>=0;i--)if(a[i]!==S)throw new Error("underscore only allowed at start");if(a.length>=4&&a.every((function(e){return e<128}))&&a[2]===E&&a[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 P(e){return T(function(e,t){var r=_(e).reverse(),n=[];for(;r.length;){var a=O(r);if(a)n.push.apply(n,(0,u.Z)(t(a)));else{var i=r.pop();if(w.has(i))n.push(i);else if(!k.has(i)){var o=x[i];if(!o)throw new Error("Disallowed codepoint: 0x".concat(i.toString(16).toUpperCase()));n.push.apply(n,(0,u.Z)(o))}}}return T((s=String.fromCodePoint.apply(String,n),s.normalize("NFC")));var s}(e,C))}function O(e,t){var r,n,a,i=A,o=[],s=e.length;t&&(t.length=0);for(var c=function(){var c=e[--s];if(!(i=null===(r=i.branches.find((function(e){return e.set.has(c)})))||void 0===r?void 0:r.node))return 0;if(i.save)a=c;else if(i.check&&c===a)return 0;o.push(c),i.fe0f&&(o.push(65039),s>0&&65039==e[s-1]&&s--),i.valid&&(n=o.slice(),2==i.valid&&n.splice(1,1),t&&t.push.apply(t,(0,u.Z)(e.slice(s).reverse())),e.length=s)};s&&0!==c(););return n}var N=new o.Logger(s.i),M=new Uint8Array(32);function U(e){if(0===e.length)throw new Error("invalid ENS name; empty component");return e}function I(e){var t=(0,a.Y0)(P(e)),r=[];if(0===e.length)return r;for(var n=0,i=0;i=t.length)throw new Error("invalid ENS name; empty component");return r.push(U(t.slice(n))),r}function R(e){return I(e).map((function(e){return(0,a.ZN)(e)})).join(".")}function L(e){try{return 0!==I(e).length}catch(t){}return!1}function B(e){"string"!==typeof e&&N.throwArgumentError("invalid ENS name; not a string","name",e);for(var t=M,r=I(e);r.length;)t=(0,i.keccak256)((0,n.concat)([t,(0,i.keccak256)(r.pop())]));return(0,n.hexlify)(t)}function j(e){return(0,n.hexlify)((0,n.concat)(I(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 P}});var n=r(4165),a=r(5671),i=r(3144),o=r(8552),s=r(9560),u=r(2009),c=r(1291),l=r(4812),f=r(2735),d=r(2069),h=r(3358),p=function(e,t,r,n){return new(r||(r=Promise))((function(a,i){function o(e){try{u(n.next(e))}catch(t){i(t)}}function s(e){try{u(n.throw(e))}catch(t){i(t)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}u((n=n.apply(e,t||[])).next())}))},b=new f.Logger(d.i),y=new Uint8Array(32);y.fill(0);var m=s.O$.from(-1),v=s.O$.from(0),g=s.O$.from(1),w=s.O$.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var k=(0,u.hexZeroPad)(g.toHexString(),32),x=(0,u.hexZeroPad)(v.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&&b.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 s.O$.from(e).toString()}catch(t){}return b.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return(0,o.getAddress)(e).toLowerCase()}catch(t){}return b.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{var t=(0,u.arrayify)(e);if(32!==t.length)throw new Error("bad length");return(0,u.hexlify)(t)}catch(r){}return b.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))&&b.throwArgumentError("invalid numeric width","type",e);var a=w.mask(r?n-1:n),i=r?a.add(g).mul(m):v;return function(t){var r=s.O$.from(t);return(r.lt(i)||r.gt(a))&&b.throwArgumentError("value out-of-bounds for ".concat(e),"value",t),(0,u.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))&&b.throwArgumentError("invalid bytes width","type",e),function(t){return(0,u.arrayify)(t).length!==f&&b.throwArgumentError("invalid length for ".concat(e),"value",t),function(e){var t=(0,u.arrayify)(e),r=t.length%32;return r?(0,u.hexConcat)([t,y.slice(r)]):(0,u.hexlify)(t)}(t)}}switch(e){case"address":return function(e){return(0,u.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,h.id)(e)}}return null}function T(e,t){return"".concat(e,"(").concat(t.map((function(e){var t=e.name;return e.type+" "+t})).join(","),")")}var P=function(){function e(t){(0,a.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={},i={};Object.keys(t).forEach((function(e){r[e]={},n[e]=[],i[e]={}}));var o=function(e){var a={};t[e].forEach((function(i){a[i.name]&&b.throwArgumentError("duplicate variable name ".concat(JSON.stringify(i.name)," in ").concat(JSON.stringify(e)),"types",t),a[i.name]=!0;var o=i.type.match(/^([^\x5b]*)(\x5b|$)/)[1];o===e&&b.throwArgumentError("circular type reference to ".concat(JSON.stringify(o)),"types",t),C(o)||(n[o]||b.throwArgumentError("unknown type ".concat(JSON.stringify(o)),"types",t),n[o].push(e),r[e][o]=!0)}))};for(var s in t)o(s);var u=Object.keys(n).filter((function(e){return 0===n[e].length}));for(var c in 0===u.length?b.throwArgumentError("missing primary type","types",t):u.length>1&&b.throwArgumentError("ambiguous primary types or unused types: ".concat(u.map((function(e){return JSON.stringify(e)})).join(", ")),"types",t),(0,l.defineReadOnly)(this,"primaryType",u[0]),function e(a,o){o[a]&&b.throwArgumentError("circular type reference to ".concat(JSON.stringify(a)),"types",t),o[a]=!0,Object.keys(r[a]).forEach((function(t){n[t]&&(e(t,o),Object.keys(o).forEach((function(e){i[e][t]=!0})))})),delete o[a]}(this.primaryType,{}),i){var f=Object.keys(i[c]);f.sort(),this._types[c]=T(c,t[c])+f.map((function(e){return T(e,t[e])})).join("")}}return(0,i.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 a=n[1],i=this.getEncoder(a),o=parseInt(n[3]);return function(e){o>=0&&e.length!==o&&b.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",e);var r=e.map(i);return t._types[a]&&(r=r.map(c.keccak256)),(0,c.keccak256)((0,u.hexConcat)(r))}}var s=this.types[e];if(s){var l=(0,h.id)(this._types[e]);return function(e){var r=s.map((function(r){var n=r.name,a=r.type,i=t.getEncoder(a)(e[n]);return t._types[a]?(0,c.keccak256)(i):i}));return r.unshift(l),(0,u.hexConcat)(r)}}return b.throwArgumentError("unknown type: ".concat(e),"type",e)}},{key:"encodeType",value:function(e){var t=this._types[e];return t||b.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 a=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(a){var i=a[1],o=parseInt(a[3]);return o>=0&&t.length!==o&&b.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map((function(e){return n._visit(i,e,r)}))}var s=this.types[e];return s?s.reduce((function(e,a){var i=a.name,o=a.type;return e[i]=n._visit(o,t[i],r),e}),{}):b.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 a=A[n];a||b.throwArgumentError("invalid typed-data domain key: ".concat(JSON.stringify(n)),"domain",t),r.push({name:n,type:a})}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,u.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,a,i){return p(this,void 0,void 0,(0,n.Z)().mark((function o(){var s,c,f;return(0,n.Z)().wrap((function(o){for(;;)switch(o.prev=o.next){case 0:t=(0,l.shallowCopy)(t),s={},t.verifyingContract&&!(0,u.isHexString)(t.verifyingContract,20)&&(s[t.verifyingContract]="0x"),(c=e.from(r)).visit(a,(function(e,t){return"address"!==e||(0,u.isHexString)(t,20)||(s[t]="0x"),t})),o.t0=(0,n.Z)().keys(s);case 6:if((o.t1=o.t0()).done){o.next=13;break}return f=o.t1.value,o.next=10,i(f);case 10:s[f]=o.sent,o.next=6;break;case 13:return t.verifyingContract&&s[t.verifyingContract]&&(t.verifyingContract=s[t.verifyingContract]),a=c.visit(a,(function(e,t){return"address"===e&&s[t]?s[t]:t})),o.abrupt("return",{domain:t,value:a});case 16:case"end":return o.stop()}}),o)})))}},{key:"getPayload",value:function(t,r,n){e.hashDomain(t);var a={},i=[];E.forEach((function(e){var r=t[e];null!=r&&(a[e]=_[e](r),i.push({name:e,type:A[e]}))}));var o=e.from(r),c=(0,l.shallowCopy)(r);return c.EIP712Domain?b.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",r):c.EIP712Domain=i,o.encode(n),{types:c,domain:a,primaryType:o.primaryType,message:o.visit(n,(function(e,t){if(e.match(/^bytes(\d*)/))return(0,u.hexlify)((0,u.arrayify)(t));if(e.match(/^u?int/))return s.O$.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!==typeof t&&b.throwArgumentError("invalid string","value",t),t}return b.throwArgumentError("unsupported type","type",e)}))}}}]),e}()},9590:function(e,t,r){"use strict";r.r(t),r.d(t,{HDNode:function(){return R},defaultPath:function(){return I},entropyToMnemonic:function(){return j},getAccountPath:function(){return D},isValidMnemonic:function(){return F},mnemonicToEntropy:function(){return B},mnemonicToSeed:function(){return L}});var n=r(5671),a=r(3144),i=r(4247),o=r(2009),s=r(9560),u=r(1953),c=r(9716),l=r(4812),f=r(4760),d=r(3984),h=r(8427),p=r(5958),b=r(136),y=r(9388),m=r(3358),v=r(2735),g=new v.Logger("wordlists/5.7.0"),w=function(){function e(t){(0,n.Z)(this,e),g.checkAbstract(this instanceof e?this.constructor:void 0,e),(0,l.defineReadOnly)(this,"locale",t)}return(0,a.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,m.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,b.Z)(r,e);var t=(0,y.Z)(r);function r(){return(0,n.Z)(this,r),t.call(this,"en")}return(0,a.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 v.Logger("hdnode/5.7.0"),_=s.O$.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),C=(0,u.Y0)("Bitcoin seed"),T=2147483648;function P(e){return(1<=256)throw new Error("Depth too large!");return N((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&~T));var n=new Uint8Array(37);if(t&T){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 a=24;a>=0;a-=8)n[33+(a>>3)]=t>>24-a&255;var i=(0,o.arrayify)((0,d.Gy)(h.p.sha512,this.chainCode,n)),u=i.slice(0,32),c=i.slice(32),l=null,p=null;this.privateKey?l=O(s.O$.from(u).add(this.privateKey).mod(_)):p=new f.SigningKey((0,o.hexlify)(u))._addPoint(this.publicKey);var b=r,y=this.mnemonic;return y&&(b=Object.freeze({phrase:y.phrase,path:r,locale:y.locale||"en"})),new e(U,l,p,this.fingerprint,O(c),t,this.depth+1,b)}},{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=T)throw new Error("invalid path index - "+a);r=r._derive(T+i)}else{if(!a.match(/^[0-9]+$/))throw new Error("invalid path component - "+a);var o=parseInt(a);if(o>=T)throw new Error("invalid path index - "+a);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 a=(0,o.arrayify)((0,d.Gy)(h.p.sha512,C,n));return new e(U,O(a.slice(0,32)),null,"0x00000000",O(a.slice(32)),0,0,r)}},{key:"fromMnemonic",value:function(t,r,n){return t=j(B(t,n=M(n)),n),e._fromSeed(L(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=i.Base58.decode(t);82===r.length&&N(r.slice(0,78))===t||S.throwArgumentError("invalid extended key","extendedKey","[REDACTED]");var n=r[4],a=(0,o.hexlify)(r.slice(5,9)),s=parseInt((0,o.hexlify)(r.slice(9,13)).substring(2),16),u=(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),a,u,s,n,null);case"0x0488ade4":case"0x04358394 ":if(0!==c[0])break;return new e(U,(0,o.hexlify)(c.slice(1)),null,a,u,s,n,null)}return S.throwArgumentError("invalid extended key","extendedKey","[REDACTED]")}}]),e}();function L(e,t){t||(t="");var r=(0,u.Y0)("mnemonic"+t,u.Uj.NFKD);return(0,c.n)((0,u.Y0)(e,u.Uj.NFKD),r,2048,64,"sha512")}function B(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))),a=0,i=0;i>3]|=1<<7-a%8),a++}var c=32*r.length/3,l=P(r.length/3);if(((0,o.arrayify)((0,d.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,a=0;a8?(r[r.length-1]<<=8,r[r.length-1]|=e[a],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=e[a]>>8-n,r.push(e[a]&(1<<8-n)-1),n+=3);var i=e.length/4,s=(0,o.arrayify)((0,d.JQ)(e))[0]&P(i);return r[r.length-1]<<=i,r[r.length-1]|=s>>8-i,t.join(r.map((function(e){return t.getWord(e)})))}function F(e,t){try{return B(e,t),!0}catch(r){}return!1}function D(e){return("number"!==typeof e||e<0||e>=T||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),a=r(3144),i=r(136),o=r(9388),s=r(2959),u=r.n(s),c=r(8552),l=r(2009),f=r(1291),d=r(9716),h=r(1953),p=r(4812),b=r(2735),y=r(5779),m=r(7211),v=new b.Logger(y.i),g=function(e){(0,i.Z)(r,e);var t=(0,o.Z)(r);function r(){return(0,n.Z)(this,r),t.apply(this,arguments)}return(0,a.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,m.Ij)(t);var n=(0,c.getAddress)((0,m.gx)(r,"ethaddr")),a=(0,m.p3)((0,m.gx)(r,"encseed"));a&&a.length%16===0||v.throwArgumentError("invalid encseed","json",e);for(var i=(0,l.arrayify)((0,d.n)(t,t,2e3,32,"sha256")).slice(0,16),o=a.slice(0,16),s=a.slice(16),p=new(u().ModeOfOperation.cbc)(i,o),b=u().padding.pkcs7.strip((0,l.arrayify)(p.decrypt(s))),y="",w=0;w255)return!1;return!0}function a(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 i(e){return new Uint8Array(e)}function o(e,t,r,n,a){null==n&&null==a||(e=e.slice?e.slice(n,a):Array.prototype.slice.call(e,n,a)),t.set(e,r)}var s={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("")}},u=function(){var e="0123456789abcdef";return{toBytes:function(e){for(var t=[],r=0;r>4]+e[15&a])}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],d=[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],h=[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],b=[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],y=[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],m=[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],v=[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],g=[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]=i[t],this._Kd[e-r][t%4]=i[t];for(var o,s=0,u=a;u>16&255]<<24^f[o>>8&255]<<16^f[255&o]<<8^f[o>>24&255]^l[s]<<24,s+=1,8!=a)for(t=1;t>8&255]<<8^f[o>>16&255]<<16^f[o>>24&255]<<24;for(t=a/2+1;t>2,h=u%4,this._Ke[d][h]=i[t],this._Kd[e-d][h]=i[t++],u++}for(var d=1;d>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),a=0;a<4;a++)n[a]^=this._Ke[0][a];for(var o=1;o>24&255]^p[n[(a+1)%4]>>16&255]^b[n[(a+2)%4]>>8&255]^y[255&n[(a+3)%4]]^this._Ke[o][a];n=r.slice()}var s,u=i(16);for(a=0;a<4;a++)s=this._Ke[t][a],u[4*a]=255&(f[n[a]>>24&255]^s>>24),u[4*a+1]=255&(f[n[(a+1)%4]>>16&255]^s>>16),u[4*a+2]=255&(f[n[(a+2)%4]>>8&255]^s>>8),u[4*a+3]=255&(f[255&n[(a+3)%4]]^s);return u},_.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),a=0;a<4;a++)n[a]^=this._Kd[0][a];for(var o=1;o>24&255]^v[n[(a+3)%4]>>16&255]^g[n[(a+2)%4]>>8&255]^w[255&n[(a+1)%4]]^this._Kd[o][a];n=r.slice()}var s,u=i(16);for(a=0;a<4;a++)s=this._Kd[t][a],u[4*a]=255&(d[n[a]>>24&255]^s>>24),u[4*a+1]=255&(d[n[(a+3)%4]>>16&255]^s>>16),u[4*a+2]=255&(d[n[(a+2)%4]>>8&255]^s>>8),u[4*a+3]=255&(d[255&n[(a+1)%4]]^s);return u};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=a(e)).length%16!==0)throw new Error("invalid plaintext size (must be multiple of 16 bytes)");for(var t=i(e.length),r=i(16),n=0;n=0;--t)this._counter[t]=e%256,e>>=8},N.prototype.setBytes=function(e){if(16!=(e=a(e,!0)).length)throw new Error("invalid counter bytes size (must be 16 bytes)");this._counter=e},N.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 N||(r=new N(r)),this._counter=r,this._remainingCounter=null,this._remainingCounterIndex=16,this._aes=new _(t)};M.prototype.encrypt=function(e){for(var t=a(e,!0),r=0;r16)throw new Error("PKCS#7 padding byte out of range");for(var r=e.length-t,n=0;ns[r]||console.log.apply(console,t)}},{key:"debug",value:function(){for(var t=arguments.length,r=new Array(t),n=0;n>4],r+=h[15&t[i]];a.push(e+"=Uint8Array(0x"+r+")")}else a.push(e+"="+JSON.stringify(t))}catch(c){a.push(e+"="+JSON.stringify(n[e].toString()))}})),a.push("code=".concat(r)),a.push("version=".concat(this.version));var i=t,s="";switch(r){case f.NUMERIC_FAULT:s="NUMERIC_FAULT";var u=t;switch(u){case"overflow":case"underflow":case"division-by-zero":s+="-"+u;break;case"negative-power":case"negative-width":s+="-unsupported";break;case"unbound-bitwise-result":s+="-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:s=r}s&&(t+=" [ See: https://links.ethers.org/v5-errors-"+s+" ]"),a.length&&(t+=" ("+a.join(", ")+")");var c=new Error(t);return c.reason=i,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"),d&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:d})}},{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"}),i){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}o=!!t,i=!!r}},{key:"setLogLevel",value:function(t){var r=s[t.toLowerCase()];null!=r?u=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 a(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(s){}if(t.EtherscanProvider&&"-"!==r.etherscan)try{n.push(new t.EtherscanProvider(e,r.etherscan))}catch(s){}if(t.AlchemyProvider&&"-"!==r.alchemy)try{n.push(new t.AlchemyProvider(e,r.alchemy))}catch(s){}if(t.PocketProvider&&"-"!==r.pocket){try{var a=new t.PocketProvider(e,r.pocket);a.network&&-1===["goerli","ropsten","rinkeby","sepolia"].indexOf(a.network.name)&&n.push(a)}catch(s){}}if(t.CloudflareProvider&&"-"!==r.cloudflare)try{n.push(new t.CloudflareProvider(e))}catch(s){}if(t.AnkrProvider&&"-"!==r.ankr)try{var i=new t.AnkrProvider(e,r.ankr);i.network&&-1===["ropsten"].indexOf(i.network.name)&&n.push(i)}catch(s){}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 a(e)},t}function i(e,t){var r=function(r,n){return r.JsonRpcProvider?new r.JsonRpcProvider(e,t):null};return r.renetwork=function(t){return i(e,t)},r}var o={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:a("homestead")},s={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:a("ropsten")},u={chainId:63,name:"classicMordor",_defaultProvider:i("https://www.ethercluster.com/mordor","classicMordor")},c={unspecified:{chainId:0,name:"unspecified"},homestead:o,mainnet:o,morden:{chainId:2,name:"morden"},ropsten:s,testnet:s,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:a("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:a("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:a("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:a("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:i("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:u,classicTestnet:u,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:i("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:a("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:a("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 a=c[e];return null==a?null:{name:a.name,chainId:a.chainId,ensAddress:a.ensAddress,_defaultProvider:a._defaultProvider||null}}var i=c[e.name];if(!i)return"number"!==typeof e.chainId&&n.throwArgumentError("invalid network chainId","network",e),e;0!==e.chainId&&e.chainId!==i.chainId&&n.throwArgumentError("network chainId mismatch","network",e);var o,s=e._defaultProvider||null;return null==s&&i._defaultProvider&&(s=(o=i._defaultProvider)&&"function"===typeof o.renetwork?i._defaultProvider.renetwork(e):i._defaultProvider),{name:e.name,chainId:i.chainId,ensAddress:e.ensAddress||i.ensAddress||null,_defaultProvider:s}}},9716:function(e,t,r){"use strict";r.d(t,{n:function(){return i}});var n=r(2009),a=r(3984);function i(e,t,r,i,o){var s;e=(0,n.arrayify)(e),t=(0,n.arrayify)(t);var u,c,l=1,f=new Uint8Array(i),d=new Uint8Array(t.length+4);d.set(t);for(var h=1;h<=l;h++){d[t.length]=h>>24&255,d[t.length+1]=h>>16&255,d[t.length+2]=h>>8&255,d[t.length+3]=255&h;var p=(0,n.arrayify)((0,a.Gy)(o,e,d));s||(s=p.length,c=new Uint8Array(s),u=i-((l=Math.ceil(i/s))-1)*s),c.set(p);for(var b=1;b0&&null==e[e.length-1];)e.pop();return e.map((function(e){if(Array.isArray(e)){var t={};e.forEach((function(e){t[T(e)]=!0}));var r=Object.keys(t);return r.sort(),r.join("|")}return T(e)})).join("&")}function O(e){if("string"===typeof e){if(e=e.toLowerCase(),32===(0,h.hexDataLength)(e))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter:*:"+P(e);if(c.Sg.isForkEvent(e))throw C.warn("not implemented"),new Error("not implemented");if(e&&"object"===typeof e)return"filter:"+(e.address||"*")+":"+P(e.topics||[])}throw new Error("invalid event - "+e)}function N(){return(new Date).getTime()}function M(e){return new Promise((function(t){setTimeout(t,e)}))}var U=["block","network","pending","poll"],I=function(){function e(t,r,n){(0,s.Z)(this,e),(0,m.defineReadOnly)(this,"tag",t),(0,m.defineReadOnly)(this,"listener",r),(0,m.defineReadOnly)(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}return(0,u.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})),a={};return n.length>0&&(a.topics=n),r&&"*"!==r&&(a.address=r),a}},{key:"pollable",value:function(){return this.tag.indexOf(":")>=0||U.indexOf(this.tag)>=0}}]),e}(),R={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 L(e){return(0,h.hexZeroPad)(d.O$.from(e).toHexString(),32)}function B(e){return f.Base58.encode((0,h.concat)([e,(0,h.hexDataSlice)((0,v.JQ)((0,v.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,g.ZN)(Z(e,t))}catch(r){}return null}function Z(e,t){if("0x"===e)return null;var r=d.O$.from((0,h.hexDataSlice)(e,t,t+32)).toNumber(),n=d.O$.from((0,h.hexDataSlice)(e,r,r+32)).toNumber();return(0,h.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 H(e){var t=(0,h.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 q(e){if(e.length%32===0)return e;var t=new Uint8Array(32*Math.ceil(e.length/32));return t.set(e),t}function V(e){for(var t=[],r=0,n=0;n=1&&i<=75)return B((0,h.concat)([[r.p2pkh],"0x"+a[2]]))}}if(null!=r.p2sh){var o=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(o){var s=parseInt(o[1],16);if(o[2].length===2*s&&s>=1&&s<=75)return B((0,h.concat)([[r.p2sh],"0x"+o[2]]))}}if(null!=r.prefix){var u=n[1],c=n[0];if(0===c?20!==u&&32!==u&&(c=-1):c=-1,c>=0&&n.length===2+u&&u>=1&&u<=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,a;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",L(e));case 18:if(null!=(n=t.sent)&&"0x"!==n){t.next=21;break}return t.abrupt("return",null);case 21:return null==(a=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",a);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,a,i,s,u,c,l,f,p,b,y,m,v,g;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:i,sender:a}),n.next=12,(0,w.fetchJson)({url:l,errorPassThrough:!0},f,(function(e,t){return e.status=t.statusCode,e}));case 12:if(!(d=n.sent).data){n.next=15;break}return n.abrupt("return",d.data);case 15:if(h=d.message||"unknown error",!(d.status>=400&&d.status<500)){n.next=18;break}return n.abrupt("return",C.throwError("response not found during CCIP fetch: ".concat(h),A.Logger.errors.SERVER_ERROR,{url:c,errorMessage:h}));case 18:s.push(h);case 19:u++,n.next=6;break;case 22:return n.abrupt("return",C.throwError("error encountered during CCIP fetch: ".concat(s.map((function(e){return JSON.stringify(e)})).join(", ")),A.Logger.errors.SERVER_ERROR,{urls:r,errorMessages:s}));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,a,i,s=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,!(N()-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 a=N(),i=(0,m.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 s._internalBlockNumber===i&&(s._internalBlockNumber=null),r;var n=N();return(t=d.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(a=this._emitted.block+1;a<=n;a++)this.emit("block",a);return this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach((function(e){if("block"!==e){var t=i._emitted[e];"pending"!==t&&n-t>12&&delete i._emitted[e]}}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=n-1),this._events.forEach((function(e){switch(e.type){case"tx":var t=e.hash,a=i.getTransactionReceipt(t).then((function(e){return e&&null!=e.blockNumber?(i._emitted["t:"+t]=e.blockNumber,i.emit(t,e),null):null})).catch((function(e){i.emit("error",e)}));r.push(a);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 s=o.toBlock-i._maxFilterBlockRange;s>o.fromBlock&&(o.fromBlock=s),o.fromBlock<0&&(o.fromBlock=0);var u=i.getLogs(o).then((function(t){e._inflight=!1,0!==t.length&&t.forEach((function(t){t.blockNumber>e._lastBlockNumber&&(e._lastBlockNumber=t.blockNumber),i._emitted["b:"+t.blockHash]=t.blockNumber,i._emitted["t:"+t.transactionHash]=t.blockNumber,i.emit(o,t)}))})).catch((function(t){i.emit("error",t),e._inflight=!1}));r.push(u)}}})),this._lastBlockNumber=n,Promise.all(r).then((function(){i.emit("didPoll",t)})).catch((function(e){i.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=N();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 a(){var i,s=this;return(0,o.Z)().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.getTransactionReceipt(e);case 2:if(!(((i=a.sent)?i.confirmations:0)>=t)){a.next=5;break}return a.abrupt("return",i);case 5:return a.abrupt("return",new Promise((function(a,i){var u=[],c=!1,l=function(){return!!c||(c=!0,u.forEach((function(e){e()})),!1)},f=function(e){e.confirmations0){var b=setTimeout((function(){l()||i(C.makeError("timeout exceeded",A.Logger.errors.TIMEOUT,{timeout:r}))}),r);b.unref&&b.unref(),u.push((function(){clearTimeout(b)}))}})));case 6:case"end":return a.stop()}}),a,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",d.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,a;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,m.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 a=r.sent,r.prev=8,r.abrupt("return",d.O$.from(a));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:a,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,a;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,m.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 a=r.sent,r.prev=8,r.abrupt("return",d.O$.from(a).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:a,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,a;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,m.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 a=r.sent,r.prev=8,r.abrupt("return",(0,h.hexlify)(a));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:a,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 a,i;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,m.resolveProperties)({address:this._getAddress(e),blockTag:this._getBlockTag(r),position:Promise.resolve(t).then((function(e){return(0,h.hexValue)(e)}))});case 4:return a=n.sent,n.next=7,this.perform("getStorageAt",a);case 7:return i=n.sent,n.prev=8,n.abrupt("return",(0,h.hexlify)(i));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:a,result:i,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,h.hexDataLength)(t))throw new Error("invalid response - sendTransaction");var a=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}),a.wait=function(t,a){return _(n,void 0,void 0,(0,o.Z)().mark((function n(){var i,s;return(0,o.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return null==t&&(t=1),null==a&&(a=0),i=void 0,0!==t&&null!=r&&(i={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,a,i);case 6:if(null!=(s=n.sent)||0!==t){n.next=9;break}return n.abrupt("return",null);case 9:return this._emitted["t:"+e.hash]=s.blockNumber,0===s.status&&C.throwError("transaction failed",A.Logger.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:s}),n.abrupt("return",s);case 12:case"end":return n.stop()}}),n,this)})))},a}},{key:"sendTransaction",value:function(e){return _(this,void 0,void 0,(0,o.Z)().mark((function t(){var r,n,a,i;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,h.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 a=t.sent,t.prev=10,t.next=13,this.perform("sendTransaction",{signedTransaction:r});case 13:return i=t.sent,t.abrupt("return",this._wrapTransaction(n,i,a));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,a=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?a._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?d.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,h.hexlify)(e):null})))})),t.t0=this.formatter,t.next=12,(0,m.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,m.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 a,i,s,u,c,l,f,p,b,y,m,v,g,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}),a=e.to,n.next=4,this.perform("call",{transaction:e,blockTag:t});case 4:if(i=n.sent,!(r>=0&&"latest"===t&&null!=a&&"0x556f1830"===i.substring(0,10)&&(0,h.hexDataLength)(i)%32===4)){n.next=31;break}for(n.prev=6,s=(0,h.hexDataSlice)(i,4),u=(0,h.hexDataSlice)(s,0,32),d.O$.from(u).eq(a)||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:i}),c=[],l=d.O$.from((0,h.hexDataSlice)(s,32,64)).toNumber(),f=d.O$.from((0,h.hexDataSlice)(s,l,l+32)).toNumber(),p=(0,h.hexDataSlice)(s,l+32),b=0;bthis._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}i=null,s=0;case 14:if(!(s0}},{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 I(O(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),a=1;a=0&&(t.throttleRetry=!0),t}return e.result}function Q(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 J(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===g.Logger.errors.SERVER_ERROR){var n=t.error;if(n&&(n.message.match(/reverted/i)||n.message.match(/VM execution error/i))){var a=n.data;if(a&&(a="0x"+a.replace(/^.*0x/i,"")),(0,z.isHexString)(a))return a;G.throwError("missing revert data in call exception",g.Logger.errors.CALL_EXCEPTION,{error:t,data:"0x"})}}var i=t.message;throw t.code===g.Logger.errors.SERVER_ERROR&&(t.error&&"string"===typeof t.error.message?i=t.error.message:"string"===typeof t.body?i=t.body:"string"===typeof t.responseText&&(i=t.responseText)),(i=(i||"").toLowerCase()).match(/insufficient funds/)&&G.throwError("insufficient funds for intrinsic transaction cost",g.Logger.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:r}),i.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&G.throwError("nonce has already been used",g.Logger.errors.NONCE_EXPIRED,{error:t,method:e,transaction:r}),i.match(/another transaction with same nonce/)&&G.throwError("replacement fee too low",g.Logger.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:r}),i.match(/execution failed due to an exception|execution reverted/)&&G.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",g.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 a;return(0,o.Z)(this,r),a=t.call(this,e),(0,f.defineReadOnly)((0,u.Z)(a),"baseUrl",a.getBaseUrl()),(0,f.defineReadOnly)((0,u.Z)(a),"apiKey",n||null),a}return(0,s.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 G.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 V(this,void 0,void 0,(0,h.Z)().mark((function n(){var a,i,o,s,u,c,l=this;return(0,h.Z)().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return a=r?this.getPostUrl():this.getUrl(e,t),i=r?this.getPostData(e,t):null,o="proxy"===e?Q:W,this.emit("debug",{action:"request",request:a,provider:this}),s={url:a,throttleSlotInterval:1e3,throttleCallback:function(e,t){return l.isCommunityResource()&&(0,d.vh)(),Promise.resolve(!0)}},u=null,i&&(s.headers={"content-type":"application/x-www-form-urlencoded; charset=UTF-8"},u=Object.keys(i).map((function(e){return"".concat(e,"=").concat(i[e])})).join("&")),n.next=9,(0,q.fetchJson)(s,u,o||Q);case 9:return c=n.sent,this.emit("debug",{action:"response",request:a,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 V(this,void 0,void 0,(0,h.Z)().mark((function e(){return(0,h.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,a=Object.create(null,{perform:{get:function(){return(0,b.Z)((0,y.Z)(r.prototype),"perform",n)}}});return V(this,void 0,void 0,(0,h.Z)().mark((function r(){var n,i,o,s,u,c,l,f,d;return(0,h.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=K(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(i=K(t.transaction)).module="proxy",i.action="eth_estimateGas",r.prev=32,r.next=35,this.fetch("proxy",i,!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=J(t.filter.fromBlock)),t.filter.toBlock&&(o.toBlock=J(t.filter.toBlock)),t.filter.address&&(o.address=t.filter.address),t.filter.topics&&t.filter.topics.length>0&&(t.filter.topics.length>1&&G.throwError("unsupported topic count",g.Logger.errors.UNSUPPORTED_OPERATION,{topics:t.filter.topics}),1===t.filter.topics.length&&("string"===typeof(s=t.filter.topics[0])&&66===s.length||G.throwError("unsupported topic format",g.Logger.errors.UNSUPPORTED_OPERATION,{topic0:s}),o.topic0=s)),r.next=48,this.fetch("logs",o);case 48:u=r.sent,c={},l=0;case 51:if(!(lt?null:(n+a)/2}function ie(e){if(null===e)return"null";if("number"===typeof e||"boolean"===typeof e)return JSON.stringify(e);if("string"===typeof e)return e;if(m.O$.isBigNumber(e))return e.toString();if(Array.isArray(e))return JSON.stringify(e.map((function(e){return ie(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]":ie(r),JSON.stringify(t)+":"+r})).join(",")+"}"}throw new Error("unknown value type: "+typeof e)}var oe=1;function se(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 ue=[g.Logger.errors.CALL_EXCEPTION,g.Logger.errors.INSUFFICIENT_FUNDS,g.Logger.errors.NONCE_EXPIRED,g.Logger.errors.REPLACEMENT_UNDERPRICED,g.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=ie;switch(t){case"getBlockNumber":return function(t){var r=t.map((function(e){return e.result})),n=ae(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 ae(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,ie(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})),ie(e))}:function(e){return null==e?null:ie(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 a=Object.keys(n),i=0;i=t)return o.result}}}(n,e.quorum)}function de(e,t){return ee(this,void 0,void 0,(0,h.Z)().mark((function r(){var n;return(0,h.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,q.poll)((function(){return new Promise((function(r,a){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 he(e,t,r,n){return ee(this,void 0,void 0,(0,h.Z)().mark((function a(){var i,o;return(0,h.Z)().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:i=e.provider,a.t0=r,a.next="getBlockNumber"===a.t0||"getGasPrice"===a.t0?4:"getEtherPrice"===a.t0?5:"getBalance"===a.t0||"getTransactionCount"===a.t0||"getCode"===a.t0?8:"getStorageAt"===a.t0?13:"getBlock"===a.t0?18:"call"===a.t0||"estimateGas"===a.t0?23:"getTransaction"===a.t0||"getTransactionReceipt"===a.t0?30:"getLogs"===a.t0?31:37;break;case 4:return a.abrupt("return",i[r]());case 5:if(!i.getEtherPrice){a.next=7;break}return a.abrupt("return",i.getEtherPrice());case 7:return a.abrupt("break",37);case 8:if(!n.blockTag||!(0,z.isHexString)(n.blockTag)){a.next=12;break}return a.next=11,de(e,t);case 11:i=a.sent;case 12:return a.abrupt("return",i[r](n.address,n.blockTag||"latest"));case 13:if(!n.blockTag||!(0,z.isHexString)(n.blockTag)){a.next=17;break}return a.next=16,de(e,t);case 16:i=a.sent;case 17:return a.abrupt("return",i.getStorageAt(n.address,n.position,n.blockTag||"latest"));case 18:if(!n.blockTag||!(0,z.isHexString)(n.blockTag)){a.next=22;break}return a.next=21,de(e,t);case 21:i=a.sent;case 22:return a.abrupt("return",i[n.includeTransactions?"getBlockWithTransactions":"getBlock"](n.blockTag||n.blockHash));case 23:if(!n.blockTag||!(0,z.isHexString)(n.blockTag)){a.next=27;break}return a.next=26,de(e,t);case 26:i=a.sent;case 27:if("call"!==r||!n.blockTag){a.next=29;break}return a.abrupt("return",i[r](n.transaction,n.blockTag));case 29:return a.abrupt("return",i[r](n.transaction));case 30:return a.abrupt("return",i[r](n.transactionHash));case 31:if(!((o=n.filter).fromBlock&&(0,z.isHexString)(o.fromBlock)||o.toBlock&&(0,z.isHexString)(o.toBlock))){a.next=36;break}return a.next=35,de(e,t);case 35:i=a.sent;case 36:return a.abrupt("return",i.getLogs(o));case 37:return a.abrupt("return",te.throwError("unknown method error",g.Logger.errors.UNKNOWN_ERROR,{method:r,params:n}));case 38:case"end":return a.stop()}}),a)})))}var pe=function(e){(0,c.Z)(r,e);var t=(0,l.Z)(r);function r(e,a){var i;(0,o.Z)(this,r),0===e.length&&te.throwArgumentError("missing providers","providers",e);var s=e.map((function(e,t){if(n.zt.isProvider(e)){var r=(0,d.Gp)(e)?2e3:750;return Object.freeze({provider:e,weight:1,stallTimeout:r,priority:1})}var a=(0,f.shallowCopy)(e);null==a.priority&&(a.priority=1),null==a.stallTimeout&&(a.stallTimeout=(0,d.Gp)(e)?2e3:750),null==a.weight&&(a.weight=1);var i=a.weight;return(i%1||i>512||i<1)&&te.throwArgumentError("invalid weight; must be integer in [1, 512]","providers[".concat(t,"].weight"),i),Object.freeze(a)})),c=s.reduce((function(e,t){return e+t.weight}),0);null==a?a=c/2:a>c&&te.throwArgumentError("quorum will always fail; larger than total weight","quorum",a);var l=ne(s.map((function(e){return e.provider.network})));return null==l&&(l=new Promise((function(e,t){setTimeout((function(){i.detectNetwork().then(e,t)}),0)}))),i=t.call(this,l),(0,f.defineReadOnly)((0,u.Z)(i),"providerConfigs",Object.freeze(s)),(0,f.defineReadOnly)((0,u.Z)(i),"quorum",a),i._highestBlockNumber=-1,i}return(0,s.Z)(r,[{key:"detectNetwork",value:function(){return ee(this,void 0,void 0,(0,h.Z)().mark((function e(){var t;return(0,h.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,h.Z)().mark((function r(){var n,a,i,o,s,u,c,l,d,p,b=this;return(0,h.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,a=0;case 5:if(!(a=b.quorum)){r.next=22;break}if(void 0===(y=o(p))){r.next=18;break}return s.forEach((function(e){e.staller&&e.staller.cancel(),e.cancelled=!0})),r.abrupt("return",{v:y});case 18:if(l){r.next=21;break}return r.next=21,se(100).getPromise();case 21:l=!1;case 22:if(m=s.reduce((function(e,t){if(!t.done||null==t.error)return e;var r=t.error.code;return ue.indexOf(r)>=0&&(e[r]||(e[r]={error:t.error,weight:0}),e[r].weight+=t.weight),e}),{}),Object.keys(m).forEach((function(e){var t=m[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",g.Logger.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:n}),t}function C(e){return new Promise((function(t){setTimeout(t,e)}))}function T(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 P(e){return e?e.toLowerCase():e}var O={},N=function(e){(0,c.Z)(r,e);var t=(0,l.Z)(r);function r(e,n,a){var i;if((0,o.Z)(this,r),i=t.call(this),e!==O)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");return(0,b.defineReadOnly)((0,u.Z)(i),"provider",n),null==a&&(a=0),"string"===typeof a?((0,b.defineReadOnly)((0,u.Z)(i),"_address",i.provider.formatter.address(a)),(0,b.defineReadOnly)((0,u.Z)(i),"_index",null)):"number"===typeof a?((0,b.defineReadOnly)((0,u.Z)(i),"_index",a),(0,b.defineReadOnly)((0,u.Z)(i),"_address",null)):A.throwArgumentError("invalid address or index","addressOrIndex",a),i}return(0,s.Z)(r,[{key:"connect",value:function(e){return A.throwError("cannot alter JSON-RPC Signer connection",g.Logger.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}},{key:"connectUnchecked",value:function(){return new M(O,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,g.Logger.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),e.provider.formatter.address(t[e._index])}))}},{key:"sendUncheckedTransaction",value:function(e){var t=this;e=(0,b.shallowCopy)(e);var r=this.getAddress().then((function(e){return e&&(e=e.toLowerCase()),e}));if(null==e.gasLimit){var n=(0,b.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,i.Z)().mark((function t(){var r;return(0,i.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,b.resolveProperties)({tx:(0,b.resolveProperties)(e),sender:r}).then((function(r){var n=r.tx,a=r.sender;null!=n.from?n.from.toLowerCase()!==a&&A.throwArgumentError("from address mismatch","transaction",e):n.from=a;var i=t.provider.constructor.hexlifyTransaction(n,{from:!0});return t.provider.send("eth_sendTransaction",[i]).then((function(e){return e}),(function(e){return"string"===typeof e.message&&e.message.match(/user denied/i)&&A.throwError("user rejected transaction",g.Logger.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:n}),_("sendTransaction",e,i)}))}))}},{key:"signTransaction",value:function(e){return A.throwError("signing transactions is unsupported",g.Logger.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}},{key:"sendTransaction",value:function(e){return x(this,void 0,void 0,(0,i.Z)().mark((function t(){var r,n,a=this;return(0,i.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,v.poll)((function(){return x(a,void 0,void 0,(0,i.Z)().mark((function e(){var t;return(0,i.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,i.Z)().mark((function t(){var r,n;return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="string"===typeof e?(0,y.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,h.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",g.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,i.Z)().mark((function t(){var r,n;return(0,i.Z)().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="string"===typeof e?(0,y.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,h.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",g.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,i.Z)().mark((function n(){var a,o,s=this;return(0,i.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 s.provider.resolveName(e)}));case 2:return a=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(a.domain,t,a.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",g.Logger.errors.ACTION_REJECTED,{action:"_signTypedData",from:o,messageData:{domain:a.domain,types:t,value:a.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,i.Z)().mark((function t(){var r,n;return(0,i.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,s.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}(N),U={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0},I=function(e){(0,c.Z)(r,e);var t=(0,l.Z)(r);function r(e,n){var a;(0,o.Z)(this,r);var i=n;return null==i&&(i=new Promise((function(e,t){setTimeout((function(){a.detectNetwork().then((function(t){e(t)}),(function(e){t(e)}))}),0)}))),a=t.call(this,i),e||(e=(0,b.getStatic)(a.constructor,"defaultUrl")()),"string"===typeof e?(0,b.defineReadOnly)((0,u.Z)(a),"connection",Object.freeze({url:e})):(0,b.defineReadOnly)((0,u.Z)(a),"connection",Object.freeze((0,b.shallowCopy)(e))),a._nextId=42,a}return(0,s.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,i.Z)().mark((function e(){var t,r;return(0,i.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,b.getStatic)(this.constructor,"getNetwork"),e.prev=21,e.abrupt("return",r(d.O$.from(t).toNumber()));case 25:return e.prev=25,e.t2=e.catch(21),e.abrupt("return",A.throwError("could not detect network",g.Logger.errors.NETWORK_ERROR,{chainId:t,event:"invalidNetwork",serverError:e.t2}));case 28:return e.abrupt("return",A.throwError("could not detect network",g.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 N(O,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,b.deepCopy)(n),provider:this});var a=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(a&&this._cache[e])return this._cache[e];var i=(0,v.fetchJson)(this.connection,JSON.stringify(n),T).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 a&&(this._cache[e]=i,setTimeout((function(){r._cache[e]=null}),0)),i}},{key:"prepareRequest",value:function(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[P(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[P(t.address),t.blockTag]];case"getCode":return["eth_getCode",[P(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[P(t.address),(0,h.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,b.getStatic)(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[(0,b.getStatic)(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=P(t.filter.address)),["eth_getLogs",[t.filter]]}return null}},{key:"perform",value:function(e,t){return x(this,void 0,void 0,(0,i.Z)().mark((function r(){var n,a,o;return(0,i.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||!d.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==(a=r.sent).maxFeePerGas&&null==a.maxPriorityFeePerGas&&((t=(0,b.shallowCopy)(t)).transaction=(0,b.shallowCopy)(n),delete t.transaction.type);case 8:return null==(o=this.prepareRequest(e,t))&&A.throwError(e+" not implemented",g.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,a.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,a.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,b.shallowCopy)(U);if(t)for(var n in t)t[n]&&(r[n]=!0);(0,b.checkProperties)(e,r);var a={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(t){if(null!=e[t]){var r=(0,h.hexValue)(d.O$.from(e[t]));"gasLimit"===t&&(t="gas"),a[t]=r}})),["from","to","data"].forEach((function(t){null!=e[t]&&(a[t]=(0,h.hexlify)(e[t]))})),e.accessList&&(a.accessList=(0,m.accessListify)(e.accessList)),a}}]),r}(k.Zk)},5683:function(e,t,r){"use strict";r.r(t),r.d(t,{randomBytes:function(){return n.O},shuffled:function(){return a.y}});var n=r(5722),a=r(4327)},5722:function(e,t,r){"use strict";r.d(t,{O:function(){return u}});var n=r(2009),a=r(2735),i=new a.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")}(),s=o.crypto||o.msCrypto;function u(e){(e<=0||e>1024||e%1||e!=e)&&i.throwArgumentError("invalid length","length",e);var t=new Uint8Array(e);return s.getRandomValues(t),(0,n.arrayify)(t)}s&&s.getRandomValues||(i.warn("WARNING: Missing strong random number source"),s={getRandomValues:function(e){return i.throwError("no secure random source avaialble",a.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 d},encode:function(){return c}});var n=r(2009),a=r(2735),i=new a.Logger("rlp/5.7.0");function o(e){for(var t=[];e;)t.unshift(255&e),e>>=8;return t}function s(e,t,r){for(var n=0,a=0;at+1+n&&i.throwError("child data too short",a.Logger.errors.BUFFER_OVERRUN,{})}return{consumed:1+n,result:o}}function f(e,t){if(0===e.length&&i.throwError("data too short",a.Logger.errors.BUFFER_OVERRUN,{}),e[t]>=248){var r=e[t]-247;t+1+r>e.length&&i.throwError("data short segment too short",a.Logger.errors.BUFFER_OVERRUN,{});var o=s(e,t+1,r);return t+1+r+o>e.length&&i.throwError("data long segment too short",a.Logger.errors.BUFFER_OVERRUN,{}),l(e,t,t+1+r,r+o)}if(e[t]>=192){var u=e[t]-192;return t+1+u>e.length&&i.throwError("data array too short",a.Logger.errors.BUFFER_OVERRUN,{}),l(e,t,t+1,u)}if(e[t]>=184){var c=e[t]-183;t+1+c>e.length&&i.throwError("data array too short",a.Logger.errors.BUFFER_OVERRUN,{});var f=s(e,t+1,c);return t+1+c+f>e.length&&i.throwError("data array too short",a.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 d=e[t]-128;return t+1+d>e.length&&i.throwError("data too short",a.Logger.errors.BUFFER_OVERRUN,{}),{consumed:1+d,result:(0,n.hexlify)(e.slice(t+1,t+1+d))}}return{consumed:1,result:(0,n.hexlify)(e[t])}}function d(e){var t=(0,n.arrayify)(e),r=f(t,0);return r.consumed!==t.length&&i.throwArgumentError("invalid rlp data","data",e),r.result}},4517:function(e,t,r){"use strict";r.r(t),r.d(t,{SupportedAlgorithm:function(){return a.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),a=r(8427)},3984:function(e,t,r){"use strict";r.d(t,{Gy:function(){return d},bP:function(){return c},JQ:function(){return l},o:function(){return f}});var n=r(7553),a=r.n(n),i=r(2009),o=r(8427),s=r(2735),u=new s.Logger("sha2/5.7.0");function c(e){return"0x"+a().ripemd160().update((0,i.arrayify)(e)).digest("hex")}function l(e){return"0x"+a().sha256().update((0,i.arrayify)(e)).digest("hex")}function f(e){return"0x"+a().sha512().update((0,i.arrayify)(e)).digest("hex")}function d(e,t,r){return o.p[e]||u.throwError("unsupported algorithm "+e,s.Logger.errors.UNSUPPORTED_OPERATION,{operation:"hmac",algorithm:e}),"0x"+a().hmac(a()[e],(0,i.arrayify)(t)).update((0,i.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 J},computePublicKey:function(){return X},recoverPublicKey:function(){return Y}});var n=r(5671),a=r(3144),i=r(4166),o=r.n(i),s=r(7553),u=r.n(s);"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 d=c((function(e,t){var r=t;function n(e){return 1===e.length?"0"+e:e}function a(e){for(var t="",r=0;r>8,o=255&a;i?r.push(i,o):r.push(o)}return r},r.zero2=n,r.toHex=a,r.encode=function(e,t){return"hex"===t?a(e):e}})),h=c((function(e,t){var r=t;r.assert=l,r.toArray=d.toArray,r.zero2=d.zero2,r.toHex=d.toHex,r.encode=d.encode,r.getNAF=function(e,t,r){var n=new Array(Math.max(e.bitLength(),r)+1);n.fill(0);for(var a=1<(a>>1)-1?(a>>1)-u:u,i.isubn(s)):s=0,n[o]=s,i.iushrn(1)}return n},r.getJSF=function(e,t){var r=[[],[]];e=e.clone(),t=t.clone();for(var n,a=0,i=0;e.cmpn(-a)>0||t.cmpn(-i)>0;){var o,s,u=e.andln(3)+a&3,c=t.andln(3)+i&3;3===u&&(u=-1),3===c&&(c=-1),o=0===(1&u)?0:3!==(n=e.andln(7)+a&7)&&5!==n||2!==c?u:-u,r[0].push(o),s=0===(1&c)?0:3!==(n=t.andln(7)+i&7)&&5!==n||2!==u?c:-c,r[1].push(s),2*a===o+1&&(a=1-a),2*i===s+1&&(i=1-i),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=h.getNAF,b=h.getJSF,y=h.assert;function m(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 v=m;function g(e,t){this.curve=e,this.type=t,this.precomputed=null}m.prototype.point=function(){throw new Error("Not implemented")},m.prototype.validate=function(){throw new Error("Not implemented")},m.prototype._fixedNafMul=function(e,t){y(e.precomputed);var r=e._getDoubles(),n=p(t,1,this._bitLength),a=(1<=i;u--)o=(o<<1)+n[u];s.push(o)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),f=a;f>0;f--){for(i=0;i=0;s--){for(var u=0;s>=0&&0===i[s];s--)u++;if(s>=0&&u++,o=o.dblp(u),s<0)break;var c=i[s];y(0!==c),o="affine"===e.type?c>0?o.mixedAdd(a[c-1>>1]):o.mixedAdd(a[-c-1>>1].neg()):c>0?o.add(a[c-1>>1]):o.add(a[-c-1>>1].neg())}return"affine"===e.type?o.toP():o},m.prototype._wnafMulAdd=function(e,t,r,n,a){var i,o,s,u=this._wnafT1,c=this._wnafT2,l=this._wnafT3,f=0;for(i=0;i=1;i-=2){var h=i-1,y=i;if(1===u[h]&&1===u[y]){var m=[t[h],null,null,t[y]];0===t[h].y.cmp(t[y].y)?(m[1]=t[h].add(t[y]),m[2]=t[h].toJ().mixedAdd(t[y].neg())):0===t[h].y.cmp(t[y].y.redNeg())?(m[1]=t[h].toJ().mixedAdd(t[y]),m[2]=t[h].add(t[y].neg())):(m[1]=t[h].toJ().mixedAdd(t[y]),m[2]=t[h].toJ().mixedAdd(t[y].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],g=b(r[h],r[y]);for(f=Math.max(g[0].length,f),l[h]=new Array(f),l[y]=new Array(f),o=0;o=0;i--){for(var E=0;i>=0;){var S=!0;for(o=0;o=0&&E++,x=x.dblp(E),i<0)break;for(o=0;o0?s=c[o][_-1>>1]:_<0&&(s=c[o][-_-1>>1].neg()),x="affine"===s.type?x.mixedAdd(s):x.add(s))}}for(i=0;i=Math.ceil((e.bitLength()+1)/t.step)},g.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var r=[this],n=this,a=0;a=0&&(i=t,s=r),n.negative&&(n=n.neg(),a=a.neg()),i.negative&&(i=i.neg(),s=s.neg()),[{a:n,b:a},{a:i,b:s}]},x.prototype._endoSplit=function(e){var t=this.endo.basis,r=t[0],n=t[1],a=n.b.mul(e).divRound(this.n),i=r.b.neg().mul(e).divRound(this.n),o=a.mul(r.a),s=i.mul(n.a),u=a.mul(r.b),c=i.mul(n.b);return{k1:e.sub(o).sub(s),k2:u.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 a=n.fromRed().isOdd();return(t&&!a||!t&&a)&&(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),a=t.redSqr().redMul(t).redIAdd(n).redIAdd(this.b);return 0===r.redSqr().redISub(a).cmpn(0)},x.prototype._endoWnafMulAdd=function(e,t,r){for(var n=this._endoWnafT1,a=this._endoWnafT2,i=0;i":""},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(),a=r.redAdd(r).redIAdd(r).redIAdd(t).redMul(n),i=a.redSqr().redISub(this.x.redAdd(this.x)),o=a.redMul(this.x.redSub(i)).redISub(this.y);return this.curve.point(i,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],a=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,a):this.curve._wnafMulAdd(1,n,a,2)},E.prototype.jmulAdd=function(e,t,r){var n=[this,t],a=[e,r];return this.curve.endo?this.curve._endoWnafMulAdd(n,a,!0):this.curve._wnafMulAdd(1,n,a,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,v.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),a=e.x.redMul(r),i=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(r.redMul(this.z)),s=n.redSub(a),u=i.redSub(o);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),f=n.redMul(c),d=u.redSqr().redIAdd(l).redISub(f).redISub(f),h=u.redMul(f.redISub(d)).redISub(i.redMul(l)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(d,h,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),a=this.y,i=e.y.redMul(t).redMul(this.z),o=r.redSub(n),s=a.redSub(i);if(0===o.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=o.redSqr(),c=u.redMul(o),l=r.redMul(u),f=s.redSqr().redIAdd(c).redISub(l).redISub(l),d=s.redMul(l.redISub(f)).redISub(a.redMul(c)),h=this.z.redMul(o);return this.curve.jpoint(f,d,h)},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(a),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=v,r.short=A,r.mont=null,r.edwards=null})),C=c((function(e,t){var r,n=t,a=h.assert;function i(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,a(this.g.validate(),"Invalid curve"),a(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 i(t);return Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:r}),r}})}n.PresetCurve=i,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:u().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:u().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:u().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:u().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:u().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:u().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:u().sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{r=null.crash()}catch(s){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:u().sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",r]})}));function T(e){if(!(this instanceof T))return new T(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=d.toArray(e.entropy,e.entropyEnc||"hex"),r=d.toArray(e.nonce,e.nonceEnc||"hex"),n=d.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 P=T;T.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 a=0;a=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(r||[])),this._reseed=1},T.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=d.toArray(r,n||"hex"),this._update(r));for(var a=[];a.length"};var U=h.assert;function I(e,t){if(e instanceof I)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 R=I;function L(){this.place=0}function B(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 a=0,i=0,o=t.place;i>>=0;return!(a<=127)&&(t.place=o,a)}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)}}I.prototype._importDER=function(e,t){e=h.toArray(e,t);var r=new L;if(48!==e[r.place++])return!1;var n=B(e,r);if(!1===n)return!1;if(n+r.place!==e.length)return!1;if(2!==e[r.place++])return!1;var a=B(e,r);if(!1===a)return!1;var i=e.slice(r.place,a+r.place);if(r.place+=a,2!==e[r.place++])return!1;var s=B(e,r);if(!1===s)return!1;if(e.length!==s+r.place)return!1;var u=e.slice(r.place,s+r.place);if(0===i[0]){if(!(128&i[1]))return!1;i=i.slice(1)}if(0===u[0]){if(!(128&u[1]))return!1;u=u.slice(1)}return this.r=new(o())(i),this.s=new(o())(u),this.recoveryParam=null,!0},I.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 a=n.concat(r),i=[48];return F(i,a.length),i=i.concat(a),h.encode(i,e)};var D=function(){throw new Error("unsupported")},Z=h.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 H=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 P({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 a=new(o())(t.generate(r));if(!(a.cmp(n)>0))return a.iaddn(1),this.keyFromPrivate(a)}},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 a=this.n.byteLength(),i=t.getPrivate().toArray("be",a),s=e.toArray("be",a),u=new P({hash:this.hash,entropy:i,nonce:s,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())(u.generate(this.n.byteLength()));if(!((f=this._truncateToN(f,!0)).cmpn(1)<=0||f.cmp(c)>=0)){var d=this.g.mul(f);if(!d.isInfinity()){var h=d.getX(),p=h.umod(this.n);if(0!==p.cmpn(0)){var b=f.invm(this.n).mul(p.mul(t.getPrivate()).iadd(e));if(0!==(b=b.umod(this.n)).cmpn(0)){var y=(d.getY().isOdd()?1:0)|(0!==h.cmp(p)?2:0);return n.canonical&&b.cmp(this.nh)>0&&(b=this.n.sub(b),y^=1),new R({r:p,s:b,recoveryParam:y})}}}}}},z.prototype.verify=function(e,t,r,n){e=this._truncateToN(new(o())(e,16)),r=this.keyFromPublic(r,n);var a=(t=new R(t,"hex")).r,i=t.s;if(a.cmpn(1)<0||a.cmp(this.n)>=0)return!1;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;var s,u=i.invm(this.n),c=u.mul(e).umod(this.n),l=u.mul(a).umod(this.n);return this.curve._maxwellTrick?!(s=this.g.jmulAdd(c,r.getPublic(),l)).isInfinity()&&s.eqXToP(a):!(s=this.g.mulAdd(c,r.getPublic(),l)).isInfinity()&&0===s.getX().umod(this.n).cmp(a)},z.prototype.recoverPubKey=function(e,t,r,n){Z((3&r)===r,"The recovery param is more than two bits"),t=new R(t,n);var a=this.n,i=new(o())(e),s=t.r,u=t.s,c=1&r,l=r>>1;if(s.cmp(this.curve.p.umod(this.curve.n))>=0&&l)throw new Error("Unable to find sencond key candinate");s=l?this.curve.pointFromX(s.add(this.curve.n),c):this.curve.pointFromX(s,c);var f=t.r.invm(a),d=a.sub(i).mul(f).umod(a),h=u.mul(f).umod(a);return this.g.mulAdd(d,s,h)},z.prototype.getKeyRecoveryParam=function(e,t,r,n){if(null!==(t=new R(t,n)).recoveryParam)return t.recoveryParam;for(var a=0;a<4;a++){var i;try{i=this.recoverPubKey(e,t,a)}catch(e){continue}if(i.eq(r))return a}throw new Error("Unable to find valid recovery factor")};var q=c((function(e,t){var r=t;r.version="6.5.4",r.utils=h,r.rand=function(){throw new Error("unsupported")},r.curve=_,r.curves=C,r.ec=H,r.eddsa=null})).ec,V=r(2009),G=r(4812),K=new(r(2735).Logger)("signing-key/5.7.0"),W=null;function Q(){return W||(W=new q("secp256k1")),W}var J=function(){function e(t){(0,n.Z)(this,e),(0,G.defineReadOnly)(this,"curve","secp256k1"),(0,G.defineReadOnly)(this,"privateKey",(0,V.hexlify)(t)),32!==(0,V.hexDataLength)(this.privateKey)&&K.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");var r=Q().keyFromPrivate((0,V.arrayify)(this.privateKey));(0,G.defineReadOnly)(this,"publicKey","0x"+r.getPublic(!1,"hex")),(0,G.defineReadOnly)(this,"compressedPublicKey","0x"+r.getPublic(!0,"hex")),(0,G.defineReadOnly)(this,"_isSigningKey",!0)}return(0,a.Z)(e,[{key:"_addPoint",value:function(e){var t=Q().keyFromPublic((0,V.arrayify)(this.publicKey)),r=Q().keyFromPublic((0,V.arrayify)(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}},{key:"signDigest",value:function(e){var t=Q().keyFromPrivate((0,V.arrayify)(this.privateKey)),r=(0,V.arrayify)(e);32!==r.length&&K.throwArgumentError("bad digest length","digest",e);var n=t.sign(r,{canonical:!0});return(0,V.splitSignature)({recoveryParam:n.recoveryParam,r:(0,V.hexZeroPad)("0x"+n.r.toString(16),32),s:(0,V.hexZeroPad)("0x"+n.s.toString(16),32)})}},{key:"computeSharedSecret",value:function(e){var t=Q().keyFromPrivate((0,V.arrayify)(this.privateKey)),r=Q().keyFromPublic((0,V.arrayify)(X(e)));return(0,V.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,V.splitSignature)(t),n={r:(0,V.arrayify)(r.r),s:(0,V.arrayify)(r.s)};return"0x"+Q().recoverPubKey((0,V.arrayify)(e),n,r.recoveryParam).encode("hex",!1)}function X(e,t){var r=(0,V.arrayify)(e);if(32===r.length){var n=new J(r);return t?"0x"+Q().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}return 33===r.length?t?(0,V.hexlify)(r):"0x"+Q().keyFromPublic(r).getPublic(!1,"hex"):65===r.length?t?"0x"+Q().keyFromPublic(r).getPublic(!0,"hex"):(0,V.hexlify)(r):K.throwArgumentError("invalid public or private key","key","[REDACTED]")}},6684:function(e,t,r){"use strict";r.r(t),r.d(t,{keccak256:function(){return y},pack:function(){return b},sha256:function(){return m}});var n=r(9560),a=r(2009),i=r(1291),o=r(3984),s=r(1953),u=r(2735),c=new RegExp("^bytes([0-9]+)$"),l=new RegExp("^(u?int)([0-9]*)$"),f=new RegExp("^(.*)\\[([0-9]*)\\]$"),d="0000000000000000000000000000000000000000000000000000000000000000",h=new u.Logger("solidity/5.7.0");function p(e,t,r){switch(e){case"address":return r?(0,a.zeroPad)(t,32):(0,a.arrayify)(t);case"string":return(0,s.Y0)(t);case"bytes":return(0,a.arrayify)(t);case"bool":return t=t?"0x01":"0x00",r?(0,a.zeroPad)(t,32):(0,a.arrayify)(t)}var i=e.match(l);if(i){var o=parseInt(i[2]||"256");return(i[2]&&String(o)!==i[2]||o%8!==0||0===o||o>256)&&h.throwArgumentError("invalid number type","type",e),r&&(o=256),t=n.O$.from(t).toTwos(o),(0,a.zeroPad)(t,o/8)}if(i=e.match(c)){var u=parseInt(i[1]);return(String(u)!==i[1]||0===u||u>32)&&h.throwArgumentError("invalid bytes type","type",e),(0,a.arrayify)(t).byteLength!==u&&h.throwArgumentError("invalid value for ".concat(e),"value",t),r?(0,a.arrayify)((t+d).substring(0,66)):t}if((i=e.match(f))&&Array.isArray(t)){var b=i[1];parseInt(i[2]||String(t.length))!=t.length&&h.throwArgumentError("invalid array length for ".concat(e),"value",t);var y=[];return t.forEach((function(e){y.push(p(b,e,!0))})),(0,a.concat)(y)}return h.throwArgumentError("invalid type","type",e)}function b(e,t){e.length!=t.length&&h.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,a.hexlify)((0,a.concat)(r))}function y(e,t){return(0,i.keccak256)(b(e,t))}function m(e,t){return(0,o.JQ)(b(e,t))}},4965:function(e,t,r){"use strict";r.r(t),r.d(t,{UnicodeNormalizationForm:function(){return i.Uj},Utf8ErrorFuncs:function(){return i.te},Utf8ErrorReason:function(){return i.Uw},_toEscapedUtf8String:function(){return i.U$},formatBytes32String:function(){return o},nameprep:function(){return v},parseBytes32String:function(){return s},toUtf8Bytes:function(){return i.Y0},toUtf8CodePoints:function(){return i.XL},toUtf8String:function(){return i.ZN}});var n=r(4160),a=r(2009),i=r(1953);function o(e){var t=(0,i.Y0)(e);if(t.length>31)throw new Error("bytes32 string must be less than 32 bytes");return(0,a.hexlify)((0,a.concat)([t,n.R]).slice(0,32))}function s(e){var t=(0,a.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,i.ZN)(t.slice(0,r))}function u(e,t){t||(t=function(e){return[parseInt(e,16)]});var r=0,n={};return e.split(",").forEach((function(e){var a=e.split(":");r+=parseInt(a[0],16),n[r]=t(a[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+=a.l)&&e<=r+a.h&&(e-r)%(a.d||1)===0){if(a.e&&-1!==a.e.indexOf(e-r))continue;return a}}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"),d="ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((function(e){return parseInt(e,16)})),h=[{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=u("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"),b=u("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"),y=u("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,h);if(t)return[e+t.s];var r=p[e];if(r)return r;var n=b[e];return n?[e+n[0]]:y[e]||null}(e);return t||[e]})),r=t.reduce((function(e,t){return t.forEach((function(t){e.push(t)})),e}),[]),(r=(0,i.XL)((0,i.uu)(r),i.Uj.NFKC)).forEach((function(e){if(l(e,m))throw new Error("STRINGPREP_CONTAINS_PROHIBITED")})),r.forEach((function(e){if(l(e,f))throw new Error("STRINGPREP_CONTAINS_UNASSIGNED")}));var n=(0,i.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 u},Uw:function(){return a},U$:function(){return d},uu:function(){return h},Y0:function(){return l},XL:function(){return b},ZN:function(){return p}});var n,a,i=r(2009),o=new(r(2735).Logger)("strings/5.7.0");function s(e,t,r,n,i){if(e===a.BAD_PREFIX||e===a.UNEXPECTED_CONTINUE){for(var o=0,s=t+1;s>6===2;s++)o++;return o}return e===a.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"}(a||(a={}));var u=Object.freeze({error:function(e,t,r,n,a){return o.throwArgumentError("invalid codepoint at offset ".concat(t,"; ").concat(e),"bytes",r)},ignore:s,replace:function(e,t,r,n,i){return e===a.OVERLONG?(n.push(i),0):(n.push(65533),s(e,t,r))}});function c(e,t){null==t&&(t=u.error),e=(0,i.arrayify)(e);for(var r=[],n=0;n>7!==0){var s=null,c=null;if(192===(224&o))s=1,c=127;else if(224===(240&o))s=2,c=2047;else{if(240!==(248&o)){n+=t(128===(192&o)?a.UNEXPECTED_CONTINUE:a.BAD_PREFIX,n-1,e,r);continue}s=3,c=65535}if(n-1+s>=e.length)n+=t(a.OVERRUN,n-1,e,r);else{for(var l=o&(1<<8-s-1)-1,f=0;f1114111?n+=t(a.OUT_OF_RANGE,n-1-s,e,r,l):l>=55296&&l<=57343?n+=t(a.UTF16_SURROGATE,n-1-s,e,r,l):l<=c?n+=t(a.OVERLONG,n-1-s,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=[],a=0;a>6|192),r.push(63&s|128);else if(55296==(64512&s)){a++;var u=e.charCodeAt(a);if(a>=e.length||56320!==(64512&u))throw new Error("invalid utf-8 string");var c=65536+((1023&s)<<10)+(1023&u);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(s>>12|224),r.push(s>>6&63|128),r.push(63&s|128)}return(0,i.arrayify)(r)}function f(e){var t="0000"+e.toString(16);return"\\u"+t.substring(t.length-4)}function d(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 h(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 h(c(e,t))}function b(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 v},parse:function(){return T},recoverAddress:function(){return g},serialize:function(){return _}});var n,a=r(8552),i=r(9560),o=r(2009),s=r(6321),u=r(1291),c=r(4812),l=r(807),f=r(4760),d=r(2735),h=new d.Logger("transactions/5.7.0");function p(e){return"0x"===e?null:(0,a.getAddress)(e)}function b(e){return"0x"===e?s._Y:i.O$.from(e)}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(n||(n={}));var y=[{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"}],m={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,type:!0,value:!0};function v(e){var t=(0,f.computePublicKey)(e);return(0,a.getAddress)((0,o.hexDataSlice)((0,u.keccak256)((0,o.hexDataSlice)(t,1)),12))}function g(e,t){return v((0,f.recoverPublicKey)((0,o.arrayify)(e),t))}function w(e,t){var r=(0,o.stripZeros)(i.O$.from(e).toHexString());return r.length>32&&h.throwArgumentError("invalid length for "+t,"transaction:"+t,e),r}function k(e,t){return{address:(0,a.getAddress)(e),storageKeys:(t||[]).map((function(t,r){return 32!==(0,o.hexDataLength)(t)&&h.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&&h.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=i.O$.from(e.gasPrice),n=i.O$.from(e.maxFeePerGas||0);r.eq(n)||h.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:r,maxFeePerGas:n})}var s=[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,a.getAddress)(e.to):"0x",w(e.value||0,"value"),e.data||"0x",A(e.accessList||[])];if(t){var u=(0,o.splitSignature)(t);s.push(w(u.recoveryParam,"recoveryParam")),s.push((0,o.stripZeros)(u.r)),s.push((0,o.stripZeros)(u.s))}return(0,o.hexConcat)(["0x02",l.encode(s)])}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,a.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&&h.throwArgumentError("untyped transactions do not support accessList; include type: 1","transaction",e),function(e,t){(0,c.checkProperties)(e,m);var r=[];y.forEach((function(t){var n=e[t.name]||[],a={};t.numeric&&(a.hexPad="left"),n=(0,o.arrayify)((0,o.hexlify)(n,a)),t.length&&n.length!==t.length&&n.length>0&&h.throwArgumentError("invalid length for "+t.name,"transaction:"+t.name,n),t.maxLength&&(n=(0,o.stripZeros)(n)).length>t.maxLength&&h.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)&&h.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 a=(0,o.splitSignature)(t),i=27+a.recoveryParam;return 0!==n?(r.pop(),r.pop(),r.pop(),i+=2*n+8,a.v>28&&a.v!==i&&h.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t)):a.v!==i&&h.throwArgumentError("transaction.chainId/signature.v mismatch","signature",t),r.push((0,o.hexlify)(i)),r.push((0,o.stripZeros)((0,o.arrayify)(a.r))),r.push((0,o.stripZeros)((0,o.arrayify)(a.s))),l.encode(r)}(e,t);switch(e.type){case 1:return S(e,t);case 2:return E(e,t)}return h.throwError("unsupported transaction type: ".concat(e.type),d.Logger.errors.UNSUPPORTED_OPERATION,{operation:"serializeTransaction",transactionType:e.type})}function C(e,t,r){try{var n=b(t[0]).toNumber();if(0!==n&&1!==n)throw new Error("bad recid");e.v=n}catch(i){h.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 a=(0,u.keccak256)(r(e));e.from=g(a,{r:e.r,s:e.s,recoveryParam:e.v})}catch(i){}}function T(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&&h.throwArgumentError("invalid raw transaction","rawTransaction",e);var r={nonce:b(t[0]).toNumber(),gasPrice:b(t[1]),gasLimit:b(t[2]),to:p(t[3]),value:b(t[4]),data:t[5],chainId:0};if(6===t.length)return r;try{r.v=i.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),i.O$.from(r.r).isZero()&&i.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,a=t.slice(0,6);0!==r.chainId&&(a.push((0,o.hexlify)(r.chainId)),a.push("0x"),a.push("0x"),n-=2*r.chainId+8);var s=(0,u.keccak256)(l.encode(a));try{r.from=g(s,{r:(0,o.hexlify)(r.r),s:(0,o.hexlify)(r.s),recoveryParam:n})}catch(c){}r.hash=(0,u.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&&h.throwArgumentError("invalid component count for transaction type: 1","payload",(0,o.hexlify)(e));var r={type:1,chainId:b(t[0]).toNumber(),nonce:b(t[1]).toNumber(),gasPrice:b(t[2]),gasLimit:b(t[3]),to:p(t[4]),value:b(t[5]),data:t[6],accessList:x(t[7])};return 8===t.length||(r.hash=(0,u.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&&h.throwArgumentError("invalid component count for transaction type: 2","payload",(0,o.hexlify)(e));var r=b(t[2]),n=b(t[3]),a={type:2,chainId:b(t[0]).toNumber(),nonce:b(t[1]).toNumber(),maxPriorityFeePerGas:r,maxFeePerGas:n,gasPrice:null,gasLimit:b(t[4]),to:p(t[5]),value:b(t[6]),data:t[7],accessList:x(t[8])};return 9===t.length||(a.hash=(0,u.keccak256)(e),C(a,t.slice(9),E)),a}(t)}return h.throwError("unsupported transaction type: ".concat(t[0]),d.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 T},parseUnits:function(){return _}});var n=r(5671),a=r(3144),i=r(2009),o=r(2735),s=r(4227),u=r(9560),c=new o.Logger(s.i),l={},f=u.O$.from(0),d=u.O$.from(-1);function h(e,t,r,n){var a={fault:t,operation:r};return void 0!==n&&(a.value=n),c.throwError(e,o.Logger.errors.NUMERIC_FAULT,a)}for(var p="0";p.length<256;)p+=p;function b(e){if("number"!==typeof e)try{e=u.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 y(e,t){null==t&&(t=0);var r=b(t),n=(e=u.O$.from(e)).lt(f);n&&(e=e.mul(d));for(var a=e.mod(r).toString();a.length2&&c.throwArgumentError("too many decimal points","value",e);var i=a[0],o=a[1];for(i||(i="0"),o||(o="0");"0"===o[o.length-1];)o=o.substring(0,o.length-1);for(o.length>r.length-1&&h("fractional component exceeds decimals","underflow","parseFixed"),""===o&&(o="0");o.length80&&c.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",a),new e(l,r,n,a)}}]),e}(),g=function(){function e(t,r,a,i){(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=i,this._hex=r,this._value=a,this._isFixedNumber=!0,Object.freeze(this)}return(0,a.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=m(this._value,this.format.decimals),n=m(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=m(this._value,this.format.decimals),n=m(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=m(this._value,this.format.decimals),n=m(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=m(this._value,this.format.decimals),n=m(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),a=k.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(a).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=u.O$.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return(0,i.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,u.Zm)(r)||(n=r,r=null),null==r&&(r=0),null==n&&(n="fixed"),e.fromString(y(t,r),v.from(n))}},{key:"fromString",value:function(t,r){null==r&&(r="fixed");var n=v.from(r),a=m(t,n.decimals);!n.signed&&a.lt(f)&&h("unsigned value cannot be negative","overflow","value",t);var o=null;n.signed?o=a.toTwos(n.width).toHexString():(o=a.toHexString(),o=(0,i.hexZeroPad)(o,n.width/8));var s=y(a,n.decimals);return new e(l,o,s,n)}},{key:"fromBytes",value:function(t,r){null==r&&(r="fixed");var n=v.from(r);if((0,i.arrayify)(t).length>n.width/8)throw new Error("overflow");var a=u.O$.from(t);n.signed&&(a=a.fromTwos(n.width));var o=a.toTwos((n.signed?0:1)+n.width).toHexString(),s=y(a,n.decimals);return new e(l,o,s,n)}},{key:"from",value:function(t,r){if("string"===typeof t)return e.fromString(t,r);if((0,i.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=g.from(1),k=g.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 a="";for(2===t.length&&(a="."+(t[1]||"0"));a.length>2&&"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(var i=[];r.length;){if(r.length<=3){i.unshift(r);break}var o=r.length-3;i.unshift(r.substring(o)),r=r.substring(0,o)}return n+i.join(",")+a}function S(e,t){if("string"===typeof t){var r=A.indexOf(t);-1!==r&&(t=3*r)}return y(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 m(e,null!=t?t:18)}function C(e){return S(e,18)}function T(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 T}});var n=r(4165),a=r(5671),i=r(3144),o=r(7326),s=r(136),u=r(9388),c=r(8552),l=r(5157),f=r(2388),d=r(2009),h=r(8836),p=r(6454),b=r(9590),y=r(1291),m=r(4812),v=r(5722),g=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(a,i){function o(e){try{u(n.next(e))}catch(t){i(t)}}function s(e){try{u(n.throw(e))}catch(t){i(t)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}u((n=n.apply(e,t||[])).next())}))},S=new A.Logger("wallet/5.7.0");var _=function(e){(0,s.Z)(r,e);var t=(0,u.Z)(r);function r(e,n){var i,s;if((0,a.Z)(this,r),i=t.call(this),null!=(s=e)&&(0,d.isHexString)(s.privateKey,32)&&null!=s.address){var u=new g.SigningKey(e.privateKey);if((0,m.defineReadOnly)((0,o.Z)(i),"_signingKey",(function(){return u})),(0,m.defineReadOnly)((0,o.Z)(i),"address",(0,x.computeAddress)(i.publicKey)),i.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,m.defineReadOnly)((0,o.Z)(i),"_mnemonic",(function(){return{phrase:f.phrase,path:f.path||b.defaultPath,locale:f.locale||"en"}}));var h=i.mnemonic,p=b.HDNode.fromMnemonic(h.phrase,null,h.locale).derivePath(h.path);(0,x.computeAddress)(p.privateKey)!==i.address&&S.throwArgumentError("mnemonic/address mismatch","privateKey","[REDACTED]")}else(0,m.defineReadOnly)((0,o.Z)(i),"_mnemonic",(function(){return null}))}else{if(g.SigningKey.isSigningKey(e))"secp256k1"!==e.curve&&S.throwArgumentError("unsupported curve; must be secp256k1","privateKey","[REDACTED]"),(0,m.defineReadOnly)((0,o.Z)(i),"_signingKey",(function(){return e}));else{"string"===typeof e&&e.match(/^[0-9a-f]*$/i)&&64===e.length&&(e="0x"+e);var y=new g.SigningKey(e);(0,m.defineReadOnly)((0,o.Z)(i),"_signingKey",(function(){return y}))}(0,m.defineReadOnly)((0,o.Z)(i),"_mnemonic",(function(){return null})),(0,m.defineReadOnly)((0,o.Z)(i),"address",(0,x.computeAddress)(i.publicKey))}return n&&!l.zt.isProvider(n)&&S.throwArgumentError("invalid provider","provider",n),(0,m.defineReadOnly)((0,o.Z)(i),"provider",n||null),i}return(0,i.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,m.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,y.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,d.joinSignature)(this._signingKey().signDigest((0,h.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 a(){var i,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 i=n.sent,n.abrupt("return",(0,d.joinSignature)(this._signingKey().signDigest(p.E.hash(i.domain,t,i.value))));case 4:case"end":return n.stop()}}),a,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,v.O)(16);e||(e={}),e.extraEntropy&&(t=(0,d.arrayify)((0,d.hexDataSlice)((0,y.keccak256)((0,d.concat)([t,e.extraEntropy])),0,16)));var n=(0,b.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=b.defaultPath),new r(b.HDNode.fromMnemonic(e,null,n).derivePath(t))}}]),r}(f.E);function C(e,t){return(0,x.recoverAddress)((0,h.r)(e),t)}function T(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 b},fetchJson:function(){return y},poll:function(){return m}});var n=r(4165),a=r(8853),i=r(2009),o=r(4812),s=r(1953),u=r(2735),c=function(e,t,r,n){return new(r||(r=Promise))((function(a,i){function o(e){try{u(n.next(e))}catch(t){i(t)}}function s(e){try{u(n.throw(e))}catch(t){i(t)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}u((n=n.apply(e,t||[])).next())}))};function l(e,t){return c(this,void 0,void 0,(0,n.Z)().mark((function r(){var a,o,s,u,c;return(0,n.Z)().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return null==t&&(t={}),a={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0},!0!==t.skipFetchSetup&&(a.mode="cors",a.cache="no-cache",a.credentials="same-origin",a.redirect="follow",a.referrer="client"),null!=t.fetchOptions&&((o=t.fetchOptions).mode&&(a.mode=o.mode),o.cache&&(a.cache=o.cache),o.credentials&&(a.credentials=o.credentials),o.redirect&&(a.redirect=o.redirect),o.referrer&&(a.referrer=o.referrer)),r.next=7,fetch(e,a);case 7:return s=r.sent,r.next=10,s.arrayBuffer();case 10:return u=r.sent,c={},s.headers.forEach?s.headers.forEach((function(e,t){c[t.toLowerCase()]=e})):s.headers.keys().forEach((function(e){c[e.toLowerCase()]=s.headers.get(e)})),r.abrupt("return",{headers:c,statusCode:s.status,statusMessage:s.statusText,body:(0,i.arrayify)(new Uint8Array(u))});case 14:case"end":return r.stop()}}),r)})))}var f=function(e,t,r,n){return new(r||(r=Promise))((function(a,i){function o(e){try{u(n.next(e))}catch(t){i(t)}}function s(e){try{u(n.throw(e))}catch(t){i(t)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,s)}u((n=n.apply(e,t||[])).next())}))},d=new u.Logger("web/5.7.1");function h(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,i.isBytesLike)(e)){if(t&&("text"===t.split("/")[0]||"application/json"===t.split(";")[0].trim()))try{return(0,s.ZN)(e)}catch(r){}return(0,i.hexlify)(e)}return e}function b(e,t,r){var i="object"===typeof e&&null!=e.throttleLimit?e.throttleLimit:12;d.assertArgument(i>0&&i%1===0,"invalid connection throttle limit","connection.throttleLimit",i);var c="object"===typeof e?e.throttleCallback:null,b="object"===typeof e&&"number"===typeof e.throttleSlotInterval?e.throttleSlotInterval:100;d.assertArgument(b>0&&b%1===0,"invalid connection throttle slot interval","connection.throttleSlotInterval",b);var y="object"===typeof e&&!!e.errorPassThrough,m={},v=null,g={method:"GET"},w=!1,k=12e4;if("string"===typeof e)v=e;else if("object"===typeof e){if(null!=e&&null!=e.url||d.throwArgumentError("missing URL","connection.url",e),v=e.url,"number"===typeof e.timeout&&e.timeout>0&&(k=e.timeout),e.headers)for(var x in e.headers)m[x.toLowerCase()]={key:x,value:String(e.headers[x])},["if-none-match","if-modified-since"].indexOf(x.toLowerCase())>=0&&(w=!0);if(g.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==v.substring(0,6)&&!0!==e.allowInsecureAuthentication&&d.throwError("basic authentication requires a secure https url",u.Logger.errors.INVALID_ARGUMENT,{argument:"url",url:v,user:e.user,password:"[REDACTED]"});var A=e.user+":"+e.password;m.authorization={key:"Authorization",value:"Basic "+(0,a.c)((0,s.Y0)(A))}}null!=e.skipFetchSetup&&(g.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(g.fetchOptions=(0,o.shallowCopy)(e.fetchOptions))}var E,S=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),_=v?v.match(S):null;if(_)try{var C={statusCode:200,statusMessage:"OK",headers:{"content-type":_[1]||"text/plain"},body:_[2]?(0,a.J)(_[3]):(E=_[3],(0,s.Y0)(E.replace(/%([0-9a-f][0-9a-f])/gi,(function(e,t){return String.fromCharCode(parseInt(t,16))}))))},T=C.body;return r&&(T=r(C.body,C)),Promise.resolve(T)}catch(M){d.throwError("processing response error",u.Logger.errors.SERVER_ERROR,{body:p(_[1],_[2]),error:M,requestBody:null,requestMethod:"GET",url:v})}t&&(g.method="POST",g.body=t,null==m["content-type"]&&(m["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==m["content-length"]&&(m["content-length"]={key:"Content-Length",value:String(t.length)}));var P={};Object.keys(m).forEach((function(e){var t=m[e];P[t.key]=t.value})),g.headers=P;var O=function(){var e=null;return{promise:new Promise((function(t,r){k&&(e=setTimeout((function(){null!=e&&(e=null,r(d.makeError("timeout",u.Logger.errors.TIMEOUT,{requestBody:p(g.body,P["content-type"]),requestMethod:g.method,timeout:k,url:v})))}),k))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),N=function(){return f(this,void 0,void 0,(0,n.Z)().mark((function e(){var t,a,o,s,f,m,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)&&(O.cancel(),d.throwError("bad response",u.Logger.errors.SERVER_ERROR,{status:a.statusCode,headers:a.headers,body:p(k,a.headers?a.headers["content-type"]:null),requestBody:p(g.body,P["content-type"]),requestMethod:g.method,url:v})),!r){e.next=60;break}return e.prev=37,e.next=40,r(k,a);case 40:return x=e.sent,O.cancel(),e.abrupt("return",x);case 45:if(e.prev=45,e.t1=e.catch(37),!(e.t1.throttleRetry&&ts)return void(o()&&n(new Error("retry limit reached")));var c=t.interval*parseInt(String(Math.random()*Math.pow(2,u)));ct.ceiling&&(c=t.ceiling),setTimeout(a,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,a=void 0!==n&&n,i=e.timeout,o=void 0===i?3e3:i;!function(){if("boolean"!==typeof r)throw new Error("@metamask/detect-provider: Expected option 'mustBeMetaMask' to be a boolean.");if("boolean"!==typeof a)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 s=!1;return new Promise((function(e){function t(){if(!s){s=!0,window.removeEventListener("ethereum#initialized",t);var n=window.ethereum;if(!n||r&&!n.isMetaMask){var i=r&&n?"Non-MetaMask window.ethereum detected.":"Unable to detect window.ethereum.";!a&&console.error("@metamask/detect-provider:",i),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=s(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,i=s(e),o=i[0],u=i[1],c=new a(function(e,t,r){return 3*(t+r)/4-r}(0,o,u)),l=0,f=u>0?o-4:o;for(r=0;r>16&255,c[l++]=t>>8&255,c[l++]=255&t;2===u&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[l++]=255&t);1===u&&(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,a=n%3,i=[],o=16383,s=0,c=n-a;sc?c:s+o));1===a?(t=e[n-1],i.push(r[t>>2]+r[t<<4&63]+"==")):2===a&&(t=(e[n-2]<<8)+e[n-1],i.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return i.join("")};for(var r=[],n=[],a="undefined"!==typeof Uint8Array?Uint8Array:Array,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)r[o]=i[o],n[i.charCodeAt(o)]=o;function s(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 u(e,t,n){for(var a,i,o=[],s=t;s>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);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 a=t.charAt(n);if(void 0!==r[a])throw new TypeError(a+" is ambiguous");r[a]=n}function i(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=i(t)^n>>5}for(t=i(t),r=0;rt)return"Exceeds length limit";var n=e.toLowerCase(),a=e.toUpperCase();if(e!==n&&e!==a)return"Mixed-case string "+e;var s=(e=n).lastIndexOf("1");if(-1===s)return"No separator character for "+e;if(0===s)return"Missing prefix for "+e;var u=e.slice(0,s),c=e.slice(s+1);if(c.length<6)return"Data too short";var l=o(u);if("string"===typeof l)return l;for(var f=[],d=0;d=c.length||f.push(p)}return 1!==l?"Invalid checksum for "+e:{prefix:u,words:f}}function u(e,t,r,n){for(var a=0,i=0,o=(1<=r;)i-=r,s.push(a>>i&o);if(n)i>0&&s.push(a<=t)return"Excess padding";if(a<n)throw new TypeError("Exceeds length limit");var a=o(e=e.toLowerCase());if("string"===typeof a)throw new Error(a);for(var s=e+"1",u=0;u>5!==0)throw new Error("Non 5-bit word");a=i(a)^c,s+=t.charAt(c)}for(u=0;u<6;++u)a=i(a);for(a^=1,u=0;u<6;++u){s+=t.charAt(a>>5*(5-u)&31)}return s},toWordsUnsafe:function(e){var t=u(e,8,5,!0);if(Array.isArray(t))return t},toWords:function(e){var t=u(e,8,5,!0);if(Array.isArray(t))return t;throw new Error(t)},fromWordsUnsafe:function(e){var t=u(e,5,8,!1);if(Array.isArray(t))return t},fromWords:function(e){var t=u(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 a(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function i(e,t,r){if(i.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=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!==typeof window&&"undefined"!==typeof window.Buffer?window.Buffer:r(6601).Buffer}catch(T){}function s(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 u(e,t,r){var n=s(e,r);return r-1>=t&&(n|=s(e,r-1)<<4),n}function c(e,t,r,a){for(var i=0,o=0,s=Math.min(e.length,r),u=t;u=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&o0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.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 a=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(a++,this.negative=1),a=0;a-=3)o=e[a]|e[a-1]<<8|e[a-2]<<16,this.words[i]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);else if("le"===r)for(a=0,i=0;a>>26-s&67108863,(s+=24)>=26&&(s-=26,i++);return this._strip()},i.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)a=u(e,t,n)<=18?(i-=18,o+=1,this.words[o]|=a>>>26):i+=8;else for(n=(e.length-t)%2===0?t+1:t;n=18?(i-=18,o+=1,this.words[o]|=a>>>26):i+=8;this._strip()},i.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,a=1;a<=67108863;a*=t)n++;n--,a=a/t|0;for(var i=e.length-r,o=i%n,s=Math.min(i,i-o)+r,u=0,l=r;l1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!==typeof Symbol&&"function"===typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=f}catch(T){i.prototype.inspect=f}else i.prototype.inspect=f;function f(){return(this.red?""}var d=["","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"],h=[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];i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var a=0,i=0,o=0;o>>24-a&16777215,(a+=2)>=26&&(a-=26,o--),r=0!==i||o!==this.length-1?d[6-u.length]+u+r:u+r}for(0!==i&&(r=i.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=h[e],l=p[e];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var b=f.modrn(l).toString(e);r=(f=f.idivn(l)).isZero()?b+r:d[c-b.length]+b+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")},i.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},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function b(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var a=0|e.words[0],i=0|t.words[0],o=a*i,s=67108863&o,u=o/67108864|0;r.words[0]=s;for(var c=1;c>>26,f=67108863&u,d=Math.min(c,t.length-1),h=Math.max(0,c-e.length+1);h<=d;h++){var p=c-h|0;l+=(o=(a=0|e.words[p])*(i=0|t.words[h])+f)/67108864|0,f=67108863&o}r.words[c]=0|f,u=0|l}return 0!==u?r.words[c]=0|u:r.length--,r._strip()}i.prototype.toArrayLike=function(e,t,r){this._strip();var a=this.byteLength(),i=r||Math.max(1,a);n(a<=i,"byte array longer than desired length"),n(i>0,"Requested array length <= 0");var o=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,i);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,a),o},i.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,a=0,i=0;a>8&255),r>16&255),6===i?(r>24&255),n=0,i=0):(n=o>>>24,i+=2)}if(r=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===i?(r>=0&&(e[r--]=o>>24&255),n=0,i=0):(n=o>>>24,i+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.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},i.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},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;te.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.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)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.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)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.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 a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-r),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"===typeof e&&e>=0);var r=e/26|0,a=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 a=0,i=0;i>>26;for(;0!==a&&i>>26;if(this.length=r.length,0!==a)this.words[this.length]=a,this.length++;else if(r!==this)for(;ie.length?this.clone().iadd(e):e.clone().iadd(this)},i.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,a=this.cmp(e);if(0===a)return this.negative=0,this.length=1,this.words[0]=0,this;a>0?(r=this,n=e):(r=e,n=this);for(var i=0,o=0;o>26,this.words[o]=67108863&t;for(;0!==i&&o>26,this.words[o]=67108863&t;if(0===i&&o>>13,h=0|o[1],p=8191&h,b=h>>>13,y=0|o[2],m=8191&y,v=y>>>13,g=0|o[3],w=8191&g,k=g>>>13,x=0|o[4],A=8191&x,E=x>>>13,S=0|o[5],_=8191&S,C=S>>>13,T=0|o[6],P=8191&T,O=T>>>13,N=0|o[7],M=8191&N,U=N>>>13,I=0|o[8],R=8191&I,L=I>>>13,B=0|o[9],j=8191&B,F=B>>>13,D=0|s[0],Z=8191&D,z=D>>>13,H=0|s[1],q=8191&H,V=H>>>13,G=0|s[2],K=8191&G,W=G>>>13,Q=0|s[3],J=8191&Q,Y=Q>>>13,X=0|s[4],$=8191&X,ee=X>>>13,te=0|s[5],re=8191&te,ne=te>>>13,ae=0|s[6],ie=8191&ae,oe=ae>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,le=0|s[8],fe=8191&le,de=le>>>13,he=0|s[9],pe=8191&he,be=he>>>13;r.negative=e.negative^t.negative,r.length=19;var ye=(c+(n=Math.imul(f,Z))|0)+((8191&(a=(a=Math.imul(f,z))+Math.imul(d,Z)|0))<<13)|0;c=((i=Math.imul(d,z))+(a>>>13)|0)+(ye>>>26)|0,ye&=67108863,n=Math.imul(p,Z),a=(a=Math.imul(p,z))+Math.imul(b,Z)|0,i=Math.imul(b,z);var me=(c+(n=n+Math.imul(f,q)|0)|0)+((8191&(a=(a=a+Math.imul(f,V)|0)+Math.imul(d,q)|0))<<13)|0;c=((i=i+Math.imul(d,V)|0)+(a>>>13)|0)+(me>>>26)|0,me&=67108863,n=Math.imul(m,Z),a=(a=Math.imul(m,z))+Math.imul(v,Z)|0,i=Math.imul(v,z),n=n+Math.imul(p,q)|0,a=(a=a+Math.imul(p,V)|0)+Math.imul(b,q)|0,i=i+Math.imul(b,V)|0;var ve=(c+(n=n+Math.imul(f,K)|0)|0)+((8191&(a=(a=a+Math.imul(f,W)|0)+Math.imul(d,K)|0))<<13)|0;c=((i=i+Math.imul(d,W)|0)+(a>>>13)|0)+(ve>>>26)|0,ve&=67108863,n=Math.imul(w,Z),a=(a=Math.imul(w,z))+Math.imul(k,Z)|0,i=Math.imul(k,z),n=n+Math.imul(m,q)|0,a=(a=a+Math.imul(m,V)|0)+Math.imul(v,q)|0,i=i+Math.imul(v,V)|0,n=n+Math.imul(p,K)|0,a=(a=a+Math.imul(p,W)|0)+Math.imul(b,K)|0,i=i+Math.imul(b,W)|0;var ge=(c+(n=n+Math.imul(f,J)|0)|0)+((8191&(a=(a=a+Math.imul(f,Y)|0)+Math.imul(d,J)|0))<<13)|0;c=((i=i+Math.imul(d,Y)|0)+(a>>>13)|0)+(ge>>>26)|0,ge&=67108863,n=Math.imul(A,Z),a=(a=Math.imul(A,z))+Math.imul(E,Z)|0,i=Math.imul(E,z),n=n+Math.imul(w,q)|0,a=(a=a+Math.imul(w,V)|0)+Math.imul(k,q)|0,i=i+Math.imul(k,V)|0,n=n+Math.imul(m,K)|0,a=(a=a+Math.imul(m,W)|0)+Math.imul(v,K)|0,i=i+Math.imul(v,W)|0,n=n+Math.imul(p,J)|0,a=(a=a+Math.imul(p,Y)|0)+Math.imul(b,J)|0,i=i+Math.imul(b,Y)|0;var we=(c+(n=n+Math.imul(f,$)|0)|0)+((8191&(a=(a=a+Math.imul(f,ee)|0)+Math.imul(d,$)|0))<<13)|0;c=((i=i+Math.imul(d,ee)|0)+(a>>>13)|0)+(we>>>26)|0,we&=67108863,n=Math.imul(_,Z),a=(a=Math.imul(_,z))+Math.imul(C,Z)|0,i=Math.imul(C,z),n=n+Math.imul(A,q)|0,a=(a=a+Math.imul(A,V)|0)+Math.imul(E,q)|0,i=i+Math.imul(E,V)|0,n=n+Math.imul(w,K)|0,a=(a=a+Math.imul(w,W)|0)+Math.imul(k,K)|0,i=i+Math.imul(k,W)|0,n=n+Math.imul(m,J)|0,a=(a=a+Math.imul(m,Y)|0)+Math.imul(v,J)|0,i=i+Math.imul(v,Y)|0,n=n+Math.imul(p,$)|0,a=(a=a+Math.imul(p,ee)|0)+Math.imul(b,$)|0,i=i+Math.imul(b,ee)|0;var ke=(c+(n=n+Math.imul(f,re)|0)|0)+((8191&(a=(a=a+Math.imul(f,ne)|0)+Math.imul(d,re)|0))<<13)|0;c=((i=i+Math.imul(d,ne)|0)+(a>>>13)|0)+(ke>>>26)|0,ke&=67108863,n=Math.imul(P,Z),a=(a=Math.imul(P,z))+Math.imul(O,Z)|0,i=Math.imul(O,z),n=n+Math.imul(_,q)|0,a=(a=a+Math.imul(_,V)|0)+Math.imul(C,q)|0,i=i+Math.imul(C,V)|0,n=n+Math.imul(A,K)|0,a=(a=a+Math.imul(A,W)|0)+Math.imul(E,K)|0,i=i+Math.imul(E,W)|0,n=n+Math.imul(w,J)|0,a=(a=a+Math.imul(w,Y)|0)+Math.imul(k,J)|0,i=i+Math.imul(k,Y)|0,n=n+Math.imul(m,$)|0,a=(a=a+Math.imul(m,ee)|0)+Math.imul(v,$)|0,i=i+Math.imul(v,ee)|0,n=n+Math.imul(p,re)|0,a=(a=a+Math.imul(p,ne)|0)+Math.imul(b,re)|0,i=i+Math.imul(b,ne)|0;var xe=(c+(n=n+Math.imul(f,ie)|0)|0)+((8191&(a=(a=a+Math.imul(f,oe)|0)+Math.imul(d,ie)|0))<<13)|0;c=((i=i+Math.imul(d,oe)|0)+(a>>>13)|0)+(xe>>>26)|0,xe&=67108863,n=Math.imul(M,Z),a=(a=Math.imul(M,z))+Math.imul(U,Z)|0,i=Math.imul(U,z),n=n+Math.imul(P,q)|0,a=(a=a+Math.imul(P,V)|0)+Math.imul(O,q)|0,i=i+Math.imul(O,V)|0,n=n+Math.imul(_,K)|0,a=(a=a+Math.imul(_,W)|0)+Math.imul(C,K)|0,i=i+Math.imul(C,W)|0,n=n+Math.imul(A,J)|0,a=(a=a+Math.imul(A,Y)|0)+Math.imul(E,J)|0,i=i+Math.imul(E,Y)|0,n=n+Math.imul(w,$)|0,a=(a=a+Math.imul(w,ee)|0)+Math.imul(k,$)|0,i=i+Math.imul(k,ee)|0,n=n+Math.imul(m,re)|0,a=(a=a+Math.imul(m,ne)|0)+Math.imul(v,re)|0,i=i+Math.imul(v,ne)|0,n=n+Math.imul(p,ie)|0,a=(a=a+Math.imul(p,oe)|0)+Math.imul(b,ie)|0,i=i+Math.imul(b,oe)|0;var Ae=(c+(n=n+Math.imul(f,ue)|0)|0)+((8191&(a=(a=a+Math.imul(f,ce)|0)+Math.imul(d,ue)|0))<<13)|0;c=((i=i+Math.imul(d,ce)|0)+(a>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,n=Math.imul(R,Z),a=(a=Math.imul(R,z))+Math.imul(L,Z)|0,i=Math.imul(L,z),n=n+Math.imul(M,q)|0,a=(a=a+Math.imul(M,V)|0)+Math.imul(U,q)|0,i=i+Math.imul(U,V)|0,n=n+Math.imul(P,K)|0,a=(a=a+Math.imul(P,W)|0)+Math.imul(O,K)|0,i=i+Math.imul(O,W)|0,n=n+Math.imul(_,J)|0,a=(a=a+Math.imul(_,Y)|0)+Math.imul(C,J)|0,i=i+Math.imul(C,Y)|0,n=n+Math.imul(A,$)|0,a=(a=a+Math.imul(A,ee)|0)+Math.imul(E,$)|0,i=i+Math.imul(E,ee)|0,n=n+Math.imul(w,re)|0,a=(a=a+Math.imul(w,ne)|0)+Math.imul(k,re)|0,i=i+Math.imul(k,ne)|0,n=n+Math.imul(m,ie)|0,a=(a=a+Math.imul(m,oe)|0)+Math.imul(v,ie)|0,i=i+Math.imul(v,oe)|0,n=n+Math.imul(p,ue)|0,a=(a=a+Math.imul(p,ce)|0)+Math.imul(b,ue)|0,i=i+Math.imul(b,ce)|0;var Ee=(c+(n=n+Math.imul(f,fe)|0)|0)+((8191&(a=(a=a+Math.imul(f,de)|0)+Math.imul(d,fe)|0))<<13)|0;c=((i=i+Math.imul(d,de)|0)+(a>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,n=Math.imul(j,Z),a=(a=Math.imul(j,z))+Math.imul(F,Z)|0,i=Math.imul(F,z),n=n+Math.imul(R,q)|0,a=(a=a+Math.imul(R,V)|0)+Math.imul(L,q)|0,i=i+Math.imul(L,V)|0,n=n+Math.imul(M,K)|0,a=(a=a+Math.imul(M,W)|0)+Math.imul(U,K)|0,i=i+Math.imul(U,W)|0,n=n+Math.imul(P,J)|0,a=(a=a+Math.imul(P,Y)|0)+Math.imul(O,J)|0,i=i+Math.imul(O,Y)|0,n=n+Math.imul(_,$)|0,a=(a=a+Math.imul(_,ee)|0)+Math.imul(C,$)|0,i=i+Math.imul(C,ee)|0,n=n+Math.imul(A,re)|0,a=(a=a+Math.imul(A,ne)|0)+Math.imul(E,re)|0,i=i+Math.imul(E,ne)|0,n=n+Math.imul(w,ie)|0,a=(a=a+Math.imul(w,oe)|0)+Math.imul(k,ie)|0,i=i+Math.imul(k,oe)|0,n=n+Math.imul(m,ue)|0,a=(a=a+Math.imul(m,ce)|0)+Math.imul(v,ue)|0,i=i+Math.imul(v,ce)|0,n=n+Math.imul(p,fe)|0,a=(a=a+Math.imul(p,de)|0)+Math.imul(b,fe)|0,i=i+Math.imul(b,de)|0;var Se=(c+(n=n+Math.imul(f,pe)|0)|0)+((8191&(a=(a=a+Math.imul(f,be)|0)+Math.imul(d,pe)|0))<<13)|0;c=((i=i+Math.imul(d,be)|0)+(a>>>13)|0)+(Se>>>26)|0,Se&=67108863,n=Math.imul(j,q),a=(a=Math.imul(j,V))+Math.imul(F,q)|0,i=Math.imul(F,V),n=n+Math.imul(R,K)|0,a=(a=a+Math.imul(R,W)|0)+Math.imul(L,K)|0,i=i+Math.imul(L,W)|0,n=n+Math.imul(M,J)|0,a=(a=a+Math.imul(M,Y)|0)+Math.imul(U,J)|0,i=i+Math.imul(U,Y)|0,n=n+Math.imul(P,$)|0,a=(a=a+Math.imul(P,ee)|0)+Math.imul(O,$)|0,i=i+Math.imul(O,ee)|0,n=n+Math.imul(_,re)|0,a=(a=a+Math.imul(_,ne)|0)+Math.imul(C,re)|0,i=i+Math.imul(C,ne)|0,n=n+Math.imul(A,ie)|0,a=(a=a+Math.imul(A,oe)|0)+Math.imul(E,ie)|0,i=i+Math.imul(E,oe)|0,n=n+Math.imul(w,ue)|0,a=(a=a+Math.imul(w,ce)|0)+Math.imul(k,ue)|0,i=i+Math.imul(k,ce)|0,n=n+Math.imul(m,fe)|0,a=(a=a+Math.imul(m,de)|0)+Math.imul(v,fe)|0,i=i+Math.imul(v,de)|0;var _e=(c+(n=n+Math.imul(p,pe)|0)|0)+((8191&(a=(a=a+Math.imul(p,be)|0)+Math.imul(b,pe)|0))<<13)|0;c=((i=i+Math.imul(b,be)|0)+(a>>>13)|0)+(_e>>>26)|0,_e&=67108863,n=Math.imul(j,K),a=(a=Math.imul(j,W))+Math.imul(F,K)|0,i=Math.imul(F,W),n=n+Math.imul(R,J)|0,a=(a=a+Math.imul(R,Y)|0)+Math.imul(L,J)|0,i=i+Math.imul(L,Y)|0,n=n+Math.imul(M,$)|0,a=(a=a+Math.imul(M,ee)|0)+Math.imul(U,$)|0,i=i+Math.imul(U,ee)|0,n=n+Math.imul(P,re)|0,a=(a=a+Math.imul(P,ne)|0)+Math.imul(O,re)|0,i=i+Math.imul(O,ne)|0,n=n+Math.imul(_,ie)|0,a=(a=a+Math.imul(_,oe)|0)+Math.imul(C,ie)|0,i=i+Math.imul(C,oe)|0,n=n+Math.imul(A,ue)|0,a=(a=a+Math.imul(A,ce)|0)+Math.imul(E,ue)|0,i=i+Math.imul(E,ce)|0,n=n+Math.imul(w,fe)|0,a=(a=a+Math.imul(w,de)|0)+Math.imul(k,fe)|0,i=i+Math.imul(k,de)|0;var Ce=(c+(n=n+Math.imul(m,pe)|0)|0)+((8191&(a=(a=a+Math.imul(m,be)|0)+Math.imul(v,pe)|0))<<13)|0;c=((i=i+Math.imul(v,be)|0)+(a>>>13)|0)+(Ce>>>26)|0,Ce&=67108863,n=Math.imul(j,J),a=(a=Math.imul(j,Y))+Math.imul(F,J)|0,i=Math.imul(F,Y),n=n+Math.imul(R,$)|0,a=(a=a+Math.imul(R,ee)|0)+Math.imul(L,$)|0,i=i+Math.imul(L,ee)|0,n=n+Math.imul(M,re)|0,a=(a=a+Math.imul(M,ne)|0)+Math.imul(U,re)|0,i=i+Math.imul(U,ne)|0,n=n+Math.imul(P,ie)|0,a=(a=a+Math.imul(P,oe)|0)+Math.imul(O,ie)|0,i=i+Math.imul(O,oe)|0,n=n+Math.imul(_,ue)|0,a=(a=a+Math.imul(_,ce)|0)+Math.imul(C,ue)|0,i=i+Math.imul(C,ce)|0,n=n+Math.imul(A,fe)|0,a=(a=a+Math.imul(A,de)|0)+Math.imul(E,fe)|0,i=i+Math.imul(E,de)|0;var Te=(c+(n=n+Math.imul(w,pe)|0)|0)+((8191&(a=(a=a+Math.imul(w,be)|0)+Math.imul(k,pe)|0))<<13)|0;c=((i=i+Math.imul(k,be)|0)+(a>>>13)|0)+(Te>>>26)|0,Te&=67108863,n=Math.imul(j,$),a=(a=Math.imul(j,ee))+Math.imul(F,$)|0,i=Math.imul(F,ee),n=n+Math.imul(R,re)|0,a=(a=a+Math.imul(R,ne)|0)+Math.imul(L,re)|0,i=i+Math.imul(L,ne)|0,n=n+Math.imul(M,ie)|0,a=(a=a+Math.imul(M,oe)|0)+Math.imul(U,ie)|0,i=i+Math.imul(U,oe)|0,n=n+Math.imul(P,ue)|0,a=(a=a+Math.imul(P,ce)|0)+Math.imul(O,ue)|0,i=i+Math.imul(O,ce)|0,n=n+Math.imul(_,fe)|0,a=(a=a+Math.imul(_,de)|0)+Math.imul(C,fe)|0,i=i+Math.imul(C,de)|0;var Pe=(c+(n=n+Math.imul(A,pe)|0)|0)+((8191&(a=(a=a+Math.imul(A,be)|0)+Math.imul(E,pe)|0))<<13)|0;c=((i=i+Math.imul(E,be)|0)+(a>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,n=Math.imul(j,re),a=(a=Math.imul(j,ne))+Math.imul(F,re)|0,i=Math.imul(F,ne),n=n+Math.imul(R,ie)|0,a=(a=a+Math.imul(R,oe)|0)+Math.imul(L,ie)|0,i=i+Math.imul(L,oe)|0,n=n+Math.imul(M,ue)|0,a=(a=a+Math.imul(M,ce)|0)+Math.imul(U,ue)|0,i=i+Math.imul(U,ce)|0,n=n+Math.imul(P,fe)|0,a=(a=a+Math.imul(P,de)|0)+Math.imul(O,fe)|0,i=i+Math.imul(O,de)|0;var Oe=(c+(n=n+Math.imul(_,pe)|0)|0)+((8191&(a=(a=a+Math.imul(_,be)|0)+Math.imul(C,pe)|0))<<13)|0;c=((i=i+Math.imul(C,be)|0)+(a>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,n=Math.imul(j,ie),a=(a=Math.imul(j,oe))+Math.imul(F,ie)|0,i=Math.imul(F,oe),n=n+Math.imul(R,ue)|0,a=(a=a+Math.imul(R,ce)|0)+Math.imul(L,ue)|0,i=i+Math.imul(L,ce)|0,n=n+Math.imul(M,fe)|0,a=(a=a+Math.imul(M,de)|0)+Math.imul(U,fe)|0,i=i+Math.imul(U,de)|0;var Ne=(c+(n=n+Math.imul(P,pe)|0)|0)+((8191&(a=(a=a+Math.imul(P,be)|0)+Math.imul(O,pe)|0))<<13)|0;c=((i=i+Math.imul(O,be)|0)+(a>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,n=Math.imul(j,ue),a=(a=Math.imul(j,ce))+Math.imul(F,ue)|0,i=Math.imul(F,ce),n=n+Math.imul(R,fe)|0,a=(a=a+Math.imul(R,de)|0)+Math.imul(L,fe)|0,i=i+Math.imul(L,de)|0;var Me=(c+(n=n+Math.imul(M,pe)|0)|0)+((8191&(a=(a=a+Math.imul(M,be)|0)+Math.imul(U,pe)|0))<<13)|0;c=((i=i+Math.imul(U,be)|0)+(a>>>13)|0)+(Me>>>26)|0,Me&=67108863,n=Math.imul(j,fe),a=(a=Math.imul(j,de))+Math.imul(F,fe)|0,i=Math.imul(F,de);var Ue=(c+(n=n+Math.imul(R,pe)|0)|0)+((8191&(a=(a=a+Math.imul(R,be)|0)+Math.imul(L,pe)|0))<<13)|0;c=((i=i+Math.imul(L,be)|0)+(a>>>13)|0)+(Ue>>>26)|0,Ue&=67108863;var Ie=(c+(n=Math.imul(j,pe))|0)+((8191&(a=(a=Math.imul(j,be))+Math.imul(F,pe)|0))<<13)|0;return c=((i=Math.imul(F,be))+(a>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,u[0]=ye,u[1]=me,u[2]=ve,u[3]=ge,u[4]=we,u[5]=ke,u[6]=xe,u[7]=Ae,u[8]=Ee,u[9]=Se,u[10]=_e,u[11]=Ce,u[12]=Te,u[13]=Pe,u[14]=Oe,u[15]=Ne,u[16]=Me,u[17]=Ue,u[18]=Ie,0!==c&&(u[19]=c,r.length++),r};function m(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,a=0,i=0;i>>26)|0)>>>26,o&=67108863}r.words[i]=s,n=o,o=a}return 0!==n?r.words[i]=n:r.length--,r._strip()}function v(e,t,r){return m(e,t,r)}function g(e,t){this.x=e,this.y=t}Math.imul||(y=b),i.prototype.mulTo=function(e,t){var r=this.length+e.length;return 10===this.length&&10===e.length?y(this,e,t):r<63?b(this,e,t):r<1024?m(this,e,t):v(this,e,t)},g.prototype.makeRBT=function(e){for(var t=new Array(e),r=i.prototype._countBits(e)-1,n=0;n>=1;return n},g.prototype.permute=function(e,t,r,n,a,i){for(var o=0;o>>=1)a++;return 1<>>=13,r[2*o+1]=8191&i,i>>>=13;for(o=2*t;o>=26,r+=i/67108864|0,r+=o>>>26,this.words[a]=67108863&o}return 0!==r&&(this.words[a]=r,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),r=0;r>>a&1}return t}(e);if(0===t.length)return new i(1);for(var r=this,n=0;n=0);var t,r=e%26,a=(e-r)/26,i=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!==a){for(t=this.length-1;t>=0;t--)this.words[t+a]=this.words[t];for(t=0;t=0),a=t?(t-t%26)/26:0;var i=e%26,o=Math.min((e-i)/26,this.length),s=67108863^67108863>>>i<o)for(this.length-=o,c=0;c=0&&(0!==l||c>=a);c--){var f=0|this.words[c];this.words[c]=l<<26-i|f>>>i,l=f&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"===typeof e&&e>=0);var t=e%26,r=(e-t)/26,a=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 a=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},i.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)-(u/67108864|0),this.words[a+r]=67108863&i}for(;a>26,this.words[a+r]=67108863&i;if(0===s)return this._strip();for(n(-1===s),s=0,a=0;a>26,this.words[a]=67108863&i;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var r=(this.length,e.length),n=this.clone(),a=e,o=0|a.words[a.length-1];0!==(r=26-this._countBits(o))&&(a=a.ushln(r),n.iushln(r),o=0|a.words[a.length-1]);var s,u=n.length-a.length;if("mod"!==t){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c=0;f--){var d=67108864*(0|n.words[a.length+f])+(0|n.words[a.length+f-1]);for(d=Math.min(d/o|0,67108863),n._ishlnsubmul(a,d,f);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(a,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=d)}return s&&s._strip(),n._strip(),"div"!==t&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(a=s.div.neg()),"div"!==t&&(o=s.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:a,mod:o}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(a=s.div.neg()),{div:a,mod:s.mod}):0!==(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(o=s.mod.neg(),r&&0!==o.negative&&o.isub(e)),{div:s.div,mod:o}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var a,o,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.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),a=e.andln(1),i=r.cmp(n);return i<0||1===a&&0===i?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,a=0,i=this.length-1;i>=0;i--)a=(r*a+(0|this.words[i]))%e;return t?-a:a},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,a=this.length-1;a>=0;a--){var i=(0|this.words[a])+67108864*r;this.words[a]=i/e|0,r=i%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.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 a=new i(1),o=new i(0),s=new i(0),u=new i(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 d=0,h=1;0===(t.words[0]&h)&&d<26;++d,h<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(a.isOdd()||o.isOdd())&&(a.iadd(l),o.isub(f)),a.iushrn(1),o.iushrn(1);for(var p=0,b=1;0===(r.words[0]&b)&&p<26;++p,b<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(f)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s),o.isub(u)):(r.isub(t),s.isub(a),u.isub(o))}return{a:s,b:u,gcd:r.iushln(c)}},i.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 a,o=new i(1),s=new i(0),u=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(u),o.iushrn(1);for(var f=0,d=1;0===(r.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(r.iushrn(f);f-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s)):(r.isub(t),s.isub(o))}return(a=0===t.cmpn(1)?o:s).cmpn(0)<0&&a.iadd(e),a},i.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 a=t.cmp(r);if(a<0){var i=t;t=r,r=i}else if(0===a||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0===(1&this.words[0])},i.prototype.isOdd=function(){return 1===(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"===typeof e);var t=e%26,r=(e-t)/26,a=1<>>26,s&=67108863,this.words[o]=s}return 0!==i&&(this.words[o]=i,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.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 a=0|this.words[0];t=a===e?0:ae.length)return 1;if(this.length=0;r--){var n=0|this.words[r],a=0|e.words[r];if(n!==a){na&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new _(e)},i.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)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.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 i(t,16),this.n=this.p.bitLength(),this.k=new i(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=i._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 i(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 i(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)},a(x,k),x.prototype.split=function(e,t){for(var r=4194303,n=Math.min(e.length,9),a=0;a>>22,i=o}i>>>=22,e.words[a-10]=i,0===i&&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]=a,t=n}return 0!==t&&(e.words[e.length++]=t),e},i._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 i(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),o=0;!a.isZero()&&0===a.andln(1);)o++,a.iushrn(1);n(!a.isZero());var s=new i(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var f=this.pow(l,a),d=this.pow(e,a.addn(1).iushrn(1)),h=this.pow(e,a),p=o;0!==h.cmp(s);){for(var b=h,y=0;0!==b.cmp(s);y++)b=b.redSqr();n(y=0;n--){for(var c=t.words[n],l=u-1;l>=0;l--){var f=c>>l&1;a!==r[0]&&(a=this.sqr(a)),0!==f||0!==o?(o<<=1,o|=f,(4===++s||0===n&&0===l)&&(a=this.mul(a,r[o]),s=0,o=0)):s=0}u=26}return a},_.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},i.mont=function(e){return new C(e)},a(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),a=r.isub(n).iushrn(this.shift),i=a;return a.cmp(this.m)>=0?i=a.isub(this.m):a.cmpn(0)<0&&(i=a.iadd(this.m)),i._forceRed(this)},C.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.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,a=r(9728).default,i=r(6115).default,o=r(1655).default,s=r(6389).default,u=r(2470),c=r(545),l="function"===typeof Symbol&&"function"===typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.lW=h,t.h2=50;var f=2147483647;function d(e){if(e>f)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,h.prototype),t}function h(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 y(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(!h.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var r=0|w(e,t),n=d(r),a=n.write(e,t);a!==r&&(n=n.slice(0,a));return n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(ee(e,Uint8Array)){var t=new Uint8Array(e);return v(t.buffer,t.byteOffset,t.byteLength)}return m(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 v(e,t,r);if("undefined"!==typeof SharedArrayBuffer&&(ee(e,SharedArrayBuffer)||e&&ee(e.buffer,SharedArrayBuffer)))return v(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 h.from(n,t,r);var a=function(e){if(h.isBuffer(e)){var t=0|g(e.length),r=d(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)?d(0):m(e);if("Buffer"===e.type&&Array.isArray(e.data))return m(e.data)}(e);if(a)return a;if("undefined"!==typeof Symbol&&null!=Symbol.toPrimitive&&"function"===typeof e[Symbol.toPrimitive])return h.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 b(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 y(e){return b(e),d(e<0?0:0|g(e))}function m(e){for(var t=e.length<0?0:0|g(e.length),r=d(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(h.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 a=!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(a)return n?-1:Y(e).length;t=(""+t).toLowerCase(),a=!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 R(this,t,r);case"utf8":case"utf-8":return N(this,t,r);case"ascii":return U(this,t,r);case"latin1":case"binary":return I(this,t,r);case"base64":return O(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(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,a){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=a?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(a)return-1;r=e.length-1}else if(r<0){if(!a)return-1;r=0}if("string"===typeof t&&(t=h.from(t,n)),h.isBuffer(t))return 0===t.length?-1:E(e,t,r,n,a);if("number"===typeof t)return t&=255,"function"===typeof Uint8Array.prototype.indexOf?a?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):E(e,[t],r,n,a);throw new TypeError("val must be string, number or Buffer")}function E(e,t,r,n,a){var i,o=1,s=e.length,u=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,s/=2,u/=2,r/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(a){var l=-1;for(i=r;is&&(r=s-u),i=r;i>=0;i--){for(var f=!0,d=0;da&&(n=a):n=a;var i,o=t.length;for(n>o/2&&(n=o/2),i=0;i>8,a=r%256,i.push(a),i.push(n);return i}(t,e.length-r),e,r,n)}function O(e,t,r){return 0===t&&r===e.length?u.fromByteArray(e):u.fromByteArray(e.slice(t,r))}function N(e,t,r){r=Math.min(e.length,r);for(var n=[],a=t;a239?4:i>223?3:i>191?2:1;if(a+s<=r){var u=void 0,c=void 0,l=void 0,f=void 0;switch(s){case 1:i<128&&(o=i);break;case 2:128===(192&(u=e[a+1]))&&(f=(31&i)<<6|63&u)>127&&(o=f);break;case 3:u=e[a+1],c=e[a+2],128===(192&u)&&128===(192&c)&&(f=(15&i)<<12|(63&u)<<6|63&c)>2047&&(f<55296||f>57343)&&(o=f);break;case 4:u=e[a+1],c=e[a+2],l=e[a+3],128===(192&u)&&128===(192&c)&&128===(192&l)&&(f=(15&i)<<18|(63&u)<<12|(63&c)<<6|63&l)>65535&&f<1114112&&(o=f)}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),a+=s}return function(e){var t=e.length;if(t<=M)return String.fromCharCode.apply(String,e);var r="",n=0;for(;nn.length?(h.isBuffer(i)||(i=h.from(i)),i.copy(n,a)):Uint8Array.prototype.set.call(n,i,a);else{if(!h.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(n,a)}a+=i.length}return n},h.byteLength=w,h.prototype._isBuffer=!0,h.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&&(h.prototype[l]=h.prototype.inspect),h.prototype.compare=function(e,t,r,n,a){if(ee(e,Uint8Array)&&(e=h.from(e,e.offset,e.byteLength)),!h.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===a&&(a=this.length),t<0||r>e.length||n<0||a>this.length)throw new RangeError("out of range index");if(n>=a&&t>=r)return 0;if(n>=a)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(a>>>=0)-(n>>>=0),o=(r>>>=0)-(t>>>=0),s=Math.min(i,o),u=this.slice(n,a),c=e.slice(t,r),l=0;l>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var a=this.length-t;if((void 0===r||r>a)&&(r=a),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!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 T(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},h.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 a=t;an)&&(r=n);for(var a="",i=t;ir)throw new RangeError("Trying to access beyond buffer length")}function j(e,t,r,n,a,i){if(!h.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>a||te.length)throw new RangeError("Index out of range")}function F(e,t,r,n,a){K(t,n,a,e,r,7);var i=Number(t&BigInt(4294967295));e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i,i>>=8,e[r++]=i;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,a){K(t,n,a,e,r,7);var i=Number(t&BigInt(4294967295));e[r+7]=i,i>>=8,e[r+6]=i,i>>=8,e[r+5]=i,i>>=8,e[r+4]=i;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,a,i){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,a){return t=+t,r>>>=0,a||Z(e,0,r,4),c.write(e,t,r,n,23,4),r+4}function H(e,t,r,n,a){return t=+t,r>>>=0,a||Z(e,0,r,8),c.write(e,t,r,n,52,8),r+8}h.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||B(e,t,this.length);for(var n=this[e],a=1,i=0;++i>>=0,t>>>=0,r||B(e,t,this.length);for(var n=this[e+--t],a=1;t>0&&(a*=256);)n+=this[e+--t]*a;return n},h.prototype.readUint8=h.prototype.readUInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),this[e]},h.prototype.readUint16LE=h.prototype.readUInt16LE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]|this[e+1]<<8},h.prototype.readUint16BE=h.prototype.readUInt16BE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]<<8|this[e+1]},h.prototype.readUint32LE=h.prototype.readUInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},h.prototype.readUint32BE=h.prototype.readUInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},h.prototype.readBigUInt64LE=ne((function(e){W(e>>>=0,"offset");var t=this[e],r=this[e+7];void 0!==t&&void 0!==r||Q(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),a=this[++e]+this[++e]*Math.pow(2,8)+this[++e]*Math.pow(2,16)+r*Math.pow(2,24);return BigInt(n)+(BigInt(a)<>>=0,"offset");var t=this[e],r=this[e+7];void 0!==t&&void 0!==r||Q(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],a=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||B(e,t,this.length);for(var n=this[e],a=1,i=0;++i=(a*=128)&&(n-=Math.pow(2,8*t)),n},h.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);for(var n=t,a=1,i=this[e+--n];n>0&&(a*=256);)i+=this[e+--n]*a;return i>=(a*=128)&&(i-=Math.pow(2,8*t)),i},h.prototype.readInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},h.prototype.readInt16LE=function(e,t){e>>>=0,t||B(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt16BE=function(e,t){e>>>=0,t||B(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},h.prototype.readInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},h.prototype.readInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},h.prototype.readBigInt64LE=ne((function(e){W(e>>>=0,"offset");var t=this[e],r=this[e+7];void 0!==t&&void 0!==r||Q(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||Q(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||B(e,4,this.length),c.read(this,e,!0,23,4)},h.prototype.readFloatBE=function(e,t){return e>>>=0,t||B(e,4,this.length),c.read(this,e,!1,23,4)},h.prototype.readDoubleLE=function(e,t){return e>>>=0,t||B(e,8,this.length),c.read(this,e,!0,52,8)},h.prototype.readDoubleBE=function(e,t){return e>>>=0,t||B(e,8,this.length),c.read(this,e,!1,52,8)},h.prototype.writeUintLE=h.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 a=1,i=0;for(this[t]=255&e;++i>>=0,r>>>=0,n)||j(this,e,t,r,Math.pow(2,8*r)-1,0);var a=r-1,i=1;for(this[t+a]=255&e;--a>=0&&(i*=256);)this[t+a]=e/i&255;return t+r},h.prototype.writeUint8=h.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},h.prototype.writeUint16LE=h.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},h.prototype.writeUint16BE=h.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},h.prototype.writeUint32LE=h.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},h.prototype.writeUint32BE=h.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},h.prototype.writeBigUInt64LE=ne((function(e){return F(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),h.prototype.writeBigUInt64BE=ne((function(e){return D(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),h.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var a=Math.pow(2,8*r-1);j(this,e,t,r,a-1,-a)}var i=0,o=1,s=0;for(this[t]=255&e;++i>0)-s&255;return t+r},h.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){var a=Math.pow(2,8*r-1);j(this,e,t,r,a-1,-a)}var i=r-1,o=1,s=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/o>>0)-s&255;return t+r},h.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},h.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},h.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},h.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},h.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},h.prototype.writeBigInt64LE=ne((function(e){return F(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),h.prototype.writeBigInt64BE=ne((function(e){return D(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),h.prototype.writeFloatLE=function(e,t,r){return z(this,e,t,!0,r)},h.prototype.writeFloatBE=function(e,t,r){return z(this,e,t,!1,r)},h.prototype.writeDoubleLE=function(e,t,r){return H(this,e,t,!0,r)},h.prototype.writeDoubleBE=function(e,t,r){return H(this,e,t,!1,r)},h.prototype.copy=function(e,t,r,n){if(!h.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(i=t;i=n+4;r-=3)t="_".concat(e.slice(r-3,r)).concat(t);return"".concat(e.slice(0,r)).concat(t)}function K(e,t,r,n,a,i){if(e>r||e3?0===t||t===BigInt(0)?">= 0".concat(s," and < 2").concat(s," ** ").concat(8*(i+1)).concat(s):">= -(2".concat(s," ** ").concat(8*(i+1)-1).concat(s,") and < 2 ** ")+"".concat(8*(i+1)-1).concat(s):">= ".concat(t).concat(s," and <= ").concat(r).concat(s),new q.ERR_OUT_OF_RANGE("value",o,e)}!function(e,t,r){W(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||Q(t,e.length-(r+1))}(n,a,i)}function W(e,t){if("number"!==typeof e)throw new q.ERR_INVALID_ARG_TYPE(t,"number",e)}function Q(e,t,r){if(Math.floor(e)!==e)throw W(e,r),new q.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new q.ERR_BUFFER_OUT_OF_BOUNDS;throw new q.ERR_OUT_OF_RANGE(r||"offset",">= ".concat(r?1:0," and <= ").concat(t),e)}V("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?"".concat(e," is outside of buffer bounds"):"Attempt to access memory outside buffer bounds"}),RangeError),V("ERR_INVALID_ARG_TYPE",(function(e,t){return'The "'.concat(e,'" argument must be of type number. Received type ').concat(typeof t)}),TypeError),V("ERR_OUT_OF_RANGE",(function(e,t,r){var n='The value of "'.concat(e,'" is out of range.'),a=r;return Number.isInteger(r)&&Math.abs(r)>Math.pow(2,32)?a=G(String(r)):"bigint"===typeof r&&(a=String(r),(r>Math.pow(BigInt(2),BigInt(32))||r<-Math.pow(BigInt(2),BigInt(32)))&&(a=G(a)),a+="n"),n+=" It must be ".concat(t,". Received ").concat(a)}),RangeError);var J=/[^+/0-9A-Za-z-_]/g;function Y(e,t){var r;t=t||1/0;for(var n=e.length,a=null,i=[],o=0;o55295&&r<57344){if(!a){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(o+1===n){(t-=3)>-1&&i.push(239,191,189);continue}a=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),a=r;continue}r=65536+(a-55296<<10|r-56320)}else a&&(t-=3)>-1&&i.push(239,191,189);if(a=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.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;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function X(e){return u.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(J,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function $(e,t,r,n){var a;for(a=0;a=t.length||a>=e.length);++a)t[a+r]=e[a];return a}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,a=0;a<16;++a)t[n+a]=e[r]+e[a];return t}();function ne(e){return"undefined"===typeof BigInt?ae:e}function ae(){throw new Error("BigInt not supported")}},7438:function(e){var t=function(){"use strict";function e(t,n,a,i){"object"===typeof n&&(a=n.depth,i=n.prototype,n.filter,n=n.circular);var o=[],s=[],u="undefined"!=typeof Buffer;return"undefined"==typeof n&&(n=!0),"undefined"==typeof a&&(a=1/0),function t(a,c){if(null===a)return null;if(0==c)return a;var l,f;if("object"!=typeof a)return a;if(e.__isArray(a))l=[];else if(e.__isRegExp(a))l=new RegExp(a.source,r(a)),a.lastIndex&&(l.lastIndex=a.lastIndex);else if(e.__isDate(a))l=new Date(a.getTime());else{if(u&&Buffer.isBuffer(a))return l=Buffer.allocUnsafe?Buffer.allocUnsafe(a.length):new Buffer(a.length),a.copy(l),l;"undefined"==typeof i?(f=Object.getPrototypeOf(a),l=Object.create(f)):(l=Object.create(i),f=i)}if(n){var d=o.indexOf(a);if(-1!=d)return s[d];o.push(a),s.push(l)}for(var h in a){var p;f&&(p=Object.getOwnPropertyDescriptor(f,h)),p&&null==p.set||(l[h]=t(a[h],c-1))}return l}(t,a)}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 a(e){if(e){var t=[0,0,0],r=1,a=e.match(/^#([a-fA-F0-9]{3})$/);if(a){a=a[1];for(var i=0;ir?(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,a=void 0===t?.5:t,i=2*a-1,o=r.alpha()-n.alpha(),s=((i*o===-1?i:(i+o)/(1+i*o))+1)/2,u=1-s;return this.rgb(s*r.red()+u*n.red(),s*r.green()+u*n.green(),s*r.blue()+u*n.blue()).alpha(r.alpha()*a+n.alpha()*(1-a))},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&&(a-=1)),[360*a,100*i,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,a=e[2]/255;return[100*((1-r-(t=Math.min(1-r,1-n,1-a)))/(1-t)||0),100*((1-n-t)/(1-t)||0),100*((1-a-t)/(1-t)||0),100*t]},o.rgb.keyword=function(e){var t=a[e];if(t)return t;var r,i,o,s=1/0;for(var u in n)if(n.hasOwnProperty(u)){var c=n[u],l=(i=e,o=c,Math.pow(i[0]-o[0],2)+Math.pow(i[1]-o[1],2)+Math.pow(i[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],a=t[2];return n/=100,a/=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-(a=a>.008856?Math.pow(a,1/3):7.787*a+16/116))]},o.hsl.rgb=function(e){var t,r,n,a,i,o=e[0]/360,s=e[1]/100,u=e[2]/100;if(0===s)return[i=255*u,i,i];t=2*u-(r=u<.5?u*(1+s):u+s-u*s),a=[0,0,0];for(var c=0;c<3;c++)(n=o+1/3*-(c-1))<0&&n++,n>1&&n--,i=6*n<1?t+6*(r-t)*n:2*n<1?r:3*n<2?t+(r-t)*(2/3-n)*6:t,a[c]=255*i;return a},o.hsl.hsv=function(e){var t=e[0],r=e[1]/100,n=e[2]/100,a=r,i=Math.max(n,.01);return r*=(n*=2)<=1?n:2-n,a*=i<=1?i:2-i,[t,100*(0===n?2*a/(i+a):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,a=Math.floor(t)%6,i=t-Math.floor(t),o=255*n*(1-r),s=255*n*(1-r*i),u=255*n*(1-r*(1-i));switch(n*=255,a){case 0:return[n,u,o];case 1:return[s,n,o];case 2:return[o,n,u];case 3:return[o,s,n];case 4:return[u,o,n];case 5:return[n,o,s]}},o.hsv.hsl=function(e){var t,r,n,a=e[0],i=e[1]/100,o=e[2]/100,s=Math.max(o,.01);return n=(2-i)*o,r=i*s,[a,100*(r=(r/=(t=(2-i)*s)<=1?t:2-t)||0),100*(n/=2)]},o.hwb.rgb=function(e){var t,r,n,a,i,o,s,u=e[0]/360,c=e[1]/100,l=e[2]/100,f=c+l;switch(f>1&&(c/=f,l/=f),n=6*u-(t=Math.floor(6*u)),0!==(1&t)&&(n=1-n),a=c+n*((r=1-l)-c),t){default:case 6:case 0:i=r,o=a,s=c;break;case 1:i=a,o=r,s=c;break;case 2:i=c,o=r,s=a;break;case 3:i=c,o=a,s=r;break;case 4:i=a,o=c,s=r;break;case 5:i=r,o=c,s=a}return[255*i,255*o,255*s]},o.cmyk.rgb=function(e){var t=e[0]/100,r=e[1]/100,n=e[2]/100,a=e[3]/100;return[255*(1-Math.min(1,t*(1-a)+a)),255*(1-Math.min(1,r*(1-a)+a)),255*(1-Math.min(1,n*(1-a)+a))]},o.xyz.rgb=function(e){var t,r,n,a=e[0]/100,i=e[1]/100,o=e[2]/100;return r=-.9689*a+1.8758*i+.0415*o,n=.0557*a+-.204*i+1.057*o,t=(t=3.2406*a+-1.5372*i+-.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,a=e[0];t=e[1]/500+(r=(a+16)/116),n=r-e[2]/200;var i=Math.pow(r,3),o=Math.pow(t,3),s=Math.pow(n,3);return r=i>.008856?i:(r-16/116)/7.787,t=o>.008856?o:(t-16/116)/7.787,n=s>.008856?s:(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],a=e[2];return(t=360*Math.atan2(a,n)/2/Math.PI)<0&&(t+=360),[r,Math.sqrt(n*n+a*a),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],a=1 in arguments?arguments[1]:o.rgb.hsv(e)[2];if(0===(a=Math.round(a/50)))return 30;var i=30+(Math.round(n/255)<<2|Math.round(r/255)<<1|Math.round(t/255));return 2===a&&(i+=60),i},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,a=e[2]/255,i=Math.max(Math.max(r,n),a),o=Math.min(Math.min(r,n),a),s=i-o;return t=s<=0?0:i===r?(n-a)/s%6:i===n?2+(a-r)/s:4+(r-n)/s+4,t/=6,[360*(t%=1),100*s,100*(s<1?o/(1-s):0)]},o.hsl.hcg=function(e){var t=e[1]/100,r=e[2]/100,n=1,a=0;return(n=r<.5?2*t*r:2*t*(1-r))<1&&(a=(r-.5*n)/(1-n)),[e[0],100*n,100*a]},o.hsv.hcg=function(e){var t=e[1]/100,r=e[2]/100,n=t*r,a=0;return n<1&&(a=(r-n)/(1-n)),[e[0],100*n,100*a]},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 a,i=[0,0,0],o=t%1*6,s=o%1,u=1-s;switch(Math.floor(o)){case 0:i[0]=1,i[1]=s,i[2]=0;break;case 1:i[0]=u,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=s;break;case 3:i[0]=0,i[1]=u,i[2]=1;break;case 4:i[0]=s,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=u}return a=(1-r)*n,[255*(r*i[0]+a),255*(r*i[1]+a),255*(r*i[2]+a)]},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,a=0;return n<1&&(a=(r-n)/(1-n)),[e[0],100*n,100*a]},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),a=r(3150),i={};Object.keys(n).forEach((function(e){i[e]={},Object.defineProperty(i[e],"channels",{value:n[e].channels}),Object.defineProperty(i[e],"labels",{value:n[e].labels});var t=a(e);Object.keys(t).forEach((function(r){var n=t[r];i[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,a=0;a1&&(t=Array.prototype.slice.call(arguments)),e(t))};return"conversion"in e&&(t.conversion=e.conversion),t}(n)}))})),e.exports=i},3150:function(e,t,r){var n=r(198);function a(e){var t=function(){for(var e={},t=Object.keys(n),r=t.length,a=0;a=0;r--){var o=n(a[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,a="0123456789abcdef".split(""),i=[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],s=[224,256,384,512],u=["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,a){return new w(e,t,a).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,a=e.length,o=this.blocks,s=this.byteCount,u=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)<=s){for(this.start=r-s,this.block=o[u],r=0;r>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[r],t=1;t>4&15]+a[15&e]+a[e>>12&15]+a[e>>8&15]+a[e>>20&15]+a[e>>16&15]+a[e>>28&15]+a[e>>24&15];s%t===0&&(k(r),o=0)}return i&&(e=r[o],i>0&&(u+=a[e>>4&15]+a[15&e]),i>1&&(u+=a[e>>12&15]+a[e>>8&15]),i>2&&(u+=a[e>>20&15]+a[e>>16&15])),u},w.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,a=this.extraBytes,i=0,o=0,s=this.outputBits>>3;e=a?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(e);o>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;s%r===0&&k(n)}return i&&(e=s<<2,t=n[o],i>0&&(u[e]=255&t),i>1&&(u[e+1]=t>>8&255),i>2&&(u[e+2]=t>>16&255)),u};var k=function(e){var t,r,n,a,i,s,u,c,l,f,d,h,p,b,y,m,v,g,w,k,x,A,E,S,_,C,T,P,O,N,M,U,I,R,L,B,j,F,D,Z,z,H,q,V,G,K,W,Q,J,Y,X,$,ee,te,re,ne,ae,ie,oe,se,ue,ce,le;for(n=0;n<48;n+=2)a=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],s=e[2]^e[12]^e[22]^e[32]^e[42],u=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],d=e[7]^e[17]^e[27]^e[37]^e[47],t=(h=e[8]^e[18]^e[28]^e[38]^e[48])^(s<<1|u>>>31),r=(p=e[9]^e[19]^e[29]^e[39]^e[49])^(u<<1|s>>>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=a^(c<<1|l>>>31),r=i^(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=s^(f<<1|d>>>31),r=u^(d<<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^(h<<1|p>>>31),r=l^(p<<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=f^(a<<1|i>>>31),r=d^(i<<1|a>>>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,b=e[0],y=e[1],K=e[11]<<4|e[10]>>>28,W=e[10]<<4|e[11]>>>28,P=e[20]<<3|e[21]>>>29,O=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ue=e[30]<<9|e[31]>>>23,H=e[40]<<18|e[41]>>>14,q=e[41]<<18|e[40]>>>14,R=e[2]<<1|e[3]>>>31,L=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,v=e[12]<<12|e[13]>>>20,Q=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,N=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,B=e[14]<<6|e[15]>>>26,j=e[15]<<6|e[14]>>>26,g=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,I=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,ae=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,V=e[8]<<27|e[9]>>>5,G=e[9]<<27|e[8]>>>5,C=e[18]<<20|e[19]>>>12,T=e[19]<<20|e[18]>>>12,ie=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]=b^~m&g,e[1]=y^~v&w,e[10]=S^~C&P,e[11]=_^~T&O,e[20]=R^~B&F,e[21]=L^~j&D,e[30]=V^~K&Q,e[31]=G^~W&J,e[40]=te^~ne&ie,e[41]=re^~ae&oe,e[2]=m^~g&k,e[3]=v^~w&x,e[12]=C^~P&N,e[13]=T^~O&M,e[22]=B^~F&Z,e[23]=j^~D&z,e[32]=K^~Q&Y,e[33]=W^~J&X,e[42]=ne^~ie&se,e[43]=ae^~oe&ue,e[4]=g^~k&A,e[5]=w^~x&E,e[14]=P^~N&U,e[15]=O^~M&I,e[24]=F^~Z&H,e[25]=D^~z&q,e[34]=Q^~Y&$,e[35]=J^~X&ee,e[44]=ie^~se&ce,e[45]=oe^~ue&le,e[6]=k^~A&b,e[7]=x^~E&y,e[16]=N^~U&S,e[17]=M^~I&_,e[26]=Z^~H&R,e[27]=z^~q&L,e[36]=Y^~$&V,e[37]=X^~ee&G,e[46]=se^~ce&te,e[47]=ue^~le&re,e[8]=A^~b&m,e[9]=E^~y&v,e[18]=U^~S&C,e[19]=I^~_&T,e[28]=H^~R&B,e[29]=q^~L&j,e[38]=$^~V&K,e[39]=ee^~G&W,e[48]=ce^~te&ne,e[49]=le^~re&ae,e[0]^=o[n],e[1]^=o[n+1]};if(n)e.exports=h;else for(b=0;b=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 a=0;a>>24&255,n[a++]=e>>>16&255,n[a++]=e>>>8&255,n[a++]=255&e}else for(n[a++]=255&e,n[a++]=e>>>8&255,n[a++]=e>>>16&255,n[a++]=e>>>24&255,n[a++]=0,n[a++]=0,n[a++]=0,n[a++]=0,i=8;ithis.blockSize&&(e=(new this.Hash).update(e).digest()),a(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),a=r(273);function i(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 s(e){return 1===e.length?"0"+e:e}function u(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=a,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),a=0;a>6|192,r[n++]=63&o|128):i(e,a)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++a)),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(a=0;a>>0}return o},t.split32=function(e,t){for(var r=new Array(4*e.length),n=0,a=0;n>>24,r[a+1]=i>>>16&255,r[a+2]=i>>>8&255,r[a+3]=255&i):(r[a+3]=i>>>24,r[a+2]=i>>>16&255,r[a+1]=i>>>8&255,r[a]=255&i)}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,a){return e+t+r+n+a>>>0},t.sum64=function(e,t,r,n){var a=e[t],i=n+e[t+1]>>>0,o=(i>>0,e[t+1]=i},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,a,i,o,s){var u=0,c=t;return u+=(c=c+n>>>0)>>0)>>0)>>0},t.sum64_4_lo=function(e,t,r,n,a,i,o,s){return t+n+i+s>>>0},t.sum64_5_hi=function(e,t,r,n,a,i,o,s,u,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,a,i,o,s,u,c){return t+n+i+s+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,a;n=[r(2776),r(5025)],void 0===(a=function(e,t){return function(e,t){function r(r,n,a){for(var i=[],o=e.ucs2.decode(r),s=0;s>23,d=l>>21&3,h=l>>5&65535,p=31&l,b=t.mapStr.substr(h,p);if(0===d||n&&1&f)throw new Error("Illegal char "+c);1===d?i.push(b):2===d?i.push(a?b:c):3===d&&i.push(c)}return i.join("").normalize("NFC")}function n(t,n,i){void 0===i&&(i=!1);var o=r(t,i,n).split(".");return(o=o.map((function(t){return t.startsWith("xn--")?a(t=e.decode(t.substring(4)),i,!1):a(t,i,n),t}))).join(".")}function a(e,n,a){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,a)!==e)throw new Error("Failed to validate "+e);var i=e.codePointAt(0);if(t.mapChar(i)&2<<23)throw new Error("Label contains illegal character: "+i)}function i(t,r){void 0===r&&(r={});var a,i=!("transitional"in r)||r.transitional,o="useStd3ASCII"in r&&r.useStd3ASCII,s="verifyDnsLength"in r&&r.verifyDnsLength,u=n(t,i,o).split(".").map(e.toASCII),c=u.join(".");if(s){if(c.length<1||c.length>253)throw new Error("DNS name has wrong length: "+c);for(a=0;a63)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:i}}(e,t)}.apply(t,n))||(e.exports=a)},545:function(e,t){t.read=function(e,t,r,n,a){var i,o,s=8*a-n-1,u=(1<>1,l=-7,f=r?a-1:0,d=r?-1:1,h=e[t+f];for(f+=d,i=h&(1<<-l)-1,h>>=-l,l+=s;l>0;i=256*i+e[t+f],f+=d,l-=8);for(o=i&(1<<-l)-1,i>>=-l,l+=n;l>0;o=256*o+e[t+f],f+=d,l-=8);if(0===i)i=1-c;else{if(i===u)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,n),i-=c}return(h?-1:1)*o*Math.pow(2,i-n)},t.write=function(e,t,r,n,a,i){var o,s,u,c=8*i-a-1,l=(1<>1,d=23===a?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:i-1,p=n?1:-1,b=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+f>=1?d/u:d*Math.pow(2,1-f))*u>=2&&(o++,u/=2),o+f>=l?(s=0,o=l):o+f>=1?(s=(t*u-1)*Math.pow(2,a),o+=f):(s=t*Math.pow(2,f-1)*Math.pow(2,a),o=0));a>=8;e[r+h]=255&s,h+=p,s/=256,a-=8);for(o=o<0;e[r+h]=255&o,h+=p,o/=256,c-=8);e[r+h-p]|=128*b}},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),a=r(7086),i=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&&i[e.replace(/\.$/,"")])return!0;var r=e.match(/(.*)\.(([\u0E00-\u0E7Fa-z0-9]+)(\.[a-z0-9]+))/),o=null,s=null;if(r&&r.length>2&&a[r[2]]&&(o=r[2],s=r[1].split(".")),!s){if((s=e.split(".")).length<=1)return!1;o=s.pop();if(!/^(?:xn--)?(?!^\d+$)[\u0E00-\u0E7Fa-z0-9]+$/gi.test(o))return!1}return!(!1===t.subdomain&&s.length>1)&&s.every((function(e,r){if(t.wildcard&&0===r&&"*"===e&&s.length>1)return!0;var n=/^([\u0E00-\u0E7Fa-zA-Z0-9-_]+)$/g;r===s.length-1&&(n=/^([\u0E00-\u0E7Fa-zA-Z0-9-]+)$/g);var a=(e.match(/--(--)?/g)||[]).length,i=(e.match(/xn--/g)||[]).length;return(r!==s.length-1||a===i)&&(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 g},encode:function(){return w},toASCII:function(){return x},toUnicode:function(){return k},ucs2decode:function(){return b},ucs2encode:function(){return y}});var n=r(7762),a=r(3433),i=2147483647,o=36,s=/^xn--/,u=/[^\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,d=String.fromCharCode;function h(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 a=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+a}function b(e){for(var t=[],r=0,n=e.length;r=55296&&a<=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,a=0,s=128,u=72,c=e.lastIndexOf("-");c<0&&(c=0);for(var l=0;l=128&&h("not-basic"),r.push(e.charCodeAt(l));for(var d=c>0?c+1:0;d=n&&h("invalid-input");var m=(t=e.charCodeAt(d++))>=48&&t<58?t-48+26:t>=65&&t<91?t-65:t>=97&&t<123?t-97:o;m>=o&&h("invalid-input"),m>f((i-a)/b)&&h("overflow"),a+=m*b;var g=y<=u?1:y>=u+26?26:y-u;if(mf(i/w)&&h("overflow"),b*=w}var k=r.length+1;u=v(a-p,k,0==p),f(a/k)>i-s&&h("overflow"),s+=f(a/k),a%=k,r.splice(a++,0,s)}return String.fromCodePoint.apply(String,r)},w=function(e){var t,r=[],a=(e=b(e)).length,s=128,u=0,c=72,l=(0,n.Z)(e);try{for(l.s();!(t=l.n()).done;){var p=t.value;p<128&&r.push(d(p))}}catch(U){l.e(U)}finally{l.f()}var y=r.length,g=y;for(y&&r.push("-");g=s&&Af((i-u)/E)&&h("overflow"),u+=(k-s)*E,s=k;var S,_=(0,n.Z)(e);try{for(_.s();!(S=_.n()).done;){var C=S.value;if(Ci&&h("overflow"),C===s){for(var T=u,P=o;;P+=o){var O=P<=c?1:P>=c+26?26:P-c;if(T>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 R(e,t,r){I.call(this,e,t,r)}I.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(a);if(null===e)throw new Error(a);if(l&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!l||!ArrayBuffer.isView(e)))throw new Error(a);t=!0}for(var n,i,o=this.blocks,s=this.byteCount,u=e.length,c=this.blockCount,f=0,d=this.s;f>2]|=e[f]<>2]|=i<>2]|=(192|i>>6)<>2]|=(128|63&i)<=57344?(o[n>>2]|=(224|i>>12)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|i>>12&63)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<=s){for(this.start=n-s,this.block=o[c],n=0;n>=8);r>0;)a.unshift(r),r=255&(e>>=8),++n;return t?a.push(n):a.unshift(n),this.update(a),a.length},I.prototype.encodeString=function(e){var t,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(a);if(null===e)throw new Error(a);if(l&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!l||!ArrayBuffer.isView(e)))throw new Error(a);t=!0}var n=0,i=e.length;if(t)n=i;else for(var o=0;o=57344?n+=3:(s=65536+((1023&s)<<10|1023&e.charCodeAt(++o)),n+=4)}return n+=this.encode(8*n),this.update(e),n},I.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&&(L(r),i=0)}return a&&(e=r[i],s+=f[e>>4&15]+f[15&e],a>1&&(s+=f[e>>12&15]+f[e>>8&15]),a>2&&(s+=f[e>>20&15]+f[e>>16&15])),s},I.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,r=this.s,n=this.outputBlocks,a=this.extraBytes,i=0,o=0,s=this.outputBits>>3;e=a?new ArrayBuffer(n+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(e);o>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;s%r===0&&L(n)}return i&&(e=s<<2,t=n[o],u[e]=255&t,i>1&&(u[e+1]=t>>8&255),i>2&&(u[e+2]=t>>16&255)),u},R.prototype=new I,R.prototype.finalize=function(){return this.encode(this.outputBits,!0),I.prototype.finalize.call(this)};var L=function(e){var t,r,n,a,i,o,s,u,c,l,f,d,h,b,y,m,v,g,w,k,x,A,E,S,_,C,T,P,O,N,M,U,I,R,L,B,j,F,D,Z,z,H,q,V,G,K,W,Q,J,Y,X,$,ee,te,re,ne,ae,ie,oe,se,ue,ce,le;for(n=0;n<48;n+=2)a=e[0]^e[10]^e[20]^e[30]^e[40],i=e[1]^e[11]^e[21]^e[31]^e[41],o=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],u=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=(d=e[8]^e[18]^e[28]^e[38]^e[48])^(o<<1|s>>>31),r=(h=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<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=a^(u<<1|c>>>31),r=i^(c<<1|u>>>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=s^(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=u^(d<<1|h>>>31),r=c^(h<<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=l^(a<<1|i>>>31),r=f^(i<<1|a>>>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,b=e[0],y=e[1],K=e[11]<<4|e[10]>>>28,W=e[10]<<4|e[11]>>>28,P=e[20]<<3|e[21]>>>29,O=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ue=e[30]<<9|e[31]>>>23,H=e[40]<<18|e[41]>>>14,q=e[41]<<18|e[40]>>>14,R=e[2]<<1|e[3]>>>31,L=e[3]<<1|e[2]>>>31,m=e[13]<<12|e[12]>>>20,v=e[12]<<12|e[13]>>>20,Q=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,N=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,B=e[14]<<6|e[15]>>>26,j=e[15]<<6|e[14]>>>26,g=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,I=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,ae=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,V=e[8]<<27|e[9]>>>5,G=e[9]<<27|e[8]>>>5,C=e[18]<<20|e[19]>>>12,T=e[19]<<20|e[18]>>>12,ie=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]=b^~m&g,e[1]=y^~v&w,e[10]=S^~C&P,e[11]=_^~T&O,e[20]=R^~B&F,e[21]=L^~j&D,e[30]=V^~K&Q,e[31]=G^~W&J,e[40]=te^~ne&ie,e[41]=re^~ae&oe,e[2]=m^~g&k,e[3]=v^~w&x,e[12]=C^~P&N,e[13]=T^~O&M,e[22]=B^~F&Z,e[23]=j^~D&z,e[32]=K^~Q&Y,e[33]=W^~J&X,e[42]=ne^~ie&se,e[43]=ae^~oe&ue,e[4]=g^~k&A,e[5]=w^~x&E,e[14]=P^~N&U,e[15]=O^~M&I,e[24]=F^~Z&H,e[25]=D^~z&q,e[34]=Q^~Y&$,e[35]=J^~X&ee,e[44]=ie^~se&ce,e[45]=oe^~ue&le,e[6]=k^~A&b,e[7]=x^~E&y,e[16]=N^~U&S,e[17]=M^~I&_,e[26]=Z^~H&R,e[27]=z^~q&L,e[36]=Y^~$&V,e[37]=X^~ee&G,e[46]=se^~ce&te,e[47]=ue^~le&re,e[8]=A^~b&m,e[9]=E^~y&v,e[18]=U^~S&C,e[19]=I^~_&T,e[28]=H^~R&B,e[29]=q^~L&j,e[38]=$^~V&K,e[39]=ee^~G&W,e[48]=ce^~te&ne,e[49]=le^~re&ae,e[0]^=p[n],e[1]^=p[n+1]};if(u)e.exports=_;else{for(T=0;T>>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,a;for(this.init_seed(19650218),r=1,n=0,a=this.N>t?this.N:t;a;a--){var i=this.mt[r-1]^this.mt[r-1]>>>30;this.mt[r]=(this.mt[r]^(1664525*((4294901760&i)>>>16)<<16)+1664525*(65535&i))+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(a=this.N-1;a;a--){i=this.mt[r-1]^this.mt[r-1]>>>30;this.mt[r]=(this.mt[r]^(1566083941*((4294901760&i)>>>16)<<16)+1566083941*(65535&i))-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 a(){}function i(){}i.resetWarningCache=a,e.exports=function(){function e(e,t,r,a,i,o){if(o!==n){var s=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 s.name="Invariant Violation",s}}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:i,resetWarningCache:a};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,a=r(861).default,i=2147483647,o=36,s=/^xn--/,u=/[^\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,d=String.fromCharCode;function h(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 a=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+a}function b(e){for(var t=[],r=0,n=e.length;r=55296&&a<=56319&&r>1,e+=f(e/t);e>455;n+=o)e=f(e/35);return f(n+36*e/(e+38))},v=function(e){var t,r=[],n=e.length,a=0,s=128,u=72,c=e.lastIndexOf("-");c<0&&(c=0);for(var l=0;l=128&&h("not-basic"),r.push(e.charCodeAt(l));for(var d=c>0?c+1:0;d=n&&h("invalid-input");var v=(t=e.charCodeAt(d++))-48<10?t-22:t-65<26?t-65:t-97<26?t-97:o;(v>=o||v>f((i-a)/b))&&h("overflow"),a+=v*b;var g=y<=u?1:y>=u+26?26:y-u;if(vf(i/w)&&h("overflow"),b*=w}var k=r.length+1;u=m(a-p,k,0==p),f(a/k)>i-s&&h("overflow"),s+=f(a/k),a%=k,r.splice(a++,0,s)}return String.fromCodePoint.apply(String,r)},g=function(e){var t,r=[],a=(e=b(e)).length,s=128,u=0,c=72,l=n(e);try{for(l.s();!(t=l.n()).done;){var p=t.value;p<128&&r.push(d(p))}}catch(U){l.e(U)}finally{l.f()}var v=r.length,g=v;for(v&&r.push("-");g=s&&Af((i-u)/E)&&h("overflow"),u+=(k-s)*E,s=k;var S,_=n(e);try{for(_.s();!(S=_.n()).done;){var C=S.value;if(Ci&&h("overflow"),C==s){for(var T=u,P=o;;P+=o){var O=P<=c?1:P>=c+26?26:P-c;if(T',(ee=te.firstChild).style.behavior="url(#default#VML)",!ee||"object"!=typeof ee.adj)return t.type=y;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=d,t.fn=n=d.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)||N.call(e).slice(8,-1).toLowerCase()==t},t.angle=function(e,r,n,a,i,o){if(null==i){var s=e-n,u=r-a;return s||u?(180+180*A.atan2(-u,-s)/T+360)%360:0}return t.angle(e,r,i,o)-t.angle(n,a,i,o)},t.rad=function(e){return e%360*T/180},t.deg=function(e){return Math.round(180*e/T%360*1e3)/1e3},t.snapTo=function(e,r,n){if(n=t.is(n,"finite")?n:10,t.is(e,O)){for(var a=e.length;a--;)if(_(e[a]-r)<=n)return e[a]}else{var i=r%(e=+e);if(ie-n)return r-i+e}return r},t.createUUID=(a=/[xy]/g,i=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(a,i).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 a=new ActiveXObject("htmlfile");a.write(""),a.close(),r=a.body}catch(e){r=createPopup().document.body}var i=r.createTextRange();ne=ce((function(e){try{r.style.color=v(e).replace(n,y);var t=i.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,y).getPropertyValue("color")}))}return ne(e)},ae=function(){return"hsb("+[this.h,this.s,this.b]+")"},ie=function(){return"hsl("+[this.h,this.s,this.l]+")"},oe=function(){return this.hex},se=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 a=t.getRGB(e);e=a.r,r=a.g,n=a.b}return(e>1||r>1||n>1)&&(e/=255,r/=255,n/=255),[e,r,n]},ue=function(e,r,n,a){var i={r:e*=255,g:r*=255,b:n*=255,hex:t.rgb(e,r,n),toString:oe};return t.is(a,"finite")&&(i.opacity=a),i};function ce(e,t,r){return function n(){var a=Array.prototype.slice.call(arguments,0),i=a.join("\u2400"),o=n.cache=n.cache||{},s=n.count=n.count||[];return o[c](i)?(function(e,t){for(var r=0,n=e.length;r=1e3&&delete o[s.shift()],s.push(i),o[i]=e[h](t,a),r?r(o[i]):o[i])}}function le(){return this.hex}function fe(e,t){for(var r=[],n=0,a=e.length;a-2*!t>n;n+=2){var i=[{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?a-4==n?i[3]={x:+e[0],y:+e[1]}:a-2==n&&(i[2]={x:+e[0],y:+e[1]},i[3]={x:+e[2],y:+e[3]}):i[0]={x:+e[a-2],y:+e[a-1]}:a-4==n?i[3]=i[2]:n||(i[0]={x:+e[n],y:+e[n+1]}),r.push(["C",(-i[0].x+6*i[1].x+i[2].x)/6,(-i[0].y+6*i[1].y+i[2].y)/6,(i[1].x+6*i[2].x-i[3].x)/6,(i[1].y+6*i[2].y-i[3].y)/6,i[2].x,i[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 a,i,o,s,u;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),s=(u=r*t)*(1-_((e=(e*=360)%360/60)%2-1)),a=i=o=r-u,ue(a+=[u,s,0,0,s,u][e=~~e],i+=[s,u,u,s,0,0][e],o+=[0,0,s,u,u,s][e],n)},t.hsl2rgb=function(e,t,r,n){var a,i,o,s,u;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),s=(u=2*t*(r<.5?r:1-r))*(1-_((e=(e*=360)%360/60)%2-1)),a=i=o=r-u/2,ue(a+=[u,s,0,0,s,u][e=~~e],i+=[s,u,u,s,0,0][e],o+=[0,0,s,u,u,s][e],n)},t.rgb2hsb=function(e,t,r){var n,a;return e=(r=se(e,t,r))[0],t=r[1],r=r[2],{h:((0==(a=(n=E(e,t,r))-S(e,t,r))?null:n==e?(t-r)/a:n==t?(r-e)/a+2:(e-t)/a+4)+360)%6*60/360,s:0==a?0:a/n,b:n,toString:ae}},t.rgb2hsl=function(e,t,r){var n,a,i,o;return e=(r=se(e,t,r))[0],t=r[1],r=r[2],n=((a=E(e,t,r))+(i=S(e,t,r)))/2,{h:((0==(o=a-i)?null:a==e?(t-r)/o:a==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:ie}},t._path2string=function(){return this.join(",").replace(H,"$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=v(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,a,i,o,s,u=e.match(M);return u?(u[2]&&(a=B(u[2].substring(5),16),n=B(u[2].substring(3,5),16),r=B(u[2].substring(1,3),16)),u[3]&&(a=B((o=u[3].charAt(3))+o,16),n=B((o=u[3].charAt(2))+o,16),r=B((o=u[3].charAt(1))+o,16)),u[4]&&(s=u[4][g](Z),r=L(s[0]),"%"==s[0].slice(-1)&&(r*=2.55),n=L(s[1]),"%"==s[1].slice(-1)&&(n*=2.55),a=L(s[2]),"%"==s[2].slice(-1)&&(a*=2.55),"rgba"==u[1].toLowerCase().slice(0,4)&&(i=L(s[3])),s[3]&&"%"==s[3].slice(-1)&&(i/=100)),u[5]?(s=u[5][g](Z),r=L(s[0]),"%"==s[0].slice(-1)&&(r*=2.55),n=L(s[1]),"%"==s[1].slice(-1)&&(n*=2.55),a=L(s[2]),"%"==s[2].slice(-1)&&(a*=2.55),("deg"==s[0].slice(-3)||"\xb0"==s[0].slice(-1))&&(r/=360),"hsba"==u[1].toLowerCase().slice(0,4)&&(i=L(s[3])),s[3]&&"%"==s[3].slice(-1)&&(i/=100),t.hsb2rgb(r,n,a,i)):u[6]?(s=u[6][g](Z),r=L(s[0]),"%"==s[0].slice(-1)&&(r*=2.55),n=L(s[1]),"%"==s[1].slice(-1)&&(n*=2.55),a=L(s[2]),"%"==s[2].slice(-1)&&(a*=2.55),("deg"==s[0].slice(-3)||"\xb0"==s[0].slice(-1))&&(r/=360),"hsla"==u[1].toLowerCase().slice(0,4)&&(i=L(s[3])),s[3]&&"%"==s[3].slice(-1)&&(i/=100),t.hsl2rgb(r,n,a,i)):((u={r:r,g:n,b:a,toString:le}).hex="#"+(16777216|a|n<<8|r<<16).toString(16).slice(1),t.is(i,"finite")&&(u.opacity=i),u)):{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=de(e);if(r.arr)return ge(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},a=[];return t.is(e,O)&&t.is(e[0],O)&&(a=ge(e)),a.length||v(e).replace(q,(function(e,t,r){var i=[],o=t.toLowerCase();if(r.replace(G,(function(e,t){t&&i.push(+t)})),"m"==o&&i.length>2&&(a.push([t][p](i.splice(0,2))),o="l",t="m"==t?"l":"L"),"r"==o)a.push([t][p](i));else for(;i.length>=n[o]&&(a.push([t][p](i.splice(0,n[o]))),n[o]););})),a.toString=t._path2string,r.arr=ge(a),a},t.parseTransformString=ce((function(e){if(!e)return null;var r=[];return t.is(e,O)&&t.is(e[0],O)&&(r=ge(e)),r.length||v(e).replace(V,(function(e,t,n){var a=[];x.call(t),n.replace(G,(function(e,t){t&&a.push(+t)})),r.push([t][p](a))})),r.toString=t._path2string,r}),this,(function(e){if(!e)return e;for(var t=[],r=0;r1?1:u<0?0:u)/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],d=0,h=0;h<12;h++){var p=c*l[h]+c,b=he(p,e,r,a,o),y=he(p,t,n,i,s),m=b*b+y*y;d+=f[h]*A.sqrt(m)}return c*d}function be(e,t,r,n,a,i,o,s){if(!(E(e,r)E(a,o)||E(t,n)E(i,s))){var u=(e-r)*(i-s)-(t-n)*(a-o);if(u){var c=((e*n-t*r)*(a-o)-(e-r)*(a*s-i*o))/u,l=((e*n-t*r)*(i-s)-(t-n)*(a*s-i*o))/u,f=+c.toFixed(2),d=+l.toFixed(2);if(!(f<+S(e,r).toFixed(2)||f>+E(e,r).toFixed(2)||f<+S(a,o).toFixed(2)||f>+E(a,o).toFixed(2)||d<+S(t,n).toFixed(2)||d>+E(t,n).toFixed(2)||d<+S(i,s).toFixed(2)||d>+E(i,s).toFixed(2)))return{x:c,y:l}}}}function ye(e,r,n){var a=t.bezierBBox(e),i=t.bezierBBox(r);if(!t.isBBoxIntersect(a,i))return n?0:[];for(var o=pe.apply(0,e),s=pe.apply(0,r),u=E(~~(o/5),1),c=E(~~(s/5),1),l=[],f=[],d={},h=n?0:[],p=0;p=0&&C<=1.001&&T>=0&&T<=1.001&&(n?h++:h.push({x:A.x,y:A.y,t1:S(C,1),t2:S(T,1)}))}}return h}function me(e,r,n){e=t._path2curve(e),r=t._path2curve(r);for(var a,i,o,s,u,c,l,f,d,h,p=n?0:[],b=0,y=e.length;bv||m=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 me(e,t)},t.pathIntersectionNumber=function(e,t){return me(e,t,1)},t.isPointInsidePath=function(e,r,n){var a=t.pathBBox(e);return t.isPointInsideBBox(a,r,n)&&me(e,[["M",r,n],["H",a.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 ve=t.pathBBox=function(e){var t=de(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,a=0,i=[],o=[],s=0,u=(e=Ce(e)).length;s1&&(n*=w=A.sqrt(w),a*=w);var k=n*n,x=a*a,E=(o==s?-1:1)*A.sqrt(_((k*x-k*v*v-x*m*m)/(k*v*v+x*m*m))),S=E*n*v/a+(t+u)/2,C=E*-a*m/n+(r+c)/2,P=A.asin(((r-C)/a).toFixed(9)),O=A.asin(((c-C)/a).toFixed(9));(P=tO&&(P-=2*T),!s&&O>P&&(O-=2*T)}var N=O-P;if(_(N)>d){var M=O,U=u,I=c;O=P+d*(s&&O>P?1:-1),b=e(u=S+n*A.cos(O),c=C+a*A.sin(O),n,a,i,0,s,U,I,[O,M,S,C])}N=O-P;var R=A.cos(P),L=A.sin(P),B=A.cos(O),j=A.sin(O),F=A.tan(N/4),D=4/3*n*F,Z=4/3*a*F,z=[t,r],H=[t+D*L,r-Z*R],q=[u+D*j,c-Z*B],V=[u,c];if(H[0]=2*z[0]-H[0],H[1]=2*z[1]-H[1],l)return[H,q,V][p](b);for(var G=[],K=0,W=(b=[H,q,V][p](b).join()[g](",")).length;K"1e12"&&(d=.5),_(p)>"1e12"&&(p=.5),d>0&&d<1&&(u=Se(e,t,r,n,a,i,o,s,d),y.push(u.x),b.push(u.y)),p>0&&p<1&&(u=Se(e,t,r,n,a,i,o,s,p),y.push(u.x),b.push(u.y)),c=i-2*n+t-(s-2*i+n),f=t-n,d=(-(l=2*(n-t)-2*(i-n))+A.sqrt(l*l-4*c*f))/2/c,p=(-l-A.sqrt(l*l-4*c*f))/2/c,_(d)>"1e12"&&(d=.5),_(p)>"1e12"&&(p=.5),d>0&&d<1&&(u=Se(e,t,r,n,a,i,o,s,d),y.push(u.x),b.push(u.y)),p>0&&p<1&&(u=Se(e,t,r,n,a,i,o,s,p),y.push(u.x),b.push(u.y)),{min:{x:S[h](0,y),y:S[h](0,b)},max:{x:E[h](0,y),y:E[h](0,b)}}})),Ce=t._path2curve=ce((function(e,t){var r=!t&&de(e);if(!t&&r.curve)return ge(r.curve);for(var n=ke(e),a=t&&ke(t),i={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},s=function(e,t,r){var n,a;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[h](0,[t.x,t.y][p](e.slice(1))));break;case"S":"C"==r||"S"==r?(n=2*t.x-t.bx,a=2*t.y-t.by):(n=t.x,a=t.y),e=["C",n,a][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},u=function(e,t){if(e[t].length>7){e[t].shift();for(var r=e[t];r.length;)l[t]="A",a&&(f[t]="A"),e.splice(t++,0,["C"][p](r.splice(0,6)));e.splice(t,1),m=E(n.length,a&&a.length||0)}},c=function(e,t,r,i,o){e&&t&&"M"==e[o][0]&&"M"!=t[o][0]&&(t.splice(o,0,["M",i.x,i.y]),r.bx=0,r.by=0,r.x=e[o][1],r.y=e[o][2],m=E(n.length,a&&a.length||0))},l=[],f=[],d="",b="",y=0,m=E(n.length,a&&a.length||0);y.01;)c=pe(e,t,r,n,a,i,o,s,f+=(ca){if(r&&!d.start){if(f+=["C"+(l=Ke(o,s,u[1],u[2],u[3],u[4],u[5],u[6],a-h)).start.x,l.start.y,l.m.x,l.m.y,l.x,l.y],i)return f;d.start=f,f=["M"+l.x,l.y+"C"+l.n.x,l.n.y,l.end.x,l.end.y,u[5],u[6]].join(),h+=c,o=+u[5],s=+u[6];continue}if(!e&&!r)return{x:(l=Ke(o,s,u[1],u[2],u[3],u[4],u[5],u[6],a-h)).x,y:l.y,alpha:l.alpha}}h+=c,o=+u[5],s=+u[6]}f+=u.shift()+u}return d.end=f,(l=e?h:r?d:t.findDotsAtSegment(o,s,u[0],u[1],u[2],u[3],u[4],u[5],1)).alpha&&(l={x:l.x,y:l.y,alpha:l.alpha}),l}},Qe=We(1),Je=We(),Ye=We(0,1);t.getTotalLength=Qe,t.getPointAtLength=Je,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},He.getTotalLength=function(){var e=this.getPath();if(e)return this.node.getTotalLength?this.node.getTotalLength():Qe(e)},He.getPointAtLength=function(e){var t=this.getPath();if(t)return Je(t,e)},He.getPath=function(){var e,r=t._getPath[this.type];if("text"!=this.type&&"set"!=this.type)return r&&(e=r(this)),e},He.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,a=-r-t,i=C(_(n),1/3)*(n<0?-1:1)+C(_(a),1/3)*(a<0?-1:1)+.5;return 3*(1-i)*i*i+i*i*i},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*T*(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,a=0;a<$e.length;a++){var i=$e[a];if(!i.el.removed&&!i.paused){var o,s,u=n-i.start,l=i.ms,f=i.easing,d=i.from,h=i.diff,b=i.to,y=(i.t,i.el),v={},g={};if(i.initstatus?(u=(i.initstatus*i.anim.top-i.prev)/(i.percent-i.prev)*l,i.status=i.initstatus,delete i.initstatus,i.stop&&$e.splice(a--,1)):i.status=(i.prev+(i.percent-i.prev)*(u/l))/i.anim.top,!(u<0))if(u1&&!i.next){for(s in b)b[c](s)&&(g[s]=i.totalOrigin[s]);i.el.attr(g),it(i.anim,i.el,i.anim.percents[0],null,i.totalOrigin,i.repeat-1)}i.next&&!i.stop&&it(i.anim,i.el,i.next,null,i.totalOrigin,i.repeat)}}}$e.length&&et(r)},rt=function(e){return e>255?255:e<0?0:e};function nt(e,t,r,n,a,i){var o=3*t,s=3*(n-t)-o,u=1-o-s,c=3*r,l=3*(a-r)-c,f=1-c-l;function d(e){return((u*e+s)*e+o)*e}return function(e,t){var r=function(e,t){var r,n,a,i,c,l;for(a=e,l=0;l<8;l++){if(i=d(a)-e,_(i)(n=1))return n;for(;ri?r=a:n=a,a=(n-r)/2+r}return a}(e,t);return((f*r+l)*r+c)*r}(e,1/(200*i))}function at(e,t){var r=[],n={};if(this.ms=t,this.times=1,e){for(var a in e)e[c](a)&&(n[L(a)]=e[a],r.push(L(a)));r.sort(W)}this.anim=n,this.top=r[r.length-1],this.percents=r}function it(r,n,a,i,s,u){a=L(a);var l,f,d,h,b,y,m=r.ms,w={},k={},x={};if(i)for(E=0,S=$e.length;Ei*r.top){a=r.percents[E],b=r.percents[E-1]||0,m=m/r.top*(a-b),h=r.percents[E+1],l=r.anim[a];break}i&&n.attr(r.anim[r.percents[E]])}if(l){if(f)f.initstatus=i,f.start=new Date-f.ms*i;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 P:x[_]=(k[_]-w[_])/m;break;case"colour":w[_]=t.getRGB(w[_]);var C=t.getRGB(k[_]);x[_]={r:(C.r-w[_].r)/m,g:(C.g-w[_].g)/m,b:(C.b-w[_].b)/m};break;case"path":var T=Ce(w[_],k[_]),O=T[1];for(w[_]=T[0],x[_]=[],E=0,S=w[_].length;Eu&&(u=f)}!e[u+="%"].callback&&(e[u].callback=a)}return new at(e,r)},He.animate=function(e,r,n,a){if(this.removed)return a&&a.call(this),this;var i=e instanceof at?e:t.animation(e,r,n,a);return it(i,this,i.percents[0],null,this.attr()),this},He.setTime=function(e,t){return e&&null!=t&&this.status(e,S(t,e.ms)/e.ms),this},He.status=function(e,t){var r,n,a=[],i=0;if(null!=t)return it(e,this,-1,S(t,1)),this;for(r=$e.length;i1)for(var n=0,a=r.length;n.5)-1;u(d-.5,2)+u(h-.5,2)>.25&&(h=i.sqrt(.25-u(d-.5,2))*a+.5)&&.5!=h&&(h=h.toFixed(5)-1e-5*a)}return f}))).split(/\s*\-\s*/),"linear"==c){var w=a.shift();if(w=-n(w),isNaN(w))return null;var k=[0,0,i.cos(e.rad(w)),i.sin(e.rad(w))],x=1/(o(s(k[2]),s(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(a);if(!A)return null;if(l=l.replace(/[\(\)\s,\xb0#]/g,"_"),t.gradient&&l!=t.gradient.id&&(b.defs.removeChild(t.gradient),delete t.gradient),!t.gradient){g=y(c+"Gradient",{id:l}),t.gradient=g,y(g,"radial"==c?{fx:d,fy:h}:{x1:k[0],y1:k[1],x2:k[2],y2:k[3],gradientTransform:t.matrix.invert()}),b.defs.appendChild(g);for(var E=0,S=A.length;E1?U.opacity/100:U.opacity});case"stroke":U=e.getRGB(b),u.setAttribute(p,U.hex),"stroke"==p&&U[t]("opacity")&&y(u,{"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(b).charAt())&&m(n,b);break;case"opacity":l.gradient&&!l[t]("stroke-opacity")&&y(u,{"stroke-opacity":b>1?b/100:b});case"fill-opacity":if(l.gradient){(I=e._g.doc.getElementById(u.getAttribute("fill").replace(/^url\(#|\)$/g,f)))&&(R=I.getElementsByTagName("stop"),y(R[R.length-1],{"stop-opacity":b}));break}default:"font-size"==p&&(b=a(b,10)+"px");var L=p.replace(/(\-.)/g,(function(e){return e.substring(1).toUpperCase()}));u.style[L]=b,n._.dirty=1,u.setAttribute(p,b)}}E(n,i),u.style.visibility=d},E=function(n,i){if("text"==n.type&&(i[t]("text")||i[t]("font")||i[t]("font-size")||i[t]("x")||i[t]("y"))){var o=n.attrs,s=n.node,u=s.firstChild?a(e._g.doc.defaultView.getComputedStyle(s.firstChild,f).getPropertyValue("font-size"),10):10;if(i[t]("text")){for(o.text=i.text;s.firstChild;)s.removeChild(s.firstChild);for(var c,l=r(i.text).split("\n"),d=[],h=0,p=l.length;h"));var W=G.getBoundingClientRect();C.W=b.w=(W.right-W.left)/100,C.H=b.h=(W.bottom-W.top)/100,C.X=b.x,C.Y=b.y+C.H/2,("x"in u||"y"in u)&&(C.path.v=e.format("m{0},{1}l{2},{1}",i(b.x*v),i(b.y*v),i(b.x*v)+1));for(var Q=["x","y","text","font","font-family","font-weight","font-style","font-size"],J=0,Y=Q.length;J.25&&(r=a.sqrt(.25-s(t-.5,2))*(2*(r>.5)-1)+.5),c=t+f+r),d}))).split(/\s*\-\s*/),"linear"==u){var l=i.shift();if(l=-n(l),isNaN(l))return null}var h=e._parseDots(i);if(!h)return null;if(t=t.shape||t.node,h.length){t.removeChild(o),o.on=!0,o.method="none",o.color=h[0].color,o.color2=h[h.length-1].color;for(var p=[],b=0,y=h.length;b')}}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,a=t.width,i=t.x,o=t.y;if(!r)throw new Error("VML container not found.");var s=new e._Paper,u=s.canvas=e._g.doc.createElement("div"),c=u.style;return i=i||0,o=o||0,a=a||512,n=n||342,s.width=a,s.height=n,a==+a&&(a+="px"),n==+n&&(n+="px"),s.coordsize=216e5+f+216e5,s.coordorigin="0 0",s.span=e._g.doc.createElement("span"),s.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;",u.appendChild(s.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",a,n),1==r?(e._g.doc.body.appendChild(u),c.left=i+"px",c.top=o+"px",c.position="absolute"):r.firstChild?r.insertBefore(u,r.firstChild):r.appendChild(u),s.renderfix=function(){},s},e.prototype.clear=function(){e.eve("raphael.clear",this),this.canvas.innerHTML=d,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 P=e.st;for(var O in T)T[t](O)&&!P[t](O)&&(P[O]=function(e){return function(){var t=arguments;return this.forEach((function(r){r[e].apply(r,t)}))}}(O))}}.apply(t,n))||(e.exports=a)}])},534:function(e,t,r){"use strict";var n=r(7313),a=r(2224);function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=1;r